3 "name": "Pman.Dialog.XtupleSalesOrder",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleSalesOrder.bjs",
10 "|show": "function () {\n this.layout.getRegion('center').showPanel(0);\n}"
17 "title": "Edit / Create Sales Order",
19 "xtype": "LayoutDialog",
24 "xtype": "LayoutRegion",
26 "alwaysShowTabs": true,
35 "|xns": "Roo.Toolbar",
40 "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}"
42 "cls": "x-btn-text-icon",
43 "text": "Download Excel",
45 "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
50 "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}"
52 "cls": "x-btn-text-icon",
55 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
60 "click": "function (_self, e)\n{\n\n _this.addShipmentBtn.fireEvent('click');\n \n}"
62 "cls": "x-btn-text-icon",
64 "text": "Add Shipment",
66 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
71 "click": "function (_self, e)\n{\n\n Pman.Dialog.XtupleCustomer.show({\n cust_id : _this.form.findField('cohead_cust_id').getValue()\n }); \n}"
73 "cls": "x-btn-text-icon",
74 "text": "Edit Customer",
76 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
81 "click": "function (_self, e)\n{\n\n _this.addInvoiceBtn.fireEvent('click');\n \n}"
83 "cls": "x-btn-text-icon",
85 "text": "Add Invoice",
87 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
92 "render": "function (_self, e)\n{\n _this.voidBtn = _self;\n}",
93 "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}"
101 "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}",
102 "render": "function (_self)\n{\n _this.closeBtn = _self;\n}"
106 "|xns": "Roo.Toolbar"
114 "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}"
117 "title": "Order Details",
118 "xtype": "ContentPanel",
123 "|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",
124 "|rendered": "function (form)\n{\n _this.form= form;\n}\n",
125 "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}"
128 "style": "margin:10px;",
130 "|url": "baseURL + '/Roo/cohead.php'",
141 "style": "width:420px",
159 "emptyText": "Automatic",
160 "fieldLabel": "Order#",
161 "name": "cohead_number",
164 "xtype": "TextField",
169 "style": "float:left",
176 "fieldLabel": "Cust#",
177 "name": "cohead_cust_id_cust_number",
180 "xtype": "TextField",
189 "fieldLabel": "Customer",
190 "forceSelection": true,
191 "hiddenName": "cohead_cust_id",
193 "loadingText": "Searching...",
195 "name": "cohead_cust_id_cust_name",
197 "qtip": "Select custinfo",
198 "queryParam": "query[cust_name]",
200 "selectOnFocus": true,
201 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
202 "triggerAction": "all",
204 "valueField": "cust_id",
206 "xtype": "TextField",
210 "xtype": "TextField",
212 "fieldLabel": "Customer PO#",
213 "name": "cohead_custponumber",
218 "fieldLabel": "Ordered",
220 "name": "cohead_orderdate",
222 "xtype": "DateField",
233 "fieldLabel": "Target Delivery",
235 "name": "cohead_targetdate",
237 "xtype": "DateField",
247 "check": "function (_self, checked)\n{\n if(checked){\n _this.form.findField('cohead_targetdate').setValue(_this.form.findField('cohead_orderdate').getValue());\n }\n}"
249 "boxLabel": "same as order",
251 "name": "_same_as_order",
261 "displayField": "location_name",
263 "emptyText": "Supply From",
264 "fieldLabel": "Supply From",
265 "forceSelection": true,
266 "hiddenName": "cohead_location_src",
268 "loadingText": "Searching...",
270 "name": "cohead_location_src_location_name",
272 "qtip": "Select terms",
273 "queryParam": "query[location_name]",
274 "selectOnFocus": true,
275 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> {location_descrip} </div>",
276 "triggerAction": "all",
278 "valueField": "location_id",
285 "|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' }",
296 "xtype": "HttpProxy",
297 "|url": "baseURL + '/Roo/location.php'",
304 "totalProperty": "total",
305 "xtype": "JsonReader",
306 "|fields": "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
320 "style": "width:420px",
335 "emptyText": "Select terms",
336 "forceSelection": true,
338 "loadingText": "Searching...",
341 "qtip": "Select terms",
342 "selectOnFocus": true,
343 "triggerAction": "all",
346 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>",
347 "queryParam": "query[terms_descrip]",
348 "fieldLabel": "Terms",
349 "valueField": "terms_id",
350 "displayField": "terms_descrip",
351 "hiddenName": "cohead_terms_id",
352 "name": "cohead_terms_id_terms_descrip",
356 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
361 "|sortInfo": "{ direction : 'ASC', field: 'terms_descrip' }",
366 "xtype": "HttpProxy",
369 "|url": "baseURL + '/Roo/terms.php'"
373 "xtype": "JsonReader",
377 "totalProperty": "total",
378 "|fields": "[{\"name\":\"terms_id\",\"type\":\"int\"},\"terms_descrip\"]"
387 "displayField": "salesrep_name",
389 "emptyText": "Select salesrep",
390 "fieldLabel": "Sales Rep",
391 "forceSelection": true,
392 "hiddenName": "cohead_display_salesrep_id",
394 "loadingText": "Searching...",
396 "name": "cohead_display_salesrep_id_salesrep_name",
398 "qtip": "Select salesrep",
399 "queryParam": "query[salesrep_name]",
400 "selectOnFocus": true,
401 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
402 "triggerAction": "all",
404 "valueField": "salesrep_id",
411 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
416 "|sortInfo": "{ direction : 'ASC', field: 'salesrep_name' }",
421 "xtype": "HttpProxy",
424 "|url": "baseURL + '/Roo/salesrep.php'"
428 "xtype": "JsonReader",
432 "totalProperty": "total",
433 "|fields": "[{\"name\":\"salesrep_id\",\"type\":\"int\"},\"salesrep_name\"]"
442 "displayField": "salesrep_name",
444 "emptyText": "Select Staff",
445 "fieldLabel": "Staff I.C.",
446 "forceSelection": true,
447 "hiddenName": "cohead_salesrep_id",
449 "loadingText": "Searching...",
451 "name": "cohead_salesrep_id_salesrep_name",
453 "qtip": "Select salesrep",
454 "queryParam": "query[salesrep_name]",
455 "selectOnFocus": true,
456 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
457 "triggerAction": "all",
459 "valueField": "salesrep_id",
466 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
471 "|sortInfo": "{ direction : 'ASC', field: 'salesrep_name' }",
476 "xtype": "HttpProxy",
479 "|url": "baseURL + '/Roo/salesrep.php'"
483 "xtype": "JsonReader",
487 "totalProperty": "total",
488 "|fields": "[{\"name\":\"salesrep_id\",\"type\":\"int\"},\"salesrep_name\"]"
495 "fieldLabel": "Order Comments",
497 "name": "cohead_ordercomments",
509 "style": "width:420px",
520 "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}",
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}"
525 "displayField": "cntct_name",
527 "emptyText": "Select cntct",
528 "fieldLabel": "Bill To (select)",
529 "forceSelection": true,
530 "hiddenName": "cohead_billto_cntct_id",
532 "loadingText": "Searching...",
534 "name": "cohead_billto_cntct_id_cntct_name",
536 "qtip": "Select cntct",
537 "queryParam": "query[cntct_name]",
538 "selectOnFocus": true,
539 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cntct_name}</b> {cntct_addr_id_addr_line1}</div>",
540 "triggerAction": "all",
542 "valueField": "cntct_id",
549 "|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' }",
559 "xtype": "HttpProxy",
562 "|url": "baseURL + '/Roo/cntct.php'"
566 "xtype": "JsonReader",
570 "totalProperty": "total",
571 "|fields": "[{\"name\":\"cntct_id\",\"type\":\"int\"},\"cntct_name\"]"
579 "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}"
581 "fieldLabel": "or enter Address",
582 "name": "billto_address",
585 "|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",
589 "fieldLabel": "Email",
590 "name": "billto_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}",
605 "style": "margin-left:10px",
610 "legend": "Price Details",
611 "style": "width:420px",
615 "labelAlign": "right",
623 "labelSeparator": " ",
630 "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}"
633 "displayField": "curr_name",
635 "emptyText": "Select curr_name",
636 "fieldLabel": "Currency",
637 "forceSelection": true,
638 "hiddenName": "cohead_curr_id",
640 "loadingText": "Searching...",
642 "name": "cohead_curr_id_curr_name",
644 "qtip": "Select Currency",
645 "queryParam": "query[curr_name]",
646 "selectOnFocus": true,
647 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
648 "triggerAction": "all",
650 "valueField": "curr_id",
657 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n \n}\n"
662 "|sortInfo": "{ direction : 'ASC', field: 'curr_symbol' }",
667 "xtype": "HttpProxy",
670 "|url": "baseURL + '/Roo/curr_symbol.php'"
674 "xtype": "JsonReader",
678 "totalProperty": "total",
679 "|fields": "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]"
686 "allowDecimals": true,
687 "cls": "roo-align-right",
688 "decimalPrecision": 3,
689 "fieldLabel": "Products",
690 "name": "cohead_subtotal",
693 "xtype": "NumberField",
700 "labelSeparator": " ",
707 "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}"
710 "displayField": "taxzone_descrip",
712 "emptyText": "Select taxtype",
713 "fieldLabel": "Tax Zone",
714 "forceSelection": true,
715 "hiddenName": "cohead_taxzone_id",
717 "loadingText": "Searching...",
719 "name": "cohead_taxzone_id_taxzone_descrip",
721 "qtip": "Select taxtype",
722 "queryParam": "query[taxzone_descrip]",
723 "selectOnFocus": true,
724 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>",
725 "triggerAction": "all",
727 "valueField": "taxzone_id",
734 "|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' }",
745 "xtype": "HttpProxy",
746 "|url": "baseURL + '/Roo/taxzone.php'",
753 "totalProperty": "total",
754 "xtype": "JsonReader",
755 "|fields": "[{\"name\":\"taxzone_id\",\"type\":\"int\"},\"taxzone_descrip\"]",
763 "allowDecimals": true,
764 "cls": "roo-align-right",
765 "decimalPrecision": 3,
767 "name": "cohead_tax",
770 "xtype": "NumberField",
776 "allowDecimals": true,
777 "cls": "roo-align-right",
778 "decimalPrecision": 3,
779 "fieldLabel": "Pre Tax discount",
780 "name": "cohead_pretax_discount",
783 "xtype": "NumberField",
788 "labelSeparator": " ",
794 "fieldLabel": "Discount after Tax Description",
795 "name": "cohead_misc_descrip",
797 "xtype": "TextField",
802 "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}"
804 "allowDecimals": true,
805 "cls": "roo-align-right",
806 "decimalPrecision": 1,
808 "name": "cohead_misc_per",
810 "xtype": "NumberField",
811 "|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",
816 "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}"
818 "allowDecimals": true,
819 "cls": "roo-align-right",
820 "decimalPrecision": 3,
821 "fieldLabel": " ",
822 "name": "cohead_posttax_discount",
824 "xtype": "NumberField",
830 "allowDecimals": true,
831 "cls": "roo-align-right",
832 "decimalPrecision": 3,
833 "fieldLabel": "Total",
834 "name": "cohead_total",
837 "xtype": "NumberField",
838 "|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",
843 "keyup": "function (_self, e)\n{\n _this.form.findField('cohead_total').recalc();\n}"
845 "allowDecimals": true,
846 "cls": "roo-align-right",
847 "decimalPrecision": 3,
848 "fieldLabel": "Shipping",
849 "name": "cohead_freight",
851 "xtype": "NumberField",
855 "allowDecimals": true,
856 "cls": "roo-align-right",
857 "decimalPrecision": 3,
858 "fieldLabel": "Unshipped Total",
859 "name": "cohead_unshipped",
862 "xtype": "NumberField",
866 "allowDecimals": true,
867 "cls": "roo-align-right",
868 "decimalPrecision": 3,
869 "fieldLabel": "Uninvoiced Total",
870 "name": "cohead_uninvoiced",
873 "xtype": "NumberField",
883 "style": "width:420px",
884 "legend": "Shipping",
893 "labelSeparator": " ",
899 "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}"
901 "boxLabel": "Same as Billing",
902 "name": "_shipto_same",
910 "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}",
911 "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}"
915 "displayField": "cntct_name",
917 "emptyText": "Select ship to",
918 "fieldLabel": "Ship to",
919 "forceSelection": true,
920 "hiddenName": "cohead_shipto_cntct_id",
922 "loadingText": "Searching...",
924 "name": "cohead_shipto_cntct_id_cntct_name",
926 "qtip": "Select shiptoinfo",
927 "queryParam": "query[cntct_name]",
928 "selectOnFocus": true,
929 "tpl": "<div class=\"x-grid-cell-text x-btn button\">{cntct_name} - <b>{cntct_addr_id_addr_line1}</b> </div>",
930 "triggerAction": "all",
932 "valueField": "cntct_id",
939 "|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' }",
949 "xtype": "HttpProxy",
952 "|url": "baseURL + '/Roo/cntct.php'"
956 "xtype": "JsonReader",
960 "totalProperty": "total",
961 "|fields": "[{\"name\":\"cntct_id\",\"type\":\"int\"},\"cntct_name\"]"
969 "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}"
971 "fieldLabel": "Address",
972 "name": "shipto_address",
976 "|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_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",
982 "fieldLabel": "Shipment Comments",
983 "name": "cohead_shipcomments",
998 "name": "cohead_shipto_id",
1003 "name": "cohead_shipto_id_shipto_name",
1008 "name": "cohead_max_linenumber",
1013 "name": "cohead_cust_id",
1018 "name": "cohead_misc",
1020 "|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",
1024 "name": "taxzone_rate",
1034 "|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}",
1035 "deactivate": "function (_self)\n{\n if(_this.grid){\n _this.grid.stopEditing();\n }\n}"
1038 "fitContainer": true,
1041 "tableName": "coitem",
1042 "title": "Order Items",
1043 "xtype": "GridPanel",
1048 "|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}",
1049 "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",
1050 "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}",
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 "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",
1058 "xtype": "EditorGrid",
1059 "|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",
1064 "tabend": "function (_self)\n{\n _this.addItemBtn.fireEvent('click', _this.addItemBtn);\n}",
1065 "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 "enter_is_tab": true,
1069 "xtype": "CellSelectionModel",
1074 "displayInfo": true,
1075 "emptyMsg": "No Items",
1077 "xtype": "PagingToolbar",
1078 "|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",
1083 "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}"
1085 "text": "Fill empty Ship To",
1087 "|xns": "Roo.Toolbar"
1091 "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}"
1093 "text": "Update Location to match S/O",
1095 "|xns": "Roo.Toolbar"
1099 "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}",
1100 "render": "function (_self)\n{\n _this.showgstBtn = _self;\n}"
1102 "enableToggle": true,
1104 "text": "Prices with GST",
1106 "|xns": "Roo.Toolbar"
1112 "|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}",
1113 "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 ",
1114 "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}"
1116 "*prop": "dataSource",
1119 "|sortInfo": "{ field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' }",
1125 "xtype": "HttpProxy",
1126 "|url": "baseURL + '/Roo/coitem.php'",
1131 ".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\"}",
1134 "totalProperty": "total",
1135 "xtype": "JsonReader",
1136 "|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]",
1148 "|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",
1149 "render": "function (_self)\n{\n _this.addItemBtn = _self;\n}"
1151 "cls": "x-btn-text-icon",
1154 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1155 "|xns": "Roo.Toolbar"
1159 "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}"
1161 "cls": "x-btn-text-icon",
1162 "text": "Find Products",
1164 "|icon": "rootURL + '/Pman/templates/images/search.gif'",
1165 "|xns": "Roo.Toolbar"
1169 "|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",
1170 "render": "function (_self)\n{\n _this.xferAll = _self;\n}"
1172 "cls": "x-btn-text-icon",
1174 "text": "Xfer all stock to HK",
1176 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
1177 "|xns": "Roo.Toolbar"
1181 "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}"
1183 "text": "Show Inventory History",
1185 "|xns": "Roo.Toolbar"
1188 "|xns": "Roo.Toolbar",
1189 "xtype": "Separator"
1192 "text": "Apply % Discount of : ",
1193 "xtype": "TextItem",
1194 "|xns": "Roo.Toolbar"
1198 "render": "function (_self)\n{\n _this._applyDiscount = _self;\n}"
1201 "xtype": "TextField",
1206 "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}"
1208 "text": "Apply To All",
1210 "|xns": "Roo.Toolbar"
1214 "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}"
1218 "|xns": "Roo.Toolbar"
1222 "|xns": "Roo.Toolbar"
1226 "|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 "
1228 "cls": "x-btn-text-icon",
1231 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
1232 "|xns": "Roo.Toolbar"
1236 "|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 "
1238 "cls": "x-btn-text-icon",
1239 "text": "Delete All",
1241 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
1242 "|xns": "Roo.Toolbar"
1247 "*prop": "colModel[]",
1248 ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_linenumber\",\"columnshort\":\"coitem_linenumber\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Item#\"}",
1249 "dataIndex": "coitem_linenumber",
1252 "xtype": "ColumnModel",
1253 "|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 }",
1257 "*prop": "colModel[]",
1258 "dataIndex": "item_number",
1259 "header": "Item Code",
1261 "xtype": "ColumnModel",
1262 "|renderer": "function(v) { return String.format('{0}', v); }",
1267 "xtype": "GridEditor",
1272 "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}"
1275 "allowBlank": false,
1276 "displayField": "itemsite_item_id_item_number",
1278 "emptyText": "Select item",
1279 "forceSelection": true,
1280 "hiddenName": "itemsite_item_id_item_number",
1282 "loadingText": "Searching...",
1284 "name": "item_number",
1286 "qtip": "Select item",
1287 "queryParam": "query[number]",
1288 "selectOnFocus": true,
1289 "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>",
1290 "triggerAction": "all",
1292 "valueField": "item_number",
1293 "xtype": "ComboBox",
1298 "|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"
1303 "|sortInfo": "{ direction : 'ASC', field: 'item_number' }",
1309 "xtype": "HttpProxy",
1310 "|url": "baseURL + '/Roo/itemsite.php'",
1317 "totalProperty": "total",
1318 "xtype": "JsonReader",
1319 "|fields": "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]",
1331 "*prop": "colModel[]",
1332 "dataIndex": "coitem_location_src",
1335 "xtype": "ColumnModel",
1336 "|renderer": "function(v,x,r) { \n return String.format('{0}', r.data.coitem_location_src_location_name); \n}",
1341 "xtype": "GridEditor",
1346 "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 "allowBlank": false,
1350 "alwaysQuery": true,
1351 "displayField": "location_name",
1353 "emptyText": "Select location",
1354 "forceSelection": true,
1355 "hiddenName": "coitem_location_src",
1357 "loadingText": "Searching...",
1359 "name": "coitem_location_src_location_name",
1361 "qtip": "Select item",
1362 "queryParam": "query[location_name]",
1363 "selectOnFocus": true,
1364 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b> {location_name}</b> {location_descrip}</div>",
1365 "triggerAction": "all",
1367 "valueField": "location_id",
1368 "xtype": "ComboBox",
1373 "|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"
1378 "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
1384 "xtype": "HttpProxy",
1385 "|url": "baseURL + '/Roo/location.php'",
1392 "totalProperty": "total",
1393 "xtype": "JsonReader",
1394 "|fields": "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
1406 "*prop": "colModel[]",
1407 "dataIndex": "coitem_shipto_id",
1410 "xtype": "ColumnModel",
1411 "|renderer": "function(v,x,r) { \n return String.format('{0}:{1}', v, r.data.coitem_shipto_id_shipto_name); \n}",
1416 "xtype": "GridEditor",
1421 "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}",
1422 "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 "allowBlank": false,
1426 "alwaysQuery": true,
1427 "displayField": "shipto_name",
1429 "emptyText": "Select cntct",
1430 "forceSelection": true,
1431 "hiddenName": "cohead_shipto_id",
1433 "loadingText": "Searching...",
1435 "name": "coitem_shipto_id_shipto_name",
1437 "qtip": "Select shipto",
1438 "queryParam": "query[shipto_name]",
1439 "selectOnFocus": true,
1440 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{shipto_id}:{shipto_addr_id_addr_name}</b> </div>",
1441 "triggerAction": "all",
1443 "valueField": "shipto_id",
1445 "xtype": "ComboBox",
1450 "|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"
1455 "|sortInfo": "{ direction : 'ASC', field: 'shipto_name' }",
1461 "xtype": "HttpProxy",
1462 "|url": "baseURL + '/Roo/shiptoinfo.php'",
1469 "totalProperty": "total",
1470 "xtype": "JsonReader",
1471 "|fields": "[{\"name\":\"cntct_id\",\"type\":\"int\"},\"cntct_name\"]",
1483 "*prop": "colModel[]",
1484 ".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\":\"\"}",
1485 "dataIndex": "item_descrip1",
1486 "header": "Item Description",
1488 "xtype": "ColumnModel",
1489 "|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}",
1494 "xtype": "GridEditor",
1499 "allowBlank": false,
1500 "xtype": "TextField",
1508 "*prop": "colModel[]",
1509 ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}",
1511 "dataIndex": "coitem_status",
1514 "xtype": "ColumnModel",
1515 "|renderer": "function(v) { return String.format('{0}', v); }",
1519 "*prop": "colModel[]",
1521 "dataIndex": "coitem_qtyord",
1524 "xtype": "ColumnModel",
1525 "|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}",
1530 "xtype": "GridEditor",
1535 "focus": "function (_self)\n{\n if (this.value == 0) {\n this.el.dom.value = '';\n }\n}"
1538 "allowDecimals": false,
1539 "decimalPrecision": 0,
1541 "style": "text-align:right",
1542 "xtype": "NumberField",
1550 "*prop": "colModel[]",
1552 "dataIndex": "coitem_price",
1555 "xtype": "ColumnModel",
1556 "|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}",
1561 "xtype": "GridEditor",
1566 "focus": "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1569 "decimalPrecision": 3,
1571 "style": "text-align:right",
1572 "xtype": "NumberField",
1580 "*prop": "colModel[]",
1582 "dataIndex": "coitem_price_tax",
1583 "header": "Sell @w/GST",
1586 "xtype": "ColumnModel",
1587 "|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}",
1592 "xtype": "GridEditor",
1597 "focus": "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1600 "decimalPrecision": 3,
1602 "style": "text-align:right",
1603 "xtype": "NumberField",
1611 "*prop": "colModel[]",
1613 "dataIndex": "coitem_linedisc",
1616 "xtype": "ColumnModel",
1617 "|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}",
1622 "xtype": "GridEditor",
1627 "focus": "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1630 "decimalPrecision": 2,
1633 "style": "text-align:right",
1634 "xtype": "NumberField",
1642 "*prop": "colModel[]",
1644 "dataIndex": "coitem_custprice",
1645 "header": "List Price",
1647 "xtype": "ColumnModel",
1648 "|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}",
1653 "xtype": "GridEditor",
1658 "focus": "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1661 "decimalPrecision": 3,
1663 "style": "text-align:right",
1664 "xtype": "NumberField",
1672 "*prop": "colModel[]",
1674 "dataIndex": "coitem_custprice_tax",
1675 "header": "List Price w/GST",
1678 "xtype": "ColumnModel",
1679 "|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}",
1684 "xtype": "GridEditor",
1689 "focus": "function (_self)\n{\n if (this.value == 0.0) {\n this.el.dom.value = '';\n }\n}"
1692 "decimalPrecision": 3,
1694 "style": "text-align:right",
1695 "xtype": "NumberField",
1703 "*prop": "colModel[]",
1705 "dataIndex": "coitem_subtotal",
1706 "header": "SubTotal",
1708 "xtype": "ColumnModel",
1709 "|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 }",
1713 "*prop": "colModel[]",
1715 "dataIndex": "coitem_subtotal_tax",
1716 "header": "SubTotal w/GST",
1719 "xtype": "ColumnModel",
1720 "|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}",
1724 "*prop": "colModel[]",
1725 ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_unitcost\",\"columnshort\":\"coitem_unitcost\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Unit Cost\"}",
1727 "dataIndex": "coitem_unitcost_in_order_cur",
1728 "header": "Unit Cost",
1730 "xtype": "ColumnModel",
1731 "|renderer": "function(v) { return Roo.util.Format.number( v, 2); }",
1735 "*prop": "colModel[]",
1737 "dataIndex": "coitem_taxtype_id",
1740 "xtype": "ColumnModel",
1741 "|renderer": "function(v,x,r) { return String.format('{0}', r.data.coitem_taxtype_id_taxtype_name); }",
1746 "xtype": "GridEditor",
1751 "allowBlank": false,
1752 "displayField": "taxtype_name",
1754 "emptyText": "Select Tax Type",
1755 "forceSelection": true,
1756 "hiddenName": "coitem_taxtype_id",
1758 "loadingText": "Searching...",
1760 "name": "coitem_taxtype_id_taxtype_name",
1762 "qtip": "Select taxtype",
1763 "queryParam": "query[taxtype_id]",
1764 "selectOnFocus": true,
1765 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{taxtype_name}</b> </div>",
1766 "triggerAction": "all",
1768 "valueField": "taxtype_id",
1770 "xtype": "ComboBox",
1775 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n \n \n}\n"
1780 "|sortInfo": "{ direction : 'ASC', field: 'taxtype_name' }",
1786 "xtype": "HttpProxy",
1787 "|url": "baseURL + '/Roo/taxtype.php'",
1794 "totalProperty": "total",
1795 "xtype": "JsonReader",
1796 "|fields": "[{\"name\":\"taxtype_id\",\"type\":\"int\"},\"taxtype_name\"]",
1808 "*prop": "colModel[]",
1810 "dataIndex": "avail_qty",
1813 "xtype": "ColumnModel",
1814 "|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}",
1818 "*prop": "colModel[]",
1819 ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}",
1821 "dataIndex": "shipitem_shipped",
1822 "header": "#reserved",
1824 "xtype": "ColumnModel",
1825 "|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}",
1829 "*prop": "colModel[]",
1830 ".builderCfg": "{\"table\":\"coitem\",\"column\":\"coitem_qtyreserved\",\"columnshort\":\"coitem_qtyreserved\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"#reserved\"}",
1832 "dataIndex": "coitem_qtyshipped",
1833 "header": "#shipped",
1835 "xtype": "ColumnModel",
1836 "|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}",
1840 "*prop": "colModel[]",
1842 "dataIndex": "cobill_billed",
1843 "header": "#invoiced",
1845 "xtype": "ColumnModel",
1846 "|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}",
1855 "activate": "function (_self)\n{\n _this.shipinvtab = _self;\n}"
1858 "title": "Shipments / Invoices",
1859 "xtype": "NestedLayoutPanel",
1864 "xtype": "BorderLayout",
1870 "xtype": "LayoutRegion",
1876 "title": "Reserve Stock / Shipments",
1877 "xtype": "LayoutRegion",
1882 "|activate": "function() {\n _this.shippanel = this;\n if (_this.shipgrid) {\n _this.shipgrid.ds.load({});\n }\n}"
1884 ".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\"}",
1885 "background": false,
1886 "fitContainer": true,
1889 "tableName": "shiphead",
1890 "title": "shiphead",
1891 "xtype": "GridPanel",
1896 "|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}",
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"
1900 ".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\"}",
1901 "autoExpandColumn": "shiphead_shipvia",
1908 "singleSelect": true,
1909 "xtype": "RowSelectionModel",
1914 "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}"
1916 "*prop": "dataSource",
1917 ".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\"}",
1920 "|sortInfo": "{ field : 'shiphead_shipvia', direction: 'ASC' }",
1925 "xtype": "HttpProxy",
1927 "|url": "baseURL + '/Roo/shiphead.php'",
1932 "xtype": "JsonReader",
1933 "totalProperty": "total",
1935 ".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\"}",
1938 "|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]"
1949 "|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}"
1951 "cls": "x-btn-text-icon",
1952 "text": "Confirm Shipment",
1954 "|icon": "rootURL + '/Pman/templates/images/lock.gif'",
1955 "|xns": "Roo.Toolbar"
1959 "|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}"
1961 "cls": "x-btn-text-icon",
1962 "text": "Download (as xls)",
1964 "|icon": "rootURL + '/Pman/templates/images/save.gif'",
1965 "|xns": "Roo.Toolbar"
1969 "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}"
1971 "cls": "x-btn-text-icon",
1972 "text": "Print Picking Slip",
1974 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
1975 "|xns": "Roo.Toolbar"
1979 "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}"
1981 "cls": "x-btn-text-icon",
1982 "text": "Print Delivery Note",
1984 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
1985 "|xns": "Roo.Toolbar"
1989 "|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 if(!s.data.shiphead_shipdate.length || !s.data.shiphead_delivery_note.length || !s.data.shiphead_shipped){\n Roo.MessageBox.alert('Error', 'Shipment has not been confirmed or the delivery note has not been filled!');\n return;\n }\n \n Roo.log(s);\n}\n"
1991 "cls": "x-btn-text-icon",
1992 "text": "Send Delivery Email",
1994 "|icon": "Roo.rootURL + 'images/default/dd/email.gif'",
1995 "|xns": "Roo.Toolbar"
1999 "|xns": "Roo.Toolbar"
2003 "|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}",
2004 "render": "function (_self)\n{\n _this.addShipmentBtn = _self;\n}"
2006 "cls": "x-btn-text-icon",
2009 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2010 "|xns": "Roo.Toolbar"
2014 "|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 "
2016 "cls": "x-btn-text-icon",
2017 "text": "Void / Unconfirm",
2019 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
2020 "|xns": "Roo.Toolbar"
2025 "*prop": "colModel[]",
2026 ".builderCfg": "{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2027 "dataIndex": "shiphead_number",
2030 "xtype": "ColumnModel",
2031 "|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 }",
2035 "*prop": "colModel[]",
2036 "dataIndex": "shiphead_location_id_location_name",
2037 "header": "From Location",
2039 "xtype": "ColumnModel",
2040 "|renderer": "function(v) { return String.format('{0}', v); }",
2044 "*prop": "colModel[]",
2045 "dataIndex": "shiphead_shipto_id_shipto_name",
2046 "header": "Ship to",
2048 "xtype": "ColumnModel",
2049 "|renderer": "function(v) { return String.format('{0}', v); }",
2053 "xtype": "ColumnModel",
2054 ".builderCfg": "{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2055 "header": "shipdate",
2057 "dataIndex": "shiphead_shipdate",
2058 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
2060 "*prop": "colModel[]"
2063 "*prop": "colModel[]",
2064 ".builderCfg": "{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2065 "dataIndex": "shiphead_sfstatus",
2068 "xtype": "ColumnModel",
2069 "|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}",
2073 "xtype": "ColumnModel",
2074 ".builderCfg": "{\"table\":\"shiphead\",\"column\":\"shiphead_shipvia\",\"columnshort\":\"shiphead_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}",
2075 "header": "shipvia",
2077 "dataIndex": "shiphead_shipvia",
2078 "|renderer": "function(v) { return String.format('{0}', v); }",
2080 "*prop": "colModel[]"
2083 "xtype": "ColumnModel",
2084 ".builderCfg": "{\"table\":\"shiphead\",\"column\":\"shiphead_tracknum\",\"columnshort\":\"shiphead_tracknum\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2085 "header": "tracknum",
2087 "dataIndex": "shiphead_tracknum",
2088 "|renderer": "function(v) { return String.format('{0}', v); }",
2090 "*prop": "colModel[]"
2098 "|activate": "function() {\n _this.invpanel = this;\n if (_this.invgrid) {\n _this.invgrid.ds.load({});\n }\n}"
2100 "background": false,
2101 "fitContainer": true,
2104 "tableName": "cobmisc",
2105 "title": "Invoices",
2106 "xtype": "GridPanel",
2111 "|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}",
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"
2115 ".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\"}",
2116 "autoExpandColumn": "invchead_invcnumber",
2123 "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}",
2124 "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}"
2126 "*prop": "dataSource",
2129 "|sortInfo": "{ field : 'invchead_invcnumber', direction: 'ASC' }",
2135 "xtype": "HttpProxy",
2136 "|url": "baseURL + '/Roo/cobmisc.php'",
2141 ".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\"}",
2144 "totalProperty": "total",
2145 "xtype": "JsonReader",
2146 "|fields": "[\n {\n 'name': 'invchead_invcnumber',\n 'type': 'string'\n },\n {\n 'name': 'invchead_invcdate',\n 'type': 'date'\n }\n]",
2158 "|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}"
2160 "cls": "x-btn-text-icon",
2161 "text": "Post Invoice",
2163 "|icon": "rootURL + '/Pman/templates/images/lock.gif'",
2164 "|xns": "Roo.Toolbar"
2167 "cls": "x-btn-text-icon",
2170 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
2171 "|xns": "Roo.Toolbar",
2180 "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}"
2182 "text": "Print Standard Invoice",
2188 "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} "
2190 "text": "Print Chinese Invoice With GST in line item",
2192 "|hidden": "!(baseURL.match(/(hk\\.php|cn\\.php)$/))",
2197 "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} "
2199 "text": "Print Chinese Invoice",
2201 "|hidden": "!(baseURL.match(/(hk\\.php|cn\\.php)$/))",
2206 "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} "
2208 "text": "Print Aus - GST included Invoice",
2210 "|hidden": "!(baseURL.match(/au\\.php$/))",
2215 "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}"
2217 "text": "Print Bambini Pronto Invoice",
2219 "|hidden": "!(baseURL.match(/au\\.php$/))",
2224 "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} "
2226 "text": "Print Bambini Pro Forma Invoice",
2228 "|hidden": "!(baseURL.match(/au\\.php$/))",
2233 "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}"
2235 "text": "Print Shipping / Commercial Invoice",
2237 "|hidden": "!( baseURL.match(/au\\.php$/)) ",
2245 "cls": "x-btn-text-icon",
2246 "text": "Payments / Refunds / Credit Memos",
2248 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
2249 "|xns": "Roo.Toolbar",
2258 "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"
2260 "cls": "x-btn-text-icon",
2261 "text": "Receive Payment",
2263 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2268 "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"
2270 "cls": "x-btn-text-icon",
2271 "text": "Issue Refund",
2273 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2278 "xtype": "Separator"
2282 "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"
2284 "cls": "x-btn-text-icon",
2285 "text": "Void Payment",
2287 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
2292 "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"
2294 "cls": "x-btn-text-icon",
2295 "text": "Void Refund",
2297 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
2302 "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"
2304 "cls": "x-btn-text-icon",
2305 "text": "Void Credit Memo",
2307 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
2316 "|xns": "Roo.Toolbar"
2320 "|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}",
2321 "render": "function (_self)\n{\n _this.addInvoiceBtn = _self;\n}"
2323 "cls": "x-btn-text-icon",
2326 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
2327 "|xns": "Roo.Toolbar"
2331 "|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}"
2333 "cls": "x-btn-text-icon",
2334 "text": "Void / Unpost",
2336 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
2337 "|xns": "Roo.Toolbar"
2342 "*prop": "colModel[]",
2343 "dataIndex": "cobmisc_invchead_id_invchead_invcnumber",
2344 "header": "Invoice #",
2346 "xtype": "ColumnModel",
2347 "|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) [ {1} ]</span>', v, r.data.cobmisc_cashrcpt_amount); \n }\n \n return v ? String.format('{0}', v) : \n '<span style=\"color:red\">' + \"Not Posted\" + '</span>'; \n}",
2351 "*prop": "colModel[]",
2352 ".builderCfg": "{\"table\":\"invchead\",\"column\":\"invchead_invcdate\",\"columnshort\":\"invchead_invcdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2353 "dataIndex": "cobmisc_invcdate",
2354 "header": "invcdate",
2356 "xtype": "ColumnModel",
2357 "|renderer": "function(v,x,r) { \n\n return String.format('{0}', v && r.data.cobmisc_id > 0 ? v.format('d/M/Y') : ''); \n}",
2361 "*prop": "colModel[]",
2363 "dataIndex": "cobmisc_qty",
2366 "xtype": "ColumnModel",
2367 "|renderer": "function(v) { return String.format('{0}', v ? parseInt(v) : 0); }",
2371 "*prop": "colModel[]",
2373 "dataIndex": "cobmisc_itemcost",
2374 "header": "Item Cost",
2376 "xtype": "ColumnModel",
2377 "|renderer": "function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); }",
2381 "*prop": "colModel[]",
2383 "dataIndex": "cobmisc_freight",
2384 "header": "Shipping",
2386 "xtype": "ColumnModel",
2387 "|renderer": "function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : ''); }",
2391 "*prop": "colModel[]",
2393 "dataIndex": "cobmisc_tax",
2396 "xtype": "ColumnModel",
2397 "|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 }",
2401 "*prop": "colModel[]",
2403 "dataIndex": "cobmisc_cohead_id_cohead_pretax_discount",
2404 "header": "Discount (Pretax)",
2406 "xtype": "ColumnModel",
2407 "|renderer": "function(v) { return String.format('{0}', v ? (1.0*v).toFixed(2) : 0); }",
2411 "*prop": "colModel[]",
2413 "dataIndex": "cobmisc_misc",
2414 "header": "Discount (Posttax)",
2416 "xtype": "ColumnModel",
2417 "|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}",
2421 "*prop": "colModel[]",
2423 "dataIndex": "cobmisc_total",
2426 "xtype": "ColumnModel",
2427 "|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}",
2431 "*prop": "colModel[]",
2433 "dataIndex": "cobmisc_outstanding",
2434 "header": "Outstanding",
2436 "xtype": "ColumnModel",
2437 "|renderer": "function(v,x,r) \n{ \n \n return String.format('{0}', v ? (v * 1.0).toFixed(2) : 0 );\n}",
2450 "|activate": "function() {\n _this.hpanel = this;\n if (_this.hgrid) {\n _this.hgrid.footer.onClick('first');\n }\n}"
2452 ".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\"}",
2454 "fitContainer": true,
2457 "tableName": "events",
2459 "xtype": "GridPanel",
2464 "|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}",
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"
2468 ".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\"}",
2469 "autoExpandColumn": "remarks",
2476 "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}"
2478 "*prop": "dataSource",
2479 ".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\"}",
2482 "|sortInfo": "{ field : 'event_when', direction: 'DESC' }",
2487 "xtype": "HttpProxy",
2489 "|url": "baseURL + '/Roo/events.php'",
2494 ".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\"}",
2497 "totalProperty": "total",
2498 "xtype": "JsonReader",
2499 "|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]",
2506 "xtype": "PagingToolbar",
2508 "displayInfo": true,
2509 "displayMsg": "Displaying events{0} - {1} of {2}",
2510 "emptyMsg": "No events found",
2514 "*prop": "colModel[]",
2515 ".builderCfg": "{\"table\":\"events\",\"column\":\"event_when\",\"columnshort\":\"event_when\",\"ctype\":\"timestamp\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2516 "dataIndex": "event_when",
2517 "header": "Changed",
2519 "xtype": "ColumnModel",
2520 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
2524 "*prop": "colModel[]",
2525 ".builderCfg": "{\"table\":\"events\",\"column\":\"action\",\"columnshort\":\"action\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2526 "dataIndex": "action",
2529 "xtype": "ColumnModel",
2530 "|renderer": "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
2534 "*prop": "colModel[]",
2535 ".builderCfg": "{\"table\":\"events\",\"column\":\"ipaddr\",\"columnshort\":\"ipaddr\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2536 "dataIndex": "ipaddr",
2537 "header": "IP address",
2539 "xtype": "ColumnModel",
2540 "|renderer": "function(v) { return String.format('{0}', v); }",
2544 "*prop": "colModel[]",
2545 ".builderCfg": "{\"table\":\"person\",\"column\":\"person_id_name\",\"columnshort\":\"name\",\"ctype\":\"varchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}",
2546 "dataIndex": "person_id_name",
2549 "xtype": "ColumnModel",
2550 "|renderer": "function(v) { return String.format('{0}', v); }",
2554 "*prop": "colModel[]",
2555 ".builderCfg": "{\"table\":\"events\",\"column\":\"remarks\",\"columnshort\":\"remarks\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}",
2556 "dataIndex": "remarks",
2559 "xtype": "ColumnModel",
2560 "|renderer": "function(v) { return String.format('{0}', v); }",
2569 "title": "Stock Tx",
2570 "xtype": "NestedLayoutPanel",
2575 "xtype": "BorderLayout",
2580 "xtype": "LayoutRegion",
2587 "xtype": "LayoutRegion",
2592 "|activate": "function() {\n _this.txpanel = this;\n if (_this.txgrid) {\n _this.txgrid.footer.onClick('first');\n }\n}"
2594 "background": false,
2595 "fitContainer": true,
2598 "tableName": "invdetail",
2599 "title": "invdetail",
2600 "xtype": "GridPanel",
2605 "|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",
2620 "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}"
2622 "text": "Run Apply Fifo on order",
2624 "|xns": "Roo.Toolbar"
2628 "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}"
2630 "text": "Run Void flagger",
2632 "|xns": "Roo.Toolbar"
2636 "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}"
2638 "text": "Auto Reverse",
2640 "|xns": "Roo.Toolbar"
2646 "selectionchange": "function (_self)\n{\n _this.txdgrid.footer.onClick('first');;\n}"
2649 "singleSelect": true,
2650 "xtype": "RowSelectionModel",
2655 "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}"
2657 "*prop": "dataSource",
2660 "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
2666 "xtype": "HttpProxy",
2667 "|url": "baseURL + '/Roo/invdetail.php'",
2672 "xtype": "JsonReader",
2673 "totalProperty": "total",
2677 "|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]"
2683 "displayInfo": true,
2684 "displayMsg": "Displaying invdetail{0} - {1} of {2}",
2685 "emptyMsg": "No invdetail found",
2687 "xtype": "PagingToolbar",
2691 "*prop": "colModel[]",
2692 "dataIndex": "item_number",
2695 "xtype": "ColumnModel",
2696 "|renderer": "function(v) { return String.format('{0}', v); }",
2700 "*prop": "colModel[]",
2702 "dataIndex": "rec_shipped",
2705 "xtype": "ColumnModel",
2706 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2710 "*prop": "colModel[]",
2712 "dataIndex": "rec_returned",
2715 "xtype": "ColumnModel",
2716 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2720 "*prop": "colModel[]",
2722 "dataIndex": "tx_shipped",
2723 "header": "#TX ship",
2725 "xtype": "ColumnModel",
2726 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2730 "*prop": "colModel[]",
2732 "dataIndex": "tx_returned",
2733 "header": "#TX ret",
2735 "xtype": "ColumnModel",
2736 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2740 "*prop": "colModel[]",
2742 "dataIndex": "tx_total",
2743 "header": "#TX Tot",
2745 "xtype": "ColumnModel",
2746 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,0)); }",
2750 "*prop": "colModel[]",
2752 "dataIndex": "total_value",
2755 "xtype": "ColumnModel",
2756 "|renderer": "function(v,x,r) { \n\n return (v*1).toFixed(3);\n}",
2760 "*prop": "colModel[]",
2762 "dataIndex": "tx_total",
2765 "xtype": "ColumnModel",
2766 "|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 }",
2775 "|activate": "function() {\n _this.txdpanel = this;\n if (_this.txdgrid) {\n _this.txdgrid.footer.onClick('first');\n }\n}"
2777 "background": false,
2778 "fitContainer": true,
2781 "tableName": "invdetail",
2782 "title": "invdetail",
2783 "xtype": "GridPanel",
2788 "|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}",
2789 "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",
2804 "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}"
2806 "text": "Duplicate Selected",
2808 "|xns": "Roo.Toolbar"
2811 "|xns": "Roo.Toolbar",
2815 "text": "Issue Date",
2816 "xtype": "TextItem",
2817 "|xns": "Roo.Toolbar"
2821 "render": "function (_self)\n{\n _this.dateSel = _self;\n}"
2823 "allowBlank": false,
2824 "fieldLabel": "Issue Date",
2826 "name": "issue_date",
2828 "xtype": "DateField",
2833 "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}"
2835 "text": "Reverse Selected",
2837 "|xns": "Roo.Toolbar"
2843 "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}"
2845 "*prop": "dataSource",
2848 "|sortInfo": "{ field : 'invdetail_id', direction: 'ASC' }",
2854 "xtype": "HttpProxy",
2855 "|url": "baseURL + '/Roo/invdetail.php'",
2860 "xtype": "JsonReader",
2861 "totalProperty": "total",
2865 "|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]"
2871 "displayInfo": true,
2872 "displayMsg": "Displaying invdetail{0} - {1} of {2}",
2873 "emptyMsg": "No invdetail found",
2875 "xtype": "PagingToolbar",
2879 "*prop": "colModel[]",
2880 "dataIndex": "invdetail_id",
2883 "xtype": "ColumnModel",
2884 "|renderer": "function(v) { return String.format('{0}', v); }",
2888 "*prop": "colModel[]",
2889 "dataIndex": "invhist_transdate",
2892 "xtype": "ColumnModel",
2893 "|renderer": "function(v) { return String.format('{0}', v); }",
2897 "*prop": "colModel[]",
2898 "dataIndex": "invhist_ordnumber",
2901 "xtype": "ColumnModel",
2902 "|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 }",
2906 "*prop": "colModel[]",
2907 "dataIndex": "location_name",
2910 "xtype": "ColumnModel",
2911 "|renderer": "function(v) { return String.format('{0}', v); }",
2915 "*prop": "colModel[]",
2916 "dataIndex": "invhist_comments",
2919 "xtype": "ColumnModel",
2920 "|renderer": "function(v) { return String.format('{0}', v); }",
2924 "*prop": "colModel[]",
2926 "dataIndex": "invdetail_qty",
2927 "header": "Qty Changed",
2929 "xtype": "ColumnModel",
2930 "|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}",
2934 "*prop": "colModel[]",
2936 "dataIndex": "invhist_value_before",
2937 "header": "Qty Changed",
2939 "xtype": "ColumnModel",
2940 "|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}",
2944 "*prop": "colModel[]",
2945 "dataIndex": "invhist_posted",
2948 "xtype": "ColumnModel",
2949 "|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 }",
2963 "xtype": "NestedLayoutPanel",
2968 "xtype": "BorderLayout",
2973 "xtype": "LayoutRegion",
2980 "xtype": "LayoutRegion",
2985 "|activate": "function() {\n _this.gltxpanel = this;\n if (_this.gltxgrid) {\n _this.gltxgrid.footer.onClick('first');\n }\n}"
2987 "background": false,
2988 "fitContainer": true,
2991 "tableName": "invdetail",
2992 "title": "invdetail",
2993 "xtype": "GridPanel",
2998 "|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}",
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}"
3002 "autoExpandColumn": "gltrans_accnt_id_accnt_descrip",
3009 "selectionchange": "function (_self)\n{\n _this.gltxdgrid.footer.onClick('first');;\n}"
3012 "singleSelect": true,
3013 "xtype": "RowSelectionModel",
3018 "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}"
3020 "*prop": "dataSource",
3023 "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
3029 "xtype": "HttpProxy",
3030 "|url": "baseURL + '/Roo/gltrans.php'",
3035 "xtype": "JsonReader",
3036 "totalProperty": "total",
3040 "|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]"
3046 "displayInfo": true,
3047 "displayMsg": "Displaying invdetail{0} - {1} of {2}",
3048 "emptyMsg": "No invdetail found",
3050 "xtype": "PagingToolbar",
3055 "render": "function (_self)\n{\n _this.glsalesbtn = _self;\n}",
3056 "click": "function (_self, e)\n{\n (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);\n}"
3058 "enableToggle": true,
3060 "text": "Split sales",
3062 "|xns": "Roo.Toolbar"
3067 "*prop": "colModel[]",
3068 "dataIndex": "gltrans_as_summary",
3069 "header": "Summary",
3071 "xtype": "ColumnModel",
3072 "|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 }",
3076 "*prop": "colModel[]",
3077 "dataIndex": "gltrans_accnt_id_accnt_descrip",
3078 "header": "Account",
3080 "xtype": "ColumnModel",
3081 "|renderer": "function(v) { return String.format('{0}', v); }",
3085 "*prop": "colModel[]",
3087 "dataIndex": "gltrans_amount_credit",
3090 "xtype": "ColumnModel",
3091 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }",
3095 "*prop": "colModel[]",
3097 "dataIndex": "gltrans_amount_debit",
3100 "xtype": "ColumnModel",
3101 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }",
3105 "*prop": "colModel[]",
3107 "dataIndex": "gltrans_amount_total",
3110 "xtype": "ColumnModel",
3111 "|renderer": "function(v) { return String.format('<b>{0}</b>', Roo.util.Format.number(v,3)); }",
3115 "*prop": "colModel[]",
3117 "dataIndex": "gltrans_amount_total_unposted",
3118 "header": "Unposted",
3120 "xtype": "ColumnModel",
3121 "|renderer": "function(v) { return String.format('<span style=\"color:red\">{0}</span>', Roo.util.Format.number(v,3)); }",
3130 "|activate": "function() {\n _this.gltxdpanel = this;\n if (_this.gltxdgrid) {\n _this.gltxdgrid.footer.onClick('first');\n }\n}"
3132 "background": false,
3133 "fitContainer": true,
3136 "tableName": "invdetail",
3137 "title": "invdetail",
3138 "xtype": "GridPanel",
3143 "|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}",
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}"
3147 "autoExpandColumn": "gltrans_notes",
3154 "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}"
3156 "*prop": "dataSource",
3159 "|sortInfo": "{ field : 'gltrans_docnumber', direction: 'ASC' }",
3165 "xtype": "HttpProxy",
3166 "|url": "baseURL + '/Roo/gltrans.php'",
3171 "xtype": "JsonReader",
3172 "totalProperty": "total",
3176 "|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]"
3182 "displayInfo": true,
3183 "displayMsg": "Displaying invdetail{0} - {1} of {2}",
3184 "emptyMsg": "No invdetail found",
3186 "xtype": "PagingToolbar",
3191 "click": "function (_self, e)\n{\n new Pman.Download( {\n grid : _this.gltxdgrid\n \n });\n}"
3195 "|xns": "Roo.Toolbar"
3200 "*prop": "colModel[]",
3201 "dataIndex": "gltrans_id",
3205 "xtype": "ColumnModel",
3206 "|renderer": "function(v) { return String.format('{0}', v ); }",
3210 "*prop": "colModel[]",
3211 "dataIndex": "gltrans_date",
3214 "xtype": "ColumnModel",
3215 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
3219 "*prop": "colModel[]",
3220 "dataIndex": "gltrans_docnumber",
3223 "xtype": "ColumnModel",
3224 "|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}",
3228 "*prop": "colModel[]",
3229 "dataIndex": "gltrans_source",
3232 "xtype": "ColumnModel",
3233 "|renderer": "function(v) { return String.format('{0}', v); }",
3237 "*prop": "colModel[]",
3238 "dataIndex": "gltrans_notes",
3241 "xtype": "ColumnModel",
3242 "|renderer": "function(v) { return String.format('{0}', v); }",
3246 "*prop": "colModel[]",
3248 "dataIndex": "gltrans_amount",
3251 "xtype": "ColumnModel",
3252 "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }",
3256 "*prop": "colModel[]",
3257 "dataIndex": "gltrans_posted",
3260 "xtype": "ColumnModel",
3261 "|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 }",
3274 "|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 "fitContainer": true,
3280 "tableName": "coitem",
3282 "xtype": "GridPanel",
3287 "|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",
3297 "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}"
3299 "*prop": "dataSource",
3302 "|sortInfo": "{ field : 'coitem_linenumber,coitem_subnumber', direction: 'ASC' }",
3308 "xtype": "HttpProxy",
3309 "|url": "baseURL + '/Roo/coitem.php'",
3314 "xtype": "JsonReader",
3315 "totalProperty": "total",
3319 "|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]"
3325 "displayInfo": true,
3326 "displayMsg": "Displaying coitem{0} - {1} of {2}",
3327 "emptyMsg": "No coitem found",
3329 "xtype": "PagingToolbar",
3333 "*prop": "colModel[]",
3334 "dataIndex": "item_number",
3335 "header": "Item Code",
3337 "xtype": "ColumnModel",
3338 "|renderer": "function(v) { return String.format('{0}', v); }",
3342 "*prop": "colModel[]",
3343 "dataIndex": "calc_subtotal",
3344 "header": "SubTotal",
3346 "xtype": "ColumnModel",
3347 "|renderer": "function(v) {\n\n\n return Roo.util.Format.number( v, 2);\n }",
3351 "*prop": "colModel[]",
3352 "dataIndex": "calc_cost_total",
3353 "header": "Cost of goods",
3355 "xtype": "ColumnModel",
3356 "|renderer": "function(v) {\n\n return Roo.util.Format.number( v, 2);\n }",
3360 "*prop": "colModel[]",
3361 "dataIndex": "profit",
3364 "xtype": "ColumnModel",
3365 "|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}",
3374 "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}",
3375 "render": "function (_self)\n{\n _this.reversalBtn = _self;\n}"
3377 "*prop": "buttons[]",
3378 "text": "Create CM reversal",
3384 "click": "function (_self, e)\n{\n if (_this.grid) _this.grid.stopEditing();\n _this.dialog.hide();\n}"
3386 "*prop": "buttons[]",
3393 "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}",
3394 "render": "function (_self)\n{\n _this.saveBtn = _self;\n}"
3396 "*prop": "buttons[]",