3 "name": "Pman.Tab.XtupleMetric",
4 "parent": "Pman.Admin",
6 "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleMetric.bjs",
10 "|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}",
11 "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}"
17 "tableName": "metric",
24 "|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}",
25 "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}"
28 "autoExpandColumn": "item_descrip1",
31 "xtype": "EditorGrid",
36 "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",
37 "load": "function (_self, records, options)\n{\n _this.grid.footer.updateSummary();\n}"
39 "*prop": "dataSource",
42 "|sortInfo": "{ field : 'poitem_linenumber', direction: 'ASC' }",
50 "|url": "baseURL + '/Xtuple/Roo/Poitem.php'",
57 "totalProperty": "total",
58 "xtype": "JsonReader",
59 "|fields": "[\n {\n 'name': 'poitem_id',\n 'type': 'int'\n }\n]",
71 "|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"
73 "cls": "x-btn-text-icon",
76 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
81 "|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}"
83 "cls": "x-btn-text-icon",
86 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
94 "emptyMsg": "No Item found",
96 "xtype": "PagingToolbar",
97 "|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",
101 "*prop": "colModel[]",
103 "dataIndex": "poitem_linenumber",
106 "xtype": "ColumnModel",
107 "|renderer": "function(v) { return String.format('{0}', v); }",
111 "*prop": "colModel[]",
112 "dataIndex": "item_number",
113 "header": "Item code",
115 "xtype": "ColumnModel",
116 "|renderer": "function(v) { return String.format('{0}', v); }",
121 "xtype": "GridEditor",
126 "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}"
130 "displayField": "itemsite_item_id_item_number",
132 "emptyText": "Select item",
133 "forceSelection": true,
134 "hiddenName": "itemsite_item_id_item_number",
136 "loadingText": "Searching...",
138 "name": "item_number",
140 "qtip": "Select item",
141 "queryParam": "query[number]",
142 "selectOnFocus": true,
143 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> - {itemsite_item_id_item_descrip1} </div>",
144 "triggerAction": "all",
146 "valueField": "item_number",
152 "|beforeload": "function (_self, o){\n o.params = o.params || {}; \n o.params.itemsite_posupply = 1;\n}\n"
157 "|sortInfo": "{ direction : 'ASC', field: 'item_number' }",
163 "xtype": "HttpProxy",
164 "|url": "baseURL + '/Roo/itemsite.php'",
171 "totalProperty": "total",
172 "xtype": "JsonReader",
173 "|fields": "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]",
185 "*prop": "colModel[]",
186 "dataIndex": "item_descrip1",
187 "header": "Item description",
189 "xtype": "ColumnModel",
190 "|renderer": "function(v) { return String.format('{0}', v); }",
194 "*prop": "colModel[]",
195 "dataIndex": "poitem_duedate",
196 "header": "Due date",
198 "xtype": "ColumnModel",
199 "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
203 "*prop": "colModel[]",
205 "dataIndex": "poitem_qty_ordered",
208 "xtype": "ColumnModel",
209 "|renderer": "function(v) { return String.format('{0}', v); }",
214 "xtype": "GridEditor",
219 "allowDecimals": false,
220 "decimalPrecision": 0,
222 "style": "text-align:right",
223 "xtype": "NumberField",
231 "*prop": "colModel[]",
233 "dataIndex": "poitem_qty_received",
234 "header": "Received",
236 "xtype": "ColumnModel",
237 "|renderer": "function(v,x,r) { \n return String.format(\n r.data.poitem_qty_ordered != (v-r.data.poitem_qty_returned) ? '<span style=\"color:red\">{0}</span>': '{0}',\n v - r.data.poitem_qty_returned);\n}",
241 "*prop": "colModel[]",
243 "dataIndex": "poitem_qty_vouchered",
244 "header": "Vouchered",
246 "xtype": "ColumnModel",
247 "|renderer": "function(v,x,r) { \n return String.format(\n r.data.poitem_qty_ordered != v ? '<span style=\"color:red\">{0}</span>': '{0}',\n v);\n}",
251 "*prop": "colModel[]",
253 "dataIndex": "poitem_unitprice",
254 "header": "Unit price",
256 "xtype": "ColumnModel",
257 "|renderer": "function(v) { return String.format('{0}', (v || v == 0) ? parseFloat(v).toFixed(3) : ''); }",
262 "xtype": "GridEditor",
268 "allowDecimals": false,
269 "decimalPrecision": 0,
271 "style": "text-align:right",
272 "xtype": "NumberField",