{ "id": "roo-file-21", "name": "Pman.Dialog.XtuplePurchaseOrder", "parent": "", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtuplePurchaseOrder.bjs", "items": [ { "listeners": { "show": "function () \n{\n this.layout.getRegion('center').showPanel(0);\n}" }, "closable": false, "collapsible": false, "height": 550, "modal": true, "resizable": true, "title": "New Purchase Order", "width": 900, "xtype": "LayoutDialog", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center", "alwaysShowTabs": true, "tabPosition": "top", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "click": "function ()\n{\n var hid = _this.form.findField('pohead_id').getValue();\n\n if(!hid.length){\n Roo.MessageBox.alert(\"Error\", \"Please save your purchase order first\"); \n return false;\n }\n\n \n if (!_this.grid) {\n _dialog.layout.showPanel(1);\n doit.defer(500);\n return;\n }\n \n \n \n var doit = function () { \n new Pman.Download({\n grid : _this.grid\n });\n }\n doit();\n \n \n}" }, "cls": "x-btn-text-icon", "text": "Download Purchase Order Items (Excel)", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/save.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "render": "function (_self)\n{\n _this.uploadBtn = _self;\n}" }, "text": "Upload Purchase Order", "xtype": "Button", "|xns": "Roo.Toolbar", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "click": "function (_self, e)\n{\n var hid = _this.form.findField('pohead_id').getValue();\n \n if(!hid.length){\n Roo.MessageBox.alert(\"Error\", \"Please save your purchase order first\"); \n return false;\n }\n Pman.Dialog.Image.show(\n {\n timeout : 60000,\n _url : baseURL+'/Xtuple/Import/PurchaseOrder?' + Roo.urlEncode({'pohead_id' : hid})\n \n },\n function () {\n if(_this.grid){\n _this.grid.footer.onClick('first');\n }\n Roo.MessageBox.alert(\"Notice\", 'UPLOADED');\n }\n );\n}" }, "text": "Upload Standard Excel", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "click": "function (_self, e)\n{\n\n var hid = _this.form.findField('pohead_id').getValue();\n \n if(!hid.length){\n Roo.MessageBox.alert(\"Error\", \"Please save your purchase order first\"); \n return false;\n }\n \n Pman.Dialog.Image.show(\n {\n _url : baseURL+'/Xtuple/Import/AUPurchaseOrder?' + Roo.urlEncode({'pohead_id' :hid})\n \n },\n function (data) {\n if(_this.grid){\n _this.grid.footer.onClick('first');\n }\n Roo.MessageBox.alert(\"Notice\", 'IMPORTED');\n\n });\n}" }, "text": "Upload AU Import Excel", "xtype": "Item", "|xns": "Roo.menu" } ] } ] } ] } ] }, { "region": "center", "title": "Order Details", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "listeners": { "|actioncomplete": "function(_self,action)\n{\n if (action.type == 'setdata') {\n _this.uploadBtn.disabled = false;\n if(!_this.data.pohead_id && Pman.Login.authUser.name.length){\n _this.saveBtn.show();\n _this.form.findField('pohead_agent_username').setValue(Pman.Login.authUser.name);\n _this.form.findField('pohead_orderdate').setValue(new Date());\n _this.form.findField('pohead_bg_arrival_est_day').setValue(new Date());\n _this.form.findField('pohead_bg_available_est_day').setValue(new Date());\n _this.form.findField('pohead_bg_available_latest_day').setValue(new Date());\n return;\n }\n _this.dialog.setTitle(\"Edit Purchase Order\");\n var params = {\n '_id' : _this.data.pohead_id\n }\n if(_this.data.office){\n params['_roo_office'] = _this.data.office;\n }\n \n this.load({ method: 'GET', params: params});\n return;\n }\n if (action.type == 'load') {\n _this.dontClose = false;\n if(_this.data.office){\n _this.uploadBtn.disabled = true;\n }\n _this.saveBtn.hide();\n if (action.result.data.pohead_status == 'U') {\n _this.saveBtn.show();\n }\n var cn = _this.form.findField('pohead_curr_id');\n cn.setDisabled(true);\n if (action.result.data.pohead_id * 1 < 1) {\n cn.setDisabled(false);\n }\n \n if(_this.grid){\n _this.grid.footer.onClick('first');\n }\n \n return;\n }\n if (action.type =='submit') {\n \n\n var cid = this.findField('pohead_id').getValue()*1;\n if (cid && !_this.dontClose) {\n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(_this, _this.form.getValues());\n }\n _this.form.reset();\n return;\n }\n Roo.log(action);\n _this.dontClose = false;\n _this.data.pohead_id = action.result.data.pohead_id;\n this.fireEvent('actioncomplete', this, { \n type: 'setdata', \n data: { \n pohead_id : action.result.data.pohead_id\n } \n });\n\n \n }\n}\n", "|rendered": "function (form)\n{\n _this.form= form;\n}\n", "actionfailed": "function (_self, action)\n{\n _this.dialog.el.unmask();\n if (action.failureType == 'client') {\n Roo.MessageBox.alert(\"Error\", \"Please fill in all the required fields\");\n }\n if (action.failureType == 'server') {\n Roo.MessageBox.alert(\"Error\", action.result.errorMsg);\n }\n _this.dialog.layout.getRegion('center').showPanel(0);\n\n}" }, "labelWidth": 200, "method": "POST", "style": "margin:10px;", "xtype": "Form", "|url": "baseURL + '/Xtuple/Roo/Pohead.php'", "|xns": "Roo.form", "items": [ { "emptyText": "Automatic", "fieldLabel": "Order #", "name": "pohead_number", "readOnly": true, "width": 150, "xtype": "TextField", "|xns": "Roo.form" }, { "allowBlank": false, "fieldLabel": "Order Date", "format": "Y-m-d", "name": "pohead_orderdate", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Estimated Arrival Date", "format": "Y-m-d", "name": "pohead_bg_arrival_est_day", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Estimated Available Date", "format": "Y-m-d", "name": "pohead_bg_available_est_day", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "Latest Estimated Available Date", "format": "Y-m-d", "name": "pohead_bg_available_latest_day", "width": 150, "xtype": "DateField", "|xns": "Roo.form" }, { "fieldLabel": "VA", "name": "pohead_bg_va", "width": 150, "xtype": "TextField", "|xns": "Roo.form" }, { "fieldLabel": "Vendor", "name": "pohead_vend_id_vend_name", "readOnly": true, "width": 250, "xtype": "TextField", "|xns": "Roo.form" }, { "allowBlank": false, "displayField": "fname", "editable": false, "fieldLabel": "Status", "hiddenName": "pohead_status", "listWidth": 200, "mode": "local", "name": "pohead_status", "readOnly": true, "tpl": "
{fname}
", "triggerAction": "all", "value": "U", "valueField": "ftype", "width": 250, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "[ \n [ 'U', \"Unreleased\"],\n [ 'O', \"Open\"],\n [ 'C' , \"Closed\"]\n]\n", "|fields": "[ 'ftype', 'fname']", "|xns": "Roo.data" } ] }, { "allowBlank": false, "displayField": "curr_name", "editable": false, "emptyText": "Select Currency", "fieldLabel": "Currency", "forceSelection": true, "hiddenName": "pohead_curr_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "pohead_curr_id_curr_name", "pageSize": 20, "qtip": "Select Currency", "queryParam": "query[curr_name]", "selectOnFocus": true, "tpl": "
{curr_name}
", "triggerAction": "all", "typeAhead": true, "valueField": "curr_id", "width": 250, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'curr_id' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|xns": "Roo.data", "|url": "baseURL + '/Roo/curr_symbol.php'" }, { "*prop": "reader", "id": "curr_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\n {\"name\":\"curr_id\",\"type\":\"int\"},\n {\"name\":\"curr_name\",\"type\":\"string\"}\n]", "|xns": "Roo.data" } ] } ] }, { "allowBlank": false, "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_location_name", "pageSize": 200, "qtip": "Select terms", "queryParam": "query[location_name]", "selectOnFocus": true, "tpl": "
{location_name}
", "triggerAction": "all", "typeAhead": false, "valueField": "location_id", "width": 250, "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._viewType = 'local';\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" } ] } ] }, { "allowBlank": false, "displayField": "terms_descrip", "editable": false, "emptyText": "Select Terms", "fieldLabel": "Terms", "forceSelection": true, "hiddenName": "pohead_terms_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "pohead_terms_id_terms_descrip", "pageSize": 20, "qtip": "Select Terms", "queryParam": "query[terms_descrip]", "selectOnFocus": true, "tpl": "
{terms_descrip}
", "triggerAction": "all", "typeAhead": true, "valueField": "terms_id", "width": 250, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'terms_descrip' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/Terms.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "terms_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\n {\"name\":\"terms_id\",\"type\":\"int\"},\n {\"name\":\"terms_descrip\",\"type\":\"string\"}\n]", "|xns": "Roo.data" } ] } ] }, { "allowBlank": false, "displayField": "taxzone_descrip", "editable": false, "emptyText": "Select Tax Zone", "fieldLabel": "Tax Zone", "forceSelection": true, "hiddenName": "pohead_taxzone_id", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "pohead_taxzone_id_taxzone_descrip", "pageSize": 20, "qtip": "Select Tax Zone", "queryParam": "query[taxzone_descrip]", "selectOnFocus": true, "tpl": "
{taxzone_descrip}
", "triggerAction": "all", "typeAhead": true, "valueField": "taxzone_id", "width": 250, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'taxzone_id' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/Taxzone.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "taxzone_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\n {\"name\":\"taxzone_id\",\"type\":\"int\"},\n {\"name\":\"taxzone_descrip\",\"type\":\"string\"}\n]", "|xns": "Roo.data" } ] } ] }, { "allowBlank": true, "displayField": "emp_name", "editable": false, "emptyText": "Select Purchasing Agent", "fieldLabel": "Purchase Agent", "forceSelection": true, "hiddenName": "pohead_agent_username", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "pohead_agent_username", "pageSize": 20, "qtip": "Select Purchasing Agent", "queryParam": "query[emp_name]", "selectOnFocus": true, "tpl": "
{emp_name}
", "triggerAction": "all", "typeAhead": true, "valueField": "emp_name", "width": 250, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'emp_id' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/Emp.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "emp_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\n {\"name\":\"emp_id\",\"type\":\"int\"},\n {\"name\":\"emp_name\",\"type\":\"string\"}\n]", "|xns": "Roo.data" } ] } ] }, { "fieldLabel": "Comments", "height": 100, "name": "pohead_comments", "width": 400, "xtype": "TextArea", "|xns": "Roo.form" }, { "name": "pohead_vend_id", "xtype": "Hidden", "|xns": "Roo.form" }, { "name": "items", "xtype": "Hidden", "|xns": "Roo.form" }, { "name": "pohead_id", "xtype": "Hidden", "|xns": "Roo.form" } ] } ] }, { "listeners": { "|activate": "function() {\n _this.panel = this;\n \n \n var pid = _this.form.findField('pohead_id').getValue() * 1;\n if (pid < 1) {\n Roo.MessageBox.alert(\"Save First\", \"Please save the purchase order first, before adding items\");\n _this.dialog.layout.getRegion('center').showPanel(0);\n return;\n }\n \n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}", "deactivate": "function (_self)\n{\n if(_this.grid){\n var ar = [];\n\n _this.grid.ds.each(function(r) {\n ar.push({\n poitem_id : r.data.poitem_id,\n poitem_itemsite_id : r.data.poitem_itemsite_id,\n poitem_unitprice : r.data.poitem_unitprice,\n poitem_qty_ordered : r.data.poitem_qty_ordered\n });\n \n });\n \n _this.form.findField('items').setValue(JSON.stringify(ar));\n }\n _this.dontClose = true;\n _this.form.doAction(\"submit\");\n\n}" }, "background": true, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "poitem", "title": "Order Items", "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}", "beforeedit": "function (e)\n{\n var r = e.record.data.poitem_qty_received * 1;\n \n if(r > 0){\n Roo.MessageBox.alert(\"Error\", \"This item has been receipted\");\n return false;\n }\n \n var status = _this.form.findField('pohead_status').getValue();\n \n if(status == 'C'){\n Roo.MessageBox.alert(\"Error\", \"This PO has been closed\");\n return false;\n }\n \n \n}" }, "*prop": "grid", "autoExpandColumn": "item_descrip1", "clicksToEdit": 1, "loadMask": true, "xtype": "EditorGrid", "|xns": "Roo.grid", "items": [ { "listeners": { "beforeload": "function (_self, o){\n o.params = o.params || {};\n var hid = _this.form.findField('pohead_id').getValue();\n \n if(!hid.length){\n return false;\n }\n \n o.params.poitem_pohead_id = hid;\n o.params._with_item = 1;\n o.params._roo_office = _this.data.office ? _this.data.office : baseURL.split('/').pop().substr(0,2);\n\n}\n", "load": "function (_self, records, options)\n{\n _this.grid.footer.updateSummary();\n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'poitem_linenumber', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "timeout": 90000, "xtype": "HttpProxy", "|url": "baseURL + '/Xtuple/Roo/Poitem.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "poitem_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\n {\n 'name': 'poitem_id',\n 'type': 'int'\n }\n]", "|xns": "Roo.data" } ] }, { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "listeners": { "|click": "function()\n{\n var status = _this.form.findField('pohead_status').getValue();\n \n if(status == 'C'){\n Roo.MessageBox.alert(\"Error\", \"This PO has been closed\");\n return;\n }\n \n var ct = _this.grid.ds.getCount();\n \n var last = ct ? _this.grid.ds.getAt(ct-1).data.poitem_linenumber * 1 + 1 : 1;\n \n var dt = _this.form.findField('pohead_orderdate').getValue();\n \n var nr = _this.grid.ds.reader.newRow({\n poitem_id : 0,\n poitem_linenumber : last,\n item_number : '',\n item_descrip1 : '',\n poitem_duedate : dt,\n poitem_qty_ordered : 1,\n poitem_unitprice : 0\n });\n \n _this.grid.stopEditing();\n _this.grid.ds.insert(_this.grid.ds.getCount(), nr); \n _this.grid.startEditing(_this.grid.ds.getCount()-1, 1);\n}\n" }, "cls": "x-btn-text-icon", "text": "Add", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|click": "function ()\n{\n var status = _this.form.findField('pohead_status').getValue();\n \n if(status == 'C'){\n Roo.MessageBox.alert(\"Error\", \"This PO has been closed\");\n return;\n }\n \n var cs = _this.grid.getSelectionModel().getSelectedCell();\n if (!cs) {\n Roo.MessageBox.alert(\"Error\", \"Select a cell\");\n return;\n }\n _this.grid.stopEditing();\n var r = _this.grid.ds.getAt(cs[0]);\n \n if(r.data.poitem_qty_received * 1 > 0){\n Roo.MessageBox.alert(\"Error\", \"This item has been receipted\");\n return;\n }\n \n \n _this.grid.ds.remove(r);\n \n}" }, "cls": "x-btn-text-icon", "text": "Remove", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "footer", "displayInfo": true, "emptyMsg": "No Item found", "pageSize": 100, "xtype": "PagingToolbar", "|updateSummary": "function() {\n\r\n var f = this;\r\n new Pman.Request({\r\n url : baseURL + '/Xtuple/Roo/Poitem',\r\n method : 'GET',\r\n params : {\n _roo_office : _this.data.office ? _this.data.office : baseURL.split('/').pop().substr(0,2),\r\n _totals : 1,\r\n poitem_pohead_id : _this.form.findField('pohead_id').getValue()\r\n },\r\n success : function(d) {\n Roo.log(d);\r\n f.displayEl.update(String.format(\r\n \"{0} items | Total : {1} {2}\",\r\n d.data[0].count_item,\r\n _this.form.findField('pohead_curr_id').el.dom.value,\r\n d.data[0].totals\r\n ));\r\n \r\n }\r\n });\r\n\n}\n", "|xns": "Roo" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "poitem_linenumber", "header": "Line#", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "item_number", "header": "Item code", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|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 (function() { \n ar.set('item_descrip1', record.data.itemsite_item_id_item_descrip1);\n ar.set('poitem_itemsite_id', record.data.itemsite_id);\n }).defer(100);\n \n}" }, "*prop": "field", "allowBlank": false, "displayField": "itemsite_item_id_item_number", "editable": true, "emptyText": "Select item", "forceSelection": true, "hiddenName": "itemsite_item_id_item_number", "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "item_number", "pageSize": 20, "qtip": "Select item", "queryParam": "query[number]", "selectOnFocus": true, "tpl": "
{itemsite_item_id_item_number} - {itemsite_item_id_item_descrip1}
", "triggerAction": "all", "typeAhead": false, "valueField": "item_number", "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {}; \n o.params.itemsite_posupply = 1;\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'item_number' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/itemsite.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "itemsite_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]", "|xns": "Roo.data" } ] } ] } ] } ] }, { "*prop": "colModel[]", "dataIndex": "item_descrip1", "header": "Item description", "width": 150, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "poitem_duedate", "header": "Due date", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "poitem_qty_ordered", "header": "Ordered", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "allowDecimals": false, "decimalPrecision": 0, "minValue": 1, "style": "text-align:right", "xtype": "NumberField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "align": "right", "dataIndex": "poitem_qty_received", "header": "Received", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n return String.format(\n r.data.poitem_qty_ordered != (v-r.data.poitem_qty_returned) ? '{0}': '{0}',\n v - r.data.poitem_qty_returned);\n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "poitem_qty_vouchered", "header": "Vouchered", "width": 65, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n return String.format(\n r.data.poitem_qty_ordered != v ? '{0}': '{0}',\n v);\n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "poitem_unitprice", "header": "Unit price", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', (v || v == 0) ? parseFloat(v).toFixed(3) : ''); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "allowBlank": false, "allowDecimals": false, "decimalPrecision": 0, "minValue": 1, "style": "text-align:right", "xtype": "NumberField", "|xns": "Roo.form" } ] } ] } ] } ] }, { "region": "center", "title": "TX", "xtype": "NestedLayoutPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "BorderLayout", "*prop": "layout", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center" }, { "*prop": "east", "split": true, "width": 550, "xtype": "LayoutRegion", "|xns": "Roo" }, { "listeners": { "|activate": "function() {\n _this.itempanel = this;\n \n \n if (_this.itemgrid) {\n _this.itemgrid.footer.onClick('first');\n }\n}" }, "background": false, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "poitem", "title": "Items", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|render": "function() \n{\n _this.itemgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.itempanel.active) {\n this.footer.onClick('first');\n }\n}", "rowclick": "function (_self, rowIndex, e)\n{\n \n _this.gltransgrid.footer.onClick('first');\n}" }, "*prop": "grid", "autoExpandColumn": "item_number", "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "listeners": { "click": "function (_self, e)\n{\n \n new Pman.Download({\n url : baseURL + '/Roo/Metasql',\n method : 'GET',\n timeout: 600000,\n params : {\n _group : 'gltrans_stock',\n _name : 'byorder',\n 'pohead_number:text' : _this.form.findField('pohead_number').getValue(),\n csvCols : '*',\n csvTitles : '*', \n limit : 9999 \n }\n });\n}" }, "text": "PO analysis", "xtype": "Button", "|xns": "Roo.Toolbar" } ] }, { "*prop": "sm", "singleSelect": true, "xtype": "RowSelectionModel", "|xns": "Roo.grid" }, { "listeners": { "beforeload": "function (_self, o)\n{\n o.params = o.params || {};\n var hid = _this.form.findField('pohead_id').getValue();\n \n if(!hid.length){\n return false;\n }\n \n o.params.poitem_pohead_id = hid;\n \n o.params._with_item = 1;\n \n}", "load": "function (_self, records, options)\n{\n _this.gltransgrid.footer.onClick('first');\n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'poitem_id', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/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]" } ] }, { "*prop": "footer", "displayInfo": false, "displayMsg": "Displaying poitem{0} - {1} of {2}", "emptyMsg": "No item found", "pageSize": 25, "xtype": "PagingToolbar", "|xns": "Roo" }, { "*prop": "colModel[]", "dataIndex": "poitem_linenumber", "header": "Line #", "width": 25, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "item_number", "header": "Item #", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "poitem_qty_ordered", "header": "Ordered", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "poitem_qty_received", "header": "Received", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v,x,r) \n{\n \n\n var recv = (v- r.data.poitem_qty_returned);\n if (recv != r.data.tx_qty) {\n return String.format('{0}{1} ', recv, \n (r.data.tx_qty *1).toFixed(0) ) ; \n }\n return String.format('{0}', (v- r.data.poitem_qty_returned)) ; \n \n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "poitem_unitprice", "header": "Unit Price", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v,x,r) \n{\n \n return String.format('{0}', (v- r.data.poitem_qty_returned) ? parseFloat(v- r.data.poitem_qty_returned).toFixed(3) : '') ; \n \n}", "|xns": "Roo.grid" } ] } ] }, { "listeners": { "|activate": "function() {\n _this.gltranspanel = this;\n //if (_this.gltransgrid) {\n // _this.gltransgrid.footer.onClick('first');\n // }\n}" }, "background": false, "fitContainer": true, "fitToframe": true, "region": "east", "tableName": "Gltrans", "title": "Gltrans", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|render": "function() \n{\n _this.gltransgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n // if (_this.gltranspanel.active) {\n // this.footer.onClick('first');\n // }\n}" }, "*prop": "grid", "autoExpandColumn": "gltrans_notes", "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "*prop": "sm", "singleSelect": true, "xtype": "RowSelectionModel", "|xns": "Roo.grid" }, { "listeners": { "beforeload": "function (_self, o)\n{\n o.params = o.params || {};\n \n var s = _this.itemgrid.getSelectionModel().getSelected();\n if(!s){\n this.removeAll();\n return false;\n }\n \n o.params._poview = 1;\n o.params.gltrans_deleted = 0;\n o.params.gltrans_doctype = 'PO';\n o.params._linenumber = s.data.poitem_linenumber;\n o.params._item = s.data.item_number;\n o.params._ponumber = _this.form.findField('pohead_number').getValue();\n \n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'gltrans_id', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/gltrans.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]" } ] }, { "*prop": "footer", "displayInfo": true, "displayMsg": "Displaying gltrans{0} - {1} of {2}", "emptyMsg": "No gltrans found", "pageSize": 25, "xtype": "PagingToolbar", "|xns": "Roo" }, { "*prop": "toolbar", "xtype": "Toolbar", "|xns": "Roo", "items": [ { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "text": "Apply fixes", "xtype": "Button", "|xns": "Roo.Toolbar", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "|click": "function()\n{\n var pohead_number = _this.form.findField('pohead_number').getValue();\n var pohead_id = _this.form.findField('pohead_id').getValue();\n \n \n new Pman.Request({\n url : baseURL + '/Roo/pohead.php',\n mask : 'sending',\n method :'POST',\n params : {\n pohead_id : pohead_id,\n _recv_fix : 1\n \n },\n success : function(res) {\n Roo.MessageBox.alert('Notice', 'DONE');\n }\n });\n \n \n \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Repost goods reciept", "xtype": "Item", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.menu" }, { "|xns": "Roo.menu", "xtype": "Separator" }, { "listeners": { "|click": "function()\n{\n var pohead_number = _this.form.findField('pohead_number').getValue();\n var pohead_id = _this.form.findField('pohead_id').getValue();\n \n var fixit = function(){\n new Pman.Request({\n url : baseURL + '/Roo/pohead.php',\n method :'POST',\n params : {\n pohead_id : pohead_id,\n _unitcost : 1\n \n },\n success : function(res) {\n Roo.MessageBox.alert('Notice', 'DONE');\n }\n });\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to fix the unit cost of \" + pohead_number + \" ?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n\n fixit();\n return;\n }\n ); \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Fix Unit Cost", "xtype": "Item", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.menu" }, { "|xns": "Roo.menu", "xtype": "Separator" }, { "listeners": { "|click": "function()\n{\n var pohead_number = _this.form.findField('pohead_number').getValue();\n var pohead_id = _this.form.findField('pohead_id').getValue();\n \n var addv = function(){\n new Pman.Request({\n url : baseURL + '/Roo/pohead.php',\n method :'POST',\n params : {\n pohead_id : pohead_id,\n _variance : 1\n \n },\n success : function(res) {\n Roo.MessageBox.alert('Notice', 'DONE');\n }\n });\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to add all the variance for \" + pohead_number + \" ?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n\n addv();\n return;\n }\n ); \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Add All Variance", "xtype": "Item", "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", "|xns": "Roo.menu" }, { "listeners": { "|click": "function()\n{\n var s = _this.gltransgrid.getSelectionModel().getSelected();\n \n if(!s){\n Roo.MessageBox.alert('Error','Please select a transaction');\n return;\n }\n \n if(s.data.gltrans_misc_id != -1){\n Roo.MessageBox.alert('Error','Just allow to delete the variance');\n return;\n }\n \n var delit = function(){\n new Pman.Request({\n url : baseURL + '/Roo/Gltrans.php',\n method :'POST',\n params : {\n gltrans_id : s.data.gltrans_id,\n _del : 1\n \n },\n success : function(res) {\n _this.gltransgrid.footer.onClick('refresh');\n \n }\n });\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to delete ?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n\n delit();\n return;\n }\n ); \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Delete Variance", "xtype": "Item", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.menu" }, { "listeners": { "|click": "function()\n{\n var pohead_number = _this.form.findField('pohead_number').getValue();\n var pohead_id = _this.form.findField('pohead_id').getValue();\n \n var delv = function(){\n new Pman.Request({\n url : baseURL + '/Roo/pohead.php',\n method :'POST',\n params : {\n pohead_id : pohead_id,\n _del : 1\n \n },\n success : function(res) {\n Roo.MessageBox.alert('Notice', 'DONE');\n }\n });\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to delete the variance on voucher of \" + pohead_number + \" ?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n\n delv();\n return;\n }\n ); \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Delete Varinace on voucher", "xtype": "Item", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.menu" }, { "|xns": "Roo.menu", "xtype": "Separator" }, { "listeners": { "|click": "function()\n{\n var pohead_number = _this.form.findField('pohead_number').getValue();\n var pohead_id = _this.form.findField('pohead_id').getValue();\n \n var addv = function(){\n new Pman.Request({\n url : baseURL + '/Roo/pohead.php',\n method :'POST',\n params : {\n pohead_id : pohead_id,\n _fix_voids : 1\n \n },\n success : function(res) {\n Roo.MessageBox.alert('Notice', 'DONE');\n }\n });\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to add all the fix the voids for \" + pohead_number + \" ?\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n\n addv();\n return;\n }\n ); \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Recalculate voids", "xtype": "Item", "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'", "|xns": "Roo.menu" } ] } ] }, { "listeners": { "|click": "function()\n{\n var s = _this.gltransgrid.selModel.getSelected();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select an item to reverse\");\n return;\n }\n \n var fixit = function(){\n new Pman.Request({\n url : baseURL + '/Roo/invdetail.php',\n method :'POST',\n params : {\n \n _reverse : s.data.invdetail_id \n },\n success : function(res) {\n Roo.MessageBox.alert('Notice', 'DONE');\n }\n });\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\",\n \"Are you sure to reverse that line\",\n function(r) {\n if (r != 'yes') {\n return;\n }\n\n fixit();\n return;\n }\n ); \n \n \n}\n" }, "cls": "x-btn-text-icon", "text": "Reverse", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", "dataIndex": "gltrans_id", "header": "ID", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_date", "header": "Date", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_docnumber", "header": "doc #", "width": 80, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "location_name", "header": "Location", "width": 60, "xtype": "ColumnModel", "|renderer": "function(v,x,r) {\n \n \n return String.format('{0}', v); \n\n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "gltrans_amount", "header": "Amount", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n return String.format('{0}', v); \n\n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "invdetail_qty", "header": "Qty", "width": 60, "xtype": "ColumnModel", "|renderer": "function(v,x,r) {\n var f = r.data.invfifo_void * 1 ? '{0}' : '{0}';\n \n return String.format(f, (v*1).toFixed(0)); \n\n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_notes", "header": "Notes", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" } ] } ] } ] } ] }, { "region": "center", "title": "GL Tx", "xtype": "NestedLayoutPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "BorderLayout", "*prop": "layout", "items": [ { "|xns": "Roo", "xtype": "LayoutRegion", "*prop": "center" }, { "*prop": "east", "split": true, "width": 500, "xtype": "LayoutRegion", "|xns": "Roo" }, { "listeners": { "|activate": "function() {\n _this.gltxpanel = this;\n if (_this.gltxgrid) {\n _this.gltxgrid.footer.onClick('first');\n }\n}" }, "background": false, "fitContainer": true, "fitToframe": true, "region": "center", "tableName": "invdetail", "title": "invdetail", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|render": "function() \n{\n _this.gltxgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.gltxpanel.active) {\n this.footer.onClick('first');\n }\n}", "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n if (columnIndex > 0) {\n return;\n }\n var rec = this.ds.getAt(rowIndex);\n rec.set('gltrans_as_summary', rec.data.gltrans_as_summary *1 ? 0 : 1);\n _this.gltxdgrid.footer.onClick('first');\n}" }, "*prop": "grid", "autoExpandColumn": "gltrans_accnt_id_accnt_descrip", "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "listeners": { "selectionchange": "function (_self)\n{\n _this.gltxdgrid.footer.onClick('first');;\n}" }, "*prop": "sm", "singleSelect": true, "xtype": "RowSelectionModel", "|xns": "Roo.grid" }, { "listeners": { "beforeload": "function (_self, o)\n{\n o.params.pohead_id = _this.form.findField('pohead_id').getValue();\n if (! o.params.pohead_id ) {\n this.removeAll();\n return false;\n }\n o.params._split_sales = _this.glsalesbtn.pressed ? 1 : 0;\n}", "load": "function (_self, records, options)\n{\n _this.gltxdgrid.footer.onClick('first');\n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'item_number', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/gltrans.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", "*prop": "reader", "id": "id", "|fields": "[\n {\n 'name': 'invdetail_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_qty',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_comments',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_qty_before',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_qty_after',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_invcitem_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_expiration',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_warrpurc',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_ls_id',\n 'type': 'int'\n }\n]" } ] }, { "*prop": "footer", "displayInfo": true, "displayMsg": "Displaying invdetail{0} - {1} of {2}", "emptyMsg": "No invdetail found", "pageSize": 9999, "xtype": "PagingToolbar", "|xns": "Roo", "items": [ { "listeners": { "render": "function (_self)\n{\n _this.glsalesbtn = _self;\n}", "click": "function (_self, e)\n{\n (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);\n}" }, "enableToggle": true, "pressed": true, "text": "Split sales", "xtype": "Button", "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", "dataIndex": "gltrans_as_summary", "header": "Summary", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n \n var state = v*1 ? '-checked' : '';\n \n return '';\n }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_accnt_id_accnt_descrip", "header": "Account", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "gltrans_amount_credit", "header": "Credit", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "gltrans_amount_debit", "header": "Debit", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "gltrans_amount_total", "header": "Sum", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "gltrans_amount_total_unposted", "header": "Unposted", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }", "|xns": "Roo.grid" } ] } ] }, { "listeners": { "|activate": "function() {\n _this.gltxdpanel = this;\n if (_this.gltxdgrid) {\n _this.gltxdgrid.footer.onClick('first');\n }\n}" }, "background": false, "fitContainer": true, "fitToframe": true, "region": "east", "tableName": "invdetail", "title": "invdetail", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|render": "function() \n{\n _this.gltxdgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.gltxdpanel.active) {\n this.footer.onClick('first');\n }\n}", "cellclick": "function (_self, ri, ci, e)\n{\n \n var deleteSel = function() {\n \n new Pman.Request({\n mask : \"Reversing\",\n url : baseURL + '/Roo/gltrans',\n method : 'POST',\n params : { \n _void : 1,\n gltrans_id : rec.data.gltrans_id\n \n }, \n success : function() {\n rec.set('gltrans_posted', false);\n rec.set('gltrans_deleted', true);\n rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);\n _this.gltxgrid.footer.onClick('first');\n }\n });\n \n }\n var undeleteSel = function() {\n \n new Pman.Request({\n mask : \"Reversing\",\n url : baseURL + '/Roo/gltrans',\n method : 'POST',\n params : { \n _unvoid : 1,\n gltrans_id : rec.data.gltrans_id\n \n }, \n success : function() {\n rec.set('gltrans_posted', true);\n rec.set('gltrans_deleted', false);\n rec.set('gltrans_docnumber', rec.data.gltrans_docnumber);\n _this.gltxgrid.footer.onClick('first');\n }\n });\n \n }\n \n var di = this.colModel.config[ci].dataIndex;\n if (di != 'gltrans_posted') {\n return;\n }\n \n \n \n var rec = this.ds.getAt(ri);\n if (rec.data.gltrans_deleted) {\n \n Roo.MessageBox.confirm(\n \"Confirm\", \n \"This should only be used by System Administrators - are you sure you know what you are doing!\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n undeleteSel();\n }\n );\n \n return false;\n }\n\n \n \n if (!rec.data.gltrans_posted) {\n\n \n \n new Pman.Request({\n method : 'POST',\n url : baseURL + '/Roo/gltrans',\n mask : \"Posting\",\n params : {\n _post : 1,\n gltrans_id : rec.data.gltrans_id\n },\n success : function (res)\n {\n rec.set('gltrans_posted', true);\n _this.gltxgrid.footer.onClick('first');\n \n }\n \n \n });\n return;\n }\n \n // we have a posted transaction.\n // only allow recalled to be deleted..\n if (!rec.data.gltrans_notes.match(/(Recall|Ship Order)/)) {\n return false;\n }\n \n \n \n \n \n\n Roo.MessageBox.confirm(\n \"Confirm\", \n \"This should only be used by System Administrators - are you sure you know what you are doing!\",\n function(x) {\n if (x != 'yes') {\n return;\n }\n deleteSel();\n }\n );\n \n \n \n}" }, "*prop": "grid", "autoExpandColumn": "gltrans_notes", "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "listeners": { "render": "function (_self)\n{\n _this.glvoidshow = _self;\n}", "click": "function (_self, e)\n{\n (function() { _this.gltxgrid.footer.onClick('first'); }).defer(100);\n}" }, "enableToggle": true, "pressed": true, "text": "Hide Void", "xtype": "Button", "|xns": "Roo.Toolbar" }, { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Request( {\n url : baseURL + '/Roo/Gltrans',\n method : 'GET',\n mask: 'sending',\n params : {\n pohead_id : _this.form.findField('pohead_id').getValue(),\n _autovoid : 1\n },\n success : function() {\n _this.gltxpanel.footer.onClick('first');\n }\n \n \n });\n}" }, "text": "AutoVoid", "xtype": "Button", "|xns": "Roo.Toolbar" } ] }, { "listeners": { "beforeload": "function (_self, o)\n{\n o.params.pohead_id = _this.form.findField('pohead_id').getValue();\n var s = _this.gltxgrid.selModel.getSelected();\n if (!s) { \n this.removeAll();\n return false;\n }\n o.params.gltrans_accnt_id = s.data.gltrans_accnt_id;\n o.params.gltrans_is_ship = s.data.gltrans_is_ship;\n o.params.gltrans_as_summary = s.data.gltrans_as_summary;\n o.params._hide_void = _this.glvoidshow.pressed ? 1 : 0;\n //glvoidshow\n \n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'gltrans_docnumber', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "xtype": "HttpProxy", "|url": "baseURL + '/Roo/gltrans.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", "*prop": "reader", "id": "id", "|fields": "[\n {\n 'name': 'invdetail_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_transtype',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_invhist_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_location_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_qty',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_comments',\n 'type': 'string'\n },\n {\n 'name': 'invdetail_qty_before',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_qty_after',\n 'type': 'float'\n },\n {\n 'name': 'invdetail_invcitem_id',\n 'type': 'int'\n },\n {\n 'name': 'invdetail_expiration',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_warrpurc',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'invdetail_ls_id',\n 'type': 'int'\n }\n]" } ] }, { "*prop": "footer", "displayInfo": true, "displayMsg": "Displaying invdetail{0} - {1} of {2}", "emptyMsg": "No invdetail found", "pageSize": 9999, "xtype": "PagingToolbar", "|xns": "Roo", "items": [ { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download( {\n grid : _this.gltxdgrid\n \n });\n}" }, "text": "Download", "xtype": "Button", "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", "dataIndex": "gltrans_id", "header": "Ref#", "sortable": true, "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_date", "header": "Date", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_docnumber", "header": "Doc#", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n\n var style = '';\n if (r.data.gltrans_misc_id > 0 && (r.data.invdetail_id *1) < 1) {\n style = ' style=\"color:red;font-weight:bold\"';\n }\n if (r.data.gltrans_deleted) {\n return String.format('{0}', v); \n }\n return String.format('{0}', v); \n}", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_source", "header": "Source", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_notes", "header": "Notes", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "align": "right", "dataIndex": "gltrans_amount", "header": "Amount", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v,3)); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "gltrans_posted", "header": "Posted", "width": 50, "xtype": "ColumnModel", "|renderer": "function(v,x,r) { \n \n var state = v ? '-checked' : '';\n \n return '';\n }", "|xns": "Roo.grid" } ] } ] } ] } ] }, { "listeners": { "click": "function (_self, e)\n{\n _this.dialog.hide();\n}" }, "*prop": "buttons[]", "text": "Cancel", "xtype": "Button", "|xns": "Roo" }, { "listeners": { "click": "function (_self, e)\n{\n if(_this.grid){\n var ar = [];\n var err = false;\n _this.grid.ds.each(function(r) {\n if(r.data.poitem_unitprice < 1){\n err = true;\n return;\n }\n ar.push({\n poitem_id : r.data.poitem_id,\n poitem_itemsite_id : r.data.poitem_itemsite_id,\n poitem_unitprice : r.data.poitem_unitprice,\n poitem_qty_ordered : r.data.poitem_qty_ordered\n });\n \n });\n \n if(err){\n Roo.MessageBox.alert('Error','Unit Price does not allow $0' );\n return;\n } \n \n _this.form.findField('items').setValue(JSON.stringify(ar));\n }\n \n _this.form.doAction(\"submit\");\n\n}", "render": "function (_self)\n{\n _this.saveBtn = _self;\n}" }, "*prop": "buttons[]", "text": "Save", "xtype": "Button", "|xns": "Roo" } ] } ], "permname": "", "modOrder": "001" }