3 "name": "Pman.Tab.XtuplePurchaseStock",
4 "parent": "Pman.Tab.XtuplePurchases",
5 "title": "Pman.Tab.XtuplePurchaseStock",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtuplePurchaseStock.bjs",
10 "title": "Incoming Stock Schedule",
11 "xtype": "NestedLayoutPanel",
16 "xtype": "BorderLayout",
21 "xtype": "LayoutRegion",
26 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
32 "tableName": "poitem",
33 "title": "Incoming Stock Schedule",
39 "|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}",
40 "afteredit": "function (e)\n{\n if (e.originalValue == e.value || e.field == 'join_poitem_location_name') {\n return;\n }\n \n e.record.commit();\n \n}",
41 "rowdblclick": "function (_self, rowIndex, e)\r\n{\r\n \n var r = _this.grid.ds.getAt(rowIndex);\r\n Pman.Dialog.XtuplePurchaseOrder.show( { pohead_id : r.data.join_poitem_pohead_id , office : _this.office.getValue()}, function() {\r\n _this.grid.footer.onClick('refresh');\r\n }); \r\n}\r",
42 "beforeedit": "function (e)\n{\n var office = _this.office.getValue();\n var local = baseURL.split('/').pop().split('.').shift();\n \n if(office != local){\n return false;\n }\n}",
43 "rowclick": "function (_self, rowIndex, e)\n{\n\n}"
46 "autoExpandColumn": "item_descrip",
49 "xtype": "EditorGrid",
54 "beforeload": "function (_self, o)\n{\n o.params = o.params || {};\n \n o.params._incoming_stock = 1;\n \n o.params.poitem_status = _this.status.getValue();\n \n o.params._roo_office = _this.office.getValue();\n \n o.params['search[location]'] = _this.location.getValue();\n \n o.params['search[name]'] = _this.searchBox.getValue();\n\n}",
55 "update": "function (_self, record, operation)\n{\n if (operation != 'commit') {\n Roo.log(operation);\n return;\n }\n var params = {\n pohead_id : record.data.join_poitem_pohead_id,\n pohead_comments : record.data.join_poitem_pohead_comments,\n pohead_bg_va : record.data.join_poitem_pohead_bg_va,\n pohead_bg_arrival_est_day : record.data.join_poitem_pohead_bg_arrival_est_day,\n pohead_bg_available_est_day : record.data.join_poitem_pohead_bg_available_est_day,\n pohead_bg_available_latest_day : record.data.join_poitem_pohead_bg_available_latest_day,\n pohead_notes : record.data.join_poitem_pohead_notes\n };\n \n\n new Pman.Request({\n method : 'POST',\n url : baseURL + '/Roo/pohead',\n params : params\n });\n \n\n _this.grid.footer.onClick('refresh');\n}"
57 "*prop": "dataSource",
60 "|sortInfo": "{ field : 'name', direction: 'ASC' }",
67 "|url": "baseURL + '/Xtuple/Roo/Poitem.php'",
72 "xtype": "JsonReader",
73 "totalProperty": "total",
77 "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'type',\n 'type': 'int'\n },\n {\n 'name': 'leader',\n 'type': 'int'\n },\n {\n 'name': 'leader_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_office_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_name',\n 'type': 'string'\n },\n {\n 'name': 'leader_phone',\n 'type': 'string'\n },\n {\n 'name': 'leader_fax',\n 'type': 'string'\n },\n {\n 'name': 'leader_email',\n 'type': 'string'\n },\n {\n 'name': 'leader_company_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_role',\n 'type': 'string'\n },\n {\n 'name': 'leader_active',\n 'type': 'int'\n },\n {\n 'name': 'leader_remarks',\n 'type': 'string'\n },\n {\n 'name': 'leader_passwd',\n 'type': 'string'\n },\n {\n 'name': 'leader_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_lang',\n 'type': 'string'\n },\n {\n 'name': 'leader_no_reset_sent',\n 'type': 'int'\n },\n {\n 'name': 'leader_action_type',\n 'type': 'string'\n },\n {\n 'name': 'leader_project_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_deleted_by',\n 'type': 'int'\n },\n {\n 'name': 'leader_deleted_dt',\n 'type': 'date'\n },\n {\n 'name': 'leader_firstname',\n 'type': 'string'\n },\n {\n 'name': 'leader_lastname',\n 'type': 'string'\n },\n {\n 'name': 'leader_name_facebook',\n 'type': 'string'\n },\n {\n 'name': 'leader_url_blog',\n 'type': 'string'\n },\n {\n 'name': 'leader_url_twitter',\n 'type': 'string'\n },\n {\n 'name': 'leader_url_linkedin',\n 'type': 'string'\n },\n {\n 'name': 'leader_crm_lead_percentage',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_industry_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_updated_action_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_created_action_id',\n 'type': 'int'\n },\n {\n 'name': 'leader_crm_type_id',\n 'type': 'int'\n }\n]"
88 "specialkey": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}",
89 "render": "function (_self)\n{\n _this.searchBox = _self;\n}"
96 "click": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}"
100 "|icon": "rootURL + '/Pman/templates/images/search.gif'",
101 "|xns": "Roo.Toolbar"
105 "click": "function (_self, e)\n{\n _this.searchBox.setValue('');\r\n _this.grid.footer.onClick('first');\r\n}"
109 "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
110 "|xns": "Roo.Toolbar"
114 "render": "function (_self)\n{\n _this.status = _self;\n}",
115 "select": "function (combo, record, index)\n{\n\n _this.grid.footer.onClick('first');\n}"
118 "displayField": "fname",
120 "emptyText": "Select Status",
121 "fieldLabel": "Status",
122 "hiddenName": "poitem_status",
125 "name": "poitem_status",
126 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
127 "triggerAction": "all",
129 "valueField": "ftype",
136 "xtype": "SimpleStore",
137 "|data": "[ \n [ 'O', \"Open\"],\n [ 'C' , \"Closed\"],\n [ 'U', \"Unreleased\"] \n]\n",
138 "|fields": "[ 'ftype', 'fname']",
145 "render": "function (_self)\n{\n _this.location = _self;\n}",
146 "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}"
150 "displayField": "location_name",
152 "emptyText": "Select a location",
153 "fieldLabel": "Location",
154 "forceSelection": true,
155 "hiddenName": "pohead_location_id",
157 "loadingText": "Searching...",
159 "name": "pohead_location_id",
161 "qtip": "Select terms",
162 "queryParam": "query[location_name]",
163 "selectOnFocus": true,
164 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>",
165 "triggerAction": "all",
167 "valueField": "location_id",
174 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params.location_netable = 1;\n o.params._roo_office = _this.office.getValue();\n o.params._notinternalcompany = 1;\n}\n"
179 "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
185 "xtype": "HttpProxy",
186 "|url": "baseURL + '/Xtuple/Roo/location.php'",
193 "totalProperty": "total",
194 "xtype": "JsonReader",
195 "|fields": "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
204 "render": "function (_self)\n{\n _this.office = _self;\n}",
205 "select": "function (combo, record, index)\n{\n _this.location.reset();\n _this.grid.footer.onClick('first');\n}"
208 "displayField": "office",
210 "fieldLabel": "Office",
211 "hiddenName": "office",
215 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{office}</b> </div>",
216 "triggerAction": "all",
217 "valueField": "office",
220 "|value": "(function() { \n if(uiConfig.incomming_default_company){\n return uiConfig.incomming_default_company;\n }\n return 'hk'; \n})()",
225 "xtype": "SimpleStore",
226 "|data": "(function() { \n var officeList = []; \n if(uiConfig.incomming_default_company){\n officeList.push([uiConfig.incomming_default_company]);\n } \n officeList.push(['hk']); \n return officeList;\n})()",
227 "|fields": "['office']",
234 "|click": "function()\n{\n var sel = _this.grid.getSelectionModel().getSelectedCell();\n if (!sel) {\n Roo.MessageBox.alert(\"Error\", \"Select a Row\");\n return;\n } \n var s = _this.grid.ds.getAt(sel[0]);\n if(!s.data.join_poitem_pohead_id.length){\n return;\n }\n \n var office = _this.office.getValue();\n var local = baseURL.split('/').pop().split('.').shift();\n\n if(office != local){\n Roo.MessageBox.alert(\"Error\", \"You cannot edit the remote date, Only local data can be edited!\");\n return;\n }\n \n Pman.Dialog.XtuplePurchaseOrderEdit.show({pohead_id : s.data.join_poitem_pohead_id} , function () {\n _this.grid.footer.onClick('refresh');\n });\n \n}\n"
236 "cls": "x-btn-text-icon",
237 "text": "Fill location",
239 "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
240 "|xns": "Roo.Toolbar"
247 "displayMsg": "Displaying poitem{0} - {1} of {2}",
248 "emptyMsg": "No poitem found",
250 "xtype": "PagingToolbar",
255 "click": "function ()\n{\n \n new Pman.Download({\n grid : _this.grid\n });\n \n \n}"
257 "cls": "x-btn-text-icon",
258 "text": "Download Schedule",
260 "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
261 "|xns": "Roo.Toolbar"
266 "*prop": "colModel[]",
267 "dataIndex": "join_poitem_pohead_number",
271 "xtype": "ColumnModel",
272 "|renderer": "function(v) { return String.format('{0}', v); }",
276 "*prop": "colModel[]",
277 "dataIndex": "brand_value",
280 "xtype": "ColumnModel",
281 "|renderer": "function(v) { return String.format('{0}', v); }",
285 "*prop": "colModel[]",
286 "dataIndex": "item_name",
287 "header": "Item (SKU)",
290 "xtype": "ColumnModel",
291 "|renderer": "function(v) { return String.format('{0}', v); }",
295 "*prop": "colModel[]",
296 "dataIndex": "item_descrip",
297 "header": "Description",
299 "xtype": "ColumnModel",
300 "|renderer": "function(v) { return String.format('{0}', v); }",
304 "*prop": "colModel[]",
305 "dataIndex": "join_poitem_pohead_comments",
306 "header": "B&G reference",
308 "xtype": "ColumnModel",
309 "|renderer": "function(v) { return String.format('{0}', v); }",
314 "xtype": "GridEditor",
319 "xtype": "TextField",
327 "*prop": "colModel[]",
328 "dataIndex": "join_poitem_pohead_bg_va",
331 "xtype": "ColumnModel",
332 "|renderer": "function(v) { return String.format('{0}', v); }",
337 "xtype": "GridEditor",
342 "xtype": "TextField",
350 "*prop": "colModel[]",
351 "dataIndex": "join_poitem_pohead_bg_arrival_est_day",
352 "header": "Est. Arrival",
354 "xtype": "ColumnModel",
355 "|renderer": "function(v) { \n if(typeof(v) == 'object'){\n return String.format('{0}',v.format('d/M/Y'));\n }\n var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', d ? d.format('d/M/Y') : '');\n}",
360 "xtype": "GridEditor",
367 "xtype": "DateField",
375 "*prop": "colModel[]",
376 "dataIndex": "join_poitem_pohead_bg_available_est_day",
377 "header": "Est. Avail",
379 "xtype": "ColumnModel",
380 "|renderer": "function(v) { \n if(typeof(v) == 'object'){\n return String.format('{0}',v.format('d/M/Y'));\n }\n var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', d ? d.format('d/M/Y') : '');\n}",
385 "xtype": "GridEditor",
392 "xtype": "DateField",
400 "*prop": "colModel[]",
401 "dataIndex": "join_poitem_pohead_bg_available_latest_day",
402 "header": "Confirm Avail",
405 "xtype": "ColumnModel",
406 "|renderer": "function(v) { \n if(typeof(v) == 'object'){\n return String.format('{0}',v.format('d/M/Y'));\n }\n var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', d ? d.format('d/M/Y') : '');\n}",
411 "xtype": "GridEditor",
418 "xtype": "DateField",
426 "*prop": "colModel[]",
427 "dataIndex": "join_poitem_location_name",
428 "header": "Location",
431 "xtype": "ColumnModel",
432 "|renderer": "function(v,x,r) \n{\n \n return String.format('{0}', v ? v : ''); \n}",
437 "xtype": "GridEditor",
442 "beforeselect": "function (combo, record, index)\n{\n var ar = _this.grid.activeEditor.record;\n \n if(record.data.location_id == ar.data.join_poitem_location_id){\n return;\n }\n \n var params = {\r\n poitem_id : ar.data.poitem_id,\r\n poitem_location_id : record.data.location_id\r\n };\r\n \r\n\r\n new Pman.Request({\r\n method : 'POST',\r\n url : baseURL + '/Roo/poitem',\r\n params : params\r\n });\n \n\r\n}"
445 "displayField": "location_name",
447 "emptyText": "Select a location",
448 "forceSelection": true,
449 "hiddenName": "join_poitem_location_id",
451 "loadingText": "Searching...",
453 "name": "join_poitem_location_name",
455 "qtip": "Select a location",
456 "queryParam": "query[location_name]",
457 "selectOnFocus": true,
458 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>",
459 "triggerAction": "all",
461 "valueField": "location_id",
467 "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params.location_netable = 1;\n}\n"
472 "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
478 "xtype": "HttpProxy",
479 "|url": "baseURL + '/Roo/location.php'",
486 "totalProperty": "total",
487 "xtype": "JsonReader",
488 "|fields": "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
500 "*prop": "colModel[]",
501 "dataIndex": "join_poitem_vend_name",
502 "header": "Originating from",
505 "xtype": "ColumnModel",
506 "|renderer": "function(v,x,r) \n{\n if(v && r.data.join_poitem_pohead_vendcountry)\n {\n return String.format('{0}', v + ' (' + r.data.join_poitem_pohead_vendcountry + ')'); \n }\n return String.format('{0}', v); \n}",
510 "*prop": "colModel[]",
511 "dataIndex": "poitem_qty_ordered",
514 "xtype": "ColumnModel",
515 "|renderer": "function(v) { return String.format('{0}', v ? v : '' ); }",
519 "*prop": "colModel[]",
520 "dataIndex": "join_poitem_pohead_orderdate",
521 "header": "Order Created",
524 "xtype": "ColumnModel",
525 "|renderer": "function(v) \n{ \n var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', d ? d.format('d/M/Y') : '');\n}",
529 "*prop": "colModel[]",
530 "dataIndex": "poitem_duedate",
531 "header": "ETA Date",
534 "xtype": "ColumnModel",
535 "|renderer": "function(v) \n{ \n // var d = Date.parseDate(v, 'Y-m-d');\n return String.format('{0}', v ? v.format('d/M/Y') : '');\n}",
539 "*prop": "colModel[]",
540 "dataIndex": "join_poitem_pohead_last_updated",
541 "header": "Last Updated",
543 "xtype": "ColumnModel",
544 "|renderer": "function(v,x,r) \r\n{\r\n if(!v){\r\n return '';\r\n }\r\n var d = (new Date()).add(Date.DAY, -15);\r\n v = new Date(v);\r\n \r\n if(v > d){\r\n return '<span style=\"color:red\">' + v.format('d/M/Y') + '</span>';\r\n }\r\n \r\n return String.format('{0}', v ? v.format('d/M/Y') : '');\r\n}",
548 "*prop": "colModel[]",
549 "dataIndex": "join_poitem_pohead_notes",
552 "xtype": "ColumnModel",
553 "|renderer": "function(v) { return String.format('{0}', v); }",
558 "xtype": "GridEditor",
563 "xtype": "TextField",