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",
70 "|xns": "Roo.Toolbar",
82 "render": "function (_self)\n{\n _this.cmnumber = _self;\n}",
83 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
86 "displayField": "cmhead_number",
89 "fieldLabel": "ordernumber",
90 "forceSelection": true,
91 "hiddenName": "cmhead_id",
93 "loadingText": "Searching...",
95 "name": "cmhead_number",
97 "qtip": "Select invchead",
98 "queryParam": "query[cmhead_number]",
99 "selectOnFocus": true,
100 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cmhead_number}</b> </div>",
101 "triggerAction": "all",
103 "valueField": "cmhead_id",
110 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
115 "|sortInfo": "{ direction : 'ASC', field: 'cmhead_number' }",
121 "xtype": "HttpProxy",
122 "|url": "baseURL + '/Roo/cmhead.php'",
129 "totalProperty": "total",
130 "xtype": "JsonReader",
131 "|fields": "[{\"name\":\"cmhead_id\",\"type\":\"int\"},\"cmhead_number\"]",
140 "render": "function (_self)\n{\n _this.customer = _self;\n}",
141 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
144 "displayField": "cust_name",
146 "emptyText": "Select Customer",
147 "fieldLabel": "cust_name",
148 "forceSelection": true,
149 "hiddenName": "cust_id",
151 "loadingText": "Searching...",
155 "qtip": "Select custinfo",
156 "queryParam": "query[cust_name]",
157 "selectOnFocus": true,
158 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
159 "triggerAction": "all",
161 "valueField": "cust_id",
169 "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
173 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
178 "xtype": "HttpProxy",
181 "|url": "baseURL + '/Roo/custinfo.php'"
185 "xtype": "JsonReader",
189 "totalProperty": "total",
190 "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
198 "render": "function (_self)\n{\n _this.status = _self;\n}",
199 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
202 "displayField": "fname",
204 "fieldLabel": "Status",
205 "hiddenName": "cm_status",
208 "name": "cm_status_name",
209 "triggerAction": "all",
210 "value": "NOTCLOSED",
211 "valueField": "ftype",
218 "xtype": "SimpleStore",
219 "|data": "[ \n [ 'NOTCLOSED', \"Not Closed\"],\n [ 'CLOSED' , \"Closed\"],\n [ 'UNPOSTED', \"Unposted only\"] ,\n [ 'UNUSED', \"Posted and not used\"] ,\n [ 'VOIDED', \"Voided\"] \n]\n",
220 "|fields": "[ 'ftype', 'fname']",
226 "|xns": "Roo.Toolbar",
230 "cls": "x-btn-text-icon",
233 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
234 "|xns": "Roo.Toolbar",
243 "click": "function (_self, e)\n{\n Pman.Dialog.XtupleCreditMemoNew.show( {} , function() {\n _this.grid.footer.onClick('first');\n }); \n\n}"
245 "cls": "x-btn-text-icon",
246 "text": "New Credit Memo",
248 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
257 "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}"
259 "cls": "x-btn-text-icon",
260 "text": "New Miscellaneous Check",
262 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
270 "|xns": "Roo.Toolbar",
275 "|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"
277 "cls": "x-btn-text-icon",
278 "text": "Void Credit Memo",
280 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
281 "|xns": "Roo.Toolbar"
284 "|xns": "Roo.Toolbar",
289 "|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"
291 "cls": "x-btn-text-icon",
292 "text": "Delete Credit Memo",
294 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
295 "|xns": "Roo.Toolbar"
298 "|xns": "Roo.Toolbar",
303 "|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"
305 "cls": "x-btn-text-icon",
308 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
309 "|xns": "Roo.Toolbar"
312 "|xns": "Roo.Toolbar",
317 "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}"
319 "cls": "x-btn-text-icon",
322 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
323 "|xns": "Roo.Toolbar"
326 "|xns": "Roo.Toolbar",
330 "cls": "x-btn-text-icon",
333 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
334 "|xns": "Roo.Toolbar",
347 "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}"
349 "cls": "x-btn-text-icon",
350 "text": "Fix Blank Return Stock",
352 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
362 "*prop": "colModel[]",
363 "dataIndex": "cmhead_number",
367 "xtype": "ColumnModel",
368 "|renderer": "function(v) { return String.format('{0}', v); }",
372 "*prop": "colModel[]",
373 "dataIndex": "cmhead_docdate",
377 "xtype": "ColumnModel",
378 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
382 "*prop": "colModel[]",
383 "dataIndex": "cmhead_salesrep_id_salesrep_name",
384 "header": "Sales Rep",
387 "xtype": "ColumnModel",
388 "|renderer": "function(v) { return String.format('{0}', v ); }",
392 "*prop": "colModel[]",
393 ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
394 "dataIndex": "cmhead_cust_id_cust_name",
395 "header": "Customer",
397 "xtype": "ColumnModel",
398 "|renderer": "function(v) { return String.format('{0}', v); }",
402 "*prop": "colModel[]",
404 "dataIndex": "cmhead_curr_id_curr_symbol",
405 "header": "Currency",
407 "xtype": "ColumnModel",
408 "|renderer": "function(v)\n{\n return String.format('{0}', v ? v : '??');\n}",
412 "*prop": "colModel[]",
414 "dataIndex": "cmhead_value",
417 "xtype": "ColumnModel",
418 "|renderer": "function(v)\n{\n return Roo.util.Format.usMoney(v);\n}",
422 "*prop": "colModel[]",
424 "dataIndex": "cmhead_unpaid",
425 "header": "Open Value",
427 "xtype": "ColumnModel",
428 "|renderer": "function(v,x,r)\n{\n if (!r.data.cmhead_posted) {\n return '';\n }\n return Roo.util.Format.usMoney(v);\n}",
432 "*prop": "colModel[]",
433 "dataIndex": "cmhead_posted",
436 "xtype": "ColumnModel",
437 "|renderer": "function(v) { return String.format('{0}', v ? 'Yes':''); }",