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 if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}"
16 "tableName": "metric",
23 "|render": "function() \n{\n _this.grid = this; \n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
24 "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}"
27 "autoExpandColumn": "metric_value",
30 "xtype": "EditorGrid",
35 "beforeload": "function (_self, o){\n o.params = o.params || {};\n \n}\n"
37 "*prop": "dataSource",
40 "|sortInfo": "{ field : 'metric_name', direction: 'ASC' }",
48 "|url": "baseURL + '/Xtuple/Roo/Poitem.php'",
55 "totalProperty": "total",
56 "xtype": "JsonReader",
57 "|fields": "[\n {\n 'name': 'poitem_id',\n 'type': 'int'\n }\n]",
69 "|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"
71 "cls": "x-btn-text-icon",
74 "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
79 "|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}"
81 "cls": "x-btn-text-icon",
84 "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
92 "emptyMsg": "No Item found",
94 "xtype": "PagingToolbar",
95 "|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",
99 "*prop": "colModel[]",
101 "dataIndex": "poitem_linenumber",
104 "xtype": "ColumnModel",
105 "|renderer": "function(v) { return String.format('{0}', v); }",
109 "*prop": "colModel[]",
110 "dataIndex": "item_number",
111 "header": "Item code",
113 "xtype": "ColumnModel",
114 "|renderer": "function(v) { return String.format('{0}', v); }",
119 "xtype": "GridEditor",
124 "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}"
128 "displayField": "itemsite_item_id_item_number",
130 "emptyText": "Select item",
131 "forceSelection": true,
132 "hiddenName": "itemsite_item_id_item_number",
134 "loadingText": "Searching...",
136 "name": "item_number",
138 "qtip": "Select item",
139 "queryParam": "query[number]",
140 "selectOnFocus": true,
141 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> - {itemsite_item_id_item_descrip1} </div>",
142 "triggerAction": "all",
144 "valueField": "item_number",
150 "|beforeload": "function (_self, o){\n o.params = o.params || {}; \n o.params.itemsite_posupply = 1;\n}\n"
155 "|sortInfo": "{ direction : 'ASC', field: 'item_number' }",
161 "xtype": "HttpProxy",
162 "|url": "baseURL + '/Roo/itemsite.php'",
169 "totalProperty": "total",
170 "xtype": "JsonReader",
171 "|fields": "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]",
183 "*prop": "colModel[]",
184 "dataIndex": "item_descrip1",
185 "header": "Item description",
187 "xtype": "ColumnModel",
188 "|renderer": "function(v) { return String.format('{0}', v); }",
192 "*prop": "colModel[]",
193 "dataIndex": "poitem_duedate",
194 "header": "Due date",
196 "xtype": "ColumnModel",
197 "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
201 "*prop": "colModel[]",
203 "dataIndex": "poitem_qty_ordered",
206 "xtype": "ColumnModel",
207 "|renderer": "function(v) { return String.format('{0}', v); }",
212 "xtype": "GridEditor",
217 "allowDecimals": false,
218 "decimalPrecision": 0,
220 "style": "text-align:right",
221 "xtype": "NumberField",
229 "*prop": "colModel[]",
231 "dataIndex": "poitem_qty_received",
232 "header": "Received",
234 "xtype": "ColumnModel",
235 "|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}",
239 "*prop": "colModel[]",
241 "dataIndex": "poitem_qty_vouchered",
242 "header": "Vouchered",
244 "xtype": "ColumnModel",
245 "|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}",
249 "*prop": "colModel[]",
251 "dataIndex": "poitem_unitprice",
252 "header": "Unit price",
254 "xtype": "ColumnModel",
255 "|renderer": "function(v) { return String.format('{0}', (v || v == 0) ? parseFloat(v).toFixed(3) : ''); }",
260 "xtype": "GridEditor",
266 "allowDecimals": false,
267 "decimalPrecision": 0,
269 "style": "text-align:right",
270 "xtype": "NumberField",