3 "name": "Pman.Tab.XtupleCreditMemos",
4 "parent": "Pman.Tab.XtupleSales",
5 "title": "Pman.Tab.XtupleCreditMemos",
6 "path": "/home/alan/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",
83 "render": "function (_self)\n{\n _this.cmnumber = _self;\n}",
84 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
87 "displayField": "cmhead_number",
90 "fieldLabel": "ordernumber",
91 "forceSelection": true,
92 "hiddenName": "cmhead_id",
94 "loadingText": "Searching...",
96 "name": "cmhead_number",
98 "qtip": "Select invchead",
99 "queryParam": "query[cmhead_number]",
100 "selectOnFocus": true,
101 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cmhead_number}</b> </div>",
102 "triggerAction": "all",
104 "valueField": "cmhead_id",
111 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
116 "|sortInfo": "{ direction : 'ASC', field: 'cmhead_number' }",
122 "xtype": "HttpProxy",
123 "|url": "baseURL + '/Roo/cmhead.php'",
130 "totalProperty": "total",
131 "xtype": "JsonReader",
132 "|fields": "[{\"name\":\"cmhead_id\",\"type\":\"int\"},\"cmhead_number\"]",
141 "render": "function (_self)\n{\n _this.customer = _self;\n}",
142 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
145 "displayField": "cust_name",
147 "emptyText": "Select Customer",
148 "fieldLabel": "cust_name",
149 "forceSelection": true,
150 "hiddenName": "cust_id",
152 "loadingText": "Searching...",
156 "qtip": "Select custinfo",
157 "queryParam": "query[cust_name]",
158 "selectOnFocus": true,
159 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
160 "triggerAction": "all",
162 "valueField": "cust_id",
170 "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
174 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
179 "xtype": "HttpProxy",
182 "|url": "baseURL + '/Roo/custinfo.php'"
186 "xtype": "JsonReader",
190 "totalProperty": "total",
191 "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
199 "render": "function (_self)\n{\n _this.status = _self;\n}",
200 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
203 "displayField": "fname",
205 "fieldLabel": "Status",
206 "hiddenName": "cm_status",
209 "name": "cm_status_name",
210 "triggerAction": "all",
211 "value": "NOTCLOSED",
212 "valueField": "ftype",
219 "xtype": "SimpleStore",
220 "|data": "[ \n [ 'NOTCLOSED', \"Not Closed\"],\n [ 'CLOSED' , \"Closed\"],\n [ 'UNPOSTED', \"Unposted only\"] ,\n [ 'UNUSED', \"Posted and not used\"] ,\n [ 'VOIDED', \"Voided\"] \n]\n",
221 "|fields": "[ 'ftype', 'fname']",
227 "|xns": "Roo.Toolbar",
231 "cls": "x-btn-text-icon",
234 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
235 "|xns": "Roo.Toolbar",
244 "click": "function (_self, e)\n{\n Pman.Dialog.XtupleCreditMemoNew.show( {} , function() {\n _this.grid.footer.onClick('first');\n }); \n\n}"
246 "cls": "x-btn-text-icon",
247 "text": "New Credit Memo",
249 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
258 "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}"
260 "cls": "x-btn-text-icon",
261 "text": "New Miscellaneous Check",
263 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
271 "|xns": "Roo.Toolbar",
276 "|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"
278 "cls": "x-btn-text-icon",
279 "text": "Void Credit Memo",
281 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
282 "|xns": "Roo.Toolbar"
285 "|xns": "Roo.Toolbar",
290 "|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"
292 "cls": "x-btn-text-icon",
293 "text": "Delete Credit Memo",
295 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
296 "|xns": "Roo.Toolbar"
299 "|xns": "Roo.Toolbar",
304 "|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"
306 "cls": "x-btn-text-icon",
309 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
310 "|xns": "Roo.Toolbar"
313 "|xns": "Roo.Toolbar",
318 "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}"
320 "cls": "x-btn-text-icon",
323 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
324 "|xns": "Roo.Toolbar"
327 "|xns": "Roo.Toolbar",
331 "cls": "x-btn-text-icon",
334 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
335 "|xns": "Roo.Toolbar",
348 "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}"
350 "cls": "x-btn-text-icon",
351 "text": "Fix Blank Return Stock",
353 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
363 "*prop": "colModel[]",
364 "dataIndex": "cmhead_number",
368 "xtype": "ColumnModel",
369 "|renderer": "function(v) { return String.format('{0}', v); }",
373 "*prop": "colModel[]",
374 "dataIndex": "cmhead_docdate",
378 "xtype": "ColumnModel",
379 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
383 "*prop": "colModel[]",
384 "dataIndex": "cmhead_salesrep_id_salesrep_name",
385 "header": "Sales Rep",
388 "xtype": "ColumnModel",
389 "|renderer": "function(v) { return String.format('{0}', v ); }",
393 "*prop": "colModel[]",
394 ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
395 "dataIndex": "cmhead_cust_id_cust_name",
396 "header": "Customer",
398 "xtype": "ColumnModel",
399 "|renderer": "function(v) { return String.format('{0}', v); }",
403 "*prop": "colModel[]",
405 "dataIndex": "cmhead_curr_id_curr_symbol",
406 "header": "Currency",
408 "xtype": "ColumnModel",
409 "|renderer": "function(v)\n{\n return String.format('{0}', v ? v : '??');\n}",
413 "*prop": "colModel[]",
415 "dataIndex": "cmhead_value",
418 "xtype": "ColumnModel",
419 "|renderer": "function(v)\n{\n return Roo.util.Format.usMoney(v);\n}",
423 "*prop": "colModel[]",
425 "dataIndex": "cmhead_unpaid",
426 "header": "Open Value",
428 "xtype": "ColumnModel",
429 "|renderer": "function(v,x,r)\n{\n if (!r.data.cmhead_posted) {\n return '';\n }\n return Roo.util.Format.usMoney(v);\n}",
433 "*prop": "colModel[]",
434 "dataIndex": "cmhead_posted",
437 "xtype": "ColumnModel",
438 "|renderer": "function(v) { return String.format('{0}', v ? 'Yes':''); }",