3 "name": "Pman.Tab.XtupleStockHistory",
4 "parent": "Pman.Tab.XtupleManage",
5 "title": "Pman.Tab.XtupleStockHistory",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleStockHistory.bjs",
10 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
16 "tableName": "invhist",
17 "title": "Inventory History",
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 "celldblclick": "function (_self, rowIndex, colIndex, e)\n{\n var col = _this.grid.colModel.config[colIndex].dataIndex;\n \n if (col !='item_number') {\n return;\n }\n var r = _this.grid.ds.getAt(rowIndex).data;\n \n _this.itemsiteCombo.setValue(r.item_number);\n _this.grid.footer.onClick('first');\n \n \n}"
27 "autoExpandColumn": "invhist_comments",
39 "select": "function (combo, record, index)\n{\n \n \n (function() { \n if (_this.grid) {\n _this.grid.footer.onClick('first'); \n }\n }).defer(100);\n}",
40 "render": "function (_self)\n{\n _this.itemsiteCombo = _self;\n}"
43 "displayField": "itemsite_item_id_item_number",
45 "emptyText": "Select itemsite",
47 "forceSelection": true,
49 "loadingText": "Searching...",
51 "name": "itemsite_item_id_item_number",
53 "qtip": "Select itemsite",
54 "queryParam": "query[number]",
55 "selectOnFocus": true,
56 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> {itemsite_item_id_item_descrip1}</div>",
57 "triggerAction": "all",
59 "valueField": "itemsite_item_id_item_number",
66 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n var l = _this.locationCombo.getValue();\n if (l ) { \n o.params._has_invdetail_location_id = l;\n }\n\n}\n"
71 "|sortInfo": "{ direction : 'ASC', field: 'id' }",
78 "|url": "baseURL + '/Roo/itemsite.php'",
83 "xtype": "JsonReader",
87 "totalProperty": "total",
88 "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"itemsite_abcclass\",\"type\":\"string\"}]"
96 "select": "function (combo, record, index)\n{\n \n \n (function() { \n if (_this.grid) {\n _this.grid.footer.onClick('first'); \n }\n }).defer(100);\n}",
97 "render": "function (_self)\n{\n _this.locationCombo = _self;\n} "
100 "displayField": "location_descrip",
102 "emptyText": "Select location",
103 "fieldLabel": "location",
104 "forceSelection": true,
105 "hiddenName": "location_id",
107 "loadingText": "Searching...",
109 "name": "location_descrip",
111 "qtip": "Select location",
112 "queryParam": "query[location_name]",
113 "selectOnFocus": true,
114 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_descrip}</b> </div>",
115 "triggerAction": "all",
117 "valueField": "location_id",
124 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params._has_invdetail = 1;\n // set more here\n var item_num = _this.itemsiteCombo.getValue();\n if (item_num.length) {\n o.params._has_invdetail_item = item_num;\n }\n \n}\n"
129 "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
135 "xtype": "HttpProxy",
136 "|url": "baseURL + '/Roo/location.php'",
141 "xtype": "JsonReader",
145 "totalProperty": "total",
146 "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"location_name\",\"type\":\"string\"}]"
154 "render": "function (_self)\n{\n _this.viewtype = _self;\n}",
155 "select": "function (combo, record, index)\n{\n Roo.log('select');\n _this.grid.footer.onClick('first');\n}"
158 "displayField": "fname",
160 "hiddenName": "status",
163 "name": "status_name",
164 "triggerAction": "all",
166 "valueField": "ftype",
173 "xtype": "SimpleStore",
174 "|data": "[ \n [ 'BOTH', \"All Transactions\"],\n [ 'IN' , \"Incomming\"],\n [ 'OUT', \"Outgoing\"] ,\n [ 'BOTHALL', \"All Transactions (with voided)\"]\n\n]\n",
175 "|fields": "[ 'ftype', 'fname']",
181 "|xns": "Roo.Toolbar",
187 "|xns": "Roo.Toolbar"
191 "render": "function (_self)\n{\n _this.dateSel = _self;\n}",
192 "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}"
195 "fieldLabel": "Date",
199 "xtype": "DateField",
203 "|xns": "Roo.Toolbar",
209 "|xns": "Roo.Toolbar"
213 "render": "function (_self)\n{\n _this.endDateSel = _self;\n}",
214 "select": "function (combo, date)\n{\n _this.grid.footer.onClick('first');\n}"
217 "fieldLabel": "Date",
221 "xtype": "DateField",
225 "|xns": "Roo.Toolbar",
229 "text": "Download Reports",
231 "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
232 "|xns": "Roo.Toolbar",
241 "click": "function (_self, e)\n{\n if (!_this.itemsiteCombo.getValue().length && \n !_this.locationCombo.getValue() && \n !_this.dateSel.getValue() && \n !_this.endDateSel.getValue()) {\n _this.grid.ds.removeAll();\n Roo.MessageBox.alert(\"Error\", \"Nothing to download!\");\n return false;\n }\n \n new Pman.Download({\n //params : {_asExcel : 1, limit : 99999},\n grid : _this.grid,\n newWindow : 1\n });\n \n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
249 "click": "function (_self, e)\n{\n \n var dt = _this.dateSel.getValue();\n var end_dt = _this.endDateSel.getValue();\n \n \n if(!dt){\n Roo.Msg.alert('Error', 'Please select a FROM date to download');\n return;\n }\n if(!end_dt){\n Roo.Msg.alert('Error', 'Please select a TO date to download');\n return;\n }\n \n var params = {\n _group : 'invhist',\n _name : 'summary',\n 'from_dt:text' : dt,\n 'to_dt:text' : end_dt,\n \n csvCols : '*',\n csvTitles : '*', \n limit : 9999 \n \n }\n if ( _this.locationCombo.getValue() * 1) {\n params['invdetail_location_id:number'] = _this.locationCombo.getValue() ;\n }\n \n \n new Pman.Download({\n url : baseURL + '/Roo/Metasql',\n method : 'GET',\n params : params\n });\n \n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
251 "text": "Summary of Orders/Transfers",
261 "click": "function (_self, e)\n{\n\n new Pman.Download({\n url : baseURL + '/Roo/Metasql',\n method : 'GET',\n params : {\n _group : 'inventory',\n _name : 'asset',\n csvCols : '*',\n csvTitles : '*', \n limit : 9999 \n \n }\n });\n \n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
263 "text": "Day by Day - GL to stock comparison",
269 "click": "function (_self, e)\n{\n var dt = _this.dateSel.getValue();\n \n if(!dt){\n Roo.Msg.alert('Error', 'Please select a FROM date to download');\n return;\n }\n \n new Pman.Download({\n url : baseURL + '/Roo/Metasql',\n method : 'GET',\n params : {\n _group : 'inventory',\n _name : 'bydate',\n '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n csvCols : '*',\n csvTitles : '*', \n limit : 9999 \n \n }\n });\n \n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
271 "text": "Inventory Transactions on From date",
277 "click": "function (_self, e)\n{\n var dt = _this.dateSel.getValue();\n \n if(!dt){\n Roo.Msg.alert('Error', 'Please select a FROM date to download');\n return;\n }\n \n new Pman.Download({\n url : baseURL + '/Roo/Metasql',\n method : 'GET',\n params : {\n _group : 'gltrans',\n _name : 'bydate',\n '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n csvCols : '*',\n csvTitles : '*', \n limit : 9999 \n \n }\n });\n \n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
279 "text": "GL Stock Transactions on From date",
289 "click": "function (_self, e)\n{\n var dt = _this.dateSel.getValue();\n var end_dt = _this.endDateSel.getValue();\n var location_id = _this.locationCombo.getValue() *1;\n \n if(!dt){\n Roo.Msg.alert('Error', 'Please select a FROM date to download');\n return;\n }\n if(!end_dt){\n Roo.Msg.alert('Error', 'Please select a TO date to download');\n return;\n }\n if(!location_id){\n Roo.Msg.alert('Error', 'Please select a Location to download');\n return;\n }\n new Pman.Download({\n url : baseURL + '/Roo/Metasql',\n newWindow : 1,\n method : 'GET',\n params : {\n _group : 'invdetail',\n '_name[0]' : 'opening',\n '_name[1]' : 'closing', \n '_name[2]' : 'byitem',\n '_name[3]' : 'bydate', \n 'location_id:number' : location_id,\n 'from_dt:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n 'to_dt:text' : typeof(end_dt) == 'string' ? end_dt : end_dt.format('Y-m-d'), \n limit : 9999 \n \n }\n });\n \n Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}\n"
291 "text": "Consignment Detail Report",
303 "beforeload": "function (_self, o)\n{\n if (!_this.itemsiteCombo.getValue().length && \n !_this.locationCombo.getValue() && \n !_this.dateSel.getValue() && \n !_this.endDateSel.getValue()) {\n _this.grid.ds.removeAll();\n return false;\n }\n o.params['query[item_number]'] = _this.itemsiteCombo.getValue();\n o.params.invdetail_location_id = _this.locationCombo.getValue();\n o.params['query[viewtype]'] = _this.viewtype.getValue(); \n o.params._with_item =1;\n \n var start = _this.dateSel.getValue();\n var end = _this.endDateSel.getValue();\n \n o.params['query[dateSel]'] = typeof(start) == 'string' ? start : start.format('Y-m-d');\n o.params['query[endDateSel]'] = typeof(end) == 'string' ? end : end.format('Y-m-d');\n \n o.params._with_balance = 1;\n \n \n}"
305 "*prop": "dataSource",
308 "|sortInfo": "{ field : 'invhist_transdate,invdetail_id', direction: 'DESC' }",
314 "xtype": "HttpProxy",
315 "|url": "baseURL + '/Roo/invdetail.php'",
320 "xtype": "JsonReader",
321 "totalProperty": "total",
325 "|fields": "[\n {\n 'name': 'invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invhist_itemsite_id',\n 'type': 'int'\n },\n {\n 'name': 'invhist_transdate',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invhist_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invhist_invqty',\n 'type': 'float'\n },\n {\n 'name': 'invhist_invuom',\n 'type': 'string'\n },\n {\n 'name': 'invhist_ordnumber',\n 'type': 'string'\n },\n {\n 'name': 'invhist_docnumber',\n 'type': 'string'\n },\n {\n 'name': 'invhist_qoh_before',\n 'type': 'float'\n },\n {\n 'name': 'invhist_qoh_after',\n 'type': 'float'\n },\n {\n 'name': 'invhist_unitcost',\n 'type': 'float'\n },\n {\n 'name': 'invhist_acct_id',\n 'type': 'int'\n },\n {\n 'name': 'invhist_xfer_warehous_id',\n 'type': 'int'\n },\n {\n 'name': 'invhist_comments',\n 'type': 'string'\n },\n {\n 'name': 'invhist_posted',\n 'type': 'int'\n },\n {\n 'name': 'invhist_imported',\n 'type': 'int'\n },\n {\n 'name': 'invhist_hasdetail',\n 'type': 'int'\n },\n {\n 'name': 'invhist_ordtype',\n 'type': 'string'\n },\n {\n 'name': 'invhist_analyze',\n 'type': 'int'\n },\n {\n 'name': 'invhist_user',\n 'type': 'string'\n },\n {\n 'name': 'invhist_created',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invhist_costmethod',\n 'type': 'string'\n },\n {\n 'name': 'invhist_value_before',\n 'type': 'float'\n },\n {\n 'name': 'invhist_value_after',\n 'type': 'float'\n },\n {\n 'name': 'invhist_series',\n 'type': 'int'\n }\n]"
332 "displayMsg": "Displaying invhist{0} - {1} of {2}",
333 "emptyMsg": "No invhist found",
335 "xtype": "PagingToolbar",
340 "click": "function (_self, e)\n{\n Roo.MessageBox.progress (\"Syncing Fifo fill\", \"Sending\");\n \n var offset = 0;\n var st = new Date();\n \n // for a single location.\n \n \n \n var runSync= function() {\n \n\n \n \n new Pman.Request( {\n url : baseURL+'/Roo/Invdetail',\n method : 'GET',\n timeout : 60000,\n params : {\n _fifo_fill : 1,\n offset : offset,\n location_id : _this.locationCombo.getValue(),\n item_number : _this.itemsiteCombo.getValue()\n },\n success : function(res) {\n Roo.log(res);\n if (!res.data.total) {\n Roo.MessageBox.hide();\n return;\n }\n var el = new Date();\n \n var elapsed = el - st;\n \n var total_time = (elapsed / offset) * res.data.total ;\n var remaining = (total_time - elapsed) / (1000 * 60);\n \n \n offset = res.data.offset + res.data.limit;\n Roo.MessageBox.updateProgress ( offset / res.data.total, \"Done \" + offset + '/' + res.data.total + \n \" Est. complete in \" + remaining.toFixed(1) + \"mins\");\n runSync();\n }, \n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"Sending failed - probably a timeout\");\n }\n \n \n });\n }\n runSync();\n}\n"
344 "|xns": "Roo.Toolbar"
348 "click": "function (_self, e)\n{\n Roo.MessageBox.progress (\"Syncing Fifo fill values\", \"Sending\");\n \n var offset = 0;\n var st = new Date();\n \n // for a single location.\n \n \n \n var runSync= function() {\n \n\n \n \n new Pman.Request( {\n url : baseURL+'/Roo/Invdetail',\n method : 'GET',\n timeout : 60000,\n params : {\n _fifo_fill : 2,\n offset : offset,\n location_id : _this.locationCombo.getValue(),\n item_number : _this.itemsiteCombo.getValue()\n },\n success : function(res) {\n Roo.log(res);\n if (!res.data.total) {\n Roo.MessageBox.hide();\n return;\n }\n var el = new Date();\n \n var elapsed = el - st;\n \n var total_time = (elapsed / offset) * res.data.total ;\n var remaining = (total_time - elapsed) / (1000 * 60);\n \n \n offset = res.data.offset + res.data.limit;\n Roo.MessageBox.updateProgress ( offset / res.data.total, \"Done \" + offset + '/' + res.data.total + \n \" Est. complete in \" + remaining.toFixed(1) + \"mins\");\n runSync();\n }, \n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"Sending failed - probably a timeout\");\n }\n \n \n });\n }\n runSync();\n}\n"
350 "text": "Fifo Fill Values",
352 "|xns": "Roo.Toolbar"
356 "click": "\nfunction (_self, e)\n{\n Roo.MessageBox.progress (\"Syncing shipvoid fill\", \"Sending\");\n \n var offset = 0;\n var st = new Date();\n \n // for a single location.\n \n \n \n var runSync= function() {\n \n \n new Pman.Request( {\n url : baseURL+'/Roo/cohead',\n method : 'GET',\n timeout : 60000,\n params : {\n _fill_shipvoid : 1,\n offset : offset\n },\n success : function(res) {\n Roo.log(res);\n if (!res.data.total) {\n Roo.MessageBox.hide();\n return;\n }\n var el = new Date();\n \n var elapsed = el - st;\n \n var total_time = (elapsed / offset) * res.data.total ;\n var remaining = (total_time - elapsed) / (1000 * 60);\n \n \n offset = res.data.offset + res.data.limit;\n Roo.MessageBox.updateProgress ( offset / res.data.total, \"Done \" + offset + '/' + res.data.total + \n \" Est. complete in \" + remaining.toFixed(1) + \"mins\");\n runSync();\n }, \n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"Sending failed - probably a timeout\");\n }\n \n \n });\n }\n runSync();\n}\n"
358 "text": "Shipvoid Fill",
360 "|xns": "Roo.Toolbar"
365 "*prop": "colModel[]",
367 "dataIndex": "invdetail_id",
368 "header": "Invdetail#",
370 "xtype": "ColumnModel",
371 "|renderer": "function(v,x,r) { \n if (r.data.invfifo_void > 0) { \n return '<s>' + v + '</s>'; \n }\n return v;\n }",
375 "*prop": "colModel[]",
376 "dataIndex": "invhist_transdate",
380 "xtype": "ColumnModel",
381 "|renderer": "function(v,x,r) {\n \n var vv = Date.parseDate(v.split(' ')[0],'Y-m-d' );\n \n if (r.data.invfifo_void > 0) { \n return String.format('<s>{0}</s>', vv ? vv.format('d/M/Y') : '');\n } \n \n return String.format('{0}', vv ? vv.format('d/M/Y') : '');\n }",
385 "*prop": "colModel[]",
386 "dataIndex": "invhist_created",
391 "xtype": "ColumnModel",
392 "|renderer": "function(v) { \n var vv = Date.parseDate(v.split(' ')[0],'Y-m-d' );\n return String.format('{0}', vv ? vv.format('d/M/Y') : '');\n }",
396 "*prop": "colModel[]",
397 "dataIndex": "item_number",
400 "xtype": "ColumnModel",
401 "|renderer": "function(v) { \n \n return String.format('<b>{0}</b>', v );\n }",
405 "*prop": "colModel[]",
406 "dataIndex": "invhist_ordnumber",
409 "xtype": "ColumnModel",
410 "|renderer": "function(v,x,r) {\n\n\n return String.format('{0}', v); }",
414 "*prop": "colModel[]",
415 "dataIndex": "invhist_docnumber",
418 "xtype": "ColumnModel",
419 "|renderer": "function(v) { return String.format('{0}', v); }",
423 "*prop": "colModel[]",
424 "dataIndex": "invhist_transtype",
427 "xtype": "ColumnModel",
428 "|renderer": "function(v,x,r) { return String.format('{0}/{1}', v,r.data.invhist_ordtype); }",
432 "*prop": "colModel[]",
434 "dataIndex": "invhist_unitcost",
435 "header": " unitcost",
437 "xtype": "ColumnModel",
438 "|renderer": "function(v) { return String.format('{0}', v); }",
442 "*prop": "colModel[]",
443 "dataIndex": "location_name",
444 "header": "Location",
446 "xtype": "ColumnModel",
447 "|renderer": "function(v) { return String.format('<B>{0}</B>', v); }",
451 "*prop": "colModel[]",
453 "dataIndex": "invdetail_qty",
456 "xtype": "ColumnModel",
457 "|renderer": "function(v,x,r) \n{\n if (r.data.invfifo_void > 0) { \n return String.format('<s>{0}</s>', parseInt( v)); \n } \n return String.format('{0}', parseInt( v)); \n}",
461 "*prop": "colModel[]",
463 "dataIndex": "invdetail_balance_qty",
466 "xtype": "ColumnModel",
467 "|renderer": "function(v,x,r) \n{\n if (r.data.invfifo_void > 0) { \n return String.format('<s>{0}</s>', parseInt( v)); \n } \n return String.format('{0}', parseInt( v)); \n}",
471 "xtype": "ColumnModel",
472 "header": "Invhist comments",
474 "dataIndex": "invhist_comments",
475 "|renderer": "function(v) { return String.format('{0}', v); }",
477 "*prop": "colModel[]"
480 "*prop": "colModel[]",
482 "dataIndex": "invfifo_qty_after",
483 "header": "Fifo After",
485 "xtype": "ColumnModel",
486 "|renderer": "function(v,x,r) { \n if ( r.data.invdetail_qty < 0 ) {\n return '';\n }\n return (v*1).toFixed(0) ;\n }",
490 "*prop": "colModel[]",
492 "dataIndex": "invfifo_qty_after",
493 "header": "Fifo After",
495 "xtype": "ColumnModel",
496 "|renderer": "function(v,x,r) { \n if ( r.data.invdetail_qty > 0 ) {\n return '';\n }\n return (v*1).toFixed(0) ;\n }",
500 "*prop": "colModel[]",
502 "dataIndex": "invfifo_cost_before",
503 "header": "Fifo Cost Before",
505 "xtype": "ColumnModel",
506 "|renderer": "function(v,x,r) { \n if ( r.data.invdetail_qty < 0 ) {\n return '';\n } \n return (v*1).toFixed(2) ;\n }",
510 "*prop": "colModel[]",
512 "dataIndex": "invfifo_cost_after",
513 "header": "Fifo Cost After",
515 "xtype": "ColumnModel",
516 "|renderer": "function(v,x,r) { \n if ( r.data.invdetail_qty < 0 ) {\n return '';\n } \n return (v*1).toFixed(2) ;\n }",
520 "*prop": "colModel[]",
522 "dataIndex": "invfifo_cost_before",
523 "header": "Fifo Cost Before",
525 "xtype": "ColumnModel",
526 "|renderer": "function(v,x,r) { \n if ( r.data.invdetail_qty > 0 ) {\n return '';\n }\n return (v*1).toFixed(2) ;\n }",
530 "*prop": "colModel[]",
532 "dataIndex": "invfifo_cost_after",
533 "header": "Fifo Cost After",
535 "xtype": "ColumnModel",
536 "|renderer": "function(v,x,r) { \n if ( r.data.invdetail_qty > 0 ) {\n return '';\n }\n return (v*1).toFixed(2) ;\n }",
540 "*prop": "colModel[]",
542 "dataIndex": "invfifo_unitcost",
543 "header": "Fifo Unitcost",
545 "xtype": "ColumnModel",
546 "|renderer": "function(v,x,r) \n{\n if (r.data.invfifo_void > 0) { \n return '<s>' + (v*1).toFixed(2) + '</s>';\n } \n return (v*1).toFixed(2) ;\n}",
550 "*prop": "colModel[]",
552 "dataIndex": "invfifo_landedunitcost",
553 "header": "Fifo Landed Unitcost",
555 "xtype": "ColumnModel",
556 "|renderer": "function(v,x,r) { \n \n var cu = ((r.data.invfifo_cost_after*1 - r.data.invfifo_cost_before*1) / Math.abs(r.data.invdetail_qty)).toFixed(2);\n var lu = (v*1).toFixed(2) ;\n if (cu != lu) {\n \n if (r.data.invfifo_void > 0) { \n return '<s><span style=\"color:red\">' + + lu +'/' +cu + '</span></s>';\n } \n \n return '<span style=\"color:red\">' + lu +'/' +cu + '</span>';\n }\n if (r.data.invfifo_void > 0) { \n return '<s>' + lu + '</s>';\n } \n \n return lu;\n }",