2 "name" : "Pman.Dialog.XtupleSalesOrder",
5 "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleSalesOrder.bjs",
11 "|show" : "function () {\n this.layout.getRegion('center').showPanel(0);\n}"
14 "collapsible" : false,
15 "title" : "Edit / Create Sales Order",
16 "xtype" : "LayoutDialog",
24 "alwaysShowTabs" : true,
25 "xtype" : "LayoutRegion",
27 "tabPosition" : "top",
37 "$ xns" : "Roo.Toolbar"
41 "click" : "function ()\n{\n var id = 1* _this.form.findField('cohead_id').getValue();\n if (!id) {\n Roo.MessageBox.alert(\"Error\", \"Save Sales order first\");\n return;\n \n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/cohead',\n method : 'GET',\n params : {\n cohead_id : id,\n _excel : 1\n },\n success : function() {\n\n }\n })\n \n \n \n}"
43 "text" : "Download Excel",
45 "cls" : "x-btn-text-icon",
46 "$ icon" : "rootURL + '/Pman/templates/images/spreadsheet.gif'",
47 "$ xns" : "Roo.Toolbar"
51 "click" : "function ()\n{\n var id = 1* _this.form.findField('cohead_id').getValue();\n if (!id) {\n Roo.MessageBox.alert(\"Error\", \"Save Sales order first\");\n return;\n \n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/cohead',\n method : 'GET',\n params : {\n cohead_id : id,\n _print : 1\n },\n success : function() {\n\n }\n })\n \n \n \n}"
55 "cls" : "x-btn-text-icon",
56 "$ icon" : "rootURL + '/Pman/templates/images/pdf.gif'",
57 "$ xns" : "Roo.Toolbar"
61 "click" : "function (_self, e)\n{\n\n _this.addShipmentBtn.fireEvent('click');\n \n}"
63 "text" : "Add Shipment",
66 "cls" : "x-btn-text-icon",
67 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
68 "$ xns" : "Roo.Toolbar"
72 "click" : "function (_self, e)\n{\n\n Pman.Dialog.XtupleCustomer.show({\n cust_id : _this.form.findField('cohead_cust_id').getValue()\n }); \n}"
74 "text" : "Edit Customer",
76 "cls" : "x-btn-text-icon",
77 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
78 "$ xns" : "Roo.Toolbar"
82 "click" : "function (_self, e)\n{\n\n _this.addInvoiceBtn.fireEvent('click');\n \n}"
84 "text" : "Add Invoice",
87 "cls" : "x-btn-text-icon",
88 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
89 "$ xns" : "Roo.Toolbar"
93 "render" : "function (_self, e)\n{\n _this.voidBtn = _self;\n}",
94 "click" : "function (_self, e)\n{\n var p = { \n cohead_id : _this.form.findField('cohead_id').getValue() \n };\n function call() {\n\n \n new Pman.Request({\n mask : 'Sending',\n url: baseURL + '/Roo/cohead',\n method : 'POST',\n params : p,\n success : function()\n {\n _this.callback();\n if ( _this.data.cohead_status == 'X') {\n _this.form.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});\n \n return;\n }\n\n \n _this.dialog.hide();\n }\n });\n }\n\n \n if (_this.data.cohead_status == 'X') {\n p._unvoid = 1;\n call();\n return;\n }\n \n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to void this?\", function(r) {\n \n if (r !='yes') {\n return;\n }\n p._void = 1;\n call(); \n\n \n });\n\n}"
98 "$ xns" : "Roo.Toolbar"
102 "render" : "function (_self)\n{\n _this.closeBtn = _self;\n}",
103 "click" : "function (_self, e)\n{\n var p = { cohead_id : _this.form.findField('cohead_id').getValue() };\n \n var close = 1;\n if (_this.data.cohead_status == 'C') {\n p._reopen = 1;\n close = 0;\n } else {\n p._close = 1;\n }\n \n new Pman.Request({\n url: baseURL + '/Roo/cohead',\n method : 'POST',\n params : p,\n mask : 'Sending',\n success : function()\n {\n _this.callback();\n if (!close) {\n _this.form.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});\n \n return;\n }\n \n _this.dialog.hide();\n }\n });\n \n}"
105 "text" : "Completed",
107 "$ xns" : "Roo.Toolbar"
115 "activate" : "function (_self)\n{\n // we need to reload to find out the subtotal.\n if (!_this.data || !_this.data.cohead_id) {\n return;\n }\n new Pman.Request({\n method : 'GET',\n url : baseURL + '/Roo/cohead',\n params : { \n _id : _this.data.cohead_id\n },\n success : function(res) {\n _this.form.findField('cohead_subtotal').setValue(res.data.cohead_subtotal);\n _this.form.findField('cohead_tax').setValue(res.data.cohead_tax);\n _this.form.findField('cohead_uninvoiced').setValue(res.data.cohead_uninvoiced);\n _this.form.findField('cohead_unshipped').setValue(res.data.cohead_unshipped);\n _this.form.findField('cohead_pretax_discount').setValue(res.data.cohead_pretax_discount); \n _this.form.findField('cohead_total').recalc(); \n _this.form.findField('cohead_misc').recalc(); \n }\n });\n}"
118 "xtype" : "ContentPanel",
119 "title" : "Order Details",
124 "actionfailed" : "function (_self, action)\n{\n if (action.failureType == 'client') {\n Roo.MessageBox.alert(\"Error\", \"Fill in all the required fields\");\n }\n if (action.failureType == 'server') { \n Roo.log(action);\n Roo.MessageBox.alert(\"Error\", action.result.errorMsg);\n }\n _this.dialog.layout.getRegion('center').showPanel(0);\n}",
125 "|actioncomplete" : "function(_self,action)\n{\n if (action.type == 'setdata') {\n // clear the stock level cache...\n _this.stockcache = [];\n \n _this.form.findField('billto_email').setValue('');\n \n _this.reversalBtn.hide();\n \n if (_this.data.cohead_id) {\n this.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});\n \n return;\n }\n _this.dialog.setTitle(\"Edit New Sales Order\");\n \n _this.closeBtn.hide();\n _this.voidBtn.hide();\n _this.saveBtn.show();\n \n if(_this.data.cohead_billto_cntct_id_cntct_id){\n _this.form.findField('billto_address').update();\n \r\n _this.form.setValues({\r\n cohead_billto_cntct_id: _this.data.cohead_billto_cntct_id_cntct_id,\r\n cohead_billto_cntct_id_cntct_name : _this.data.cohead_billto_cntct_id_cntct_name,\r\n _shipto_same : 1,\n _same_as_order : 1\n \r\n }); \r\n }\n \n return;\n }\n if (action.type == 'load') {\n \n \n _this.data = action.result.data;\n\n if (!_this.data.cohead_shipto_id && _this.data.shipto_id*1 > 0) {\n _this.form.findField('cohead_shipto_id').setValue(_this.data.shipto_id);\n _this.form.findField('cohead_shipto_id_shipto_name').setValue(_this.data.cohead_shipto_cntct_id_cntct_name);\n \n }\n \n \n _this.dataloading = true;\n if (_this.data.cohead_shipto_cntct_id == _this.data.cohead_billto_cntct_id) {\n this.findField('_shipto_same').setValue(1);\n Roo.log(\"set shipto 1\");\n } else {\n this.findField('_shipto_same').setValue(0);\n Roo.log(\"set shipto 0\");\n }\n _this.dataloading = false; \n \n \n this.findField('billto_address').update();\n this.findField('shipto_address').update(); \n _this.dialog.setTitle(\"Edit Sales Order - \" + this.findField('cohead_number').getValue());\n \n \n if (_this.data.cohead_status == 'C') {\n _this.closeBtn.show();\n _this.closeBtn.setText('Re-open');\n _this.voidBtn.hide();\n _this.saveBtn.hide();\n _this.reversalBtn.show();\n } else if (_this.data.cohead_status == 'X') {\n _this.closeBtn.hide(); \n _this.voidBtn.show(); \n _this.voidBtn.setText(\"Un-void / Re-open\"); \n _this.saveBtn.hide();\n } else {\n // it's open\n _this.closeBtn.show(); \n _this.closeBtn.setText('Complete and Close'); \n _this.voidBtn.setText(\"Void\"); \n _this.voidBtn.show(); \n _this.saveBtn.show(); \n }\n \n _this.form.findField('cohead_misc_per').update();\n \n // finally override the value for discount...\n if ((''+ _this.data.cohead_misc_descrip).length) {\n _this.form.findField('cohead_misc_descrip').setValue(_this.data.cohead_misc_descrip);\n }\n \n // update the stockcache...\n\n new Pman.Request({\n url : baseURL + '/Roo/cohead',\n method : 'GET',\n params : {\n _stockLevel : _this.data.cohead_id\n },\n success : function(res) \n {\n for (var i in res.data) {\n \n if(typeof(_this.stockcache[res.data[i].item]) == 'undefined'){\n _this.stockcache[res.data[i].item] = res.data[i];\n }\n }\n }\n });\n \n return;\n }\n if (action.type =='submit') {\n \n\n var id = _this.form.findField('cohead_id').getValue() * 1;\n if (id < 1) {\n\n _this.data.cohead_id = action.result.data.cohead_id;\n this.load({ method: 'GET', params: { '_id' : _this.data.cohead_id }});\n return;\n }\n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(_this, _this.form.getValues());\n }\n _this.form.reset();\n return;\n }\n}\n",
126 "|rendered" : "function (form)\n{\n _this.form= form;\n}\n"
128 "$ url" : "baseURL + '/Roo/cohead.php'",
131 "style" : "margin:10px;",
132 "$ xns" : "Roo.form",
137 "$ xns" : "Roo.form",
140 "style" : "width:420px",
142 "xtype" : "FieldSet",
144 "$ xns" : "Roo.form",
150 "$ xns" : "Roo.form",
156 "$ xns" : "Roo.form",
159 "fieldLabel" : "Order#",
160 "emptyText" : "Automatic",
161 "xtype" : "TextField",
165 "$ xns" : "Roo.form",
166 "name" : "cohead_number"
169 "style" : "float:left",
173 "$ xns" : "Roo.form",
176 "fieldLabel" : "Cust#",
177 "xtype" : "TextField",
181 "$ xns" : "Roo.form",
182 "name" : "cohead_cust_id_cust_number"
190 "triggerAction" : "all",
191 "forceSelection" : true,
192 "fieldLabel" : "Customer",
193 "selectOnFocus" : true,
195 "hiddenName" : "cohead_cust_id",
197 "valueField" : "cust_id",
198 "xtype" : "TextField",
203 "$ xns" : "Roo.form",
204 "name" : "cohead_cust_id_cust_name",
205 "qtip" : "Select custinfo",
206 "queryParam" : "query[cust_name]",
207 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
208 "loadingText" : "Searching..."
211 "fieldLabel" : "Customer PO#",
212 "xtype" : "TextField",
213 "$ xns" : "Roo.form",
215 "name" : "cohead_custponumber"
219 "fieldLabel" : "Ordered",
220 "xtype" : "DateField",
221 "allowBlank" : false,
223 "$ xns" : "Roo.form",
224 "name" : "cohead_orderdate"
230 "$ xns" : "Roo.form",
234 "fieldLabel" : "Target Delivery",
235 "xtype" : "DateField",
236 "allowBlank" : false,
238 "$ xns" : "Roo.form",
239 "name" : "cohead_targetdate"
244 "$ xns" : "Roo.form",
248 "check" : "function (_self, checked)\n{\n if(checked){\n _this.form.findField('cohead_targetdate').setValue(_this.form.findField('cohead_orderdate').getValue());\n }\n}"
251 "xtype" : "Checkbox",
252 "boxLabel" : "same as order",
253 "$ xns" : "Roo.form",
254 "name" : "_same_as_order"
262 "triggerAction" : "all",
263 "fieldLabel" : "Supply From",
264 "forceSelection" : true,
265 "selectOnFocus" : true,
267 "displayField" : "location_name",
268 "emptyText" : "Supply From",
269 "hiddenName" : "cohead_location_src",
271 "valueField" : "location_id",
272 "xtype" : "ComboBox",
273 "allowBlank" : false,
277 "$ xns" : "Roo.form",
278 "name" : "cohead_location_src_location_name",
279 "qtip" : "Select terms",
280 "queryParam" : "query[location_name]",
281 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> {location_descrip} </div>",
282 "loadingText" : "Searching...",
286 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params.location_netable = 1;\n o.params.location_restrict = 0;\n o.params._notinternalcompany = 1;\n}\n"
290 "$ sortInfo" : "{ direction : 'ASC', field: 'location_name' }",
291 "$ xns" : "Roo.data",
295 "$ url" : "baseURL + '/Roo/location.php'",
296 "xtype" : "HttpProxy",
298 "$ xns" : "Roo.data",
302 "id" : "location_id",
304 "xtype" : "JsonReader",
305 "$ fields" : "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
306 "$ xns" : "Roo.data",
308 "totalProperty" : "total"
319 "style" : "width:420px",
320 "legend" : "Details",
321 "xtype" : "FieldSet",
323 "$ xns" : "Roo.form",
329 "$ xns" : "Roo.form",
333 "triggerAction" : "all",
334 "forceSelection" : true,
335 "selectOnFocus" : true,
336 "fieldLabel" : "Terms",
338 "xtype" : "ComboBox",
339 "emptyText" : "Select terms",
341 "valueField" : "terms_id",
342 "displayField" : "terms_descrip",
343 "hiddenName" : "cohead_terms_id",
344 "allowBlank" : false,
347 "$ xns" : "Roo.form",
349 "qtip" : "Select terms",
350 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>",
351 "queryParam" : "query[terms_descrip]",
352 "name" : "cohead_terms_id_terms_descrip",
353 "loadingText" : "Searching...",
357 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
361 "$ sortInfo" : "{ direction : 'ASC', field: 'terms_descrip' }",
362 "$ xns" : "Roo.data",
366 "$ url" : "baseURL + '/Roo/terms.php'",
368 "xtype" : "HttpProxy",
369 "$ xns" : "Roo.data",
375 "xtype" : "JsonReader",
376 "$ xns" : "Roo.data",
377 "$ fields" : "[{\"name\":\"terms_id\",\"type\":\"int\"},\"terms_descrip\"]",
379 "totalProperty" : "total"
386 "alwaysQuery" : true,
388 "triggerAction" : "all",
389 "fieldLabel" : "Sales Rep",
390 "forceSelection" : true,
391 "selectOnFocus" : true,
393 "displayField" : "salesrep_name",
394 "emptyText" : "Select salesrep",
395 "hiddenName" : "cohead_display_salesrep_id",
397 "valueField" : "salesrep_id",
398 "xtype" : "ComboBox",
403 "$ xns" : "Roo.form",
404 "name" : "cohead_display_salesrep_id_salesrep_name",
405 "qtip" : "Select salesrep",
406 "queryParam" : "query[salesrep_name]",
407 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
408 "loadingText" : "Searching...",
412 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
416 "$ sortInfo" : "{ direction : 'ASC', field: 'salesrep_name' }",
417 "$ xns" : "Roo.data",
421 "$ url" : "baseURL + '/Roo/salesrep.php'",
423 "xtype" : "HttpProxy",
424 "$ xns" : "Roo.data",
428 "id" : "salesrep_id",
430 "xtype" : "JsonReader",
431 "$ xns" : "Roo.data",
432 "$ fields" : "[{\"name\":\"salesrep_id\",\"type\":\"int\"},\"salesrep_name\"]",
434 "totalProperty" : "total"
441 "alwaysQuery" : true,
443 "triggerAction" : "all",
444 "fieldLabel" : "Staff I.C.",
445 "forceSelection" : true,
446 "selectOnFocus" : true,
448 "displayField" : "salesrep_name",
449 "emptyText" : "Select Staff",
450 "hiddenName" : "cohead_salesrep_id",
452 "valueField" : "salesrep_id",
453 "xtype" : "ComboBox",
454 "allowBlank" : false,
458 "$ xns" : "Roo.form",
459 "name" : "cohead_salesrep_id_salesrep_name",
460 "qtip" : "Select salesrep",
461 "queryParam" : "query[salesrep_name]",
462 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
463 "loadingText" : "Searching...",
467 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
471 "$ sortInfo" : "{ direction : 'ASC', field: 'salesrep_name' }",
472 "$ xns" : "Roo.data",
476 "$ url" : "baseURL + '/Roo/salesrep.php'",
478 "xtype" : "HttpProxy",
479 "$ xns" : "Roo.data",
483 "id" : "salesrep_id",
485 "xtype" : "JsonReader",
486 "$ xns" : "Roo.data",
487 "$ fields" : "[{\"name\":\"salesrep_id\",\"type\":\"int\"},\"salesrep_name\"]",
489 "totalProperty" : "total"
496 "fieldLabel" : "Order Comments",
497 "xtype" : "TextArea",
499 "$ xns" : "Roo.form",
500 "name" : "cohead_ordercomments",
508 "style" : "width:420px",
509 "xtype" : "FieldSet",
510 "legend" : "Billing",
511 "$ xns" : "Roo.form",
517 "$ xns" : "Roo.form",
521 "add" : "function (combo)\n{\n \n Pman.Dialog.XtupleQuickContact.show( \n {\n _id : id,\n customer_id : _this.form.findField('cohead_cust_id').getValue()\n },\n \n function (data) {\n \n for(var i in data) {\n \n _this.data['cohead_billto_cntct_id_' + i] = data[i];\n }\n \n _this.form.findField('billto_address').update();\n // fill in the select box..\n _this.form.setValues( {\n cohead_billto_cntct_id : data.cntct_id,\n cohead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+ \n data.cntct_last_name\n \n });\n }\n );\n // Pman.Dialog.XtupleCustomer.show(\n //{ cust_id : _this.form.findField('cohead_cust_id').getValue() }, \n //function(data) {\n // refresh the data in the pulldown..\n // }); \n\n}",
522 "beforeselect" : "function (combo, record, index)\n{\n // set _this.data values ..\n\n // just add everything...\n for(var i in record.data) {\n _this.data['cohead_billto_cntct_id_' + i] = record.data[i];\n }\n \n _this.form.findField('billto_address').update();\n \n \n \n}"
524 "alwaysQuery" : true,
526 "triggerAction" : "all",
527 "fieldLabel" : "Bill To (select)",
528 "forceSelection" : true,
529 "selectOnFocus" : true,
531 "displayField" : "cntct_name",
532 "emptyText" : "Select cntct",
533 "hiddenName" : "cohead_billto_cntct_id",
535 "valueField" : "cntct_id",
536 "xtype" : "ComboBox",
537 "allowBlank" : false,
541 "$ xns" : "Roo.form",
542 "name" : "cohead_billto_cntct_id_cntct_name",
543 "qtip" : "Select cntct",
544 "queryParam" : "query[cntct_name]",
545 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{cntct_name}</b> {cntct_addr_id_addr_line1}</div>",
546 "loadingText" : "Searching...",
550 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params._customer_id = _this.data.cohead_cust_id;\n}\n"
554 "$ sortInfo" : "{ direction : 'ASC', field: 'cntct_name' }",
555 "$ xns" : "Roo.data",
559 "$ url" : "baseURL + '/Roo/cntct.php'",
561 "xtype" : "HttpProxy",
562 "$ xns" : "Roo.data",
568 "xtype" : "JsonReader",
569 "$ xns" : "Roo.data",
570 "$ fields" : "[{\"name\":\"cntct_id\",\"type\":\"int\"},\"cntct_name\"]",
572 "totalProperty" : "total"
580 "render" : "function (_self)\n{\n Roo.log(this.el)\n \n \n \n this.el.on('click', function() { \n var id = _this.form.findField('cohead_billto_cntct_id').getValue();\n Pman.Dialog.XtupleQuickContact.show( \n {\n _id : id,\n customer_id : _this.form.findField('cohead_cust_id').getValue()\n },\n \n function (data) {\n \n for(var i in data) {\n \n _this.data['cohead_billto_cntct_id_' + i] = data[i];\n }\n \n _this.form.findField('billto_address').update();\n // fill in the select box..\n _this.form.setValues( {\n cohead_billto_cntct_id : data.cntct_id,\n cohead_billto_cntct_id_cntct_name : data.cntct_first_name + ' '+ \n data.cntct_last_name\n \n });\n \n \n Roo.log(data);\n }\n );\n \n Roo.log(\"Click text\");\n \n \n });\n}"
582 "fieldLabel" : "or enter Address",
583 "xtype" : "TextArea",
584 "$ update" : "function() {\n\n var c = ['first_name', 'last_name' ] ;\n var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];\n var v = [];\n Roo.each(c, function(e) {\n if (_this.data['cohead_billto_cntct_id_cntct_' +e].length) { \n v.push(_this.data['cohead_billto_cntct_id_cntct_' +e]);\n }\n });\n Roo.each(a, function(e) {\n if (_this.data['cohead_billto_cntct_id_cntct_addr_id_addr_' +e].length) {\n v.push(_this.data['cohead_billto_cntct_id_cntct_addr_id_addr_' +e]);\n }\n });\n\n this.setValue(v.join(\"\\n\"));\n \n if(_this.data.cohead_billto_cntct_id_cntct_email.length){\n _this.form.findField('billto_email').setValue(_this.data.cohead_billto_cntct_id_cntct_email);\n }\n}\n",
586 "$ xns" : "Roo.form",
587 "name" : "billto_address"
590 "fieldLabel" : "Email",
591 "xtype" : "DisplayField",
592 "$ valueRenderer" : "function(v)\n{\n \n return v ? String.format('<a href=\"mailto:{0}\" target=\"_blank\">{0}</a>',v) : '';\n}",
593 "$ xns" : "Roo.form",
594 "name" : "billto_email"
604 "style" : "margin-left:10px",
606 "$ xns" : "Roo.form",
609 "legend" : "Price Details",
610 "xtype" : "FieldSet",
611 "style" : "width:420px",
613 "$ xns" : "Roo.form",
616 "labelAlign" : "right",
620 "$ xns" : "Roo.form",
623 "labelAlign" : "top",
625 "labelSeparator" : " ",
627 "$ xns" : "Roo.form",
631 "beforequery" : "function (combo, query, forceAll, cancel, e)\n{\n Roo.log('beforequery');\n \n if (_this.form.findField('cohead_number').getValue().length) {\n Roo.MessageBox.alert(\"Error\", \"You can not change the currency of this order\");\n if (query) {\n query.cancel = true;\n }\n return false;\n }\n}"
634 "triggerAction" : "all",
635 "fieldLabel" : "Currency",
636 "forceSelection" : true,
637 "selectOnFocus" : true,
639 "displayField" : "curr_name",
640 "emptyText" : "Select curr_name",
641 "hiddenName" : "cohead_curr_id",
643 "valueField" : "curr_id",
644 "xtype" : "ComboBox",
645 "allowBlank" : false,
649 "$ xns" : "Roo.form",
650 "name" : "cohead_curr_id_curr_name",
651 "qtip" : "Select Currency",
652 "queryParam" : "query[curr_name]",
653 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
654 "loadingText" : "Searching...",
658 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n \n}\n"
662 "$ sortInfo" : "{ direction : 'ASC', field: 'curr_symbol' }",
663 "$ xns" : "Roo.data",
667 "$ url" : "baseURL + '/Roo/curr_symbol.php'",
669 "xtype" : "HttpProxy",
670 "$ xns" : "Roo.data",
676 "xtype" : "JsonReader",
677 "$ xns" : "Roo.data",
678 "$ fields" : "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]",
680 "totalProperty" : "total"
687 "fieldLabel" : "Products",
688 "xtype" : "NumberField",
689 "cls" : "roo-align-right",
691 "allowDecimals" : true,
692 "decimalPrecision" : 3,
694 "$ xns" : "Roo.form",
695 "name" : "cohead_subtotal"
700 "labelAlign" : "top",
702 "labelSeparator" : " ",
704 "$ xns" : "Roo.form",
708 "select" : "function (combo, record, index)\n{\n _this.form.findField('cohead_tax').setValue(\n parseFloat(record.data.taxzone_rate) * \n parseFloat(_this.form.findField('cohead_subtotal').getValue())\n );\n _this.form.findField('cohead_total').recalc();\n}"
711 "triggerAction" : "all",
712 "fieldLabel" : "Tax Zone",
713 "forceSelection" : true,
714 "selectOnFocus" : true,
716 "displayField" : "taxzone_descrip",
717 "emptyText" : "Select taxtype",
718 "hiddenName" : "cohead_taxzone_id",
720 "valueField" : "taxzone_id",
721 "xtype" : "ComboBox",
722 "allowBlank" : false,
726 "$ xns" : "Roo.form",
727 "name" : "cohead_taxzone_id_taxzone_descrip",
728 "qtip" : "Select taxtype",
729 "queryParam" : "query[taxzone_descrip]",
730 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>",
731 "loadingText" : "Searching...",
735 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n \n o.params.with_date = _this.form.findField('cohead_orderdate').getValue().format('Y-m-d'); \n Roo.log(\"with date?\" + o.params.with_date);\n \n \n}\n"
739 "$ sortInfo" : "{ direction : 'ASC', field: 'taxzone_descrip' }",
740 "$ xns" : "Roo.data",
744 "$ url" : "baseURL + '/Roo/taxzone.php'",
745 "xtype" : "HttpProxy",
747 "$ xns" : "Roo.data",
753 "xtype" : "JsonReader",
754 "$ fields" : "[{\"name\":\"taxzone_id\",\"type\":\"int\"},\"taxzone_descrip\"]",
755 "$ xns" : "Roo.data",
757 "totalProperty" : "total"
764 "fieldLabel" : "Tax",
765 "xtype" : "NumberField",
766 "cls" : "roo-align-right",
768 "allowDecimals" : true,
769 "decimalPrecision" : 3,
771 "$ xns" : "Roo.form",
772 "name" : "cohead_tax"
777 "fieldLabel" : "Pre Tax discount",
778 "xtype" : "NumberField",
779 "cls" : "roo-align-right",
781 "allowDecimals" : true,
782 "decimalPrecision" : 3,
784 "$ xns" : "Roo.form",
785 "name" : "cohead_pretax_discount"
788 "labelAlign" : "top",
790 "labelSeparator" : " ",
792 "$ xns" : "Roo.form",
795 "fieldLabel" : "Discount after Tax Description",
796 "xtype" : "TextField",
798 "$ xns" : "Roo.form",
799 "name" : "cohead_misc_descrip"
803 "keyup" : "function (_self, e)\n{\n var pv = parseFloat(_this.form.findField('cohead_subtotal').getValue());\n var tax = parseFloat(_this.form.findField('cohead_tax').getValue());\n var pd = parseFloat(_this.form.findField('cohead_pretax_discount').getValue());\n \n var n = this.getValue();\n var discount = parseFloat(n * (pv + tax + pd) * 0.01);\n \n _this.form.findField('cohead_posttax_discount').setValue(discount);\n\n _this.form.findField('cohead_total').recalc();\n _this.form.findField('cohead_misc').recalc();\n var val = discount * -1.0;\n if (val > 0) {\n _this.form.findField('cohead_misc_descrip').setValue(\"Discount of \" + val.toFixed(1)+'%');\n }\n \n \n}"
806 "xtype" : "NumberField",
807 "$ update" : "function() {\n var m = _this.form.findField('cohead_misc_per');\n var pv = parseFloat(_this.form.findField('cohead_subtotal').getValue());\n var tax = parseFloat(_this.form.findField('cohead_tax').getValue());\n var pd = parseFloat(_this.form.findField('cohead_pretax_discount').getValue());\n \n var discount = parseFloat(_this.form.findField('cohead_posttax_discount').getValue());\n \n if (discount > 0.0) {\n this.setValue(0); \n return;\n }\n if (pv < 0) {\n this.setValue(0); \n return;\n }\n var val = ((discount) / (pv + tax + pd)) * -100;\n \n //Roo.log(\"update discount?\" + val);\n this.setValue(val.toFixed(1));\n \n if (val > 0.0) {\n _this.form.findField('cohead_misc_descrip').setValue(\"Discount of \" + val.toFixed(1)+'%');\n \n }\n \n \n}\n",
808 "cls" : "roo-align-right",
809 "allowDecimals" : true,
810 "decimalPrecision" : 1,
812 "$ xns" : "Roo.form",
813 "name" : "cohead_misc_per"
817 "keyup" : "function (_self, e)\n{\n _this.form.findField('cohead_misc_per').update();\n _this.form.findField('cohead_total').recalc();\n _this.form.findField('cohead_misc').recalc();\n}"
819 "fieldLabel" : " ",
820 "xtype" : "NumberField",
821 "cls" : "roo-align-right",
822 "allowDecimals" : true,
823 "decimalPrecision" : 3,
825 "$ xns" : "Roo.form",
826 "name" : "cohead_posttax_discount"
831 "fieldLabel" : "Total",
832 "$ recalc" : "function() {\n var d = _this.form.getValues();\n this.setValue( \n parseFloat(d.cohead_subtotal) + \n parseFloat(d.cohead_pretax_discount) + \n parseFloat(d.cohead_posttax_discount) + \n parseFloat(d.cohead_tax) + \n parseFloat(d.cohead_freight));\n}\n",
833 "xtype" : "NumberField",
834 "cls" : "roo-align-right",
836 "allowDecimals" : true,
837 "decimalPrecision" : 3,
839 "$ xns" : "Roo.form",
840 "name" : "cohead_total"
844 "keyup" : "function (_self, e)\n{\n _this.form.findField('cohead_total').recalc();\n}"
846 "fieldLabel" : "Shipping",
847 "xtype" : "NumberField",
848 "cls" : "roo-align-right",
849 "allowDecimals" : true,
850 "decimalPrecision" : 3,
852 "$ xns" : "Roo.form",
853 "name" : "cohead_freight"
856 "fieldLabel" : "Unshipped Total",
857 "xtype" : "NumberField",
858 "cls" : "roo-align-right",
860 "allowDecimals" : true,
861 "decimalPrecision" : 3,
863 "$ xns" : "Roo.form",
864 "name" : "cohead_unshipped"
867 "fieldLabel" : "Uninvoiced Total",
868 "xtype" : "NumberField",
869 "cls" : "roo-align-right",
871 "allowDecimals" : true,
872 "decimalPrecision" : 3,
874 "$ xns" : "Roo.form",
875 "name" : "cohead_uninvoiced"
882 "style" : "width:420px",
883 "xtype" : "FieldSet",
884 "legend" : "Shipping",
885 "$ xns" : "Roo.form",
891 "$ xns" : "Roo.form",
895 "labelSeparator" : " ",
896 "$ xns" : "Roo.form",
900 "check" : "function (_self, checked)\n{\n if (!_this.form) {\n return;\n }\n \n if (_this.dataloading) {\n \n return;\n }\n \n \n if (checked) {\n \n // copy the cohead_billto_cntct_id\n for (var i in _this.data) {\n if (!i.match(/^cohead_billto_cntct_id/)) {\n continue;\n }\n var ni = i.replace(/^cohead_billto_cntct_id/, 'cohead_shipto_cntct_id');\n _this.data[ni] = _this.data[i];\n }\n _this.form.findField('shipto_address').update();\n _this.form.setValues( {\n cohead_shipto_cntct_id : _this.data.cohead_shipto_cntct_id,\n cohead_shipto_cntct_id_cntct_name : _this.data.cohead_shipto_cntct_id_cntct_first_name + ' ' + \n _this.data.cohead_shipto_cntct_id_cntct_last_name \n \n \n });\n\n \n } else {\n for (var i in _this.data) {\n if (!i.match(/^cohead_billto_cntct_id/)) {\n continue;\n }\n var ni = i.replace(/^cohead_billto_cntct_id/, 'cohead_shipto_cntct_id');\n \n _this.data[ni] = '';\n }\n _this.form.findField('shipto_address').update();\n \n _this.form.setValues( {\n cohead_shipto_cntct_id : '',\n cohead_shipto_cntct_id_cntct_name : '' \n \n \n });\n }\n \n}"
902 "xtype" : "Checkbox",
903 "boxLabel" : "Same as Billing",
904 "$ xns" : "Roo.form",
905 "name" : "_shipto_same"
911 "add" : "function (combo)\n{\n Pman.Dialog.XtupleQuickContact.show( \n {\n _id : id,\n customer_id : _this.form.findField('cohead_cust_id').getValue()\n },\n \n function (data) {\n \n for(var i in data) {\n \n _this.data['cohead_shipto_cntct_id_' + i] = data[i];\n }\n \n _this.form.findField('shipto_address').update();\n // fill in the select box..\n _this.form.setValues( {\n cohead_shipto_cntct_id : data.cntct_id,\n cohead_shipto_cntct_id_cntct_name : data.cntct_first_name + ' '+ \n data.cntct_last_name\n \n });\n }\n ); \n}",
912 "beforeselect" : "function (combo, record, index)\n{\n \n // just add everything...\n for(var i in record.data) {\n //Roo.log('cohead_shipto_cntct_id_' + i +' =' + record.data[i]);\n _this.data['cohead_shipto_cntct_id_' + i] = record.data[i];\n }\n\n _this.form.findField('shipto_address').update();\n \n \n}"
914 "alwaysQuery" : true,
916 "triggerAction" : "all",
917 "fieldLabel" : "Ship to",
918 "forceSelection" : true,
919 "selectOnFocus" : true,
921 "displayField" : "cntct_name",
922 "emptyText" : "Select ship to",
923 "hiddenName" : "cohead_shipto_cntct_id",
925 "valueField" : "cntct_id",
926 "xtype" : "ComboBox",
927 "allowBlank" : false,
931 "$ xns" : "Roo.form",
932 "name" : "cohead_shipto_cntct_id_cntct_name",
933 "qtip" : "Select shiptoinfo",
934 "queryParam" : "query[cntct_name]",
935 "tpl" : "<div class=\"x-grid-cell-text x-btn button\">{cntct_name} - <b>{cntct_addr_id_addr_line1}</b> </div>",
936 "loadingText" : "Searching...",
940 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params._customer_id = _this.data.cohead_cust_id;\n}\n"
944 "$ sortInfo" : "{ direction : 'ASC', field: 'cntct_name' }",
945 "$ xns" : "Roo.data",
949 "$ url" : "baseURL + '/Roo/cntct.php'",
951 "xtype" : "HttpProxy",
952 "$ xns" : "Roo.data",
958 "xtype" : "JsonReader",
959 "$ xns" : "Roo.data",
960 "$ fields" : "[{\"name\":\"cntct_id\",\"type\":\"int\"},\"cntct_name\"]",
962 "totalProperty" : "total"
970 "render" : "function (_self)\n{\n Roo.log(this.el)\n \n \n \n this.el.on('click', function() { \n var id = _this.form.findField('cohead_shipto_cntct_id').getValue();\n Pman.Dialog.XtupleQuickContact.show( \n {\n _id : id,\n customer_id : _this.form.findField('cohead_cust_id').getValue()\n },\n \n function (data) {\n \n for(var i in data) {\n \n _this.data['cohead_shipto_cntct_id_' + i] = data[i];\n }\n \n _this.form.findField('shipto_address').update();\n // fill in the select box..\n _this.form.setValues( {\n cohead_shipto_cntct_id : data.cntct_id,\n cohead_shipto_cntct_id_cntct_name : data.cntct_first_name + ' '+ \n data.cntct_last_name\n \n });\n \n \n //Roo.log(data);\n }\n );\n \n // Roo.log(\"Click text\");\n \n \n });\n}"
972 "fieldLabel" : "Address",
973 "xtype" : "TextArea",
974 "$ update" : "function() {\n\n var c = ['first_name', 'last_name' ] ;\n var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];\n var v = [];\n \n if (_this.data['cohead_shipto_vend_name'] && _this.data['cohead_shipto_vend_name'].length) {\n v.push(_this.data['cohead_shipto_vend_name']);\n }\n if (_this.data['cohead_shipto_vendaddr_code'] && _this.data['cohead_shipto_vendaddr_code'].length) {\n v.push(_this.data['cohead_shipto_vendaddr_code']);\n }\n Roo.each(c, function(e) {\n if (_this.data['cohead_shipto_cntct_id_cntct_' +e] && \n _this.data['cohead_shipto_cntct_id_cntct_' +e].length) {\n v.push(_this.data['cohead_shipto_cntct_id_cntct_' +e]);\n }\n });\n Roo.each(a, function(e) {\n if (_this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e] && \n _this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e].length) { \n v.push(_this.data['cohead_shipto_cntct_id_cntct_addr_id_addr_' +e]);\n }\n });\n\n this.setValue(v.join(\"\\n\"));\n}\n",
977 "$ xns" : "Roo.form",
978 "name" : "shipto_address"
981 "fieldLabel" : "Shipment Comments",
982 "xtype" : "TextArea",
983 "$ xns" : "Roo.form",
985 "name" : "cohead_shipcomments"
995 "$ xns" : "Roo.form",
1000 "$ xns" : "Roo.form",
1001 "name" : "cohead_shipto_id"
1005 "$ xns" : "Roo.form",
1006 "name" : "cohead_shipto_id_shipto_name"
1010 "$ xns" : "Roo.form",
1011 "name" : "cohead_max_linenumber"
1015 "$ xns" : "Roo.form",
1016 "name" : "cohead_cust_id"
1019 "$ recalc" : "function() {\n var d = _this.form.getValues();\n this.setValue( \n parseFloat(d.cohead_pretax_discount) + \n parseFloat(d.cohead_posttax_discount) );\n}\n",
1021 "$ xns" : "Roo.form",
1022 "name" : "cohead_misc"
1026 "$ xns" : "Roo.form",
1027 "name" : "taxzone_rate"
1035 "deactivate" : "function (_self)\n{\n if(_this.grid){\n _this.grid.stopEditing();\n }\n}",
1036 "|activate" : "function() {\n _this.panel = this;\n \n try { if (MODULE.isBuilder) {\n return;\n } } catch(e) { }\n \n var id = _this.form.findField('cohead_id').getValue() * 1;\n if (id < 1) {\n Roo.MessageBox.alert(\"Save First\", \"Save the order first, before adding items\");\n _this.dialog.layout.getRegion('center').showPanel(0);\n return;\n }\n \n if (_this.grid) {\n _this.grid.footer.onClick('first');\n \n //if (_this.form.findField('cohead_cust_id_cust_name').getValue() == 'Bloom and Grow HK') {\n // _this.xferAll.show();\n // \n // } else {\n // _this.xferAll.hide();\n // }\n }\n \n}"
1038 "fitToframe" : true,
1039 "background" : true,
1040 "region" : "center",
1041 "title" : "Order Items",
1042 "xtype" : "GridPanel",
1043 "fitContainer" : true,
1045 "tableName" : "coitem",
1049 "beforeedit" : "function (e)\n{\n // we can only edit if nothing is assigned to shipping or invoices..\n \n var rec = e.record\n\n if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0 || (rec.data.shipitem_shipped - rec.data.coitem_qtyshipped) > 0 ) {\n Roo.MessageBox.alert(\"Error\", \"That item has been shipped, has a draft shipment or invoices - void the shipments/invoices first\");\n e.cancel = true;\n return;\n }\n \n if (rec.data.coitem_subnumber * 1 > 0) {\n Roo.log(\"Edit container event\");\n Roo.log(e); // if it's a tab.. \n\n \n switch(e.field) {\n // allow editing of source / destination..\n case 'coitem_shipto_id':\n case 'coitem_location_src': \n return;\n default : \n break;\n }\n Roo.MessageBox.alert(\"Error\", \"That is a kit item, edit the container.\");\n e.cancel = true;\n return;\n }\n // zero off values..\n //if (e.field == 'coitem_qtyord' && rec.data.coitem_qtyord == 0) {\n // e.value ='';\n // }\n // if (e.field == 'coitem_custprice' && rec.data.coitem_qtyord == 0.0) {\n // e.value ='';\n // }\n \n if (rec.data.item_type == 'K' && e.field == 'item_number') {\n // you can not change the product type on kits' as it messing things up..\n Roo.MessageBox.alert(\"Error\", \"That is a kit item,if you need to change it, delete it first.\");\n e.cancel = true;\n return;\n }\n \n}",
1050 "|render" : "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n \n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
1051 "celldblclick" : "function (_self, rowIndex, columnIndex, e)\n{\n var rec = this.ds.getAt(rowIndex);\n var di = this.cm.getDataIndex(columnIndex);\n if (di != 'avail_qty') {\n return;\n }\n \n Pman.Dialog.XtupleInvHistory.show({\n itemsite_item_id_item_number : rec.data.item_number,\n // itemsite_item_id_item_descript1 : rec.data.item_descrip1,\n location_name : rec.data.coitem_location_src_location_name,\n location_descrip : rec.data.coitem_location_src_location_descrip,\n \n invhist_transdate : _this.form.findField('cohead_targetdate').getValue() \n }); \n \n}",
1052 "afteredit" : "function (e)\n{\n Roo.log('afteredit:' + e.record.data.coitem_linenumber);\n\n \n // if ( e.record && e.record.data.coitem_id) {\n // as we disable update to the display on the ajax callback to \n // allow editing flow to continue, and not refresh - we can only update\n // these values after something has actually been edited.\n // e.record.set('coitem_id', e.record.data.coitem_id);\n // e.record.set('coitem_status', e.record.data.coitem_status);\n // }\n \n if (e.field == 'item_number' || e.originalValue == e.value) {\n // afterselect handles this...\n return;\n }\n if (e.field == 'item_descrip1') {\n e.record.set('coitem_memo', e.value);\n }\n var rate = _this.form.findField('taxzone_rate').getValue();\n switch(e.field) {\n case 'coitem_linedisc':\n \n var cp = parseFloat(e.record.data.coitem_custprice);\n \n if (isNaN(cp) || cp == 0.0) {\n break;\n }\n \n var dis = parseFloat(e.value);\n \n if (isNaN(dis)) {\n break;\n }\n \n e.record.set(\n 'coitem_price',\n Math.max(0,cp * ((100.0 - parseInt(e.value))/ 100.0) ) \n );\n \n // donot need to set the subtotal here, coz we will render it automatically\n // e.record.set(\n // 'coitem_subtotal',\n // e.record.data.coitem_price * 1.0 * e.record.data.coitem_qtyord\n // );\n break;\n \n case 'coitem_price': // SELL@ price\n\n var cp = parseFloat(e.record.data.coitem_custprice);\n // list price is < price -- update it..\n if (isNaN(cp) || cp == 0.0 || cp < e.value) {\n e.record.set('coitem_custprice', e.value);\n cp = e.value;\n }\n // update the discount calc.\n \n e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( e.value / cp) * 100.0))); \n \n // donot need to set the subtotal here, coz we will render it automatically\n //e.record.set(\n // 'coitem_subtotal',\n // e.record.data.coitem_price * 1.0 * e.record.data.coitem_qtyord\n //);\n break;\n \n case 'coitem_custprice':\n // modified customer price...\n // just modify the discount.. -- leave the entered price the same..\n var sp = parseFloat(e.record.data.coitem_price);\n var cp = parseFloat(e.value);\n if (isNaN(cp) || cp == 0.0 || cp < e.value) {\n break;\n }\n \n e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0))); \n \n break;\n \n case 'coitem_custprice_tax':\n var cp = parseFloat(e.value / ( 1 + rate * 1 ));\n var sp = parseFloat(e.record.data.coitem_price);\n \n if (isNaN(cp) || cp == 0.0) {\n break;\n }\n e.record.set('coitem_custprice', cp);\n e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0))); \n \n break; \n \n case 'coitem_price_tax':\n\n var cp = parseFloat(e.record.data.coitem_custprice);\n var sp = parseFloat(e.value / ( 1 + rate * 1 ));\n if (isNaN(cp) || cp == 0.0 || cp < sp) {\n e.record.set('coitem_custprice', sp);\n cp = sp;\n }\n e.record.set('coitem_price', sp);\n e.record.set('coitem_linedisc', Math.max(0, 100.0 - (( sp / cp) * 100.0))); \n \n break;\n \n }\n \n \n \n \n var doupdate = function() { \n if (!e.record.updatePending) {\n Roo.log('doupdate...' + e.record.data.coitem_linenumber);\n Roo.log(e.record);\n e.record.commit();\n return;\n }\n Roo.log('doupdate pending...' + e.record.data.coitem_linenumber);\n // wait until it's not peding an update..\n doupdate.defer(500);\n }\n\n if(e.record.data.coitem_id * 1 < 1 && !e.record.isInserting){ // insert\n e.record.isInserting = 1;\n e.record.isUpdating = 0;\n doupdate();\n return;\n }\n \n // update\n if(!e.record.isInserting && !e.record.isUpdating){\n e.record.isUpdating = 1;\n doupdate();\n return;\n }\n \n if(!e.record.updatePending){\n e.record.updatePending = 1;\n doupdate();\n return;\n }\n Roo.log(\"got to end without doing an update?\" + e.record.data.coitem_linenumber);\n \n}\n",
1053 "rowclass" : "function (gridview, rowcfg)\n{\n if (rowcfg.record.data.coitem_status == 'C' &&\n rowcfg.record.data.shipitem_shipped * 1 < 1) {\n \n rowcfg.rowClass = 'strikethrough';\n }\n if (rowcfg.record.data.coitem_status == 'X' ) {\n \n rowcfg.rowClass = 'strikethrough';\n }\n \n if (!rowcfg.record.data.coitem_id) { \n rowcfg.rowClass = 'dragon-not-saved';\n }\n \n \n // Roo.log(rowcfg);\n// shipitem_shipped\n}"
1055 "autoExpandColumn" : "item_descrip1",
1056 "xtype" : "EditorGrid",
1058 "$ loadAvail" : "function() {\n \n \n this.ds.each(function(r) {\n \n if(!r.data.item_number.length){\n return;\n }\n \n if(typeof(_this.stockcache[r.data.item_number]) != 'undefined'){\n \n r.set('avail_qty', _this.stockcache[r.data.item_number].qty);\n if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {\n r.set('coitem_unitcost_in_order_cur', _this.stockcache[r.data.item_number].unitcost);\n }\n return;\n }\n \n var q = [];\n \n q.push( { \n item : r.data.item_number, \n loc: r.data.coitem_location_src_location_name,\n id: r.data.coitem_linenumber + (r.data.coitem_subnumber ? ('.' + r.data.coitem_subnumber) : '')\n } );\n \n new Pman.Request({\n url : baseURL + '/Roo/itemloc',\n method : 'POST',\n params : {\n _availqty : Roo.encode(q),\n curr_name : _this.form.findField('cohead_curr_id').el.dom.value\n },\n success : function(res) \n {\n for (var i in res.data) {\n _this.stockcache[res.data[i].item] = res.data[i];\n }\n r.set('avail_qty', _this.stockcache[r.data.item_number].qty);\n if (r.data.coitem_unitcost_in_order_cur * 1.0 < 0.1) {\n r.set('coitem_unitcost_in_order_cur', _this.stockcache[r.data.item_number].unitcost);\n }\n //_this.grid.ds.fireEvent(\"update\", _this.grid.ds, r, Roo.data.Record.EDIT);\n return\n }\n });\n });\n \n \n}\n",
1060 "$ xns" : "Roo.grid",
1065 "tabend" : "function (_self)\n{\n _this.addItemBtn.fireEvent('click', _this.addItemBtn);\n}",
1066 "beforeeditnext" : "function (eventdata)\n{\n \n return;\n // this does not work, as the reload effect cancels editng.\n var rec = _this.grid.ds.getAt(eventdata.cell[0]);\n if (rec.data.coitem_subnumber *1 < 0 ) {\n return;\n }\n var r = eventdata.cell[0] + 1;\n\n while (true) {\n if (r > _this.grid.ds.getCount()-1 ) {\n eventdata.cell = false;\n return;\n }\n rec = _this.grid.ds.getAt(r);\n if (rec.data.coitem_subnumber *1 < 0 ) {\n eventdata.cell = [ r, eventdata.cell[1] ];\n return;\n }\n r++;\n }\n \n \n \n\n}"
1068 "xtype" : "CellSelectionModel",
1069 "$ xns" : "Roo.grid",
1071 "enter_is_tab" : true
1075 "xtype" : "PagingToolbar",
1076 "emptyMsg" : "No Items",
1078 "displayInfo" : true,
1079 "$ updateSummary" : "function() {\n var f = this;\n new Pman.Request({\n url : baseURL + '/Roo/Coitem',\n method : 'GET',\n params : {\n _totals : 1,\n coitem_cohead_id : _this.form.findField('cohead_id').getValue()\n },\n success : function(d) {\n //Roo.log(d);\n f.displayEl.update(String.format(\n \"{0} items | Subtotal: {2} | Tax: {3} | List Discount {4} | Total : {1}{5}\",\n d.data.total_qty,\n _this.form.findField('cohead_curr_id').el.dom.value,\n d.data.total_sub,\n d.data.total_tax,\n d.data.total_list_discount, \n d.data.total_total\n ));\n \n }\n });\n}\n",
1080 "* prop" : "footer",
1084 "click" : "function (_self, e)\n{\n new Pman.Request({\n url : baseURL + '/Roo/Cohead',\n method : 'GET',\n params : {\n _fill_shipto : _this.form.findField('cohead_id').getValue()\n },\n success : function() {\n _this.grid.footer.onClick('first');\n }\n });\n}"
1086 "text" : "Fill empty Ship To",
1088 "$ xns" : "Roo.Toolbar"
1092 "click" : "function (_self, e)\n{\n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure?<BR>\"+\n \"This will set all the locations to match the Sales Order - and remove all old locations.\",\n function (res) {\n if(res!='yes') {\n return;\n \n }\n new Pman.Request({\n url : baseURL + '/Roo/Cohead',\n method : 'GET',\n params : {\n _fill_location : _this.form.findField('cohead_id').getValue(),\n _location_id : _this.form.findField('cohead_location_src').getValue()\n },\n success : function() {\n _this.grid.footer.onClick('first');\n }\n });\n });\n \n}"
1094 "text" : "Update Location to match S/O",
1096 "$ xns" : "Roo.Toolbar"
1100 "toggle" : "function (_self, pressed)\n{\n this.setText(pressed ? \"Prices exc GST\" : \"Prices with GST\");\n var cm = _this.grid.getColumnModel();\n\n cm.setHidden(cm.getIndexByDataIndex('coitem_price_tax'), pressed ? false : true);\n cm.setHidden(cm.getIndexByDataIndex('coitem_custprice_tax'), pressed ? false : true);\n cm.setHidden(cm.getIndexByDataIndex('coitem_subtotal_tax'), pressed ? false : true);\n \n cm.setHidden(cm.getIndexByDataIndex('coitem_price'), pressed ? true : false);\n cm.setHidden(cm.getIndexByDataIndex('coitem_custprice'), pressed ? true : false);\n cm.setHidden(cm.getIndexByDataIndex('coitem_subtotal'), pressed ? true : false);\n return;\n}",
1101 "render" : "function (_self)\n{\n _this.showgstBtn = _self;\n}"
1103 "text" : "Prices with GST",
1104 "enableToggle" : true,
1107 "$ xns" : "Roo.Toolbar"
1113 "|beforeload" : "function (_self,o) {\n\n try {\n this.removeAll();\n } catch (e) { }\n \n\n if (!_this.data || !_this.data.cohead_id) {\n return false;\n }\n o.params = o.params || {};\n \n o.params.coitem_cohead_id = _this.data.cohead_id;\n o.params._without_list_discount =1;\n //o.params.limit = 999;\n\n \n}",
1114 "update" : "function (_self, rec, operation)\n {\n \n if (operation != Roo.data.Record.COMMIT) {\n return;\n }\n\n // row has been updated..\n // if the qty + item has been filled in, we should try and save it..\n \n \n var setRecord = function(){\n \n Roo.log(\"Clearing update?\" + rec.data.coitem_linenumber);\n rec.updatePending = 0;\n if(rec.isInserting){\n rec.isInserting = 0;\n return;\n }\n rec.isUpdating = 0;\n\n }\n if (!(rec.data.coitem_itemsite_id * 1) || !(rec.data.coitem_qtyord*1)) {\n setRecord();\n return;\n }\n var doCommit = function() {\n Roo.log(\"Sending data?\" + rec.data.coitem_linenumber);\n \n new Pman.Request({\n url : baseURL+'/Roo/coitem',\n method : 'POST',\n params : rec.data,\n success: function(res)\n {\n try {\n var row = _this.grid.ds.indexOf(rec);\n Roo.get(_this.grid.view.getRow(row)).removeClass('dragon-not-saved');\n } catch(e) {\n Roo.log(e);\n }\n \n \n Roo.log(\"GOT success: \" + rec.data.coitem_linenumber);\n //Roo.log(\"GOT success\");\n // update the data...\n \n if (rec.data.item_type == 'K') {\n Roo.log(\"Kit??\");\n _this.grid.ds.load({});\n \n return;\n }\n \n // why is this here.??\n \n if (_this.grid.activeEditor) {\n rec.editing = true;\n \n \n } \n \n rec.set('coitem_id', res.data.coitem_id);\n rec.set('coitem_status', res.data.coitem_status);\n \n \n rec.dirty = false;\n delete rec.modified;\n try {\n _this.grid.footer.updateSummary(); \n _this.grid.loadAvail();\n } catch (e) { }\n \n\n setRecord();\n },\n failure : function(res)\n {\n setRecord();\n Roo.MessageBox.alert(\"Error\", res.errorMsg ? res.errorMsg : \"Error updating\");\n }\n \n \n });\n } ; \n \n \n doCommit();\n \n \n \n}\n \n ",
1115 "load" : "function (_self, records, options)\n{\n // need to fetch availablity from master data..\n // build a list of what to ask..\n\n // query: ITEM CODE - LOCATION\n _this.grid.footer.updateSummary();\n _this.grid.loadAvail.defer(100, _this.grid);\n\n \n \n \n}"
1118 "remoteSort" : true,
1119 "$ sortInfo" : "{ field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' }",
1120 "$ xns" : "Roo.data",
1121 "* prop" : "dataSource",
1124 "$ url" : "baseURL + '/Roo/coitem.php'",
1125 "xtype" : "HttpProxy",
1127 "$ xns" : "Roo.data",
1133 "xtype" : "JsonReader",
1134 "$ fields" : "[\n {\n 'name': 'coitem_linenumber',\n 'type': 'int'\n },\n {\n 'name': 'coitem_itemsite_id',\n 'type': 'int'\n },\n {\n 'name': 'coitem_qtyord'\n },\n {\n 'name': 'coitem_unitcost'\n },\n {\n 'name': 'coitem_price'\n },\n {\n 'name': 'coitem_custprice'\n },\n {\n 'name': 'coitem_qtyreturned'\n },\n {\n 'name': 'coitem_prcost'\n },\n {\n 'name': 'coitem_price_uom_id',\n 'type': 'int'\n },\n {\n 'name': 'coitem_qtyreserved'\n }\n]",
1135 "$ xns" : "Roo.data",
1136 "* prop" : "reader",
1137 "# builderCfg" : "{\"cols\":[{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"},{\"table\":\"coitem\",\"column\":\"coitem_itemsite_id\",\"columnshort\":\"coitem_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"itemsite_id\",\"deps\":[{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_item_id\",\"columnshort\":\"itemsite_item_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warehous_id\",\"columnshort\":\"itemsite_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_qtyonhand\",\"columnshort\":\"itemsite_qtyonhand\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_reorderlevel\",\"columnshort\":\"itemsite_reorderlevel\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordertoqty\",\"columnshort\":\"itemsite_ordertoqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cyclecountfreq\",\"columnshort\":\"itemsite_cyclecountfreq\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastcount\",\"columnshort\":\"itemsite_datelastcount\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastused\",\"columnshort\":\"itemsite_datelastused\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_loccntrl\",\"columnshort\":\"itemsite_loccntrl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_safetystock\",\"columnshort\":\"itemsite_safetystock\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_minordqty\",\"columnshort\":\"itemsite_minordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_multordqty\",\"columnshort\":\"itemsite_multordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_leadtime\",\"columnshort\":\"itemsite_leadtime\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_abcclass\",\"columnshort\":\"itemsite_abcclass\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_issuemethod\",\"columnshort\":\"itemsite_issuemethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_controlmethod\",\"columnshort\":\"itemsite_controlmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_active\",\"columnshort\":\"itemsite_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_plancode_id\",\"columnshort\":\"itemsite_plancode_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costcat_id\",\"columnshort\":\"itemsite_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_eventfence\",\"columnshort\":\"itemsite_eventfence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_sold\",\"columnshort\":\"itemsite_sold\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_stocked\",\"columnshort\":\"itemsite_stocked\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_freeze\",\"columnshort\":\"itemsite_freeze\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_id\",\"columnshort\":\"itemsite_location_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparams\",\"columnshort\":\"itemsite_useparams\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparamsmanual\",\"columnshort\":\"itemsite_useparamsmanual\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_soldranking\",\"columnshort\":\"itemsite_soldranking\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createpr\",\"columnshort\":\"itemsite_createpr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location\",\"columnshort\":\"itemsite_location\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_comments\",\"columnshort\":\"itemsite_location_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_notes\",\"columnshort\":\"itemsite_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_perishable\",\"columnshort\":\"itemsite_perishable\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_nnqoh\",\"columnshort\":\"itemsite_nnqoh\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoabcclass\",\"columnshort\":\"itemsite_autoabcclass\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup\",\"columnshort\":\"itemsite_ordergroup\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_disallowblankwip\",\"columnshort\":\"itemsite_disallowblankwip\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_maxordqty\",\"columnshort\":\"itemsite_maxordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_mps_timefence\",\"columnshort\":\"itemsite_mps_timefence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createwo\",\"columnshort\":\"itemsite_createwo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warrpurc\",\"columnshort\":\"itemsite_warrpurc\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoreg\",\"columnshort\":\"itemsite_autoreg\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costmethod\",\"columnshort\":\"itemsite_costmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_value\",\"columnshort\":\"itemsite_value\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup_first\",\"columnshort\":\"itemsite_ordergroup_first\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_supply_itemsite_id\",\"columnshort\":\"itemsite_supply_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_planning_type\",\"columnshort\":\"itemsite_planning_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_wosupply\",\"columnshort\":\"itemsite_wosupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_posupply\",\"columnshort\":\"itemsite_posupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_lsseq_id\",\"columnshort\":\"itemsite_lsseq_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cosdefault\",\"columnshort\":\"itemsite_cosdefault\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopr\",\"columnshort\":\"itemsite_createsopr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopo\",\"columnshort\":\"itemsite_createsopo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_dropship\",\"columnshort\":\"itemsite_dropship\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyord\",\"columnshort\":\"coitem_qtyord\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Qty\"},{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"},{\"table\":\"coitem\",\"column\":\"coitem_price\",\"columnshort\":\"coitem_price\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Price\"},{\"table\":\"coitem\",\"column\":\"coitem_custprice\",\"columnshort\":\"coitem_custprice\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Cust Price\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreturned\",\"columnshort\":\"coitem_qtyreturned\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#Returned\"},{\"table\":\"coitem\",\"column\":\"coitem_prcost\",\"columnshort\":\"coitem_prcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"prcost?\"},{\"table\":\"coitem\",\"column\":\"coitem_price_uom_id\",\"columnshort\":\"coitem_price_uom_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"uom_id\",\"deps\":[{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_name\",\"columnshort\":\"uom_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_descrip\",\"columnshort\":\"uom_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"uom\",\"column\":\"coitem_price_uom_id_uom_item_weight\",\"columnshort\":\"uom_item_weight\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Unit of\"},{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}],\"cols_ex\":[\"coitem_price_uom_id_uom_descrip\"],\"table\":\"coitem\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1138 "totalProperty" : "total"
1143 "xtype" : "Toolbar",
1145 "* prop" : "toolbar",
1149 "|click" : "function()\n{\n \n Roo.log(\"add presed\");\n \n // work out last \n var grid = _this.grid;\n var err = false;\n grid.ds.each(function(r) {\n if (r.data.coitem_qtyord < 1) { \n Roo.MessageBox.alert(\"Error\", \"you must fill in a quantity for \" + r.data.item_number);\n err = true;\n return true;\n }\n \n });\n if (err) {\n return;\n }\n \n\n// var last = 0;\n var last = _this.form.findField('cohead_max_linenumber').getValue(); \n last++; \n if(last == 99999){\n last++;\n }\n \n\n _this.form.findField('cohead_max_linenumber').setValue(last); \n \n // this should be getting the previous row..??\n var ct = _this.grid.ds.getCount();\n var lastrow = ct ? _this.grid.ds.getAt(ct-1) : false;\n \n function lastor(k,d,kk) {\n var def = d ? _this.form.findField(k).el.dom.value : _this.form.findField(k).getValue();\n return lastrow ? lastrow.data[kk] : def;\n }\n \n // uses form defaults or last row value.\n var nr = _this.grid.ds.reader.newRow({\n coitem_linenumber : last,\n item_number : '',\n item_descrip1 : '',\n coitem_qtyord : 0,\n coitem_cohead_id : _this.form.findField('cohead_id').getValue(),\n coitem_qtyshipped : 0,\n coitem_location_src : lastor('cohead_location_src',false, 'coitem_location_src'),\n coitem_location_src_location_name : lastor('cohead_location_src',true, 'coitem_location_src_location_name'),\n coitem_shipto_id : lastor('cohead_shipto_id',false, 'coitem_shipto_id'),\n coitem_shipto_id_shipto_name : lastor('cohead_shipto_id_shipto_name', false, 'coitem_shipto_id_shipto_name'),\n coitem_unitcost_in_order_cur : 0,\n coitem_taxtype_id : _this.data.default_taxtype_id,\n coitem_taxtype_id_taxtype_name : 'Taxable',\n coitem_status : '',\n avail_qty : 0\n \n });\n grid.stopEditing();\n grid.ds.insert(grid.ds.getCount(), nr); \n grid.startEditing(grid.ds.getCount()-1, 1); // type..\n nr.updatePending = 0;\n nr.isUpdating = 0;\n nr.isInserting =0;\n \n}\n",
1150 "render" : "function (_self)\n{\n _this.addItemBtn = _self;\n}"
1154 "cls" : "x-btn-text-icon",
1155 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1156 "$ xns" : "Roo.Toolbar"
1160 "click" : "function (_self, e)\n{\n var last = _this.form.findField('cohead_max_linenumber').getValue(); \r\n last++;\r\n _this.form.findField('cohead_max_linenumber').setValue(last); \n\n var ct = _this.grid.ds.getCount();\r\n var lastrow = ct ? _this.grid.ds.getAt(ct-1) : false;\r\n \r\n function lastor(k,d,kk) {\r\n var def = d ? _this.form.findField(k).el.dom.value : _this.form.findField(k).getValue();\r\n return lastrow ? lastrow.data[kk] : def;\r\n }\n \n var cohead_cust_id = _this.form.findField('cohead_cust_id').getValue();\n var cohead_id = _this.form.findField('cohead_id').getValue();\n \n Pman.Dialog.XtupleSalesProductList.show( {cohead_cust_id : cohead_cust_id, cohead_id : cohead_id} , function(res) {\n\n _this.grid.stopEditing();\n\n if (_this.grid.ds.getCount() > 0) {\n var lr = _this.grid.ds.getAt(_this.grid.ds.getCount()-1);\n if (!lr.data.coitem_itemsite_id) {\n lr.set('coitem_itemsite_id', res.item_itemsite_id_itemsite_id);\n lr.set('item_number', res.item_number);\n lr.set('item_descrip1', res.item_descrip1); \n lr.set('coitem_listprice', res.item_price); \n lr.set('coitem_price', res.item_price); \n lr.set('coitem_custprice', res.item_price); \n return;\n }\n }\n \n \n \n var nr = _this.grid.ds.reader.newRow({\n coitem_linenumber : last,\n coitem_itemsite_id : res.item_itemsite_id_itemsite_id,\n item_number : res.item_number,\n item_descrip1 : res.item_descrip1,\n coitem_qtyord : 0,\n coitem_cohead_id : _this.form.findField('cohead_id').getValue(),\n coitem_qtyshipped : 0,\n coitem_listprice : res.item_price,\n coitem_price : res.item_price,\n coitem_custprice : res.item_price,\n avail_qty : 0,\n coitem_location_src : lastor('cohead_location_src',false, 'coitem_location_src'),\n coitem_location_src_location_name : lastor('cohead_location_src',true, 'coitem_location_src_location_name'),\n coitem_shipto_id : lastor('cohead_shipto_id',false, 'coitem_shipto_id'),\n coitem_shipto_id_shipto_name : lastor('cohead_shipto_id_shipto_name', false, 'coitem_shipto_id_shipto_name')\n \n });\n _this.grid.ds.insert(_this.grid.ds.getCount(), nr); \n\n }); \n}"
1162 "text" : "Find Products",
1164 "cls" : "x-btn-text-icon",
1165 "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
1166 "$ xns" : "Roo.Toolbar"
1170 "|click" : "function()\n{\n // work out last \n new Pman.Request({\n url : baseURL + '/Roo/coitem',\n mask : 'Loading Data',\n method: 'GET',\n params : {\n\n _hk_xfer :_this.form.findField('cohead_id').getValue()\n },\n success : function() {\n _this.grid.ds.load({});\n }\n \n });\n}\n",
1171 "render" : "function (_self)\n{\n _this.xferAll = _self;\n}"
1173 "text" : "Xfer all stock to HK",
1176 "cls" : "x-btn-text-icon",
1177 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1178 "$ xns" : "Roo.Toolbar"
1182 "click" : "function (_self, e)\n{\n var c = _this.grid.getSelectionModel().getSelectedCell();\n if (!c) {\n Roo.MessageBox.alert(\"Error\", \"Select item to show history (you can also double click on the #avail number) \");\n return;\n }\n \n var rec = _this.grid.ds.getAt(c[0]);\n\n Pman.Dialog.XtupleInvHistory.show({\n itemsite_item_id_item_number : rec.data.item_number,\n // itemsite_item_id_item_descript1 : rec.data.item_descrip1,\n location_name : rec.data.coitem_location_src_location_name,\n location_descrip : rec.data.coitem_location_src_location_descrip,\n \n \n invhist_transdate : _this.form.findField('cohead_targetdate').getValue() \n }); \n \n \n}"
1184 "text" : "Show Inventory History",
1186 "$ xns" : "Roo.Toolbar"
1189 "xtype" : "Separator",
1190 "$ xns" : "Roo.Toolbar"
1193 "text" : "Apply % Discount of : ",
1194 "xtype" : "TextItem",
1195 "$ xns" : "Roo.Toolbar"
1199 "render" : "function (_self)\n{\n _this._applyDiscount = _self;\n}"
1201 "xtype" : "TextField",
1202 "$ xns" : "Roo.form",
1207 "click" : "function (_self, e)\n{\n var val = parseFloat(_this._applyDiscount.getValue());\n \n var factor = (100.0 - val)/100.0;\n \n _this.grid.ds.each(function(rec) {\n if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {\n return;\n }\n \n rec.set('coitem_price', rec.data.coitem_custprice * factor);\n rec.set('coitem_linedisc', val);\n rec.set('coitem_subtotal', rec.data.coitem_price & rec.data.ordqty);\n rec.commit();\n \n });\n \n \n}"
1209 "text" : "Apply To All",
1211 "$ xns" : "Roo.Toolbar"
1215 "click" : "function (_self, e)\n{\n\n if (!(1* _this.form.findField('cohead_id').getValue())) {\n Roo.MessageBox.alert(\"Error\", \"save the order first\");\n }\n \n\n Pman.Dialog.Image.show(\n {\n timeout : 60000,\n _url : baseURL+'/Xtuple/Import/SalesOrder',\n onid : _this.form.findField('cohead_id').getValue()\n \n },\n function (data) {\n\n Roo.MessageBox.alert(\"Notice\", \"Uploaded\");\n _this.grid.footer.onClick('first');\n\n }\n );\n}"
1219 "$ xns" : "Roo.Toolbar"
1223 "$ xns" : "Roo.Toolbar"
1227 "|click" : "function()\n{\n _this.grid.stopEditing();\n // check that no shipments or invoices are done..\n var rc = _this.grid.getSelectionModel().getSelectedCell();\n \n var rec = _this.grid.ds.getAt(rc[0]);\n \n if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {\n Roo.MessageBox.alert(\"Error\", \"That item has been shipped or invoices - void the shipments/invoices first\");\n return;\n }\n if (rec.data.coitem_subnumber*1 > 0) {\n Roo.MessageBox.alert(\"Error\", \"Delete the kit item that that belongs to.\");\n return;\n }\n if (!rec.data.coitem_id) {\n _this.grid.ds.remove(rec);\n return;\n }\n function remove()\n {\n \n new Pman.Request({\n url : baseURL + '/Roo/coitem',\n method : 'POST',\n params : {\n _delete : rec.data.coitem_id\n \n },\n success : function() {\n if (rec.data.item_type == 'K') {\n _this.grid.ds.load({});\n return;\n }\n _this.grid.ds.remove(rec);\n }\n \n });\n }\n if (rec.data_qtyord * 1 < 1) {\n remove();\n }\n \n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that line?\", function(r)\n {\n if (r != 'yes') {\n return;\n }\n remove();\n \n });\n\n \n \n}\n "
1231 "cls" : "x-btn-text-icon",
1232 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
1233 "$ xns" : "Roo.Toolbar"
1237 "|click" : "function()\n{\n _this.grid.stopEditing();\n // check that no shipments or invoices are done..\n var ids = [];\n _this.grid.ds.each(function(rec) {\n \n\n \n if (rec.data.coitem_qtyshipped > 0 || rec.data.cobill_billed > 0) {\n //Roo.MessageBox.alert(\"Error\", \"That item has been shipped or invoices - void the shipments/invoices first\");\n return;\n }\n if (rec.data.item_type == 'K') {\n return;\n }\n\n if (rec.data.coitem_subnumber*1 > 0) {\n //Roo.MessageBox.alert(\"Error\", \"Delete the kit item that that belongs to.\");\n return;\n }\n if (!rec.data.coitem_id) {\n _this.grid.ds.remove(rec);\n return;\n }\n ids.push(rec.data.coitem_id);\n });\n function remove()\n {\n \n new Pman.Request({\n url : baseURL + '/Roo/coitem',\n method : 'POST',\n params : {\n _delete : ids.join(',')\n \n },\n success : function() {\n\n _this.grid.footer.onClick('first');\n }\n \n });\n }\n// if (rec.data_qtyord * 1 < 1) {\n// remove();\n// }\n \n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete everything?\", function(r)\n {\n if (r != 'yes') {\n return;\n }\n remove();\n \n });\n\n \n \n}\n "
1239 "text" : "Delete All",
1241 "cls" : "x-btn-text-icon",
1242 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
1243 "$ xns" : "Roo.Toolbar"
1248 "xtype" : "ColumnModel",
1251 "$ renderer" : "function(v,x,r) {\n\n if (r.data.coitem_subnumber * 1 > 0) {\n return String.format('{0}.{1}', v,r.data.coitem_subnumber);\n }\n return String.format('{0}', v);\n }",
1252 "$ xns" : "Roo.grid",
1253 "* prop" : "colModel[]",
1254 "dataIndex" : "coitem_linenumber",
1255 "# builderCfg" : "{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"}"
1258 "xtype" : "ColumnModel",
1259 "header" : "Item Code",
1261 "$ renderer" : "function(v) { return String.format('{0}', v); }",
1262 "$ xns" : "Roo.grid",
1263 "* prop" : "colModel[]",
1264 "dataIndex" : "item_number",
1267 "xtype" : "GridEditor",
1268 "$ xns" : "Roo.grid",
1269 "* prop" : "editor",
1273 "beforeselect" : "function (combo, record, index)\n{\n // set _this.data values ..\n var ar = _this.grid.activeEditor.record;\n// Roo.log('beforeselect');\n \n \n (function() { \n // Roo.log('beforeselect-cb');\n ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);\n ar.set('coitem_listprice', record.data.item_listprice);\n ar.set('coitem_price', record.data.item_price);\n ar.set('coitem_custprice', record.data.item_price);\n ar.set('coitem_itemsite_id', record.data.itemsite_id);\n ar.set('item_number', record.data.itemsite_item_id_item_number);\n ar.set('item_type', record.data.itemsite_item_id_item_type);\n ar.set('avail_qty', 0);\n ar.commit();\n }).defer(100);\n \n}"
1276 "triggerAction" : "all",
1277 "forceSelection" : true,
1278 "selectOnFocus" : true,
1280 "displayField" : "itemsite_item_id_item_number",
1281 "emptyText" : "Select item",
1282 "hiddenName" : "itemsite_item_id_item_number",
1284 "valueField" : "item_number",
1285 "xtype" : "ComboBox",
1286 "allowBlank" : false,
1287 "typeAhead" : false,
1289 "$ xns" : "Roo.form",
1291 "name" : "item_number",
1292 "qtip" : "Select item",
1293 "queryParam" : "query[number]",
1294 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> ${item_price:toFixed(2)}- {itemsite_item_id_item_descrip1} </div>",
1295 "loadingText" : "Searching...",
1299 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n o.params.customer_id = _this.form.findField('cohead_cust_id').getValue();\n o.params['query[cohead_id]'] = _this.form.findField('cohead_id').getValue();\n //o.params.shipto_cust_id = _this.data.cohead_cust_id;\n // set more here\n}\n"
1302 "remoteSort" : true,
1303 "$ sortInfo" : "{ direction : 'ASC', field: 'item_number' }",
1304 "$ xns" : "Roo.data",
1308 "$ url" : "baseURL + '/Roo/itemsite.php'",
1309 "xtype" : "HttpProxy",
1311 "$ xns" : "Roo.data",
1317 "xtype" : "JsonReader",
1318 "$ fields" : "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]",
1319 "$ xns" : "Roo.data",
1320 "* prop" : "reader",
1321 "totalProperty" : "total"
1332 "xtype" : "ColumnModel",
1335 "$ renderer" : "function(v,x,r) { \n return String.format('{0}', r.data.coitem_location_src_location_name); \n}",
1336 "$ xns" : "Roo.grid",
1337 "* prop" : "colModel[]",
1338 "dataIndex" : "coitem_location_src",
1341 "xtype" : "GridEditor",
1342 "$ xns" : "Roo.grid",
1343 "* prop" : "editor",
1347 "beforeselect" : "function (combo, record, index)\n{\n // set _this.data values ..\n var ar = _this.grid.activeEditor.record;\n \n \n \n //Roo.log('beforeselect');\n \n /*\n (function() { \n // Roo.log('beforeselect-cb');\n ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);\n ar.set('coitem_price', record.data.item_listprice);\n ar.set('coitem_custprice', record.data.item_price);\n ar.set('coitem_itemsite_id', record.data.itemsite_id);\n ar.set('item_number', record.data.itemsite_item_id_item_number);\n\n ar.commit();\n }).defer(100);\n */\n}"
1349 "alwaysQuery" : true,
1351 "triggerAction" : "all",
1352 "forceSelection" : true,
1353 "selectOnFocus" : true,
1355 "displayField" : "location_name",
1356 "emptyText" : "Select location",
1357 "hiddenName" : "coitem_location_src",
1359 "valueField" : "location_id",
1360 "xtype" : "ComboBox",
1361 "allowBlank" : false,
1362 "typeAhead" : false,
1364 "$ xns" : "Roo.form",
1366 "name" : "coitem_location_src_location_name",
1367 "qtip" : "Select item",
1368 "queryParam" : "query[location_name]",
1369 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b> {location_name}</b> {location_descrip}</div>",
1370 "loadingText" : "Searching...",
1374 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n \n var row = _this.grid.activeEditor.record;\n \n o.params['query[item_itemsite_id]'] = row.data.coitem_itemsite_id;\n // need to know the date to calc the est. delivery time..\n //o.params['query[avail_when]'] = _this.form.findField('cohead_targetdate').getValue().format('Y-m-d');\n //o.params.location_netable = 1;\n o.params['query[cohead_id]'] = _this.form.findField('cohead_id').getValue(); \n \n o.params.location_restrict = 0;\n o.params._notinternalcompany = 1;\n \n // _this.grid;\n\n// o.params.itemsite_id = _this.form.findField('cohead_cust_id').getValue();\n //o.params.shipto_cust_id = _this.data.cohead_cust_id;\n // set more here\n}\n"
1377 "remoteSort" : true,
1378 "$ sortInfo" : "{ direction : 'ASC', field: 'location_name' }",
1379 "$ xns" : "Roo.data",
1383 "$ url" : "baseURL + '/Roo/location.php'",
1384 "xtype" : "HttpProxy",
1386 "$ xns" : "Roo.data",
1392 "xtype" : "JsonReader",
1393 "$ fields" : "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
1394 "$ xns" : "Roo.data",
1395 "* prop" : "reader",
1396 "totalProperty" : "total"
1407 "xtype" : "ColumnModel",
1410 "$ renderer" : "function(v,x,r) { \n return String.format('{0}:{1}', v, r.data.coitem_shipto_id_shipto_name); \n}",
1411 "$ xns" : "Roo.grid",
1412 "* prop" : "colModel[]",
1413 "dataIndex" : "coitem_shipto_id",
1416 "xtype" : "GridEditor",
1417 "$ xns" : "Roo.grid",
1418 "* prop" : "editor",
1422 "add" : "function (combo)\n{\n\n Pman.Dialog.XtupleCustomer.show({ cust_id : _this.form.findField('cohead_cust_id').getValue() }, function(data) {\n // refresh the data in the pulldown..\n }); \n}",
1423 "beforeselect" : "function (combo, record, index)\n{\n\n var v = [];\n for(var i = 1; i <4; i++) {\n _this.data['cohead_shiptoaddress'+ i] = record.data['cntct_addr_id_addr_line'+i];\n }\n _this.form.findField('shipto_address').update();\n \n \n}"
1425 "alwaysQuery" : true,
1427 "triggerAction" : "all",
1428 "forceSelection" : true,
1429 "selectOnFocus" : true,
1431 "displayField" : "shipto_name",
1432 "emptyText" : "Select cntct",
1433 "hiddenName" : "cohead_shipto_id",
1435 "valueField" : "shipto_id",
1436 "xtype" : "ComboBox",
1437 "allowBlank" : false,
1438 "typeAhead" : false,
1441 "$ xns" : "Roo.form",
1443 "name" : "coitem_shipto_id_shipto_name",
1444 "qtip" : "Select shipto",
1445 "queryParam" : "query[shipto_name]",
1446 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{shipto_id}:{shipto_addr_id_addr_name}</b> </div>",
1447 "loadingText" : "Searching...",
1451 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n o.params.shipto_cust_id = _this.data.cohead_cust_id; \n //o.params['query[with_shipinfo]'] = 1;\n // set more here\n}\n"
1454 "remoteSort" : true,
1455 "$ sortInfo" : "{ direction : 'ASC', field: 'shipto_name' }",
1456 "$ xns" : "Roo.data",
1460 "$ url" : "baseURL + '/Roo/shiptoinfo.php'",
1461 "xtype" : "HttpProxy",
1463 "$ xns" : "Roo.data",
1469 "xtype" : "JsonReader",
1470 "$ fields" : "[{\"name\":\"cntct_id\",\"type\":\"int\"},\"cntct_name\"]",
1471 "$ xns" : "Roo.data",
1472 "* prop" : "reader",
1473 "totalProperty" : "total"
1484 "xtype" : "ColumnModel",
1485 "header" : "Item Description",
1487 "$ renderer" : "function(v,x,r) { \n\n if (r.data.coitem_memo && r.data.coitem_memo.length) {\n return String.format('{0}', r.data.coitem_memo);\n if (r.data.coitem_memo != v) {\n r.set('item_descrip1', r.data.coitem_memo);\n }\n \n }\n if (v && v.length > 49) {\n return String.format('<span style=\"color:orange\" qtip=\"line may be too long to print\">{0}</span>', v);\n }\n \n return String.format('{0}', v); \n \n}",
1488 "$ xns" : "Roo.grid",
1489 "* prop" : "colModel[]",
1490 "dataIndex" : "item_descrip1",
1491 "# builderCfg" : "{\"table\":\"coitem\",\"column\":\"coitem_itemsite_id\",\"columnshort\":\"coitem_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"itemsite_id\",\"deps\":[{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_item_id\",\"columnshort\":\"itemsite_item_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warehous_id\",\"columnshort\":\"itemsite_warehous_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_qtyonhand\",\"columnshort\":\"itemsite_qtyonhand\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_reorderlevel\",\"columnshort\":\"itemsite_reorderlevel\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordertoqty\",\"columnshort\":\"itemsite_ordertoqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cyclecountfreq\",\"columnshort\":\"itemsite_cyclecountfreq\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastcount\",\"columnshort\":\"itemsite_datelastcount\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_datelastused\",\"columnshort\":\"itemsite_datelastused\",\"ctype\":\"date\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_loccntrl\",\"columnshort\":\"itemsite_loccntrl\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_safetystock\",\"columnshort\":\"itemsite_safetystock\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_minordqty\",\"columnshort\":\"itemsite_minordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_multordqty\",\"columnshort\":\"itemsite_multordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_leadtime\",\"columnshort\":\"itemsite_leadtime\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_abcclass\",\"columnshort\":\"itemsite_abcclass\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_issuemethod\",\"columnshort\":\"itemsite_issuemethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_controlmethod\",\"columnshort\":\"itemsite_controlmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_active\",\"columnshort\":\"itemsite_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_plancode_id\",\"columnshort\":\"itemsite_plancode_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costcat_id\",\"columnshort\":\"itemsite_costcat_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_eventfence\",\"columnshort\":\"itemsite_eventfence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_sold\",\"columnshort\":\"itemsite_sold\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_stocked\",\"columnshort\":\"itemsite_stocked\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_freeze\",\"columnshort\":\"itemsite_freeze\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_id\",\"columnshort\":\"itemsite_location_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparams\",\"columnshort\":\"itemsite_useparams\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_useparamsmanual\",\"columnshort\":\"itemsite_useparamsmanual\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_soldranking\",\"columnshort\":\"itemsite_soldranking\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createpr\",\"columnshort\":\"itemsite_createpr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location\",\"columnshort\":\"itemsite_location\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_location_comments\",\"columnshort\":\"itemsite_location_comments\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_notes\",\"columnshort\":\"itemsite_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_perishable\",\"columnshort\":\"itemsite_perishable\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_nnqoh\",\"columnshort\":\"itemsite_nnqoh\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoabcclass\",\"columnshort\":\"itemsite_autoabcclass\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup\",\"columnshort\":\"itemsite_ordergroup\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_disallowblankwip\",\"columnshort\":\"itemsite_disallowblankwip\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_maxordqty\",\"columnshort\":\"itemsite_maxordqty\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_mps_timefence\",\"columnshort\":\"itemsite_mps_timefence\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createwo\",\"columnshort\":\"itemsite_createwo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_warrpurc\",\"columnshort\":\"itemsite_warrpurc\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_autoreg\",\"columnshort\":\"itemsite_autoreg\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_costmethod\",\"columnshort\":\"itemsite_costmethod\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_value\",\"columnshort\":\"itemsite_value\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_ordergroup_first\",\"columnshort\":\"itemsite_ordergroup_first\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_supply_itemsite_id\",\"columnshort\":\"itemsite_supply_itemsite_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_planning_type\",\"columnshort\":\"itemsite_planning_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_wosupply\",\"columnshort\":\"itemsite_wosupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_posupply\",\"columnshort\":\"itemsite_posupply\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_lsseq_id\",\"columnshort\":\"itemsite_lsseq_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_cosdefault\",\"columnshort\":\"itemsite_cosdefault\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopr\",\"columnshort\":\"itemsite_createsopr\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_createsopo\",\"columnshort\":\"itemsite_createsopo\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"itemsite\",\"column\":\"coitem_itemsite_id_itemsite_dropship\",\"columnshort\":\"itemsite_dropship\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
1494 "xtype" : "GridEditor",
1495 "$ xns" : "Roo.grid",
1496 "* prop" : "editor",
1499 "xtype" : "TextField",
1500 "allowBlank" : false,
1501 "$ xns" : "Roo.form",
1510 "xtype" : "ColumnModel",
1511 "header" : "Status",
1513 "$ renderer" : "function(v) { return String.format('{0}', v); }",
1514 "$ xns" : "Roo.grid",
1515 "* prop" : "colModel[]",
1516 "# builderCfg" : "{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}",
1517 "dataIndex" : "coitem_status"
1521 "xtype" : "ColumnModel",
1524 "$ renderer" : "function(v,x,r) { \n var v = parseInt(v);\n //var aq = parseInt(r.data.avail_qty);\n //aq = isNaN(aq) ? 0 : aq;\n \n var rate = _this.form.findField('taxzone_rate').getValue();\n r.data.coitem_subtotal = v * r.data.coitem_price;\n r.data.coitem_subtotal_tax = v * r.data.coitem_price * ( 1 + rate * 1);\n return String.format('{0}', v); \n \n}",
1525 "$ xns" : "Roo.grid",
1526 "* prop" : "colModel[]",
1527 "dataIndex" : "coitem_qtyord",
1530 "xtype" : "GridEditor",
1531 "$ xns" : "Roo.grid",
1532 "* prop" : "editor",
1536 "focus" : "function (_self)\n{\n if (this.value == 0) {\n this.el.dom.value = '';\n }\n}"
1539 "style" : "text-align:right",
1540 "xtype" : "NumberField",
1541 "allowDecimals" : false,
1542 "decimalPrecision" : 0,
1543 "$ xns" : "Roo.form",
1552 "xtype" : "ColumnModel",
1553 "header" : "Sell @",
1555 "$ renderer" : "function(v,x,r) { \n\n var rate = _this.form.findField('taxzone_rate').getValue();\n r.data.coitem_subtotal = v * r.data.coitem_qtyord;\n r.data.coitem_subtotal_tax = v * ( 1 + rate * 1 ) * r.data.coitem_qtyord;\n r.data.coitem_price_tax = v * ( 1 + rate * 1 );\n if (parseInt(v) < 1) {\n return String.format('<b style=\"color:red;\">{0}</b>', Roo.util.Format.number(v,3)); \n }\n \n \n //r.set('coitem_subtotal', v * r.data.coitem_qtyord);\n \n return String.format('{0}', Roo.util.Format.number(v,3)); \n}",
1556 "$ xns" : "Roo.grid",
1557 "* prop" : "colModel[]",
1558 "dataIndex" : "coitem_price",
1561 "xtype" : "GridEditor",
1562 "$ xns" : "Roo.grid",
1563 "* prop" : "editor",
1567 "focus" : "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1570 "style" : "text-align:right",
1571 "xtype" : "NumberField",
1572 "decimalPrecision" : 3,
1573 "$ xns" : "Roo.form",
1583 "xtype" : "ColumnModel",
1584 "header" : "Sell @w/GST",
1586 "$ renderer" : "function(v,x,r) { \n \n if (parseInt(v) < 1) {\n return String.format('<b style=\"color:red;\">{0}</b>', Roo.util.Format.number(v,3)); \n }\n \n return String.format('{0}', Roo.util.Format.number(v,3)); \n}",
1587 "$ xns" : "Roo.grid",
1588 "* prop" : "colModel[]",
1589 "dataIndex" : "coitem_price_tax",
1592 "xtype" : "GridEditor",
1593 "$ xns" : "Roo.grid",
1594 "* prop" : "editor",
1598 "focus" : "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1601 "style" : "text-align:right",
1602 "xtype" : "NumberField",
1603 "decimalPrecision" : 3,
1604 "$ xns" : "Roo.form",
1613 "xtype" : "ColumnModel",
1616 "$ renderer" : "function(v,x,r) { \n\n // coitem_custprice = coitem_price * ((100 - coitem_disc)/ 100) \n \n // 12 * (( 100 - 0) / 100)\n // coitem_custprice / coitem_price = ((100 - coitem_disc)/ 100) \n // 100 - ((coitem_custprice / coitem_price) * 100) = coitem_disc\n // 100 - 97 = 100 -3 \n\n // r.data.coitem_linedisc = 100 - (\n // (parseFloat(r.data.coitem_custprice) /\n // parseFloat(r.data.coitem_price)\n // ) * 100.00);\n var fl = parseFloat(r.data.coitem_linedisc);\n if ( isNaN(fl) || fl == 0.0 || r.data.coitem_price > r.data.coitem_custprice) {\n return '';\n }\n return String.format('<span style=\"color:green\">{0}%</span>', Roo.util.Format.number( r.data.coitem_linedisc,2)); \n}",
1617 "$ xns" : "Roo.grid",
1618 "* prop" : "colModel[]",
1619 "dataIndex" : "coitem_linedisc",
1622 "xtype" : "GridEditor",
1623 "$ xns" : "Roo.grid",
1624 "* prop" : "editor",
1628 "focus" : "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1631 "style" : "text-align:right",
1632 "xtype" : "NumberField",
1633 "decimalPrecision" : 2,
1634 "$ xns" : "Roo.form",
1644 "xtype" : "ColumnModel",
1645 "header" : "List Price",
1647 "$ renderer" : "function(v,x,r) { \n \n var rate = _this.form.findField('taxzone_rate').getValue();\n r.data.coitem_custprice_tax = v * ( 1 + rate * 1 );\n \n var tip = 'No WRP available';\n if ((r.data.coitem_wrpprice * 1) > 0) {\n tip = \"WRP : \" + Roo.util.Format.number(r.data.coitem_wrpprice,3);\n }\n // less than zero, show as red..\n if (parseFloat(v) < 1) {\n return String.format('<b qtip=\"{1}\" style=\"color:red;\">{0}</b>', \n Roo.util.Format.number(v,3), tip); \n }\n if (r.data.customer_price_each != v) {\n return String.format('<b qtip=\"{1}\" style=\"color:pink;\">{0}</b>', \n Roo.util.Format.number(v,3), \n \"List Price = \" + Roo.util.Format.number(r.data.customer_price_each,3)\n ); \n }\n \n \n \n //r.data.coitem_subtotal = v * r.data.coitem_qtyord;\n \n //r.set('coitem_subtotal', v * r.data.coitem_qtyord);\n \n return String.format('<span qtip=\"{1}\">{0}</span>', Roo.util.Format.number(v,3), tip); \n}",
1648 "$ xns" : "Roo.grid",
1649 "* prop" : "colModel[]",
1650 "dataIndex" : "coitem_custprice",
1653 "xtype" : "GridEditor",
1654 "$ xns" : "Roo.grid",
1655 "* prop" : "editor",
1659 "focus" : "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1662 "style" : "text-align:right",
1663 "xtype" : "NumberField",
1664 "decimalPrecision" : 3,
1665 "$ xns" : "Roo.form",
1675 "xtype" : "ColumnModel",
1676 "header" : "List Price w/GST",
1678 "$ renderer" : "function(v,x,r) { \n var rate = _this.form.findField('taxzone_rate').getValue();\n var tip = 'No WRP available';\n if ((r.data.coitem_wrpprice * 1) > 0) {\n tip = \"WRP : \" + Roo.util.Format.number(r.data.coitem_wrpprice,3);\n }\n \n if (parseFloat(v) < 1) {\n return String.format('<b qtip=\"{1}\" style=\"color:red;\">{0}</b>', \n Roo.util.Format.number(v,3), tip); \n }\n if (r.data.customer_price_each != v) {\n return String.format('<b qtip=\"{1}\" style=\"color:pink;\">{0}</b>', \n Roo.util.Format.number(v,3), \n \"List Price = \" + Roo.util.Format.number(r.data.customer_price_each * ( 1 + rate * 1 ),3)\n ); \n }\n \n return String.format('<span qtip=\"{1}\">{0}</span>', Roo.util.Format.number(v,3), tip); \n}",
1679 "$ xns" : "Roo.grid",
1680 "* prop" : "colModel[]",
1681 "dataIndex" : "coitem_custprice_tax",
1684 "xtype" : "GridEditor",
1685 "$ xns" : "Roo.grid",
1686 "* prop" : "editor",
1690 "focus" : "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1693 "style" : "text-align:right",
1694 "xtype" : "NumberField",
1695 "decimalPrecision" : 3,
1696 "$ xns" : "Roo.form",
1705 "xtype" : "ColumnModel",
1706 "header" : "SubTotal",
1708 "$ renderer" : "function(v) {\n\n if (parseInt(v) < 1) {\n return String.format('<b style=\"color:red;\">{0}</b>', Roo.util.Format.number(v,2)); \n }\n\n \n\n return Roo.util.Format.number( v, 2);\n }",
1709 "$ xns" : "Roo.grid",
1710 "* prop" : "colModel[]",
1711 "dataIndex" : "coitem_subtotal"
1716 "xtype" : "ColumnModel",
1717 "header" : "SubTotal w/GST",
1719 "$ renderer" : "function(v,x,r) { \n \n if (parseInt(v) < 1) {\n return String.format('<b style=\"color:red;\">{0}</b>', Roo.util.Format.number(v,2)); \n }\n \n return String.format('{0}', Roo.util.Format.number(v,2)); \n}",
1720 "$ xns" : "Roo.grid",
1721 "* prop" : "colModel[]",
1722 "dataIndex" : "coitem_subtotal_tax"
1726 "xtype" : "ColumnModel",
1727 "header" : "Unit Cost",
1729 "$ renderer" : "function(v) { return Roo.util.Format.number( v, 2); }",
1730 "$ xns" : "Roo.grid",
1731 "* prop" : "colModel[]",
1732 "# builderCfg" : "{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}",
1733 "dataIndex" : "coitem_unitcost_in_order_cur"
1737 "xtype" : "ColumnModel",
1740 "$ renderer" : "function(v,x,r) { return String.format('{0}', r.data.coitem_taxtype_id_taxtype_name); }",
1741 "$ xns" : "Roo.grid",
1742 "* prop" : "colModel[]",
1743 "dataIndex" : "coitem_taxtype_id",
1746 "xtype" : "GridEditor",
1747 "$ xns" : "Roo.grid",
1748 "* prop" : "editor",
1752 "triggerAction" : "all",
1753 "forceSelection" : true,
1754 "selectOnFocus" : true,
1756 "displayField" : "taxtype_name",
1757 "emptyText" : "Select Tax Type",
1758 "hiddenName" : "coitem_taxtype_id",
1760 "valueField" : "taxtype_id",
1761 "xtype" : "ComboBox",
1762 "allowBlank" : false,
1766 "$ xns" : "Roo.form",
1768 "name" : "coitem_taxtype_id_taxtype_name",
1769 "qtip" : "Select taxtype",
1770 "queryParam" : "query[taxtype_id]",
1771 "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{taxtype_name}</b> </div>",
1772 "loadingText" : "Searching...",
1776 "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n \n \n}\n"
1779 "remoteSort" : true,
1780 "$ sortInfo" : "{ direction : 'ASC', field: 'taxtype_name' }",
1781 "$ xns" : "Roo.data",
1785 "$ url" : "baseURL + '/Roo/taxtype.php'",
1786 "xtype" : "HttpProxy",
1788 "$ xns" : "Roo.data",
1792 "id" : "taxtype_id",
1794 "xtype" : "JsonReader",
1795 "$ fields" : "[{\"name\":\"taxtype_id\",\"type\":\"int\"},\"taxtype_name\"]",
1796 "$ xns" : "Roo.data",
1797 "* prop" : "reader",
1798 "totalProperty" : "total"
1810 "xtype" : "ColumnModel",
1811 "header" : "#avail",
1813 "$ renderer" : "function(v,x,r) { \n\n var oq = parseInt(r.data.coitem_qtyord);\n var aq = parseInt(r.data.avail_qty);\n var sq = parseInt(r.data.coitem_qtyshipped);\n aq = isNaN(aq) ? 0 : aq;\n oq = isNaN(oq) ? 0 : oq;\n sq = isNaN(sq) ? 0 : sq;\n \n var unshipped = oq - sq;\n \n if ( aq < 0 || (unshipped > 0 && aq < unshipped)) {\n return String.format('<b style=\"color:red;\">{0}</b>', parseInt(aq));\n }\n \n return String.format('{0}', aq); \n \n}",
1814 "$ xns" : "Roo.grid",
1815 "* prop" : "colModel[]",
1816 "dataIndex" : "avail_qty"
1820 "xtype" : "ColumnModel",
1821 "header" : "#reserved",
1823 "$ renderer" : "function(v,x,r) { \n\n \n var vv = parseInt(v);\n vv = isNaN(vv) ? 0 : vv;\n \n var ov = parseInt(r.data.coitem_qtyord);\n ov = isNaN(ov) ? 0 : ov;\n \n var qs = parseInt(r.data.coitem_qtyshipped);\n qs = isNaN(qs) ? 0 : qs;\n \n \n \n if (vv < ov) {\n // not enough reserved yet.\n return String.format('<b style=\"background-color:red;color:yellow\">{0}</b>', vv - qs);\n }\n \n return String.format('{0}', vv - qs); \n \n}",
1824 "$ xns" : "Roo.grid",
1825 "* prop" : "colModel[]",
1826 "# builderCfg" : "{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}",
1827 "dataIndex" : "shipitem_shipped"
1831 "xtype" : "ColumnModel",
1832 "header" : "#shipped",
1834 "$ renderer" : "function(v,x,r) { \n \n var vv = parseInt(v);\n vv = isNaN(vv) ? 0 : vv;\n \n var ov = parseInt(r.data.coitem_qtyord);\n ov = isNaN(ov) ? 0 : ov;\n \n\n if (vv != ov) {\n // not enought shipped.\n // or too many shipped.\n return String.format('<b style=\"background-color:red;color:yellow\">{0}</b>', vv);\n }\n\n \n \n return String.format('{0}', vv); \n \n}",
1835 "$ xns" : "Roo.grid",
1836 "* prop" : "colModel[]",
1837 "# builderCfg" : "{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}",
1838 "dataIndex" : "coitem_qtyshipped"
1842 "xtype" : "ColumnModel",
1843 "header" : "#invoiced",
1845 "$ renderer" : "function(v,x,r) { \n \n var vv = parseInt(v);\n vv = isNaN(vv) ? 0 : vv;\n \n var ov = parseInt(r.data.coitem_qtyord);\n ov = isNaN(ov) ? 0 : ov;\n \n\n if (vv !=ov) {\n return String.format('<b style=\"background-color:red;color:yellow\">{0}</b>', vv); \n }\n return String.format('{0}', vv); \n \n}",
1846 "$ xns" : "Roo.grid",
1847 "* prop" : "colModel[]",
1848 "dataIndex" : "cobill_billed"
1856 "activate" : "function (_self)\n{\n _this.shipinvtab = _self;\n}"
1858 "region" : "center",
1859 "xtype" : "NestedLayoutPanel",
1860 "title" : "Shipments / Invoices",
1864 "xtype" : "BorderLayout",
1866 "* prop" : "layout",
1869 "xtype" : "LayoutRegion",
1871 "* prop" : "center",
1875 "title" : "Reserve Stock / Shipments",
1876 "xtype" : "LayoutRegion",
1883 "|activate" : "function() {\n _this.shippanel = this;\n if (_this.shipgrid) {\n _this.shipgrid.ds.load({});\n }\n}"
1885 "background" : false,
1886 "fitToframe" : true,
1888 "title" : "shiphead",
1889 "xtype" : "GridPanel",
1890 "fitContainer" : true,
1892 "# builderCfg" : "{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1893 "tableName" : "shiphead",
1897 "rowdblclick" : "function (_self, rowIndex, e)\n{\n var rec = this.ds.getAt(rowIndex);\n if (!rec.json.shiphead_shipdate.length) {\n Roo.MessageBox.alert(\"Error\", \"You can not edit voided shipments, create a new one, and use the restore feature\");\n return;\n }\n\n Pman.Dialog.XtupleShipment.show({\n shiphead_id : rec.data.shiphead_id\n\n }, function() {\n _self.ds.load({});\n \n });\n \n}\n",
1898 "|render" : "function() \n{\n _this.shipgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.shippanel.active) {\n this.ds.load({});\n }\n}"
1900 "autoExpandColumn" : "shiphead_shipvia",
1903 "$ xns" : "Roo.grid",
1905 "# builderCfg" : "{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1908 "xtype" : "RowSelectionModel",
1909 "singleSelect" : true,
1910 "$ xns" : "Roo.grid",
1915 "beforeload" : "function (_self, options)\n{\n options.params = options.params || {};\n options.params.shiphead_order_id = _this.form.findField('cohead_id').getValue() * 1;\n if (options.params.shiphead_order_id < 1) {\n return false;\n }\n}"
1917 "remoteSort" : true,
1919 "$ sortInfo" : "{ field : 'shiphead_shipvia', direction: 'ASC' }",
1920 "$ xns" : "Roo.data",
1921 "* prop" : "dataSource",
1922 "# builderCfg" : "{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
1925 "$ url" : "baseURL + '/Roo/shiphead.php'",
1927 "xtype" : "HttpProxy",
1928 "$ xns" : "Roo.data",
1934 "xtype" : "JsonReader",
1935 "$ xns" : "Roo.data",
1936 "$ fields" : "[\n {\n 'name': 'shiphead_number',\n 'type': 'string'\n },\n {\n 'name': 'shiphead_shipvia',\n 'type': 'string'\n },\n {\n 'name': 'shiphead_shipdate',\n 'type': 'date'\n },\n {\n 'name': 'shiphead_sfstatus'\n },\n {\n 'name': 'shiphead_tracknum',\n 'type': 'string'\n }\n]",
1937 "* prop" : "reader",
1938 "totalProperty" : "total",
1939 "# builderCfg" : "{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_shipvia\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}"
1944 "xtype" : "Toolbar",
1946 "* prop" : "toolbar",
1950 "|click" : "function()\n{\n var sel = _this.shipgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a shipment\");\n return;\n }\n if (sel.data.shiphead_shipped) {\n Roo.MessageBox.alert(\"Error\", \"Shipment is already confirmed\");\n return;\n }\n \n \n // check current status of shipment..\n \n \n new Pman.Request({ \n mask : 'Sending',\n url : baseURL + '/Roo/shiphead',\n method : 'POST',\n timeout : 90000,\n params : {\n shiphead_id : sel.data.shiphead_id,\n _confirm : 1\n },\n success : function() {\n _this.shipgrid.ds.load({});\n }\n });\n \n \n}"
1952 "text" : "Confirm Shipment",
1954 "cls" : "x-btn-text-icon",
1955 "$ icon" : "rootURL + '/Pman/templates/images/lock.gif'",
1956 "$ xns" : "Roo.Toolbar"
1960 "|click" : "function()\n{\n var sel = _this.shipgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a shipment\");\n return;\n }\n\n \n // check current status of shipment..\n \n \n new Pman.Download({\n url : baseURL + '/Roo/shiphead',\n method : 'GET',\n params : {\n _download :sel.data.shiphead_id\n \n }\n });\n \n \n}"
1962 "text" : "Download (as xls)",
1964 "cls" : "x-btn-text-icon",
1965 "$ icon" : "rootURL + '/Pman/templates/images/save.gif'",
1966 "$ xns" : "Roo.Toolbar"
1970 "click" : "function ()\n{\n var sel = _this.shipgrid.getSelectionModel().getSelected();\r\n if (!sel) {\r\n Roo.MessageBox.alert(\"Error\", \"Select a shipment\");\r\n return;\r\n }\r\n // check current status of shipment..\n \n new Pman.Download({\n url : baseURL + '/Xtuple/Print',\n method : 'GET',\n params : {\n template : 'picking-slip',\n param : \"shiphead_id:integer='\" + sel.data.shiphead_id + \"'\",\n filename : 'picking-slip-' + sel.data.shiphead_number\n },\n success : function() {\n\n }\n })\n \n \n \n}"
1972 "text" : "Print Picking Slip",
1974 "cls" : "x-btn-text-icon",
1975 "$ icon" : "rootURL + '/Pman/templates/images/pdf.gif'",
1976 "$ xns" : "Roo.Toolbar"
1980 "click" : "function ()\n{\n var sel = _this.shipgrid.getSelectionModel().getSelected();\r\n if (!sel) {\r\n Roo.MessageBox.alert(\"Error\", \"Select a shipment\");\r\n return;\r\n }\r\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Xtuple/Print',\n method : 'GET',\n params : {\n template : 'delivery-note-',\n param : \"shiphead_id:integer='\" + sel.data.shiphead_id + \"'\",\n filename : 'delivery-note-' + sel.data.shiphead_number\n },\n success : function() {\n\n }\n })\n \n \n \n}"
1982 "text" : "Print Delivery Note",
1984 "cls" : "x-btn-text-icon",
1985 "$ icon" : "rootURL + '/Pman/templates/images/pdf.gif'",
1986 "$ xns" : "Roo.Toolbar"
1990 "|click" : "function()\n{\n var s = _this.shipgrid.getSelectionModel().getSelected();\n \n if(!s || s.data.shiphead_id * 1 < 1){\n Roo.MessageBox.alert('Error', 'Please select a shipment');\n return;\n }\n \n new Pman.Request({\n method: 'POST',\n url: baseURL+ '/Roo/shiphead',\n params : {\n shiphead_id : s.data.shiphead_id,\n _send_delivery : 1\n },\n success : function() {\n Roo.MessageBox.alert('Notice', 'SENT');\n }\n });\n \n}\n"
1992 "text" : "Send Delivery Email",
1994 "cls" : "x-btn-text-icon",
1995 "$ icon" : "Roo.rootURL + 'images/default/dd/email.gif'",
1996 "$ xns" : "Roo.Toolbar"
2000 "$ xns" : "Roo.Toolbar"
2004 "|click" : "function()\n{ \n if (!_this.form.findField('cohead_id').getValue()) {\n Roo.MessageBox.alert(\"Error\", \"Save Order first\");\n return;\n }\n var rv = _this.form.getFieldValues();\n \n Pman.Dialog.XtupleShipmentNew.show({\n shiphead_order_id : rv.cohead_id,\n shiphead_shipdate : _this.form.findField('cohead_targetdate').getValue().format('Y-m-d')\n },\n function() { \n _this.shipgrid.ds.load({});\n }\n );\n}",
2005 "render" : "function (_self)\n{\n _this.addShipmentBtn = _self;\n}"
2009 "cls" : "x-btn-text-icon",
2010 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2011 "$ xns" : "Roo.Toolbar"
2015 "|click" : "function()\n{\n var sel = _this.shipgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a shipment\");\n return;\n }\n // check current status of shipment..\n \n var msg = sel.data.shiphead_shipped ? \n \"Are you sure you want to un-confirm that shipment? - It will remove items from unposted invoices\" : \n \"Are you sure you want to void that shipment?\";\n \n Roo.MessageBox.confirm(\"Are you sure\", msg,\n function(r) {\n if (r != 'yes') {\n return;\n }\n new Pman.Request({\n mask : 'Sending',\n timeout : 90000,\n url : baseURL + '/Roo/shiphead',\n method : 'POST',\n \n params : {\n shiphead_id : sel.data.shiphead_id,\n _void : 1\n },\n success : function() {\n _this.shipgrid.ds.load({});\n }\n })\n \n }\n );\n \n \n \n \n \n}\n "
2017 "text" : "Void / Unconfirm",
2019 "cls" : "x-btn-text-icon",
2020 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
2021 "$ xns" : "Roo.Toolbar"
2026 "xtype" : "ColumnModel",
2027 "header" : "number",
2029 "$ renderer" : "function(v,x,r) {\n if (r.json.shiphead_shipdate.length) {\n return String.format('{0}', v); \n }\n return String.format('<s>{0}</s>', v); \n }",
2030 "$ xns" : "Roo.grid",
2031 "* prop" : "colModel[]",
2032 "dataIndex" : "shiphead_number",
2033 "# builderCfg" : "{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2036 "xtype" : "ColumnModel",
2037 "header" : "From Location",
2039 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2040 "$ xns" : "Roo.grid",
2041 "* prop" : "colModel[]",
2042 "dataIndex" : "shiphead_location_id_location_name"
2045 "xtype" : "ColumnModel",
2046 "header" : "Ship to",
2048 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2049 "$ xns" : "Roo.grid",
2050 "* prop" : "colModel[]",
2051 "dataIndex" : "shiphead_shipto_id_shipto_name"
2054 "xtype" : "ColumnModel",
2055 "header" : "shipdate",
2057 "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
2058 "$ xns" : "Roo.grid",
2059 "* prop" : "colModel[]",
2060 "# builderCfg" : "{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2061 "dataIndex" : "shiphead_shipdate"
2064 "xtype" : "ColumnModel",
2065 "header" : "Status",
2067 "$ renderer" : "function(v,x,r) { \n\n\n\n \n if (r.json.shiphead_shipdate.length) {\n \n if (r.json.shiphead_shipped) {\n return \"Confirmed\";\n }\n \n return '<span style=\"color:red\">Draft</span>';\n }\n \n return 'VOID';\n \n\n}",
2068 "$ xns" : "Roo.grid",
2069 "* prop" : "colModel[]",
2070 "dataIndex" : "shiphead_sfstatus",
2071 "# builderCfg" : "{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2074 "xtype" : "ColumnModel",
2075 "header" : "shipvia",
2077 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2078 "$ xns" : "Roo.grid",
2079 "* prop" : "colModel[]",
2080 "# builderCfg" : "{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}",
2081 "dataIndex" : "shiphead_shipvia"
2084 "xtype" : "ColumnModel",
2085 "header" : "tracknum",
2087 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2088 "$ xns" : "Roo.grid",
2089 "* prop" : "colModel[]",
2090 "# builderCfg" : "{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2091 "dataIndex" : "shiphead_tracknum"
2099 "|activate" : "function() {\n _this.invpanel = this;\n if (_this.invgrid) {\n _this.invgrid.ds.load({});\n }\n}"
2101 "fitToframe" : true,
2102 "background" : false,
2103 "region" : "center",
2104 "title" : "Invoices",
2105 "xtype" : "GridPanel",
2106 "fitContainer" : true,
2108 "tableName" : "cobmisc",
2112 "|rowdblclick" : "function (_self, rowIndex, e)\n{\n\n var ri = this.ds.getAt(rowIndex);\n if ( ri.data.cobmisc_id < 0) { // skip summary row..\n return;\n }\n var rv = _this.form.getFieldValues();\n Pman.Dialog.XtupleInvoice.show({\n cobmisc_id : ri.data.cobmisc_id,\n // below parms for add credit memo\n cmdata : {\n cm_cust_id : rv.cohead_cust_id,\n cm_cust_id_cust_name : rv.cohead_cust_id_cust_name,\n cm_curr_id : rv.cohead_curr_id,\n cm_curr_id_curr_name : rv.cohead_curr_id_curr_name,\n cm_terms_id : rv.cohead_terms_id,\n cm_terms_id_terms_descrip : rv.cohead_terms_id_terms_descrip,\n cm_salesrep_id : rv.cohead_salesrep_id,\n cm_salesrep_id_salesrep_name : rv.cohead_salesrep_id_salesrep_name,\n cm_docdate : new Date(),\n cm_taxzone_id : rv.cohead_taxzone_id,\n cm_taxzone_id_taxzone_descrip : rv.cohead_taxzone_id_taxzone_descrip,\n cm_billto_cntct_id : rv.cohead_billto_cntct_id,\n cm_billto_cntct_id_cntct_name : rv.cohead_billto_cntct_id_cntct_name,\n cm_location_src : rv.cohead_location_src,\n cm_location_src_location_name : rv.cohead_location_src_location_name,\n cm_billto_address : rv.billto_address\n }\n },\n function() { \n _this.invgrid.ds.load({});\n });\n \n}\n\n",
2113 "|render" : "function() \n{\n _this.invgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.invpanel.active) {\n this.ds.load({});\n }\n}"
2115 "autoExpandColumn" : "invchead_invcnumber",
2118 "$ xns" : "Roo.grid",
2120 "# builderCfg" : "{\"cols\":[{\"table\":\"invchead\",\"column\":\"invchead_invcnumber\",\"columnshort\":\"invchead_invcnumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"invchead_invcnumber\"],\"table\":\"invchead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
2124 "beforeload" : "function (_self, options)\n{\n\n options.params = options.params || {};\n options.params.cobmisc_cohead_id = _this.form.findField('cohead_id').getValue() * 1;\n if (options.params.cobmisc_cohead_id < 1) {\n return false;\n }\n \n options.params._with_other_payment = 1;\n //options.params['query[invchead_ordernumber]'] = _this.form.findField('cohead_number').getValue()\n \n}",
2125 "load" : "function (_self, records, options)\n{\n var total = 0;\n var done = 0;\n var totalic = 0.0;\n var totalfreight = 0.0; \n var totalmisc = 0.0; \n var totaltax = 0.0; \n \n Roo.each(records, function(r)\n {\n if(r.data.cobmisc_id > 1){\n done += parseInt(r.data.cobmisc_qty);\n totalic += parseFloat(r.data.cobmisc_itemcost).toFixed(2)*1; \n totalmisc += parseFloat(r.data.cobmisc_misc).toFixed(2)*1; \n totalfreight += parseFloat(r.data.cobmisc_freight).toFixed(2)*1; \n totaltax += parseFloat(r.data.cobmisc_tax).toFixed(2)*1; \n total = parseInt(r.data.cobmisc_total_qty);\n }\n \n });\n \n _this.shipinvtab.layout.getRegion('center').getPanel(0).setTitle(\n (total == done) ?\n \"Invoices (Complete)\" : \n (\"Invoices prepared for \" + done + '/' + total)\n );\n\n \n var frtotal = (parseFloat(_this.form.findField('cohead_freight').getValue()) - totalfreight).toFixed(2);\n var misctotal = (parseFloat(_this.form.findField('cohead_misc').getValue()) - totalmisc).toFixed(2);\n var ictotal = (parseFloat(_this.form.findField('cohead_subtotal').getValue()) - totalic).toFixed(2);\n var taxtotal = (parseFloat(_this.form.findField('cohead_tax').getValue()) - totaltax).toFixed(2);\n var remtotal = frtotal*1 + misctotal*1 + ictotal*1 + taxtotal*1;\n \n var nr = this.reader.newRow({\n cobmisc_id : -1,\n cobmisc_invchead_id_invchead_invcnumber : \"Total Remaining\",\n cobmisc_qty : total - done,\n cobmisc_freight :frtotal,\n cobmisc_misc : misctotal, \n cobmisc_itemcost : ictotal, \n cobmisc_tax : taxtotal,\n cobmisc_total : remtotal\n\n \n });\n // do we need to add it somehow??\n _this.invgrid.ds.add(nr);\n}"
2128 "remoteSort" : true,
2129 "$ sortInfo" : "{ field : 'invchead_invcnumber', direction: 'ASC' }",
2130 "$ xns" : "Roo.data",
2131 "* prop" : "dataSource",
2134 "$ url" : "baseURL + '/Roo/cobmisc.php'",
2135 "xtype" : "HttpProxy",
2137 "$ xns" : "Roo.data",
2143 "xtype" : "JsonReader",
2144 "$ fields" : "[\n {\n 'name': 'invchead_invcnumber',\n 'type': 'string'\n },\n {\n 'name': 'invchead_invcdate',\n 'type': 'date'\n }\n]",
2145 "$ xns" : "Roo.data",
2146 "* prop" : "reader",
2147 "# builderCfg" : "{\"cols\":[{\"table\":\"invchead\",\"column\":\"invchead_invcnumber\",\"columnshort\":\"invchead_invcnumber\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"invchead_invcnumber\"],\"table\":\"invchead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
2148 "totalProperty" : "total"
2153 "xtype" : "Toolbar",
2155 "* prop" : "toolbar",
2159 "|click" : "function ()\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n // check current status of shipment..\n \n Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to Post that invoice?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n new Pman.Request({\n mask : 'Sending',\n url : baseURL + '/Roo/cobmisc',\n method : 'POST',\n params : {\n cobmisc_id : sel.data.cobmisc_id,\n _post : 1\n },\n success : function() {\n _this.invgrid.ds.load({});\n }\n })\n \n }\n );\n \n \n \n}"
2161 "text" : "Post Invoice",
2163 "cls" : "x-btn-text-icon",
2164 "$ icon" : "rootURL + '/Pman/templates/images/lock.gif'",
2165 "$ xns" : "Roo.Toolbar"
2170 "cls" : "x-btn-text-icon",
2171 "$ icon" : "rootURL + '/Pman/templates/images/pdf.gif'",
2172 "$ xns" : "Roo.Toolbar",
2176 "$ xns" : "Roo.menu",
2181 "click" : "function ()\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if (!sel.data.cobmisc_invchead_id) {\n Roo.MessageBox.alert(\"Error\", \"Invoice has not been posted\");\n return;\n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/invchead',\n method : 'GET',\n params : {\n invchead_id : sel.data.cobmisc_invchead_id,\n _print : 1\n },\n success : function() {\n\n }\n })\n \n \n \n}"
2183 "text" : "Print Standard Invoice",
2185 "$ xns" : "Roo.menu"
2189 "click" : "function (_self, e)\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if (!sel.data.cobmisc_invchead_id) {\n Roo.MessageBox.alert(\"Error\", \"Invoice has not been posted\");\n return;\n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/invchead',\n method : 'GET',\n params : {\n invchead_id : sel.data.cobmisc_invchead_id,\n _print : 'cn'\n \n },\n success : function() {\n\n }\n })\n \n \n} "
2191 "$ hidden" : "!(baseURL.match(/(hk\\.php|cn\\.php)$/))",
2192 "text" : "Print Chinese Invoice With GST in line item",
2194 "$ xns" : "Roo.menu"
2198 "click" : "function (_self, e)\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if (!sel.data.cobmisc_invchead_id) {\n Roo.MessageBox.alert(\"Error\", \"Invoice has not been posted\");\n return;\n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/invchead',\n method : 'GET',\n params : {\n invchead_id : sel.data.cobmisc_invchead_id,\n _print : 'cn-gst'\n \n },\n success : function() {\n\n }\n })\n \n \n} "
2200 "$ hidden" : "!(baseURL.match(/(hk\\.php|cn\\.php)$/))",
2201 "text" : "Print Chinese Invoice",
2203 "$ xns" : "Roo.menu"
2207 "click" : "function (_self, e)\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if (!sel.data.cobmisc_invchead_id) {\n Roo.MessageBox.alert(\"Error\", \"Invoice has not been posted\");\n return;\n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/invchead',\n method : 'GET',\n params : {\n invchead_id : sel.data.cobmisc_invchead_id,\n _print : 'au-gst'\n \n },\n success : function() {\n\n }\n })\n \n \n} "
2209 "$ hidden" : "!(baseURL.match(/au\\.php$/))",
2210 "text" : "Print Aus - GST included Invoice",
2212 "$ xns" : "Roo.menu"
2216 "click" : "function (_self, e)\n{\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if (!sel.data.cobmisc_invchead_id) {\n Roo.MessageBox.alert(\"Error\", \"Invoice has not been posted\");\n return;\n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/invchead',\n method : 'GET',\n params : {\n invchead_id : sel.data.cobmisc_invchead_id,\n\n _print : 'au-net',\n ts: Math.random()\n }\n })\n\n\n}"
2218 "$ hidden" : "!(baseURL.match(/au\\.php$/))",
2219 "text" : "Print Bambini Pronto Invoice",
2221 "$ xns" : "Roo.menu"
2225 "click" : "function (_self, e)\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if (!sel.data.cobmisc_invchead_id) {\n Roo.MessageBox.alert(\"Error\", \"Invoice has not been posted\");\n return;\n }\n // check current status of shipment..\n\n new Pman.Download({\n url : baseURL + '/Roo/invchead',\n method : 'GET',\n params : {\n invchead_id : sel.data.cobmisc_invchead_id,\n _print : 'au-proforma'\n \n },\n success : function() {\n\n }\n })\n \n \n} "
2227 "$ hidden" : "!(baseURL.match(/au\\.php$/))",
2228 "text" : "Print Bambini Pro Forma Invoice",
2230 "$ xns" : "Roo.menu"
2234 "click" : "function (_self, e)\n{\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n \n Pman.Dialog.XtupleDiscountOfInvoice.show({invchead_id : sel.data.cobmisc_invchead_id}, function(){\n\n });\n}"
2236 "$ hidden" : "!( baseURL.match(/au\\.php$/)) ",
2237 "text" : "Print Shipping / Commercial Invoice",
2239 "$ xns" : "Roo.menu"
2246 "text" : "Payments / Refunds / Credit Memos",
2248 "cls" : "x-btn-text-icon",
2249 "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
2250 "$ xns" : "Roo.Toolbar",
2254 "$ xns" : "Roo.menu",
2259 "click" : "function(_self,e)\n {\n \n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel || sel.data.cobmisc_id < 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n if(!sel.data.cobmisc_posted){\n Roo.MessageBox.alert(\"Error\", \"This invoice has not been posted!\");\n return;\n }\n if(sel.data.cobmisc_outstanding == 0){\n Roo.MessageBox.alert(\"Error\", \"There is no any outstanding of this invoice!\");\n return;\n }\n \n var cust_id = _this.form.findField('cohead_cust_id').getValue();\n if(!cust_id){\n return;\n }\n var data = {\n cashrcpt_amount : sel.data.cobmisc_outstanding,\n cashrcpt_cust_id : cust_id,\n cashrcpt_aropen_id : sel.data.cobmisc_aropen_id_aropen_id,\n cashrcpt_distdate : new Date(),\n cashrcpt_fundstype : 'C',\n cashrcpt_curr_id : sel.data.cobmisc_curr_id_curr_id,\n cashrcpt_curr_id_curr_name : sel.data.cobmisc_curr_id_curr_name,\n cashrcpt_usecustdeposit : true,\n cashrcpt_docdate : new Date(),\n cashrcpt_salescat_id : -1,\n cashrcpt_applydate : new Date(),\n cashrcpt_discount : 0\n };\n Pman.Dialog.XtupleReceivePayment.show( data , function() {\n _this.invgrid.ds.load({});\n }); \n}\n"
2261 "text" : "Receive Payment",
2263 "cls" : "x-btn-text-icon",
2264 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2265 "$ xns" : "Roo.menu"
2269 "click" : "function(_self,e)\n{\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel || sel.data.cobmisc_cobapply_aropen_id < 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a credit memo\");\n return;\n }\n if(!sel.data.cobmisc_posted){\n Roo.MessageBox.alert(\"Error\", \"The invoice that credit memo has been applied to has been not posted\");\n return;\n }\n var cust_id = _this.form.findField('cohead_cust_id').getValue();\n if(!cust_id){\n return;\n }\n \n if(!sel.data.cobmisc_outstanding || sel.data.cobmisc_outstanding == 0){\n Roo.MessageBox.alert(\"Error\", \"The amount of this credit memo is 0!\");\n return;\n }\n \n var d = _this.form.getFieldValues();\n \n var data = {\n 'checkhead_recip_id' : cust_id,\n 'checkhead_recip_type' : 'C',\n 'checkhead_checkdate' : new Date(),\n 'checkhead_amount' : sel.data.cobmisc_outstanding,\n 'remaining_total' : sel.data.cobmisc_outstanding,\n 'checkhead_curr_id' : d.cohead_curr_id,\n 'checkhead_curr_id_curr_name' : d.cohead_curr_id_curr_name,\n 'checkhead_misc' : true,\n 'aropen_id' : sel.data.cobmisc_cobapply_aropen_id,\n \t'cmhead_number' : sel.data.cobmisc_invchead_id_invchead_invcnumber,\n\t'cust_name' : d.cohead_cust_id_cust_name,\n\t'_create_and_post' : 1\n\n };\n \n \n Pman.Dialog.XtupleMiscellaneousCheck.show( data , function() {\n _this.invgrid.ds.load({});\n }); \n}\n"
2271 "text" : "Issue Refund",
2273 "cls" : "x-btn-text-icon",
2274 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2275 "$ xns" : "Roo.menu"
2278 "xtype" : "Separator",
2279 "$ xns" : "Roo.menu"
2283 "click" : "function(_self,e)\n{\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel || sel.data.cobmisc_cashrcpt_id * 1 < 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a Receive Payment\");\n return;\n }\n \n Roo.MessageBox.confirm(\"Confirm\", \"Voiding receipt will mean you will have to re-enter the receipt refund - \" + \n \"please take note of the details so you can enter it again correctly later.\", function(r) {\n \n if (r !='yes') {\n return;\n }\n new Pman.Request({\n url : baseURL + '/Roo/cashrcpt',\n method : 'POST',\n params : {\n cashrcpt_id : sel.data.cobmisc_cashrcpt_id,\n _void : 1\n },\n success : function() \n {\n _this.invgrid.ds.load({});\n \n }\n });\n \n })\n \n \n}\n"
2285 "text" : "Void Payment",
2287 "cls" : "x-btn-text-icon",
2288 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
2289 "$ xns" : "Roo.menu"
2293 "click" : "function(_self,e)\n{\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel || sel.data.cobmisc_checkhead_id * 1 < 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a Miscellaneours Check\");\n return;\n }\n \n Roo.MessageBox.confirm(\"Confirm\", \"Voiding refund will mean you will have to re-enter the receipt refund - \" + \n \"please take note of the details so you can enter it again correctly later.\", function(r) {\n \n if (r !='yes') {\n return;\n }\n new Pman.Request({\n url : baseURL + '/Roo/checkhead',\n method : 'POST',\n params : {\n checkhead_id : sel.data.cobmisc_checkhead_id,\n _voidPosted : 1\n },\n success : function() \n {\n _this.invgrid.ds.load({});\n \n }\n });\n \n })\n \n \n}\n"
2295 "text" : "Void Refund",
2297 "cls" : "x-btn-text-icon",
2298 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
2299 "$ xns" : "Roo.menu"
2303 "click" : "function(_self,e)\n{\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel || sel.data.cobmisc_cobapply_aropen_id < 1) {\n Roo.MessageBox.alert(\"Error\", \"Select a credit memo\");\n return;\n }\n \n if(sel.data.cobmisc_posted){\n Roo.MessageBox.alert(\"Error\", \"You cann't void this credit memo, since the invoice that credit memo has been applied to has been posted\");\n return;\n }\n \n if (sel.data.cobmisc_cobapply_id < 1) {\n Roo.MessageBox.alert(\"Error\", \"invaild credit memo\");\n return;\n }\n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to void this applied credit memo, \" + \n \"it will also void all the check that belongs to this credit memo \", function(r) {\n \n if (r !='yes') {\n return;\n }\n new Pman.Request({\n url : baseURL + '/Roo/cobapply',\n method : 'POST',\n params : {\n _delete : sel.data.cobmisc_cobapply_id,\n _void : 1\n },\n success : function() \n {\n _this.invgrid.ds.load({});\n \n }\n });\n \n })\n \n}\n"
2305 "text" : "Void Credit Memo",
2307 "cls" : "x-btn-text-icon",
2308 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
2309 "$ xns" : "Roo.menu"
2317 "$ xns" : "Roo.Toolbar"
2321 "|click" : "function ()\n{\n\n if (!_this.form.findField('cohead_id').getValue()) {\n Roo.MessageBox.alert(\"Error\", \"Save Order first\");\n return;\n }\n \n var rv = _this.form.getFieldValues();\n \n \n Pman.Dialog.XtupleInvoice.show({\n cobmisc_cohead_id : rv.cohead_id,\n cobmisc_shipdate : _this.form.findField('cohead_targetdate').getValue(),\n cobmisc_invcdate : _this.form.findField('cohead_targetdate').getValue(),\n cobmisc_curr_id : rv.cohead_curr_id,\n cobmisc_curr_id_curr_name : rv.cohead_curr_id_curr_name,\n // below parms for add credit memo\n cmdata : {\n cm_cust_id : rv.cohead_cust_id,\n cm_cust_id_cust_name : rv.cohead_cust_id_cust_name,\n cm_curr_id : rv.cohead_curr_id,\n cm_curr_id_curr_name : rv.cohead_curr_id_curr_name,\n cm_terms_id : rv.cohead_terms_id,\n cm_terms_id_terms_descrip : rv.cohead_terms_id_terms_descrip,\n cm_salesrep_id : rv.cohead_salesrep_id,\n cm_salesrep_id_salesrep_name : rv.cohead_salesrep_id_salesrep_name,\n cm_docdate : new Date(),\n cm_taxzone_id : rv.cohead_taxzone_id,\n cm_taxzone_id_taxzone_descrip : rv.cohead_taxzone_id_taxzone_descrip,\n cm_billto_cntct_id : rv.cohead_billto_cntct_id,\n cm_billto_cntct_id_cntct_name : rv.cohead_billto_cntct_id_cntct_name,\n cm_location_src : rv.cohead_location_src,\n cm_location_src_location_name : rv.cohead_location_src_location_name,\n cm_billto_address : rv.billto_address\n }\n \n },\n function() { \n _this.invgrid.ds.load({});\n });\n \n}",
2322 "render" : "function (_self)\n{\n _this.addInvoiceBtn = _self;\n}"
2326 "cls" : "x-btn-text-icon",
2327 "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2328 "$ xns" : "Roo.Toolbar"
2332 "|click" : "function ()\n{\n\n var sel = _this.invgrid.getSelectionModel().getSelected();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n return;\n }\n // check current status of shipment..\n \n var params = {\n// cobmisc_id : sel.data.cobmisc_id,\n _void : 1\n };\n if (sel.data.cobmisc_id * 1) {\n params.cobmisc_id = sel.data.cobmisc_id * 1 ;\n }\n if (sel.data.cobmisc_invchead_id_invchead_id * 1) { \n params.invchead_id = sel.data.cobmisc_invchead_id_invchead_id * 1;\n }\n \n Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to VOID that invoice?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n new Pman.Request({\n mask : 'Sending',\n url : baseURL + '/Roo/cobmisc',\n method : 'POST',\n params : params,\n success : function() {\n _this.invgrid.ds.load({});\n }\n })\n \n }\n );\n \n \n \n}"
2334 "text" : "Void / Unpost",
2336 "cls" : "x-btn-text-icon",
2337 "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
2338 "$ xns" : "Roo.Toolbar"
2343 "xtype" : "ColumnModel",
2344 "header" : "Invoice #",
2346 "$ renderer" : "function(v,x,r) { \n if (v && \n r.data.cobmisc_invchead_id_invchead_id * 1 && \n !r.data.cobmisc_invchead_id_invchead_posted) {\n return '<span style=\"color:red\">' + \n \"NEEDS Voiding then re-posted: \" + \n String.format('{0}', v) +\n '</span>'; \n }\n\n if(v && r.data.cobmisc_id == -2){\n return String.format('<span style=\"margin-left: 10px;\"> - {0} (Credit Memo)</span>', v); \n }\n if(v && r.data.cobmisc_id == -3){\n return String.format('<span style=\"margin-left: 20px;\"> - {0} (Miscellaneous Check)</span>', v); \n }\n if(v && r.data.cobmisc_id == -4){\n return String.format('<span style=\"margin-left: 10px;\"> - {0} (Receive Payment to {2}) [ {1} ]</span>', \n v, r.data.cobmisc_cashrcpt_amount, r.json.cashrcpt_bankaccnt_id_bankaccnt_bankname); \n }\n \n return v ? String.format('{0}', v) : \n '<span style=\"color:red\">' + \"Not Posted\" + '</span>'; \n}",
2347 "$ xns" : "Roo.grid",
2348 "* prop" : "colModel[]",
2349 "dataIndex" : "cobmisc_invchead_id_invchead_invcnumber"
2352 "xtype" : "ColumnModel",
2353 "header" : "invcdate",
2355 "$ renderer" : "function(v,x,r) { \n \n return String.format('{0}', v && v.format ? v.format('d/M/Y') : ''); \n}",
2356 "$ xns" : "Roo.grid",
2357 "* prop" : "colModel[]",
2358 "dataIndex" : "cobmisc_invcdate",
2359 "# builderCfg" : "{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2363 "xtype" : "ColumnModel",
2366 "$ renderer" : "function(v) { return String.format('{0}', v ? parseInt(v) : 0); }",
2367 "$ xns" : "Roo.grid",
2368 "* prop" : "colModel[]",
2369 "dataIndex" : "cobmisc_qty"
2373 "xtype" : "ColumnModel",
2374 "header" : "Item Cost",
2376 "$ renderer" : "function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); }",
2377 "$ xns" : "Roo.grid",
2378 "* prop" : "colModel[]",
2379 "dataIndex" : "cobmisc_itemcost"
2383 "xtype" : "ColumnModel",
2384 "header" : "Shipping",
2386 "$ renderer" : "function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : ''); }",
2387 "$ xns" : "Roo.grid",
2388 "* prop" : "colModel[]",
2389 "dataIndex" : "cobmisc_freight"
2393 "xtype" : "ColumnModel",
2396 "$ renderer" : "function(v,x,r) { \n\n // tax is based on the % itemcost..\n// var ic = r.data.cobmisc_itemcost;\n /*\n var ic =r.data.cobmisc_itemcost - (1* r.data.cobmisc_itemcost_taxfree);\n \n var tax= _this.form.findField('cohead_tax').getValue() * 1.0;\n var totic = _this.form.findField('cohead_subtotal').getValue() * 1.0; \n if (tax < 0.1) {\n return '';\n }\n var taxp = tax / totic;\n var lv = taxp * ic;\n */\n return String.format('{0}', (1.0*v).toFixed(2) );\n \n \n }",
2397 "$ xns" : "Roo.grid",
2398 "* prop" : "colModel[]",
2399 "dataIndex" : "cobmisc_tax"
2403 "xtype" : "ColumnModel",
2404 "header" : "Discount (Pretax)",
2406 "$ renderer" : "function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); }",
2407 "$ xns" : "Roo.grid",
2408 "* prop" : "colModel[]",
2409 "dataIndex" : "cobmisc_cohead_id_cohead_pretax_discount"
2413 "xtype" : "ColumnModel",
2414 "header" : "Discount (Posttax)",
2416 "$ renderer" : "function(v,x,r) \n{\n var vv = v - r.data.cobmisc_cohead_id_cohead_pretax_discount;\n \n return String.format('{0}', vv ? (1.0*vv).toFixed(2) : 0); \n}",
2417 "$ xns" : "Roo.grid",
2418 "* prop" : "colModel[]",
2419 "dataIndex" : "cobmisc_misc"
2423 "xtype" : "ColumnModel",
2424 "header" : "Total ",
2426 "$ renderer" : "function(v,x,r) { \n\n/* \n var ic = r.data.cobmisc_itemcost;\n var tax= _this.form.findField('cohead_tax').getValue() * 1.0;\n var totic = _this.form.findField('cohead_subtotal').getValue() * 1.0; \n var lv = 0.0;\n if (tax > 0.0) {\n var taxp = tax / totic;\n lv = taxp * ic;\n\n }\n */ \n \n\n if(v){\n return String.format('{0}',(v * 1.0).toFixed(2) );\n }\n var d= r.data;\n\n return String.format('{0}',\n ((d.cobmisc_itemcost * 1.0) + \n (d.cobmisc_freight * 1.0) + \n (d.cobmisc_tax * 1.0) +\n (d.cobmisc_misc * 1.0) \n\n ).toFixed(2) );\n}",
2427 "$ xns" : "Roo.grid",
2428 "* prop" : "colModel[]",
2429 "dataIndex" : "cobmisc_total"
2433 "xtype" : "ColumnModel",
2434 "header" : "Outstanding",
2436 "$ renderer" : "function(v,x,r) \n{ \n \n return String.format('{0}', v ? (v * 1.0).toFixed(2) : 0 );\n}",
2437 "$ xns" : "Roo.grid",
2438 "* prop" : "colModel[]",
2439 "dataIndex" : "cobmisc_outstanding"
2451 "|activate" : "function() {\n _this.hpanel = this;\n if (_this.hgrid) {\n _this.hgrid.footer.onClick('first');\n }\n}"
2453 "background" : true,
2454 "fitToframe" : true,
2455 "region" : "center",
2456 "title" : "History",
2457 "xtype" : "GridPanel",
2458 "fitContainer" : true,
2460 "# builderCfg" : "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
2461 "tableName" : "events",
2465 "|rowdblclick" : "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n _this.grid.footer.onClick('first');\n }); \n}\n",
2466 "|render" : "function() \n{\n _this.hgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.hpanel.active) {\n this.footer.onClick('first');\n }\n}"
2468 "autoExpandColumn" : "remarks",
2471 "$ xns" : "Roo.grid",
2473 "# builderCfg" : "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
2477 "beforeload" : "function (_self, options)\n{\n options.params._related_on_table = 'cohead';\n options.params._related_on_id = _this.form.findField('cohead_id').getValue();\n}"
2479 "remoteSort" : true,
2481 "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }",
2482 "$ xns" : "Roo.data",
2483 "* prop" : "dataSource",
2484 "# builderCfg" : "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
2487 "$ url" : "baseURL + '/Roo/events.php'",
2489 "xtype" : "HttpProxy",
2490 "$ xns" : "Roo.data",
2496 "xtype" : "JsonReader",
2497 "$ fields" : "[\n {\n 'name': 'event_when',\n 'type': 'date'\n },\n {\n 'name': 'action',\n 'type': 'string'\n },\n {\n 'name': 'ipaddr',\n 'type': 'string'\n },\n {\n 'name': 'person_id_name',\n 'type': 'string'\n },\n {\n 'name': 'remarks',\n 'type': 'string'\n }\n]",
2498 "$ xns" : "Roo.data",
2499 "* prop" : "reader",
2500 "# builderCfg" : "{\"cols\":[{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}],\"cols_ex\":[\"remarks\"],\"table\":\"events\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}",
2501 "totalProperty" : "total"
2507 "xtype" : "PagingToolbar",
2508 "emptyMsg" : "No events found",
2510 "displayInfo" : true,
2511 "displayMsg" : "Displaying events{0} - {1} of {2}",
2515 "xtype" : "ColumnModel",
2516 "header" : "Changed",
2518 "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
2519 "$ xns" : "Roo.grid",
2520 "* prop" : "colModel[]",
2521 "dataIndex" : "event_when",
2522 "# builderCfg" : "{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2525 "xtype" : "ColumnModel",
2526 "header" : "action",
2528 "$ renderer" : "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
2529 "$ xns" : "Roo.grid",
2530 "* prop" : "colModel[]",
2531 "dataIndex" : "action",
2532 "# builderCfg" : "{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2535 "xtype" : "ColumnModel",
2536 "header" : "IP address",
2538 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2539 "$ xns" : "Roo.grid",
2540 "* prop" : "colModel[]",
2541 "dataIndex" : "ipaddr",
2542 "# builderCfg" : "{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2545 "xtype" : "ColumnModel",
2548 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2549 "$ xns" : "Roo.grid",
2550 "* prop" : "colModel[]",
2551 "dataIndex" : "person_id_name",
2552 "# builderCfg" : "{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}"
2555 "xtype" : "ColumnModel",
2558 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2559 "$ xns" : "Roo.grid",
2560 "* prop" : "colModel[]",
2561 "dataIndex" : "remarks",
2562 "# builderCfg" : "{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}"
2569 "region" : "center",
2570 "xtype" : "NestedLayoutPanel",
2571 "title" : "Stock Tx",
2575 "xtype" : "BorderLayout",
2577 "* prop" : "layout",
2580 "xtype" : "LayoutRegion",
2585 "xtype" : "LayoutRegion",
2593 "|activate" : "function() {\n _this.txpanel = this;\n if (_this.txgrid) {\n _this.txgrid.footer.onClick('first');\n }\n}"
2595 "fitToframe" : true,
2596 "background" : false,
2597 "region" : "center",
2598 "title" : "invdetail",
2599 "xtype" : "GridPanel",
2600 "fitContainer" : true,
2602 "tableName" : "invdetail",
2606 "|render" : "function() \n{\n _this.txgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.txpanel.active) {\n this.footer.onClick('first');\n }\n}"
2608 "autoExpandColumn" : "item_number",
2611 "$ xns" : "Roo.grid",
2615 "xtype" : "Toolbar",
2617 "* prop" : "toolbar",
2621 "click" : "function (_self, e)\n{\n new Pman.Request({\n mask : 'applying',\n url : baseURL + '/Roo/Cohead',\n method : 'GET',\n params : {\n _apply_fifo : _this.form.findField('cohead_id').getValue()\n },\n success : function () {\n Roo.MessageBox.alert(\"Applied\", \"Succesfully Applied\");\n }\n });\n}"
2623 "text" : "Run Apply Fifo on order",
2625 "$ xns" : "Roo.Toolbar"
2629 "click" : "function (_self, e)\n{\n new Pman.Request({\n mask : 'running',\n url : baseURL + '/Roo/Cohead',\n method : 'GET',\n params : {\n _run_void_fix : _this.form.findField('cohead_id').getValue()\n },\n success : function () {\n Roo.MessageBox.alert(\"Applied\", \"Succesfully Run\");\n }\n });\n}"
2631 "text" : "Run Void flagger",
2633 "$ xns" : "Roo.Toolbar"
2637 "click" : "function (_self, e)\n{\n new Pman.Download({\n newWindow : true,\n mask : 'running',\n url : baseURL + '/Roo/Invdetail',\n method : 'GET',\n timeout :90000,\n params : {\n _post : 1,\n _reverse_all_bad : _this.form.findField('cohead_id').getValue()\n },\n success : function () {\n Roo.MessageBox.alert(\"Applied\", \"Succesfully Run\");\n }\n });\n}"
2639 "text" : "Auto Reverse",
2641 "$ xns" : "Roo.Toolbar"
2647 "selectionchange" : "function (_self)\n{\n _this.txdgrid.footer.onClick('first');;\n}"
2649 "xtype" : "RowSelectionModel",
2650 "singleSelect" : true,
2651 "$ xns" : "Roo.grid",
2656 "beforeload" : "function (_self, o)\n{\n o.params.cohead_id = _this.form.findField('cohead_id').getValue();\n if (! o.params.cohead_id ) {\n this.removeAll();\n return false;\n }\n}"
2659 "remoteSort" : true,
2660 "$ sortInfo" : "{ field : 'item_number', direction: 'ASC' }",
2661 "$ xns" : "Roo.data",
2662 "* prop" : "dataSource",
2665 "$ url" : "baseURL + '/Roo/invdetail.php'",
2666 "xtype" : "HttpProxy",
2668 "$ xns" : "Roo.data",
2674 "xtype" : "JsonReader",
2675 "$ xns" : "Roo.data",
2676 "$ fields" : "[\n {\n 'name': 'invdetail_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_qty',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_comments',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_qty_before',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_qty_after',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_invcitem_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_expiration',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_warrpurc',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_ls_id',\n 'type': 'int'\n }\n]",
2677 "* prop" : "reader",
2678 "totalProperty" : "total"
2684 "xtype" : "PagingToolbar",
2685 "emptyMsg" : "No invdetail found",
2687 "displayMsg" : "Displaying invdetail{0} - {1} of {2}",
2688 "displayInfo" : true,
2692 "xtype" : "ColumnModel",
2695 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2696 "$ xns" : "Roo.grid",
2697 "* prop" : "colModel[]",
2698 "dataIndex" : "item_number"
2702 "xtype" : "ColumnModel",
2705 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2706 "$ xns" : "Roo.grid",
2707 "* prop" : "colModel[]",
2708 "dataIndex" : "rec_shipped"
2712 "xtype" : "ColumnModel",
2715 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2716 "$ xns" : "Roo.grid",
2717 "* prop" : "colModel[]",
2718 "dataIndex" : "rec_returned"
2722 "xtype" : "ColumnModel",
2723 "header" : "#TX ship",
2725 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2726 "$ xns" : "Roo.grid",
2727 "* prop" : "colModel[]",
2728 "dataIndex" : "tx_shipped"
2732 "xtype" : "ColumnModel",
2733 "header" : "#TX ret",
2735 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2736 "$ xns" : "Roo.grid",
2737 "* prop" : "colModel[]",
2738 "dataIndex" : "tx_returned"
2742 "xtype" : "ColumnModel",
2743 "header" : "#TX Tot",
2745 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2746 "$ xns" : "Roo.grid",
2747 "* prop" : "colModel[]",
2748 "dataIndex" : "tx_total"
2752 "xtype" : "ColumnModel",
2755 "$ renderer" : "function(v,x,r) { \n\n return (v*1).toFixed(3);\n}",
2756 "$ xns" : "Roo.grid",
2757 "* prop" : "colModel[]",
2758 "dataIndex" : "total_value"
2762 "xtype" : "ColumnModel",
2765 "$ renderer" : "function(v,x,r) { \n\n var cototal = (r.data.rec_returned*1) - (r.data.rec_shipped*1);\n// Roo.log(cototal);\n var diff = (v*1) - cototal;\n // Roo.log(diff);\n if (diff == 0) {\n return '';\n }\n return String.format('<span style=\"color:red\">{0}</span>', diff ); \n }",
2766 "$ xns" : "Roo.grid",
2767 "* prop" : "colModel[]",
2768 "dataIndex" : "tx_total"
2776 "|activate" : "function() {\n _this.txdpanel = this;\n if (_this.txdgrid) {\n _this.txdgrid.footer.onClick('first');\n }\n}"
2778 "fitToframe" : true,
2779 "background" : false,
2781 "title" : "invdetail",
2782 "xtype" : "GridPanel",
2783 "fitContainer" : true,
2785 "tableName" : "invdetail",
2789 "|render" : "function() \n{\n _this.txdgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.txdpanel.active) {\n this.footer.onClick('first');\n }\n}",
2790 "rowclick" : "function (_self, rowIndex, e)\n{\n var s = _this.txdgrid.ds.getAt(rowIndex);\n var dt = s.data.invhist_transdate.split(' ');\n \n _this.dateSel.setValue(new Date(dt[0]));\n}"
2792 "autoExpandColumn" : "invhist_comments",
2795 "$ xns" : "Roo.grid",
2799 "xtype" : "Toolbar",
2801 "* prop" : "toolbar",
2805 "click" : "function (_self, e)\n{\n var s = _this.txdgrid.selModel.getSelected();\n\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a transaction\");\n return;\n }\n \n var reverseSel = function() {\n \n new Pman.Request({\n mask : \"Reversing\",\n url : baseURL + '/Roo/invdetail',\n method : 'POST',\n params : {\n _duplicate : s.data.invdetail_id\n }, \n success : function() {\n _this.txdgrid.footer.onClick('first');\n }\n });\n \n }\n \n \n\n Roo.MessageBox.confirm(\n \"Confirm\", \n \"This should only be used by System Administrators - are you sure you know what you are doing!\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n reverseSel();\n }\n );\n \n \n \n \n}"
2807 "text" : "Duplicate Selected",
2809 "$ xns" : "Roo.Toolbar"
2813 "$ xns" : "Roo.Toolbar"
2816 "text" : "Issue Date",
2817 "xtype" : "TextItem",
2818 "$ xns" : "Roo.Toolbar"
2822 "render" : "function (_self)\n{\n _this.dateSel = _self;\n}"
2825 "fieldLabel" : "Issue Date",
2826 "xtype" : "DateField",
2827 "allowBlank" : false,
2829 "$ xns" : "Roo.form",
2830 "name" : "issue_date"
2834 "click" : "function (_self, e)\n{\n var s = _this.txdgrid.selModel.getSelected();\n var dt = _this.dateSel.getValue();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select a transaction\");\n return;\n }\n \n var reverseSel = function(force) {\n \n new Pman.Request({\n mask : \"Reversing\",\n url : baseURL + '/Roo/invdetail',\n method : 'POST',\n params : {\n _reverse : s.data.invdetail_id,\n _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n _force : force\n }, \n success : function() {\n _this.txdgrid.footer.onClick('first');\n },\n failure : function(res) {\n Roo.log(res);\n try {\n if (res.errors.confirm) {\n \n Roo.MessageBox.confirm(\n \"Confirm\", \n \"are you really sure the totals will get messed up.\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n reverseSel(1);\n }\n );\n return;\n }\n } catch(e) { }\n Roo.MessageBox.alert(\"Error\", res.errorMsg);\n \n \n }\n });\n \n }\n \n \n\n Roo.MessageBox.confirm(\n \"Confirm\", \n \"This should only be used by System Administrators - are you sure you know what you are doing!\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n reverseSel(0);\n }\n );\n \n \n \n \n}"
2836 "text" : "Reverse Selected",
2838 "$ xns" : "Roo.Toolbar"
2844 "beforeload" : "function (_self, o)\n{\n o.params.cohead_id = _this.form.findField('cohead_id').getValue();\n var s = _this.txgrid.selModel.getSelected();\n if (!s) { \n this.removeAll();\n return false;\n }\n o.params.itemsite_id = s.data.invhist_itemsite_id;\n \n}"
2847 "remoteSort" : true,
2848 "$ sortInfo" : "{ field : 'invdetail_id', direction: 'ASC' }",
2849 "$ xns" : "Roo.data",
2850 "* prop" : "dataSource",
2853 "$ url" : "baseURL + '/Roo/invdetail.php'",
2854 "xtype" : "HttpProxy",
2856 "$ xns" : "Roo.data",
2862 "xtype" : "JsonReader",
2863 "$ xns" : "Roo.data",
2864 "$ fields" : "[\n {\n 'name': 'invdetail_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_qty',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_comments',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_qty_before',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_qty_after',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_invcitem_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_expiration',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_warrpurc',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_ls_id',\n 'type': 'int'\n }\n]",
2865 "* prop" : "reader",
2866 "totalProperty" : "total"
2872 "xtype" : "PagingToolbar",
2873 "emptyMsg" : "No invdetail found",
2875 "displayMsg" : "Displaying invdetail{0} - {1} of {2}",
2876 "displayInfo" : true,
2880 "xtype" : "ColumnModel",
2883 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2884 "$ xns" : "Roo.grid",
2885 "* prop" : "colModel[]",
2886 "dataIndex" : "invdetail_id"
2889 "xtype" : "ColumnModel",
2892 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2893 "$ xns" : "Roo.grid",
2894 "* prop" : "colModel[]",
2895 "dataIndex" : "invhist_transdate"
2898 "xtype" : "ColumnModel",
2901 "$ renderer" : "function(v,x,r) {\n if (r.data.invfifo_void *1 != 0) {\n return String.format('<s>{0}</s>', v); \n }\n\n return String.format('{0}', v); \n }",
2902 "$ xns" : "Roo.grid",
2903 "* prop" : "colModel[]",
2904 "dataIndex" : "invhist_ordnumber"
2907 "xtype" : "ColumnModel",
2910 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2911 "$ xns" : "Roo.grid",
2912 "* prop" : "colModel[]",
2913 "dataIndex" : "location_name"
2916 "xtype" : "ColumnModel",
2919 "$ renderer" : "function(v) { return String.format('{0}', v); }",
2920 "$ xns" : "Roo.grid",
2921 "* prop" : "colModel[]",
2922 "dataIndex" : "invhist_comments"
2926 "xtype" : "ColumnModel",
2927 "header" : "Qty Changed",
2929 "$ renderer" : "function(v,x,r) {\n if ( r.data.coitem_shipped != v) {\n return String.format('{0} <span style=\"color:red\">({1})</span>',\n Roo.util.Format.number(v,0),\n r.data.coitem_shipped\n );\n \n }\n return String.format('{0}', Roo.util.Format.number(v,0));\n}",
2930 "$ xns" : "Roo.grid",
2931 "* prop" : "colModel[]",
2932 "dataIndex" : "invdetail_qty"
2936 "xtype" : "ColumnModel",
2937 "header" : "Qty Changed",
2939 "$ renderer" : "function(v,x,r) {\n var tot = r.data.invhist_value_after*1 - v*1;\n var f = '{0}';\n if (r.data.invdetail_qty >0 && tot < 0) {\n f = '<span style=\"color:red\">{0}</span>';\n }\n if (r.data.invdetail_qty < 0 && tot > 0) {\n f = '<span style=\"color:red\">{0}</span>';\n } \n return String.format(f, Roo.util.Format.number(tot));\n}",
2940 "$ xns" : "Roo.grid",
2941 "* prop" : "colModel[]",
2942 "dataIndex" : "invhist_value_before"
2945 "xtype" : "ColumnModel",
2946 "header" : "Posted",
2948 "$ renderer" : "function(v,x,r) { \n \n var state = v ? '-checked' : '';\n \n return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }",
2949 "$ xns" : "Roo.grid",
2950 "* prop" : "colModel[]",
2951 "dataIndex" : "invhist_posted"
2962 "region" : "center",
2963 "xtype" : "NestedLayoutPanel",
2968 "xtype" : "BorderLayout",
2970 "* prop" : "layout",
2973 "xtype" : "LayoutRegion",
2978 "xtype" : "LayoutRegion",
2986 "|activate" : "function() {\n _this.gltxpanel = this;\n if (_this.gltxgrid) {\n _this.gltxgrid.footer.onClick('first');\n }\n}"
2988 "fitToframe" : true,
2989 "background" : false,
2990 "region" : "center",
2991 "title" : "invdetail",
2992 "xtype" : "GridPanel",
2993 "fitContainer" : true,
2995 "tableName" : "invdetail",
2999 "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n if (columnIndex > 0) {\n return;\n }\n var rec = this.ds.getAt(rowIndex);\n rec.set('gltrans_as_summary', rec.data.gltrans_as_summary *1 ? 0 : 1);\n _this.gltxdgrid.footer.onClick('first');\n}",
3000 "|render" : "function() \n{\n _this.gltxgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.gltxpanel.active) {\n this.footer.onClick('first');\n }\n}"
3002 "autoExpandColumn" : "gltrans_accnt_id_accnt_descrip",
3005 "$ xns" : "Roo.grid",
3010 "selectionchange" : "function (_self)\n{\n _this.gltxdgrid.footer.onClick('first');;\n}"
3012 "xtype" : "RowSelectionModel",
3013 "singleSelect" : true,
3014 "$ xns" : "Roo.grid",
3019 "beforeload" : "function (_self, o)\n{\n o.params.cohead_id = _this.form.findField('cohead_id').getValue();\n if (! o.params.cohead_id ) {\n this.removeAll();\n return false;\n }\n o.params._split_sales = _this.glsalesbtn.pressed ? 1 : 0;\n}"
3022 "remoteSort" : true,
3023 "$ sortInfo" : "{ field : 'item_number', direction: 'ASC' }",
3024 "$ xns" : "Roo.data",
3025 "* prop" : "dataSource",
3028 "$ url" : "baseURL + '/Roo/gltrans.php'",
3029 "xtype" : "HttpProxy",
3031 "$ xns" : "Roo.data",
3037 "xtype" : "JsonReader",
3038 "$ xns" : "Roo.data",
3039 "$ fields" : "[\n {\n 'name': 'invdetail_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_qty',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_comments',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_qty_before',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_qty_after',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_invcitem_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_expiration',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_warrpurc',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_ls_id',\n 'type': 'int'\n }\n]",
3040 "* prop" : "reader",
3041 "totalProperty" : "total"
3047 "xtype" : "PagingToolbar",
3048 "emptyMsg" : "No invdetail found",
3050 "displayMsg" : "Displaying invdetail{0} - {1} of {2}",
3051 "displayInfo" : true,
3052 "* prop" : "footer",
3056 "render" : "function (_self)\n{\n _this.glsalesbtn = _self;\n}",
3057 "click" : "function (_self, e)\n{\n (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);\n}"
3059 "text" : "Split sales",
3060 "enableToggle" : true,
3063 "$ xns" : "Roo.Toolbar"
3068 "xtype" : "ColumnModel",
3069 "header" : "Summary",
3071 "$ renderer" : "function(v,x,r) { \n \n var state = v*1 ? '-checked' : '';\n \n return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }",
3072 "$ xns" : "Roo.grid",
3073 "* prop" : "colModel[]",
3074 "dataIndex" : "gltrans_as_summary"
3077 "xtype" : "ColumnModel",
3078 "header" : "Account",
3080 "$ renderer" : "function(v) { return String.format('{0}', v); }",
3081 "$ xns" : "Roo.grid",
3082 "* prop" : "colModel[]",
3083 "dataIndex" : "gltrans_accnt_id_accnt_descrip"
3087 "xtype" : "ColumnModel",
3088 "header" : "Credit",
3090 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }",
3091 "$ xns" : "Roo.grid",
3092 "* prop" : "colModel[]",
3093 "dataIndex" : "gltrans_amount_credit"
3097 "xtype" : "ColumnModel",
3100 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }",
3101 "$ xns" : "Roo.grid",
3102 "* prop" : "colModel[]",
3103 "dataIndex" : "gltrans_amount_debit"
3107 "xtype" : "ColumnModel",
3110 "$ renderer" : "function(v) { return String.format('<b>{0}</b>', Roo.util.Format.number(v,3)); }",
3111 "$ xns" : "Roo.grid",
3112 "* prop" : "colModel[]",
3113 "dataIndex" : "gltrans_amount_total"
3117 "xtype" : "ColumnModel",
3118 "header" : "Unposted",
3120 "$ renderer" : "function(v) { return String.format('<span style=\"color:red\">{0}</span>', Roo.util.Format.number(v,3)); }",
3121 "$ xns" : "Roo.grid",
3122 "* prop" : "colModel[]",
3123 "dataIndex" : "gltrans_amount_total_unposted"
3131 "|activate" : "function() {\n _this.gltxdpanel = this;\n if (_this.gltxdgrid) {\n _this.gltxdgrid.footer.onClick('first');\n }\n}"
3133 "fitToframe" : true,
3134 "background" : false,
3136 "title" : "invdetail",
3137 "xtype" : "GridPanel",
3138 "fitContainer" : true,
3140 "tableName" : "invdetail",
3144 "cellclick" : "function (_self, ri, ci, e)\n{\n \n var deleteSel = function() {\n \n new Pman.Request({\n mask : \"Reversing\",\n url : baseURL + '/Roo/gltrans',\n method : 'POST',\n params : { \n _void : 1,\n gltrans_id : rec.data.gltrans_id\n \n }, \n success : function() {\n rec.set('gltrans_posted', false);\n rec.set('gltrans_deleted', true);\n rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);\n _this.gltxgrid.footer.onClick('first');\n }\n });\n \n }\n var undeleteSel = function() {\n \n new Pman.Request({\n mask : \"Reversing\",\n url : baseURL + '/Roo/gltrans',\n method : 'POST',\n params : { \n _unvoid : 1,\n gltrans_id : rec.data.gltrans_id\n \n }, \n success : function() {\n rec.set('gltrans_posted', true);\n rec.set('gltrans_deleted', false);\n rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);\n _this.gltxgrid.footer.onClick('first');\n }\n });\n \n }\n \n var di = this.colModel.config[ci].dataIndex;\n if (di != 'gltrans_posted') {\n return;\n }\n \n \n \n var rec = this.ds.getAt(ri);\n if (rec.data.gltrans_deleted) {\n \n Roo.MessageBox.confirm(\n \"Confirm\", \n \"This should only be used by System Administrators - are you sure you know what you are doing!\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n undeleteSel();\n }\n );\n \n return false;\n }\n\n \n \n if (!rec.data.gltrans_posted) {\n\n \n \n new Pman.Request({\n method : 'POST',\n url : baseURL + '/Roo/gltrans',\n mask : \"Posting\",\n params : {\n _post : 1,\n gltrans_id : rec.data.gltrans_id\n },\n success : function (res)\n {\n rec.set('gltrans_posted', true);\n _this.gltxgrid.footer.onClick('first');\n \n }\n \n \n });\n return;\n }\n \n // we have a posted transaction.\n // only allow recalled to be deleted..\n if (!rec.data.gltrans_notes.match(/(Recall|Ship Order)/)) {\n return false;\n }\n \n \n \n \n \n\n Roo.MessageBox.confirm(\n \"Confirm\", \n \"This should only be used by System Administrators - are you sure you know what you are doing!\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n deleteSel();\n }\n );\n \n \n \n}",
3145 "|render" : "function() \n{\n _this.gltxdgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.gltxdpanel.active) {\n this.footer.onClick('first');\n }\n}"
3147 "autoExpandColumn" : "gltrans_notes",
3150 "$ xns" : "Roo.grid",
3155 "beforeload" : "function (_self, o)\n{\n o.params.cohead_id = _this.form.findField('cohead_id').getValue();\n var s = _this.gltxgrid.selModel.getSelected();\n if (!s) { \n this.removeAll();\n return false;\n }\n o.params.gltrans_accnt_id = s.data.gltrans_accnt_id;\n o.params.gltrans_is_ship = s.data.gltrans_is_ship;\n o.params.gltrans_as_summary = s.data.gltrans_as_summary;\n \n \n}"
3158 "remoteSort" : true,
3159 "$ sortInfo" : "{ field : 'gltrans_docnumber', direction: 'ASC' }",
3160 "$ xns" : "Roo.data",
3161 "* prop" : "dataSource",
3164 "$ url" : "baseURL + '/Roo/gltrans.php'",
3165 "xtype" : "HttpProxy",
3167 "$ xns" : "Roo.data",
3173 "xtype" : "JsonReader",
3174 "$ xns" : "Roo.data",
3175 "$ fields" : "[\n {\n 'name': 'invdetail_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_qty',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_comments',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_qty_before',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_qty_after',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_invcitem_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_expiration',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_warrpurc',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_ls_id',\n 'type': 'int'\n }\n]",
3176 "* prop" : "reader",
3177 "totalProperty" : "total"
3183 "xtype" : "PagingToolbar",
3184 "emptyMsg" : "No invdetail found",
3186 "displayMsg" : "Displaying invdetail{0} - {1} of {2}",
3187 "displayInfo" : true,
3188 "* prop" : "footer",
3192 "click" : "function (_self, e)\n{\n new Pman.Download( {\n grid : _this.gltxdgrid\n \n });\n}"
3194 "text" : "Download",
3196 "$ xns" : "Roo.Toolbar"
3201 "xtype" : "ColumnModel",
3205 "$ renderer" : "function(v) { return String.format('{0}', v ); }",
3206 "$ xns" : "Roo.grid",
3207 "* prop" : "colModel[]",
3208 "dataIndex" : "gltrans_id"
3211 "xtype" : "ColumnModel",
3214 "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
3215 "$ xns" : "Roo.grid",
3216 "* prop" : "colModel[]",
3217 "dataIndex" : "gltrans_date"
3220 "xtype" : "ColumnModel",
3223 "$ renderer" : "function(v,x,r) { \n if (r.data.gltrans_deleted) {\n return String.format('<s>{0}</s>', v); \n }\n return String.format('{0}', v); \n}",
3224 "$ xns" : "Roo.grid",
3225 "* prop" : "colModel[]",
3226 "dataIndex" : "gltrans_docnumber"
3229 "xtype" : "ColumnModel",
3230 "header" : "Source",
3232 "$ renderer" : "function(v) { return String.format('{0}', v); }",
3233 "$ xns" : "Roo.grid",
3234 "* prop" : "colModel[]",
3235 "dataIndex" : "gltrans_source"
3238 "xtype" : "ColumnModel",
3241 "$ renderer" : "function(v) { return String.format('{0}', v); }",
3242 "$ xns" : "Roo.grid",
3243 "* prop" : "colModel[]",
3244 "dataIndex" : "gltrans_notes"
3248 "xtype" : "ColumnModel",
3249 "header" : "Amount",
3251 "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }",
3252 "$ xns" : "Roo.grid",
3253 "* prop" : "colModel[]",
3254 "dataIndex" : "gltrans_amount"
3257 "xtype" : "ColumnModel",
3258 "header" : "Posted",
3260 "$ renderer" : "function(v,x,r) { \n \n var state = v ? '-checked' : '';\n \n return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }",
3261 "$ xns" : "Roo.grid",
3262 "* prop" : "colModel[]",
3263 "dataIndex" : "gltrans_posted"
3275 "|activate" : "function() {\n _this.profitpanel = this;\n \n try { if (MODULE.isBuilder) {\n return;\n } } catch(e) { }\n \n var id = _this.form.findField('cohead_id').getValue() * 1;\n if (id < 1) {\n Roo.MessageBox.alert(\"Save First\", \"Save the order first, before adding items\");\n _this.dialog.layout.getRegion('center').showPanel(0);\n return;\n }\n \n if (_this.profitgrid) {\n _this.profitgrid.footer.onClick('first');\n }\n \n}"
3277 "fitToframe" : true,
3278 "background" : true,
3279 "region" : "center",
3281 "xtype" : "GridPanel",
3282 "fitContainer" : true,
3284 "tableName" : "coitem",
3288 "|render" : "function() \n{\n _this.profitgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.profitpanel.active) {\n this.footer.onClick('first');\n }\n}"
3290 "autoExpandColumn" : "item_number",
3293 "$ xns" : "Roo.grid",
3298 "beforeload" : "function (_self,o) {\n\n try {\n this.removeAll();\n } catch (e) { }\n \n\n if (!_this.data || !_this.data.cohead_id) {\n return false;\n }\n o.params = o.params || {};\n \n o.params.coitem_cohead_id = _this.data.cohead_id;\n o.params._without_list_discount =1;\n o.params._with_profit = 1;\n \n}"
3301 "remoteSort" : true,
3302 "$ sortInfo" : "{ field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' }",
3303 "$ xns" : "Roo.data",
3304 "* prop" : "dataSource",
3307 "$ url" : "baseURL + '/Roo/coitem.php'",
3308 "xtype" : "HttpProxy",
3310 "$ xns" : "Roo.data",
3316 "xtype" : "JsonReader",
3317 "$ xns" : "Roo.data",
3318 "$ fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'type',\n 'type': 'int'\n },\n {\n 'name': 'leader',\n 'type': 'int'\n },\n {\n 'name': 'leader_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_office_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_name',\n 'type': 'string'\n },\n {\n 'name': 'leader_phone',\n 'type': 'string'\n },\n {\n 'name': 'leader_fax',\n 'type': 'string'\n },\n {\n 'name': 'leader_email',\n 'type': 'string'\n },\n {\n 'name': 'leader_company_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_role',\n 'type': 'string'\n },\n {\n 'name': 'leader_active',\n 'type': 'int'\n },\n {\n 'name': 'leader_remarks',\n 'type': 'string'\n },\n {\n 'name': 'leader_passwd',\n 'type': 'string'\n },\n {\n 'name': 'leader_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_lang',\n 'type': 'string'\n },\n {\n 'name': 'leader_no_reset_sent',\n 'type': 'int'\n },\n {\n 'name': 'leader_action_type',\n 'type': 'string'\n },\n {\n 'name': 'leader_project_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_deleted_by',\n 'type': 'int'\n },\n {\n 'name': 'leader_deleted_dt',\n 'type': 'date'\n },\n {\n 'name': 'leader_firstname',\n 'type': 'string'\n },\n {\n 'name': 'leader_lastname',\n 'type': 'string'\n },\n {\n 'name': 'leader_name_facebook',\n 'type': 'string'\n },\n {\n 'name': 'leader_url_blog',\n 'type': 'string'\n },\n {\n 'name': 'leader_url_twitter',\n 'type': 'string'\n },\n {\n 'name': 'leader_url_linkedin',\n 'type': 'string'\n },\n {\n 'name': 'leader_crm_lead_percentage',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_industry_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_updated_action_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_created_action_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_type_id',\n 'type': 'int'\n }\n]",
3319 "* prop" : "reader",
3320 "totalProperty" : "total"
3326 "xtype" : "PagingToolbar",
3327 "emptyMsg" : "No coitem found",
3329 "displayMsg" : "Displaying coitem{0} - {1} of {2}",
3330 "displayInfo" : true,
3334 "xtype" : "ColumnModel",
3335 "header" : "Item Code",
3337 "$ renderer" : "function(v) { return String.format('{0}', v); }",
3338 "$ xns" : "Roo.grid",
3339 "* prop" : "colModel[]",
3340 "dataIndex" : "item_number"
3343 "xtype" : "ColumnModel",
3344 "header" : "SubTotal",
3346 "$ renderer" : "function(v) {\n\n\n return Roo.util.Format.number( v, 2);\n }",
3347 "$ xns" : "Roo.grid",
3348 "* prop" : "colModel[]",
3349 "dataIndex" : "calc_subtotal"
3352 "xtype" : "ColumnModel",
3353 "header" : "Cost of goods",
3355 "$ renderer" : "function(v) {\n\n return Roo.util.Format.number( v, 2);\n }",
3356 "$ xns" : "Roo.grid",
3357 "* prop" : "colModel[]",
3358 "dataIndex" : "calc_cost_total"
3361 "xtype" : "ColumnModel",
3362 "header" : "Profit",
3364 "$ renderer" : "function(v,x,r) {\n \n var profit = r.data.calc_subtotal - r.data.calc_cost_total;\n \n if(parseInt(profit) < 1){\n return String.format('<b style=\"color:red;\">{0}</b>', Roo.util.Format.number(profit,2)); \n }\n \n \n return Roo.util.Format.number( profit, 2);\n}",
3365 "$ xns" : "Roo.grid",
3366 "* prop" : "colModel[]",
3367 "dataIndex" : "profit"
3375 "render" : "function (_self)\n{\n _this.reversalBtn = _self;\n}",
3376 "click" : "function (_self, e)\n{\n var id = _this.form.findField('cohead_id').getValue() * 1;\n \n if(id < 1){\n Roo.MessageBox.alert('Error', 'Error occour on getting the sales order id');\n return;\n }\n\n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure to create a credit memo reversal?\",\n function (res) {\n if(res!='yes') {\n return;\n \n }\n new Pman.Request({\n method: 'POST',\n url: baseURL+ '/Roo/cohead',\n params : {\n cohead_id : id,\n _cm_reversal : 1\n },\n success : function() {\n _this.form.load({ method: 'GET', params: { '_id' : id }});\n }\n });\n }); \n \n}"
3378 "text" : "Create CM reversal",
3381 "* prop" : "buttons[]"
3385 "click" : "function (_self, e)\n{\n if (_this.grid) _this.grid.stopEditing();\n _this.dialog.hide();\n}"
3390 "* prop" : "buttons[]"
3394 "render" : "function (_self)\n{\n _this.saveBtn = _self;\n}",
3395 "click" : "function (_self, e)\n{\n // do some checks?\n \n if (_this.grid) _this.grid.stopEditing();\n \n _this.form.doAction(\"submit\");\n\n}"
3400 "* prop" : "buttons[]"