3 "name": "Pman.Tab.XtupleSalesHistory",
4 "parent": "Pman.Tab.XtupleSales",
5 "title": "Pman.Tab.XtupleSalesHistory",
6 "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleSalesHistory.bjs",
10 "|activate": "function() {\n _this.hpanel = this;\n if (_this.hgrid) {\n _this.hgrid.footer.onClick('first');\n }\n}"
16 "tableName": "cohist",
17 "title": "Sales History",
23 "|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}",
24 "|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n"
27 "autoExpandColumn": "item_descrip1",
34 "beforeload": "function (_self, o)\n{\n \n Roo.apply(o.params, {\n _group : 'salesHistory',\n _name : 'bydate',\n \n 'credit:text' : 'credit',\n 'return:text' : 'return',\n 'includeFormatted:int' : 1,\n 'startDate:text' : _this.dateFrom.getValue(),\n 'endDate:text' : _this.dateTo.getValue()\n \n });\n \n if (_this.custSel.getValue()) {\n o.params['cust_id:number'] = _this.custSel.getValue();\n }\n \n if (_this.countrySel.getValue()) {\n o.params['addr_country:text'] = _this.countrySel.getValue();\n }\n \n if (_this.postalCodeSel.getValue()) {\n o.params['addr_postalcode:text'] = _this.postalCodeSel.getValue();\n }\n \n if (_this.itemSel.getValue()) {\n o.params['item_id:number'] = _this.itemSel.getValue();\n }\n \n if (_this.orderRep.getValue()) {\n o.params['cohist_salesrep_id:number'] = _this.orderRep.getValue();\n }\n \n if (_this.custRep.getValue()) {\n o.params['cust_salesrep_id:number'] = _this.custRep.getValue();\n }\n \n}"
36 "*prop": "dataSource",
39 "|sortInfo": "{ field : 'cohist_shipvia', direction: 'ASC' }",
46 "|url": "baseURL + '/Roo/metasql.php'",
51 "xtype": "JsonReader",
52 "totalProperty": "total",
56 "|fields": "[\n {\n 'name': 'cohist_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_cust_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_itemsite_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_shipdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cohist_shipvia',\n 'type': 'string'\n },\n {\n 'name': 'cohist_ordernumber',\n 'type': 'string'\n },\n {\n 'name': 'cohist_orderdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cohist_invcnumber',\n 'type': 'string'\n },\n {\n 'name': 'cohist_invcdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cohist_qtyshipped',\n 'type': 'float'\n },\n {\n 'name': 'cohist_unitprice',\n 'type': 'float'\n },\n {\n 'name': 'cohist_shipto_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_salesrep_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_duedate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cohist_imported',\n 'type': 'int'\n },\n {\n 'name': 'cohist_billtoname',\n 'type': 'string'\n },\n {\n 'name': 'cohist_billtoaddress1',\n 'type': 'string'\n },\n {\n 'name': 'cohist_billtoaddress2',\n 'type': 'string'\n },\n {\n 'name': 'cohist_billtoaddress3',\n 'type': 'string'\n },\n {\n 'name': 'cohist_billtocity',\n 'type': 'string'\n },\n {\n 'name': 'cohist_billtostate',\n 'type': 'string'\n },\n {\n 'name': 'cohist_billtozip',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptoname',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptoaddress1',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptoaddress2',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptoaddress3',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptocity',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptostate',\n 'type': 'string'\n },\n {\n 'name': 'cohist_shiptozip',\n 'type': 'string'\n },\n {\n 'name': 'cohist_commission',\n 'type': 'float'\n },\n {\n 'name': 'cohist_commissionpaid',\n 'type': 'int'\n },\n {\n 'name': 'cohist_unitcost',\n 'type': 'float'\n },\n {\n 'name': 'cohist_misc_type',\n 'type': 'string'\n },\n {\n 'name': 'cohist_misc_descrip',\n 'type': 'string'\n },\n {\n 'name': 'cohist_misc_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_doctype',\n 'type': 'string'\n },\n {\n 'name': 'cohist_promisedate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'cohist_ponumber',\n 'type': 'string'\n },\n {\n 'name': 'cohist_curr_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_sequence',\n 'type': 'int'\n },\n {\n 'name': 'cohist_taxtype_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_taxzone_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_curr_id_curr_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_curr_id_curr_base',\n 'type': 'int'\n },\n {\n 'name': 'cohist_curr_id_curr_name',\n 'type': 'string'\n },\n {\n 'name': 'cohist_curr_id_curr_symbol',\n 'type': 'string'\n },\n {\n 'name': 'cohist_curr_id_curr_abbr',\n 'type': 'string'\n },\n {\n 'name': 'cohist_taxzone_id_taxzone_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_taxzone_id_taxzone_code',\n 'type': 'string'\n },\n {\n 'name': 'cohist_taxzone_id_taxzone_descrip',\n 'type': 'string'\n },\n {\n 'name': 'cohist_taxtype_id_taxtype_id',\n 'type': 'int'\n },\n {\n 'name': 'cohist_taxtype_id_taxtype_name',\n 'type': 'string'\n },\n {\n 'name': 'cohist_taxtype_id_taxtype_descrip',\n 'type': 'string'\n },\n {\n 'name': 'cohist_taxtype_id_taxtype_sys',\n 'type': 'int'\n }\n]"
63 "displayMsg": "Displaying Sales History {0} - {1} of {2}",
64 "emptyMsg": "No cohist found",
66 "xtype": "PagingToolbar",
70 "text": "<span class=\"sales-footer-text\"></span>",
83 "render": "function (_self)\n{\n _this.custSel = _self;\n}"
86 "displayField": "cust_name",
88 "emptyText": "Select Customer",
89 "fieldLabel": "cust_name",
90 "forceSelection": true,
91 "hiddenName": "cust_id",
93 "loadingText": "Searching...",
97 "qtip": "Select Customer",
98 "queryParam": "query[cust_name]",
99 "selectOnFocus": true,
100 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
101 "triggerAction": "all",
103 "valueField": "cust_id",
110 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
115 "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
120 "xtype": "HttpProxy",
123 "|url": "baseURL + '/Roo/custinfo.php'"
127 "xtype": "JsonReader",
131 "totalProperty": "total",
132 "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
140 "render": "function (_self)\n{\n _this.countrySel = _self;\n}"
143 "displayField": "addr_country",
145 "emptyText": "Select Country",
146 "fieldLabel": "addr_country",
147 "forceSelection": true,
148 "hiddenName": "addr_country",
150 "loadingText": "Searching...",
152 "name": "addr_country",
154 "qtip": "Select Country",
155 "queryParam": "query[addr_country]",
156 "selectOnFocus": true,
157 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_country}</b> </div>",
158 "triggerAction": "all",
160 "valueField": "addr_country",
167 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params._distinct = 'addr_country';\n o.params._columns = 'addr_country'; \n o.params['!addr_country'] = ''; \n // set more here\n}\n"
172 "|sortInfo": "{ direction : 'ASC', field: 'addr_country' }",
178 "xtype": "HttpProxy",
179 "|url": "baseURL + '/Roo/addr.php'",
184 "id": "addr_country",
186 "totalProperty": "total",
187 "xtype": "JsonReader",
188 "|fields": "[{\"name\":\"addr_country\",\"type\":\"string\"}]",
197 "render": "function (_self)\n{\n _this.postalCodeSel = _self;\n}"
200 "displayField": "addr_postalcode",
202 "emptyText": "Select Postal Code",
203 "fieldLabel": "addr_postalcode",
204 "forceSelection": true,
205 "hiddenName": "addr_postalcode",
207 "loadingText": "Searching...",
209 "name": "addr_postalcode",
211 "qtip": "Select Postal Code",
212 "queryParam": "query[addr_postalcode]",
213 "selectOnFocus": true,
214 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_postalcode}</b> </div>",
215 "triggerAction": "all",
217 "valueField": "addr_postalcode",
224 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params._distinct = 'addr_postalcode';\n o.params._columns = 'addr_postalcode'; \n o.params['!addr_postalcode'] = ''; \n // set more here\n}\n"
229 "|sortInfo": "{ direction : 'ASC', field: 'addr_postalcode' }",
235 "xtype": "HttpProxy",
236 "|url": "baseURL + '/Roo/addr.php'",
241 "id": "addr_postalcode",
243 "totalProperty": "total",
244 "xtype": "JsonReader",
245 "|fields": "[{\"name\":\"addr_postalcode\",\"type\":\"string\"}]",
254 "render": "function (_self)\n{\n _this.itemSel = _self;\n}"
257 "displayField": "item_number",
259 "emptyText": "Select Item Number",
260 "fieldLabel": "item_number",
261 "forceSelection": true,
262 "hiddenName": "item_number",
264 "loadingText": "Searching...",
266 "name": "item_number",
268 "qtip": "Select Item Number",
269 "queryParam": "query[number_or_name]",
270 "selectOnFocus": true,
271 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>",
272 "triggerAction": "all",
274 "valueField": "item_id",
281 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n"
286 "|sortInfo": "{ direction : 'ASC', field: 'item_number' }",
292 "xtype": "HttpProxy",
293 "|url": "baseURL + '/Roo/Item.php'",
300 "totalProperty": "total",
301 "xtype": "JsonReader",
302 "|fields": "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]",
311 "render": "function (_self)\n{\n _this.orderRep = _self;\n}"
314 "displayField": "salesrep_name",
316 "emptyText": "Order Sales Rep",
317 "fieldLabel": "Order Sales Rep",
318 "forceSelection": true,
319 "hiddenName": "salesrep_name",
321 "loadingText": "Searching...",
323 "name": "salesrep_name",
325 "qtip": "Select Order Sales Rep",
326 "queryParam": "query[name]",
327 "selectOnFocus": true,
328 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
329 "triggerAction": "all",
331 "valueField": "salesrep_id",
338 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params.salesrep_active = 1\n}\n"
343 "|sortInfo": "{ direction : 'ASC', field: 'salesrep_id' }",
349 "xtype": "HttpProxy",
350 "|url": "baseURL + '/Roo/Salesrep.php'",
357 "totalProperty": "total",
358 "xtype": "JsonReader",
359 "|fields": "[{\"name\":\"salesrep_id\",\"type\":\"int\"}]",
368 "render": "function (_self)\n{\n _this.custRep = _self;\n}"
371 "displayField": "salesrep_name",
373 "emptyText": "Customer Sales Rep",
374 "fieldLabel": "Customer Sales Rep",
375 "forceSelection": true,
376 "hiddenName": "salesrep_name",
378 "loadingText": "Searching...",
380 "name": "salesrep_name",
382 "qtip": "Select Customer Sales Rep",
383 "queryParam": "query[name]",
384 "selectOnFocus": true,
385 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>",
386 "triggerAction": "all",
388 "valueField": "salesrep_id",
395 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params.salesrep_active = 1\n}\n"
400 "|sortInfo": "{ direction : 'ASC', field: 'salesrep_id' }",
406 "xtype": "HttpProxy",
407 "|url": "baseURL + '/Roo/Salesrep.php'",
414 "totalProperty": "total",
415 "xtype": "JsonReader",
416 "|fields": "[{\"name\":\"salesrep_id\",\"type\":\"int\"}]",
426 "|xns": "Roo.Toolbar"
430 "render": "function (_self)\n{\n _this.dateFrom = _self;\n}"
434 "xtype": "DateField",
435 "|value": "(function() {return (new Date()).add(Date.MONTH, -3); })()",
441 "|xns": "Roo.Toolbar"
445 "render": "function (_self)\n{\n_this.dateTo = _self;\n}"
449 "xtype": "DateField",
450 "|value": "(function() {return (new Date()) })()",
455 "click": "function (_self, e)\n{\n _this.hgrid.footer.onClick('first');\n}"
459 "|xns": "Roo.Toolbar"
462 "|xns": "Roo.Toolbar",
468 "|xns": "Roo.Toolbar",
477 "click": "function (_self, e)\n{\n var o = { params : {}};\n Roo.apply(o.params, {\n _group : 'salesHistory',\n _name : 'bydate',\n csvCols : '*', csvTitles : '*',\n 'credit:text' : 'credit',\n 'return:text' : 'return',\n 'includeFormatted:int' : 1,\n 'startDate:text' : _this.dateFrom.getValue(),\n 'endDate:text' : _this.dateTo.getValue(),\n limit : 99999\n \n });\n \n if (_this.custSel.getValue()) {\n o.params['cust_id:number'] = _this.custSel.getValue();\n }\n \n if (_this.countrySel.getValue()) {\n o.params['addr_country:text'] = _this.countrySel.getValue();\n }\n \n if (_this.postalCodeSel.getValue()) {\n o.params['addr_postalcode:text'] = _this.postalCodeSel.getValue();\n }\n \n if (_this.itemSel.getValue()) {\n o.params['item_id:number'] = _this.itemSel.getValue();\n }\n \n if (_this.orderRep.getValue()) {\n o.params['cohist_salesrep_id:number'] = _this.orderRep.getValue();\n }\n \n if (_this.custRep.getValue()) {\n o.params['cust_salesrep_id:number'] = _this.custRep.getValue();\n }\n \n \n new Pman.Download({\n url: baseURL + '/Roo/Metasql',\n params : o.params,\n limit : 100000,\n newWindow : true\n });\n}"
479 "text": "Sales History",
485 "click": "function (_self, e)\n{\n var o = { params : {}};\n Roo.apply(o.params, {\n _group : 'salesHistory',\n _name : 'stockist',\n csvCols : '*', csvTitles : '*',\n 'credit:text' : 'credit',\n 'return:text' : 'return',\n 'includeFormatted:int' : 1,\n 'startDate:text' : _this.dateFrom.getValue(),\n 'endDate:text' : _this.dateTo.getValue(),\n limit : 99999\n \n });\n \n if (_this.custSel.getValue()) {\n o.params['cust_id:number'] = _this.custSel.getValue();\n }\n \n if (_this.countrySel.getValue()) {\n o.params['addr_country:text'] = _this.countrySel.getValue();\n }\n \n if (_this.postalCodeSel.getValue()) {\n o.params['addr_postalcode:text'] = _this.postalCodeSel.getValue();\n }\n \n if (_this.itemSel.getValue()) {\n o.params['item_id:number'] = _this.itemSel.getValue();\n }\n \n if (_this.orderRep.getValue()) {\n o.params['cohist_salesrep_id:number'] = _this.orderRep.getValue();\n }\n \n if (_this.custRep.getValue()) {\n o.params['cust_salesrep_id:number'] = _this.custRep.getValue();\n }\n \n \n new Pman.Download({\n url: baseURL + '/Roo/Metasql',\n params : o.params,\n limit : 100000,\n newWindow : true\n });\n}"
487 "text": "Stockists Summary",
498 "*prop": "colModel[]",
499 "dataIndex": "cust_id",
502 "xtype": "ColumnModel",
503 "|renderer": "function(v) { return String.format('{0}', v); }",
507 "*prop": "colModel[]",
508 "dataIndex": "cust_name",
509 "header": "Customer",
511 "xtype": "ColumnModel",
512 "|renderer": "function(v) { return String.format('{0}', v); }",
516 "*prop": "colModel[]",
517 "dataIndex": "order_salesrep_name",
518 "header": "Order Sales Rep",
520 "xtype": "ColumnModel",
521 "|renderer": "function(v) { return String.format('{0}', v); }",
525 "*prop": "colModel[]",
526 "dataIndex": "cust_salesrep_name",
527 "header": "Customer Sales Rep",
530 "xtype": "ColumnModel",
531 "|renderer": "function(v) { return String.format('{0}', v); }",
535 "*prop": "colModel[]",
536 "dataIndex": "addr_country",
539 "xtype": "ColumnModel",
540 "|renderer": "function(v) { return String.format('{0}', v); }",
544 "*prop": "colModel[]",
545 "dataIndex": "addr_city",
549 "xtype": "ColumnModel",
550 "|renderer": "function(v) { return String.format('{0}', v); }",
554 "*prop": "colModel[]",
555 "dataIndex": "addr_state",
559 "xtype": "ColumnModel",
560 "|renderer": "function(v) { return String.format('{0}', v); }",
564 "*prop": "colModel[]",
565 "dataIndex": "addr_postalcode",
566 "header": "Postal Code",
568 "xtype": "ColumnModel",
569 "|renderer": "function(v) { return String.format('{0}', v); }",
573 "*prop": "colModel[]",
574 "dataIndex": "cohist_ordernumber",
577 "xtype": "ColumnModel",
578 "|renderer": "function(v) { return String.format('{0}', v); }",
582 "*prop": "colModel[]",
583 "dataIndex": "cohead_orderdate",
584 "header": "Order date",
586 "xtype": "ColumnModel",
587 "|renderer": "function(v) { \n var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', d ? d.format('d/M/Y') : '');\n }",
591 "*prop": "colModel[]",
592 "dataIndex": "invmonth",
593 "header": "Invoice Month",
595 "xtype": "ColumnModel",
596 "|renderer": "function(v) { \n \n return String.format('{0}', v);\n }",
600 "*prop": "colModel[]",
601 "dataIndex": "cohist_invcdate",
602 "header": "Invoice date",
604 "xtype": "ColumnModel",
605 "|renderer": "function(v) { \n var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', d ? d.format('d/M/Y') : '');\n }",
609 "*prop": "colModel[]",
610 "dataIndex": "cohist_invcnumber",
611 "header": "Invoice#",
613 "xtype": "ColumnModel",
614 "|renderer": "function(v) { return String.format('{0}', v); }",
618 "*prop": "colModel[]",
619 "dataIndex": "item_brand",
622 "xtype": "ColumnModel",
623 "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
627 "*prop": "colModel[]",
628 "dataIndex": "item_number",
629 "header": "Item No.",
631 "xtype": "ColumnModel",
632 "|renderer": "function(v) { return String.format('{0}', v ? v : ''); }",
636 "*prop": "colModel[]",
637 "dataIndex": "item_descrip1",
638 "header": "Description",
640 "xtype": "ColumnModel",
641 "|renderer": "function(v) { return String.format('{0}', v); }",
645 "*prop": "colModel[]",
647 "dataIndex": "cohist_qtyshipped",
650 "xtype": "ColumnModel",
651 "|renderer": "function(v) { return parseInt(v); }",
655 "*prop": "colModel[]",
656 "dataIndex": "currabbr",
657 "header": "Currency",
659 "xtype": "ColumnModel",
660 "|renderer": "function(v) { return String.format('{0}', v.split(/\\s+/)[0]); }",
664 "*prop": "colModel[]",
666 "dataIndex": "cohist_unitprice",
667 "header": "Unit Price",
669 "xtype": "ColumnModel",
670 "|renderer": "function(v) { return Roo.util.Format.number( v, 2); }",
674 "*prop": "colModel[]",
676 "dataIndex": "extprice",
677 "header": "Ext Cost",
679 "xtype": "ColumnModel",
680 "|renderer": "function(v) { return Roo.util.Format.number( v, 2); }",
684 "*prop": "colModel[]",
686 "dataIndex": "extpricebase",
687 "header": "Ext Price (Base)",
689 "xtype": "ColumnModel",
690 "|renderer": "function(v) { return Roo.util.Format.number( v, 2); }",
694 "*prop": "colModel[]",
696 "dataIndex": "baseunitprice",
697 "header": "Unit Price (Base)",
700 "xtype": "ColumnModel",
701 "|renderer": "function(v) { return Roo.util.Format.number( v, 2); }",
705 "*prop": "colModel[]",
707 "dataIndex": "basefifovalue",
708 "header": "Fifo Cost",
710 "xtype": "ColumnModel",
711 "|renderer": "function(v) { return Roo.util.Format.number( v, 2); }",