{ "id": "roo-file-46", "name": "Pman.Tab.XtuplePurchaseStock", "parent": "Pman.Tab.XtuplePurchases", "title": "Pman.Tab.XtuplePurchaseStock", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtuplePurchaseStock.bjs", "items": [ { "background": true, "title": "Incoming Stock Schedule", "xtype": "NestedLayoutPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "BorderLayout", "*prop": "layout", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center" }, { "listeners": { "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, "background": true, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "poitem", "title": "Incoming Stock Schedule", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|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}", "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}", "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", "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}", "rowclick": "function (_self, rowIndex, e)\n{\n\n}" }, "*prop": "grid", "autoExpandColumn": "item_descrip", "clicksToEdit": 1, "loadMask": true, "xtype": "EditorGrid", "|xns": "Roo.grid", "items": [ { "listeners": { "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}", "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}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'name', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Xtuple/Roo/Poitem.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", "*prop": "reader", "id": "id", "|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]" } ] }, { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "listeners": { "specialkey": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}", "render": "function (_self)\n{\n _this.searchBox = _self;\n}" }, "xtype": "TextField", "|xns": "Roo.form" }, { "listeners": { "click": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/search.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "click": "function (_self, e)\n{\n _this.searchBox.setValue('');\r\n _this.grid.footer.onClick('first');\r\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "render": "function (_self)\n{\n _this.status = _self;\n}", "select": "function (combo, record, index)\n{\n\n _this.grid.footer.onClick('first');\n}" }, "allowBlank": true, "displayField": "fname", "editable": false, "emptyText": "Select Status", "fieldLabel": "Status", "hiddenName": "poitem_status", "listWidth": 200, "mode": "local", "name": "poitem_status", "tpl": "
{fname}
", "triggerAction": "all", "value": "", "valueField": "ftype", "width": 150, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "[ \n [ 'O', \"Open\"],\n [ 'C' , \"Closed\"],\n [ 'U', \"Unreleased\"] \n]\n", "|fields": "[ 'ftype', 'fname']", "|xns": "Roo.data" } ] }, { "listeners": { "render": "function (_self)\n{\n _this.location = _self;\n}", "select": "function (combo, record, index)\n{\n _this.grid.footer.onClick('first');\n}" }, "allowBlank": true, "alwaysQuery": true, "displayField": "location_name", "editable": true, "emptyText": "Select a location", "fieldLabel": "Location", "forceSelection": true, "hiddenName": "pohead_location_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "pohead_location_id", "pageSize": 200, "qtip": "Select terms", "queryParam": "query[location_name]", "selectOnFocus": true, "tpl": "
{location_name}
", "triggerAction": "all", "typeAhead": false, "valueField": "location_id", "width": 200, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|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" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'location_name' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Xtuple/Roo/location.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "location_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]", "|xns": "Roo.data" } ] } ] }, { "listeners": { "render": "function (_self)\n{\n _this.office = _self;\n}", "select": "function (combo, record, index)\n{\n _this.location.reset();\n _this.grid.footer.onClick('first');\n}" }, "allowBlank": false, "displayField": "office", "editable": false, "fieldLabel": "Office", "hiddenName": "office", "listWidth": 200, "mode": "local", "name": "office", "tpl": "
{office}
", "triggerAction": "all", "valueField": "office", "width": 150, "xtype": "ComboBox", "|value": "(function() { \n if(uiConfig.incomming_default_company){\n return uiConfig.incomming_default_company;\n }\n return 'hk'; \n})()", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|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})()", "|fields": "['office']", "|xns": "Roo.data" } ] }, { "listeners": { "|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" }, "cls": "x-btn-text-icon", "text": "Fill location", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "footer", "displayInfo": true, "displayMsg": "Displaying poitem{0} - {1} of {2}", "emptyMsg": "No poitem found", "pageSize": 25, "xtype": "PagingToolbar", "|xns": "Roo", "items": [ { "listeners": { "click": "function ()\n{\n \n new Pman.Download({\n grid : _this.grid\n });\n \n \n}" }, "cls": "x-btn-text-icon", "text": "Download Schedule", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_number", "header": "P/O No#", "sortable": true, "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "brand_value", "header": "Brand", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "item_name", "header": "Item (SKU)", "sortable": true, "width": 70, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "item_descrip", "header": "Description", "width": 300, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_comments", "header": "B&G reference", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "xtype": "TextField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_bg_va", "header": "VA?", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "xtype": "TextField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_bg_arrival_est_day", "header": "Est. Arrival", "width": 70, "xtype": "ColumnModel", "|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}", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "format": "d/M/Y", "useIso": true, "xtype": "DateField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_bg_available_est_day", "header": "Est. Avail", "width": 70, "xtype": "ColumnModel", "|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}", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "format": "d/M/Y", "useIso": true, "xtype": "DateField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_bg_available_latest_day", "header": "Confirm Avail", "sortable": true, "width": 70, "xtype": "ColumnModel", "|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}", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "format": "d/M/Y", "useIso": true, "xtype": "DateField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_location_name", "header": "Location", "sortable": true, "width": 100, "xtype": "ColumnModel", "|renderer": "function(v,x,r) \n{\n \n return String.format('{0}', v ? v : ''); \n}", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "listeners": { "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}" }, "*prop": "field", "displayField": "location_name", "editable": true, "emptyText": "Select a location", "forceSelection": true, "hiddenName": "join_poitem_location_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "join_poitem_location_name", "pageSize": 20, "qtip": "Select a location", "queryParam": "query[location_name]", "selectOnFocus": true, "tpl": "
{location_name}
", "triggerAction": "all", "typeAhead": false, "valueField": "location_id", "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params.location_netable = 1;\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'location_name' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/location.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "location_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]", "|xns": "Roo.data" } ] } ] } ] } ] }, { "*prop": "colModel[]", "dataIndex": "join_poitem_vend_name", "header": "Originating from", "sortable": true, "width": 100, "xtype": "ColumnModel", "|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}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "poitem_qty_ordered", "header": "Qty", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v : '' ); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_orderdate", "header": "Order Created", "sortable": true, "width": 100, "xtype": "ColumnModel", "|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}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "poitem_duedate", "header": "ETA Date", "sortable": true, "width": 100, "xtype": "ColumnModel", "|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}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_last_updated", "header": "Last Updated", "width": 100, "xtype": "ColumnModel", "|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 '' + v.format('d/M/Y') + '';\r\n }\r\n \r\n return String.format('{0}', v ? v.format('d/M/Y') : '');\r\n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "join_poitem_pohead_notes", "header": "Notes", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "xtype": "TextField", "|xns": "Roo.form" } ] } ] } ] } ] } ] } ] } ], "permname": "", "modOrder": "200" }