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",
76 "render": "function (_self)\n{\n _this.cmnumber = _self;\n}",
77 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
80 "displayField": "cmhead_number",
83 "fieldLabel": "ordernumber",
84 "forceSelection": true,
85 "hiddenName": "cmhead_id",
87 "loadingText": "Searching...",
89 "name": "cmhead_number",
91 "qtip": "Select invchead",
92 "queryParam": "query[cmhead_number]",
93 "selectOnFocus": true,
94 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cmhead_number}</b> </div>",
95 "triggerAction": "all",
97 "valueField": "cmhead_id",
104 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
109 "|sortInfo": "{ direction : 'ASC', field: 'cmhead_number' }",
115 "xtype": "HttpProxy",
116 "|url": "baseURL + '/Roo/cmhead.php'",
123 "totalProperty": "total",
124 "xtype": "JsonReader",
125 "|fields": "[{\"name\":\"cmhead_id\",\"type\":\"int\"},\"cmhead_number\"]",
134 "render": "function (_self)\n{\n _this.customer = _self;\n}",
135 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
138 "displayField": "cust_name",
140 "emptyText": "Select Customer",
141 "fieldLabel": "cust_name",
142 "forceSelection": true,
143 "hiddenName": "cust_id",
145 "loadingText": "Searching...",
149 "qtip": "Select custinfo",
150 "queryParam": "query[cust_name]",
151 "selectOnFocus": true,
152 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
153 "triggerAction": "all",
155 "valueField": "cust_id",
163 "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
167 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
172 "xtype": "HttpProxy",
175 "|url": "baseURL + '/Roo/custinfo.php'"
179 "xtype": "JsonReader",
183 "totalProperty": "total",
184 "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
192 "render": "function (_self)\n{\n _this.status = _self;\n}",
193 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
196 "displayField": "fname",
198 "fieldLabel": "Status",
199 "hiddenName": "cm_status",
202 "name": "cm_status_name",
203 "triggerAction": "all",
204 "value": "NOTCLOSED",
205 "valueField": "ftype",
212 "xtype": "SimpleStore",
213 "|data": "[ \n [ 'NOTCLOSED', \"Not Closed\"],\n [ 'CLOSED' , \"Closed\"],\n [ 'UNPOSTED', \"Unposted only\"] ,\n [ 'UNUSED', \"Posted and not used\"] ,\n [ 'VOIDED', \"Voided\"] \n]\n",
214 "|fields": "[ 'ftype', 'fname']",
220 "|xns": "Roo.Toolbar",
224 "cls": "x-btn-text-icon",
227 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
228 "|xns": "Roo.Toolbar",
237 "click": "function (_self, e)\n{\n Pman.Dialog.XtupleCreditMemoNew.show( {} , function() {\n _this.grid.footer.onClick('first');\n }); \n\n}"
239 "cls": "x-btn-text-icon",
240 "text": "New Credit Memo",
242 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
251 "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}"
253 "cls": "x-btn-text-icon",
254 "text": "New Miscellaneous Check",
256 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
264 "|xns": "Roo.Toolbar",
269 "|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"
271 "cls": "x-btn-text-icon",
272 "text": "Void Credit Memo",
274 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
275 "|xns": "Roo.Toolbar"
278 "|xns": "Roo.Toolbar",
283 "|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"
285 "cls": "x-btn-text-icon",
286 "text": "Delete Credit Memo",
288 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
289 "|xns": "Roo.Toolbar"
292 "|xns": "Roo.Toolbar",
297 "|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"
299 "cls": "x-btn-text-icon",
302 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
303 "|xns": "Roo.Toolbar"
306 "|xns": "Roo.Toolbar",
311 "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}"
313 "cls": "x-btn-text-icon",
316 "|icon": "rootURL + '/Pman/templates/images/pdf.gif'",
317 "|xns": "Roo.Toolbar"
320 "|xns": "Roo.Toolbar",
324 "cls": "x-btn-text-icon",
327 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
328 "|xns": "Roo.Toolbar",
341 "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}"
343 "cls": "x-btn-text-icon",
344 "text": "Fix Blank Return Stock",
346 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
356 "*prop": "colModel[]",
357 "dataIndex": "cmhead_number",
361 "xtype": "ColumnModel",
362 "|renderer": "function(v) { return String.format('{0}', v); }",
366 "*prop": "colModel[]",
367 "dataIndex": "cmhead_docdate",
371 "xtype": "ColumnModel",
372 "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
376 "*prop": "colModel[]",
377 "dataIndex": "cmhead_salesrep_id_salesrep_name",
378 "header": "Sales Rep",
381 "xtype": "ColumnModel",
382 "|renderer": "function(v) { return String.format('{0}', v ); }",
386 "*prop": "colModel[]",
387 ".builderCfg": "{\"table\":\"custinfo\",\"column\":\"cohead_cust_id_cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"Customer\"}",
388 "dataIndex": "cmhead_cust_id_cust_name",
389 "header": "Customer",
391 "xtype": "ColumnModel",
392 "|renderer": "function(v) { return String.format('{0}', v); }",
396 "*prop": "colModel[]",
398 "dataIndex": "cmhead_curr_id_curr_symbol",
399 "header": "Currency",
401 "xtype": "ColumnModel",
402 "|renderer": "function(v)\n{\n return String.format('{0}', v ? v : '??');\n}",
406 "*prop": "colModel[]",
408 "dataIndex": "cmhead_value",
411 "xtype": "ColumnModel",
412 "|renderer": "function(v)\n{\n return Roo.util.Format.usMoney(v);\n}",
416 "*prop": "colModel[]",
418 "dataIndex": "cmhead_unpaid",
419 "header": "Open Value",
421 "xtype": "ColumnModel",
422 "|renderer": "function(v,x,r)\n{\n if (!r.data.cmhead_posted) {\n return '';\n }\n return Roo.util.Format.usMoney(v);\n}",
426 "*prop": "colModel[]",
427 "dataIndex": "cmhead_posted",
430 "xtype": "ColumnModel",
431 "|renderer": "function(v) { return String.format('{0}', v ? 'Yes':''); }",