netsuite nlobjSearchFilter anyof noneof ,order状态列表,transaction类型-CarlZeng

var trnTypeAR = [‘Build’,’VendBill’,’InvAdjst’,’InvTrnfr’,’ItemRcpt’,’Journal’];sFilters[filterBase+2] = new nlobjSearchFilter(‘type’,null,’anyof’,trnTypeAR,null);anyof noneof 就是这么应用的. 是比较实用的功能,以及orde…

var trnTypeAR = [‘Build’,’VendBill’,’InvAdjst’,’InvTrnfr’,’ItemRcpt’,’Journal’];
sFilters[filterBase+2] = new nlobjSearchFilter(‘type’,null,’anyof’,trnTypeAR,null);

anyof noneof 就是这么应用的. 是比较实用的功能,

以及order状态列表

var dd = win.makeMultiDropdown(‘Transaction_STATUS’, 8, new Array(‘Bill:Open’, ‘VendBill:A’, ‘Bill:Paid In Full’, ‘VendBill:B’, ‘Bill Payment:Voided’, ‘VendPymt:V’, ‘Bill Payment:Online Bill Pay Pending Accounting Approval’, ‘VendPymt:Z’, ‘Cash Sale:Unapproved Payment’, ‘CashSale:A’, ‘Cash Sale:Not Deposited’, ‘CashSale:B’, ‘Cash Sale:Deposited’, ‘CashSale:C’, ‘Cheque:Voided’, ‘Check:V’, ‘Cheque:Online Bill Pay Pending Accounting Approval’, ‘Check:Z’, ‘Commission:Pending Payment’, ‘Commissn:A’, ‘Commission:Overpaid’, ‘Commissn:O’, ‘Commission:Pending Accounting Approval’, ‘Commissn:P’, ‘Commission:Rejected by Accounting’, ‘Commissn:R’, ‘Commission:Paid in Full’, ‘Commissn:X’, ‘Credit Memo:Open’, ‘CustCred:A’, ‘Credit Memo:Fully Applied’, ‘CustCred:B’, ‘Customer Deposit:Not Deposited’, ‘CustDep:A’, ‘Customer Deposit:Deposited’, ‘CustDep:B’, ‘Customer Deposit:Fully Applied’, ‘CustDep:C’, ‘Customer Refund:Voided’, ‘CustRfnd:V’,

‘Estimate:Open’, ‘Estimate:A’, ‘Estimate:Processed’, ‘Estimate:B’, ‘Estimate:Closed’, ‘Estimate:C’, ‘Estimate:Voided’, ‘Estimate:V’, ‘Estimate:Expired’, ‘Estimate:X’, ‘Expense Report:In Progress’, ‘ExpRept:A’, ‘Expense Report:Pending Supervisor Approval’, ‘ExpRept:B’, ‘Expense Report:Pending Accounting Approval’, ‘ExpRept:C’, ‘Expense Report:Rejected by Supervisor’, ‘ExpRept:D’, ‘Expense Report:Rejected by Accounting’, ‘ExpRept:E’, ‘Expense Report:Approved by Accounting’, ‘ExpRept:F’, ‘Expense Report:Approved (Overridden) by Accounting’, ‘ExpRept:G’, ‘Expense Report:Rejected (Overridden) by Accounting’, ‘ExpRept:H’, ‘Expense Report:Paid In Full’, ‘ExpRept:I’, ‘Invoice:Open’, ‘CustInvc:A’, ‘Invoice:Paid In Full’, ‘CustInvc:B’, ‘Item Fulfillment:Picked’, ‘ItemShip:A’, ‘Item Fulfillment:Packed’, ‘ItemShip:B’, ‘Item Fulfillment:Shipped’, ‘ItemShip:C’, ‘Journal:Pending Approval’, ‘Journal:A’, ‘Journal:Approved for Posting’, ‘Journal:B’, ‘Opportunity:In Progress’, ‘Opprtnty:A’, ‘Opportunity:Issued Estimate’, ‘Opprtnty:B’,

‘Opportunity:Closed – Won’, ‘Opprtnty:C’, ‘Opportunity:Closed – Lost’, ‘Opprtnty:D’, ‘Paycheque:Undefined’, ‘Paycheck:A’, ‘Paycheque:Pending Tax Calculation’, ‘Paycheck:C’, ‘Paycheque:Pending Commitment’, ‘Paycheck:D’, ‘Paycheque:Committed’, ‘Paycheck:F’, ‘Paycheque:Preview’, ‘Paycheck:P’, ‘Paycheque:Reversed’, ‘Paycheck:R’, ‘Payment:Unapproved Payment’, ‘CustPymt:A’, ‘Payment:Not Deposited’, ‘CustPymt:B’, ‘Payment:Deposited’, ‘CustPymt:C’, ‘Payroll Liability Cheque:Voided’, ‘LiabPymt:V’, ‘Purchase Order:Pending Supervisor Approval’, ‘PurchOrd:A’, ‘Purchase Order:Pending Receipt’, ‘PurchOrd:B’, ‘Purchase Order:Rejected by Supervisor’, ‘PurchOrd:C’, ‘Purchase Order:Partially Received’, ‘PurchOrd:D’, ‘Purchase Order:Pending Billing/Partially Received’, ‘PurchOrd:E’, ‘Purchase Order:Pending Bill’, ‘PurchOrd:F’, ‘Purchase Order:Fully Billed’, ‘PurchOrd:G’, ‘Purchase Order:Closed’, ‘PurchOrd:H’, ‘Return Authorisation:Pending Approval’, ‘RtnAuth:A’, ‘Return Authorisation:Pending Receipt’, ‘RtnAuth:B’,

‘Return Authorisation:Cancelled’, ‘RtnAuth:C’, ‘Return Authorisation:Partially Received’, ‘RtnAuth:D’, ‘Return Authorisation:Pending Refund/Partially Received’, ‘RtnAuth:E’, ‘Return Authorisation:Pending Refund’, ‘RtnAuth:F’, ‘Return Authorisation:Refunded’, ‘RtnAuth:G’, ‘Return Authorisation:Closed’, ‘RtnAuth:H’, ‘Sales Order:Pending Approval’, ‘SalesOrd:A’, ‘Sales Order:Pending Fulfillment’, ‘SalesOrd:B’, ‘Sales Order:Cancelled’, ‘SalesOrd:C’, ‘Sales Order:Partially Fulfilled’, ‘SalesOrd:D’, ‘Sales Order:Pending Billing/Partially Fulfilled’, ‘SalesOrd:E’, ‘Sales Order:Pending Billing’, ‘SalesOrd:F’, ‘Sales Order:Billed’, ‘SalesOrd:G’, ‘Sales Order:Closed’, ‘SalesOrd:H’, ‘Sales Tax Payment:Voided’, ‘TaxPymt:V’, ‘Sales Tax Payment:Online Bill Pay Pending Accounting Approval’, ‘TaxPymt:Z’, ‘Statement Charge:Open’, ‘CustChrg:A’, ‘Statement Charge:Paid In Full’, ‘CustChrg:B’, ‘Tax Liability Cheque:Voided’, ‘TaxLiab:V’, ‘Tegata Payable:Endorsed’, ‘TegPybl:E’, ‘Tegata Payable:Issued’, ‘TegPybl:I’,

‘Tegata Payable:Paid’, ‘TegPybl:P’, ‘Tegata Receivable:Collected’, ‘TegRcvbl:C’, ‘Tegata Receivable:Discounted’, ‘TegRcvbl:D’, ‘Tegata Receivable:Endorsed’, ‘TegRcvbl:E’, ‘Tegata Receivable:Holding’, ‘TegRcvbl:H’, ‘Vendor Return Authorization:Pending Approval’, ‘VendAuth:A’, ‘Vendor Return Authorization:Pending Return’, ‘VendAuth:B’, ‘Vendor Return Authorization:Cancelled’, ‘VendAuth:C’, ‘Vendor Return Authorization:Partially Returned’, ‘VendAuth:D’, ‘Vendor Return Authorization:Pending Credit/Partially Returned’, ‘VendAuth:E’, ‘Vendor Return Authorization:Pending Credit’, ‘VendAuth:F’, ‘Vendor Return Authorization:Credited’, ‘VendAuth:G’, ‘Vendor Return Authorization:Closed’, ‘VendAuth:H’, ‘Work Order:Pending Build’, ‘WorkOrd:B’, ‘Work Order:Cancelled’, ‘WorkOrd:C’, ‘Work Order:Partially Built’, ‘WorkOrd:D’, ‘Work Order:Built’, ‘WorkOrd:G’, ‘Work Order:Closed’, ‘WorkOrd:H’), “”,”setWindowChanged(window, true);”,document,0,null,300);

所有系统transaction 状态 如下所示,netsuite将单据的状态分类到上没有的类型。

以及 transaction类型 如 ‘Return Authorisation 那么 他的列表 比如nlobjSearchFilter 必须使用RtnAuth 表示!

在举例:’Expense Report’ 值就是 ExpRept, 其他类似递推。。

netsuite Bin Numbers 输入原理-CarlZeng

重复利用:popupBinDiv(document.forms[‘item_form’].elements[‘itembinlist’].value,document.forms[‘inventory_form’].elements[‘binnumbers’], 0, document.forms[‘inventory_form’].elements[‘adjustqtyby’]);显然netsu…

Bins

重复利用:
popupBinDiv(document.forms[‘item_form’].elements[‘itembinlist’].value,document.forms[‘inventory_form’].elements[‘binnumbers’], 0, document.forms[‘inventory_form’].elements[‘adjustqtyby’]);

显然netsuite在item变化时需要准备这个 ‘itembinlist’ div显示内容库,然后它设置的popupBinDiv 就可以发挥作用来完成可视化的输入效果。

如果时间允许,我们其实可以重建这个显示库,包括动态生成这个可视化显示的div触发起点。

zeng 2009-03-30 0924

js 页面动态div 例子-CarlZeng

var div = document.createElement(“DIV”); div.innerHTML= “……”; document.getElementById(id).appendChild(div); 这个innerHTML 在Netsuite中可以变成一个 由suitelet生成的html 通过页面的即时Ajax交互 。实现一个很好的用户体验。 另外给出 页面的小例子: <…

var div = document.createElement(“DIV”);
div.innerHTML= “……”;
document.getElementById(id).appendChild(div);

这个innerHTML 在Netsuite中可以变成一个 由suitelet生成的html 通过页面的即时Ajax交互 。实现一个很好的用户体验。

另外给出 页面的小例子:

**
网站数据加载中……

**

另外附带一个 Dhtml中的例子:



DHtml举例12


请点击下边的文字……

  • 您好吗?
  • 您姓什么?
  • 恢复原样!

Description of 3D MAGIC Lenticular Application Design & Output Software v2.0SE
3D MAGIC v2 is the professional 3D/Flip design & output software with RIP function
inside, supports all kinds of lenticular materials, contains rich functions, (including
morph effect, mask effect, advanced flip effects, 3D by drawing, Sub-3D
by group and various combination, etc.).



3D MAGICv2.0 can be applied in various industries, including advertisement, exhibition,
indoor or outdoor decoration, wedding photography, gifts, offset printing, 3D light
box,motion display,etc.


js 抛出异常 throw-CarlZeng

netsuite中,有的时候在流程上我们需要控制,停止现有流程那么可以采取一种比较无奈的办法。由于一些特殊情况,我们可以编写详细的流程控制,如netsuite销售人员可以审批一些SO单据,但并不是所有的SO单据他都能自己审批。那么这个时候, 就可以让脚本帮忙审批哪些满足条件的SO,但是一些特定的SO用户点击审批,我们可以直接trigger到这个事件! 然后直接 throw “您已被禁止审批该单据”…

netsuite中,有的时候在流程上我们需要控制,停止现有流程那么可以采取一种比较无奈的办法。

由于一些特殊情况,我们可以编写详细的流程控制,如netsuite销售人员可以审批一些SO单据,但并不是所有的SO单据他都能自己审批。那么这个时候, 就可以让脚本帮忙审批哪些满足条件的SO,但是一些特定的SO用户点击审批,

我们可以直接trigger到这个事件! 然后直接 throw “您已被禁止审批该单据”; // 扔出一个不同的错误。

举一反三,netsuite中可以用这种方法处理一些特殊流程。

zeng.cz
20081223

js 当前日期 格式 Javascript 对时间的代号 日期计算-CarlZeng

MyDate = new Date();alert(MyDate.getFullYear()+”-“+ MyDate.getMonth()+”-“+MyDate.getDate()+” “+MyDate.getHours()+”:”+MyDate.getMinutes());getFullYear 解决千年问题.在netsuite中的应用:custpage_shipdate.setDefaultV…

MyDate = new Date();
alert(MyDate.getFullYear()+”-“+ MyDate.getMonth()
+”-“+MyDate.getDate()+” “+MyDate.getHours()
+”:”+MyDate.getMinutes());

getFullYear 解决千年问题.

在netsuite中的应用:
custpage_shipdate.setDefaultValue( nlapiDateToString( new Date() ) );
这个 nlapiDateToString 自动适应 用户的语言环境.

能将”2007-12-09″转换成”2007/12/09″:

str.replace(



,

/

);
//
替换一下就可以了

—————————————–

Javascript 对时间的代号
0-11数字表示1-12月: var a= new Date(2006,5,6) 结果是2006-6-6
0-6表示星期
1-31表示日期
0-23小时
0-59分钟,秒
时间或日期 加减 计算技巧:

var threemonthago=new Date(paytrandate.getTime()-3*30 *1000*60*60*24);

这样计算就 准确无误了!!

或者使用:

var datefromnow120=new Date();
datefromnow120=new Date(datefromnow120.valueOf() + 120 * 24 * 60 * 60 * 1000);

也一样。

js 动态创建iframe 后submit提交-CarlZeng

var f=document.createElement(“IFRAME”);f.id = “iframe01”;f.name= “iframe01”;f.height=1000;f.width=1000;f.src=’https://system.netsuite.com/app/accounting/transactions/inventory/inventorynumbereditor.nl…

var f=document.createElement(“IFRAME”);
f.id = “iframe01”;
f.name= “iframe01”;
f.height=1000;
f.width=1000;
f.src=’https://system.netsuite.com/app/accounting/transactions/inventory/inventorynumbereditor.nl?l=T&tranid=745&lineid=1′; //”about:blank”
document.body.appendChild(f);

到这里已经添加完毕!

//eval( ‘document.frames(“iframe’+j+'”).document.all(“main_form”).submit()’ );
//document.getElementById(‘iframe01’).

var fr = window.frames[“iframe01”]; //关键语句 获取iframe
alert(fr);
fr.document.getElementById(‘main_form’).submit(); //提交

var list=document.getElementById(‘numbers_form’).getElementsByTagName(‘input’);
alert( list[0].name );
for(i=0;i<list.length;i++){
if(list[i].name==’custitemnumber_manufactureddate1′) alert(list[i].name);
}
list[i].value=’abc’ //赋值

js post 应用-CarlZeng

之前写了一篇关于 post和get的区别:http://www.cnblogs.com/backuper/archive/2008/10/10/1307807.html组建一个post的方法的应用是更加安全的:比如原始提交页面:查看如上,我们可以看到 html方式的一个post 把一个变量为:inputName,值是:post内容12312jlkjsdfo8asdfujsadfjsasf……..

之前写了一篇关于 post和get的区别:http://www.cnblogs.com/backuper/archive/2008/10/10/1307807.html

组建一个post的方法的应用是更加安全的:比如

原始提交页面:

查看

如上,我们可以看到 html方式的一个post 把一个变量为:inputName,值是:post内容12312jlkjsdfo8asdfujsadfjsasf…..asfasd的东西传给了:https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=230&deploy=1&compid=TSTDRV297427&h=b3c5157e6c8aea60c95b 这个链接地址。

—————————————————-

查看
就可以啊,无非是将input 中的value变成<%=Request(“xxx”)%>或<%=Response.Write xxx>

To be continued….
zeng.cz 200801041811

用这个去post

查看

用这个去取和生成页面:

function test_postSL(request, response)
{
if (request.getMethod() == ‘GET’){
response.writePage(”);
}
else{
var rParams = request.getAllParameters();
var inputName=rParams[‘inputName’];
nlapiLogExecution(‘Error’,’test_postSL rParams’,’inputName:’+inputName);
if(inputName!=null||inputName!=”)response.writeLine(‘True’);
else response.writeLine(‘False’);
}
}

js fix小数点 和int的区别-CarlZeng

num.Fixed(2) 功能:可以定义精确到多少为的小数点。 Returns the integer portion of a number. Int(number) Fix(number) …

num.Fixed(2)

功能:可以定义精确到多少为的小数点。

Returns the integer portion of a number.

Int(number)

    **Fix(**number**)**

The number argument can be any valid numeric expression. If number contains Null, Null is returned.

Both Int and Fix remove the fractional part of number and return the resulting integer value.

The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.

The following examples illustrate how the Int and Fix functions return integer portions of numbers:

CopyCode imageCopy Code

MyNumber = Int(99.8) ‘ Returns 99.

    MyNumber = **Fix(**99.2**)**    ' Returns 99.



    MyNumber = **Int(**-99.8**)**   ' Returns -100.



    MyNumber = **Fix(**-99.8**)**   ' Returns -99.



    MyNumber = **Int(**-99.2**)**   ' Returns -100.



    MyNumber = **Fix(**-99.2**)**   ' Returns -99.

经过测试 结论:  在netsuite中 不能使用 num.Fixed(2)  必须使用num.toFixed(2)  才可以成功.  所以,默认这个版本的js 支持: toFixed

这里还需要注意一点 由于js是不明确定义变量的类型,所有我们在用一个数左右一个自定义函数的返回值时,需要对它进行类型的转化后 才可以使用 toFixed方法。

parseFloat  这个时候就派上用场了。  先parseFloat 在toFixed(4),即可。

javascript统计字符串内字符出现次数-CarlZeng

用字符串的split方法将其分为数组,数组的length-1就是字符的出现次数。代码修改为JavaScript如下: function test(){ var str = “www.netsuite.com”; alert(str.split(“c”).length-1); alert(str.split(“w”).length-1); }

用字符串的split方法将其分为数组,数组的length-1就是字符的出现次数。代码修改为JavaScript如下:

function test(){
var str = “www.netsuite.com”;
alert(str.split(“c”).length-1);
alert(str.split(“w”).length-1);
}

html js 跨域 p3p-CarlZeng

动态的创建iframe,然后向里面append DOM元素


var cw = window.frames['tst']; cw.document.open(); cw.document.write('<script>alert("test")<' + '/script>'); cw...</x-turndown>

*   <iframe id="tst" src="javascript:false"></iframe>
*   <script>
*   var cw = window.frames['tst'];
*   cw.document.open();
*   cw.document.write('<script>alert("test")<' + '/script>');
*   cw.document.write('<div>test</div>');
*   cw.document.close();
*   </script>

这段代码可以实现 js动态的创建iframe,然后向里面append DOM元素、JS函数

js动态的创建iframe:

var f=document.createElement("IFRAME");  
f.id = "iframe01";  
f.name= "iframe01";  
f.height=1000;  
f.width=1000;  
f.src='https://system.netsuite.com/app/accounting/transactions/inventory/inventorynumbereditor.nl?l=T&tranid=745&lineid=1'; //"about:blank"  
document.body.appendChild(f);

var header= new Array();  
header['P3P: CP']= 'CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR';  
header['Set-Cookie']= 'test=axis; expires=Sun, 23-Dec-2018 08:13:02 GMT; domain=.google.com; path=/';  
var url ='https://mail.google.com/mail/#inbox';  
nlapiRequestURL(url, null, header);

如上代码失败可知:ajax不支持跨域, 这样跨域必须要用到php,jsp或者c++等动态语言服务端的代理。

详细见:

http://blog.csdn.net/lanmao100/archive/2008/04/25/2328491.aspx 用P3P header解决iframe跨域访问cookie/session

http://viralpatel.net/blogs/2008/12/how-to-set-third-party-cookies-with-iframe.html How to set third-party cookies with iframe

http://hi.baidu.com/aullik5/blog/item/cde7f31efc3953f2e0fe0b46.html P3P Header Tips