3 "name": "Pman.Tab.XtupleCreditMemos",
4 "parent": "Pman.Tab.XtupleSales",
5 "title": "Pman.Tab.XtupleCreditMemos",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCreditMemos.bjs",
10 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
16 "tableName": "cmhead",
17 "title": "Credit Memos",
23 "|render": "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
24 "|rowdblclick": "function (_self, rowIndex, e)\n{\n var s = this.dataSource.getAt(rowIndex);\n Pman.Dialog.XtupleCreditMemo.show({\n cmhead_id : s.data.cmhead_id\n },function() {\n _this.grid.footer.onClick('first');\n \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"
27 "autoExpandColumn": "cmhead_cust_id_cust_name",
34 "beforeload": "function (_self, o)\n{\n if ( _this.customer && _this.customer.getValue() ) {\n o.params.cmhead_cust_id = _this.customer.getValue();\n }\n if (_this.cmnumber && _this.cmnumber.getValue() ) {\n o.params.cmhead_id = _this.cmnumber.getValue();\n }\n if (_this.status) { \n o.params['query[status]'] = _this.status.getValue();\n }\n \n o.params._with_aropen = 1;\n}"
36 "*prop": "dataSource",
39 "|sortInfo": "{ field : 'cmhead_id', direction: 'DESC' }",
46 "|url": "baseURL + '/Roo/cmhead.php'",
51 "xtype": "JsonReader",
52 "totalProperty": "total",
56 "|fields": "[\n {\n 'name': 'cmhead_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_number',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_posted',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_invcnumber',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_custponumber',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_cust_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_docdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cmhead_shipto_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_shipto_name',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_address1',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_address2',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_address3',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_city',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_state',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_zipcode',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_salesrep_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_freight',\n 'type': 'float'\n },\n {\n 'name': 'cmhead_misc',\n 'type': 'float'\n },\n {\n 'name': 'cmhead_comments',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_printed',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_billtoname',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_billtoaddress1',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_billtoaddress2',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_billtoaddress3',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_billtocity',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_billtostate',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_billtozip',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_hold',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_commission',\n 'type': 'float'\n },\n {\n 'name': 'cmhead_misc_accnt_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_misc_descrip',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_rsncode_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_curr_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_freighttaxtype_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_gldistdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cmhead_billtocountry',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_shipto_country',\n 'type': 'string'\n },\n {\n 'name': 'cmhead_rahead_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_taxzone_id',\n 'type': 'int'\n },\n {\n 'name': 'cmhead_prj_id',\n 'type': 'int'\n }\n]"
62 "xtype": "PagingToolbar",
65 "displayMsg": "Displaying cmhead{0} - {1} of {2}",
66 "emptyMsg": "No cmhead found",
71 "click": "function (_self, e)\n{\n new Pman.Download({\n grid : _this.grid\n });\n Roo.MessageBox.alert(\"Notice\", \"Report is downloading\");\n}"
86 "render": "function (_self)\n{\n _this.cmnumber = _self;\n}",
87 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
90 "displayField": "cmhead_number",
93 "fieldLabel": "ordernumber",
94 "forceSelection": true,
95 "hiddenName": "cmhead_id",
97 "loadingText": "Searching...",
99 "name": "cmhead_number",
101 "qtip": "Select invchead",
102 "queryParam": "query[cmhead_number]",
103 "selectOnFocus": true,
104 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cmhead_number}</b> </div>",
105 "triggerAction": "all",
107 "valueField": "cmhead_id",
114 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
119 "|sortInfo": "{ direction : 'ASC', field: 'cmhead_number' }",
125 "xtype": "HttpProxy",
126 "|url": "baseURL + '/Roo/cmhead.php'",
133 "totalProperty": "total",
134 "xtype": "JsonReader",
135 "|fields": "[{\"name\":\"cmhead_id\",\"type\":\"int\"},\"cmhead_number\"]",
144 "render": "function (_self)\n{\n _this.customer = _self;\n}",
145 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
148 "displayField": "cust_name",
150 "emptyText": "Select Customer",
151 "fieldLabel": "cust_name",
152 "forceSelection": true,
153 "hiddenName": "cust_id",
155 "loadingText": "Searching...",
159 "qtip": "Select custinfo",
160 "queryParam": "query[cust_name]",
161 "selectOnFocus": true,
162 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
163 "triggerAction": "all",
165 "valueField": "cust_id",
173 "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
177 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
182 "xtype": "HttpProxy",
185 "|url": "baseURL + '/Roo/custinfo.php'"
189 "xtype": "JsonReader",
193 "totalProperty": "total",
194 "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
202 "render": "function (_self)\n{\n _this.status = _self;\n}",
203 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
206 "displayField": "fname",
208 "fieldLabel": "Status",
209 "hiddenName": "cm_status",
212 "name": "cm_status_name",
213 "triggerAction": "all",
214 "value": "NOTCLOSED",
215 "valueField": "ftype",
222 "xtype": "SimpleStore",
223 "|data": "[ \n [ 'NOTCLOSED', \"Not Closed\"],\n [ 'CLOSED' , \"Closed\"],\n [ 'UNPOSTED', \"Unposted only\"] ,\n [ 'UNUSED', \"Posted and not used\"] ,\n [ 'VOIDED', \"Voided\"],\n [ 'NOTVOIDED', \"Not Voided\"],\n [ 'ALL', \"Show All\"],\n]\n",
224 "|fields": "[ 'ftype', 'fname']",
230 "|xns": "Roo.Toolbar",
234 "cls": "x-btn-text-icon",
237 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
238 "|xns": "Roo.Toolbar",
247 "click": "function (_self, e)\n{\n Pman.Dialog.XtupleCreditMemoNew.show( {} , function() {\n _this.grid.footer.onClick('first');\n }); \n\n}"
249 "cls": "x-btn-text-icon",
250 "text": "New Credit Memo",
252 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
261 "click": "function (_self, e)\n{\n var s = _this.grid.getSelectionModel().getSelections();\n\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n } \n if(s[0].data.checkhead_total == 0){\n Roo.MessageBox.alert(\"Error\", \"you cannot create the miscellaneous check for the credit memo coz the total amount remaining is 0! \");\n return;\n }\n if(!s[0].data.cmhead_posted){\n Roo.MessageBox.alert(\"Error\", \"This credit memo has not been posted!\");\n return;\n }\n var data = {\n 'checkhead_recip_id' : s[0].data.cmhead_cust_id,\n 'checkhead_recip_type' : 'C',\n 'checkhead_checkdate' : new Date(),\n 'checkhead_amount' : s[0].data.checkhead_total,\n 'remaining_total' : s[0].data.checkhead_total,\n 'checkhead_curr_id' : s[0].data.cmhead_curr_id,\n 'checkhead_curr_id_curr_name' : s[0].data.cmhead_curr_id_curr_name,\n 'checkhead_misc' : true,\n 'aropen_id' : s[0].data.cmhead_aropen_id_aropen_id,\n \t'cmhead_number' : s[0].data.cmhead_number,\n\t'cust_name' : s[0].data.cmhead_cust_id_cust_name,\n\t'_create_and_post' : 1\n\n };\n \n \n Pman.Dialog.XtupleMiscellaneousCheck.show( data , function() {\n _this.grid.footer.onClick('first');\n }); \n\n}"
263 "cls": "x-btn-text-icon",
264 "text": "New Miscellaneous Check",
266 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
274 "|xns": "Roo.Toolbar",
279 "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n\n var postit = function()\n {\n new Pman.Request(\n {\n url : baseURL + '/Roo/Cmhead',\n mask: 'Voiding',\n method : 'POST',\n params : {\n cmhead_id : s[0].data.cmhead_id,\n _void : 1\n },\n success : function()\n {\n _this.grid.footer.onClick('refresh');\n } \n });\n \n };\n\n\n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to void this credit memo?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n postit();\n }\n );\n \n}\n"
281 "cls": "x-btn-text-icon",
282 "text": "Void Credit Memo",
284 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
285 "|xns": "Roo.Toolbar"
288 "|xns": "Roo.Toolbar",
293 "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n if (s[0].data.cmhead_posted ) { \n Roo.MessageBox.alert(\"Error\", \n \"You can not delete posted credit memo's - you have to create an invoice to reverse them\");\n return;\n }\n \n \n\n var postit = function()\n {\n new Pman.Request(\n {\n url : baseURL + '/Roo/Cmhead',\n mask: 'Deleting',\n method : 'POST',\n params : {\n _delete : s[0].data.cmhead_id \n },\n success : function()\n {\n _this.grid.footer.onClick('refresh');\n } \n });\n \n };\n\n\n Roo.MessageBox.confirm(\n \"Confirm Deletion\",\n \"You will have to make sure this credit memo has no line items associated before deleting it. \",\n function(r) {\n if (r != 'yes') {\n return;\n }\n postit();\n }\n );\n \n}\n"
295 "cls": "x-btn-text-icon",
296 "text": "Delete Credit Memo",
298 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
299 "|xns": "Roo.Toolbar"
302 "|xns": "Roo.Toolbar",
307 "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n\n var postit = function()\n {\n new Pman.Request(\n {\n url : baseURL + '/Roo/Cmhead',\n mask: 'Posting',\n method : 'POST',\n params : {\n cmhead_id : s[0].data.cmhead_id,\n _post : 1\n },\n success : function()\n {\n _this.grid.footer.onClick('refresh');\n } \n });\n \n };\n\n\n Roo.MessageBox.confirm(\n \"Confirm Posting\",\n \"Are you sure that is complete, <B>Voiding a Credit memo invoices creating a sales order and invoice</B>, so make sure this is correct before posting\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n postit();\n }\n ); \n \n}\n"
309 "cls": "x-btn-text-icon",
312 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
313 "|xns": "Roo.Toolbar"
316 "|xns": "Roo.Toolbar",
321 "click": "function ()\n{\n var s = _this.grid.getSelectionModel().getSelected();\n if (!s || !s.data.cmhead_id) {\n Roo.MessageBox.alert(\"Error\", \"Select a credit memo\");\n return\n }\n \n var ext = baseURL.split('/').pop().replace(/\\.php/, '');\n new Pman.Download({\n url : baseURL + '/Xtuple/Print',\n params : {\n template: 'creditmemo-' + ext,\n filename : 'creditmemo-' + s.data.cmhead_id,\n 'param[0]': \"cmhead_id:string='\" + s.data.cmhead_id + \"'\"\n \n },\n method : 'GET'\n });\n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n \n \n \n}"
323 "cls": "x-btn-text-icon",
326 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
327 "|xns": "Roo.Toolbar"
330 "|xns": "Roo.Toolbar",
334 "cls": "x-btn-text-icon",
337 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
338 "|xns": "Roo.Toolbar",
351 "click": "function (_self, e)\n{\n Roo.MessageBox.confirm(\n \"Confirm\",\n \"It is going to fill in all the blank return stock. Are you sure?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n new Pman.Request(\n {\n url : baseURL + '/Roo/Cmhead',\n mask: 'Processing',\n method : 'POST',\n params : {\n _fix_stock : 1\n },\n success : function()\n {\n Roo.MessageBox.alert('Notice','Fixed');\n _this.grid.footer.onClick('refresh');\n } \n });\n }\n ); \n}"
353 "cls": "x-btn-text-icon",
354 "text": "Fix Blank Return Stock",
356 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
366 "*prop": "colModel[]",
367 "dataIndex": "cmhead_number",
371 "xtype": "ColumnModel",
372 "|renderer": "function(v) { return String.format('{0}', v); }",
376 "*prop": "colModel[]",
377 "dataIndex": "cmhead_docdate",
381 "xtype": "ColumnModel",
382 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
386 "*prop": "colModel[]",
387 "dataIndex": "cmhead_salesrep_id_salesrep_name",
388 "header": "Sales Rep",
391 "xtype": "ColumnModel",
392 "|renderer": "function(v) { return String.format('{0}', v ); }",
396 "*prop": "colModel[]",
397 "dataIndex": "cust_salesrep_salesrep_name",
398 "header": "Cust. Sales Rep",
401 "xtype": "ColumnModel",
402 "|renderer": "function(v) { return String.format('{0}', v ); }",
406 "*prop": "colModel[]",
407 ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
408 "dataIndex": "cmhead_cust_id_cust_name",
409 "header": "Customer",
411 "xtype": "ColumnModel",
412 "|renderer": "function(v) { return String.format('{0}', v); }",
416 "*prop": "colModel[]",
418 "dataIndex": "cmhead_curr_id_curr_symbol",
419 "header": "Currency",
421 "xtype": "ColumnModel",
422 "|renderer": "function(v)\n{\n return String.format('{0}', v ? v : '??');\n}",
426 "*prop": "colModel[]",
428 "dataIndex": "cmhead_value",
431 "xtype": "ColumnModel",
432 "|renderer": "function(v)\n{\n return Roo.util.Format.usMoney(v);\n}",
436 "*prop": "colModel[]",
438 "dataIndex": "cmhead_unpaid",
439 "header": "Open Value",
441 "xtype": "ColumnModel",
442 "|renderer": "function(v,x,r)\n{\n if (!r.data.cmhead_posted) {\n return '';\n }\n return Roo.util.Format.usMoney(v);\n}",
446 "*prop": "colModel[]",
447 "dataIndex": "cmhead_posted",
450 "xtype": "ColumnModel",
451 "|renderer": "function(v) { return String.format('{0}', v ? 'Yes':''); }",