Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleAdjustmentGroup.bjs
1 {
2     "id": "roo-file-324",
3     "name": "Pman.Dialog.XtupleAdjustmentGroup",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleAdjustmentGroup.bjs",
7     "items": [
8         {
9             "closable": false,
10             "collapsible": false,
11             "height": 500,
12             "modal": true,
13             "resizable": false,
14             "title": "Edit / Create Inventory Adjustment Group",
15             "width": 600,
16             "xtype": "LayoutDialog",
17             "|xns": "Roo",
18             "items": [
19                 {
20                     "*prop": "center",
21                     "tabPosition": "top",
22                     "xtype": "LayoutRegion",
23                     "|xns": "Roo"
24                 },
25                 {
26                     "region": "center",
27                     "xtype": "NestedLayoutPanel",
28                     "|xns": "Roo",
29                     "items": [
30                         {
31                             "|xns": "Roo",
32                             "xtype": "BorderLayout",
33                             "*prop": "layout",
34                             "items": [
35                                 {
36                                     "*prop": "north",
37                                     "height": 150,
38                                     "split": true,
39                                     "xtype": "LayoutRegion",
40                                     "|xns": "Roo"
41                                 },
42                                 {
43                                     "|xns": "Roo",
44                                     "xtype": "LayoutRegion",
45                                     "*prop": "center"
46                                 },
47                                 {
48                                     "region": "north",
49                                     "xtype": "ContentPanel",
50                                     "|xns": "Roo",
51                                     "items": [
52                                         {
53                                             "listeners": {
54                                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n        _this.grid.ds.removeAll();\n        _this.saveBtn.show();\n        if(_this.data.invadjgrp_id){\n       \n            this.load({ method: 'GET', params: { '_id' : _this.data.invadjgrp_id }});\n        }\n       return;\n    }\n    if (action.type == 'load') {\n        _this.data = action.result.data;\n        if(_this.data.invadjgrp_posted){\n            _this.saveBtn.hide();\n        }\n\n        _this.grid.ds.load({});\n        return;\n    }\n    if (action.type =='submit') {\n        \n    \n        if (!_this.grid.ds.getCount()  && this.findField('invadjgrp_id').getValue()*1 < 1) {\n        \n        \n        \n            this.load({ method: 'GET', params: { '_id' : action.result.data.invadjgrp_id }});\n            return;\n        \n        }\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}\n",
55                                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
56                                             },
57                                             "method": "POST",
58                                             "style": "margin:10px;",
59                                             "xtype": "Form",
60                                             "|url": "baseURL + '/Roo/Invadjgrp.php'",
61                                             "|xns": "Roo.form",
62                                             "items": [
63                                                 {
64                                                     "legend": "Inventory Adjustment Group Detail",
65                                                     "style": "width:520px",
66                                                     "xtype": "FieldSet",
67                                                     "|xns": "Roo.form",
68                                                     "items": [
69                                                         {
70                                                             "allowBlank": false,
71                                                             "fieldLabel": "Name",
72                                                             "name": "invadjgrp_name",
73                                                             "width": 200,
74                                                             "xtype": "TextField",
75                                                             "|xns": "Roo.form"
76                                                         },
77                                                         {
78                                                             "allowBlank": false,
79                                                             "fieldLabel": "Date",
80                                                             "format": "Y-m-d",
81                                                             "name": "invadjgrp_transdate",
82                                                             "useIso": true,
83                                                             "width": 200,
84                                                             "xtype": "DateField",
85                                                             "|xns": "Roo.form"
86                                                         },
87                                                         {
88                                                             "allowBlank": false,
89                                                             "displayField": "location_name",
90                                                             "editable": false,
91                                                             "emptyText": "Select Location",
92                                                             "fieldLabel": "Location",
93                                                             "forceSelection": true,
94                                                             "hiddenName": "invadjgrp_location_id",
95                                                             "listWidth": 400,
96                                                             "loadingText": "Searching...",
97                                                             "minChars": 2,
98                                                             "name": "invadjgrp_location_id_location_name",
99                                                             "pageSize": 20,
100                                                             "qtip": "Select Location",
101                                                             "queryParam": "query[location_name]",
102                                                             "selectOnFocus": true,
103                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> {location_descrip} </div>",
104                                                             "triggerAction": "all",
105                                                             "typeAhead": true,
106                                                             "valueField": "location_id",
107                                                             "width": 200,
108                                                             "xtype": "ComboBox",
109                                                             "|xns": "Roo.form",
110                                                             "items": [
111                                                                 {
112                                                                     "listeners": {
113                                                                         "|beforeload": "function (_self, o){\n    \n    o.params = o.params || {};\n    o.params.location_netable = 1;\n    o.params._notinternalcompany = 1;\n    o.params.location_restrict = 0;\n}\n"
114                                                                     },
115                                                                     "*prop": "store",
116                                                                     "remoteSort": true,
117                                                                     "xtype": "Store",
118                                                                     "|sortInfo": "{ direction : 'ASC', field: 'curr_id' }",
119                                                                     "|xns": "Roo.data",
120                                                                     "items": [
121                                                                         {
122                                                                             "*prop": "proxy",
123                                                                             "method": "GET",
124                                                                             "xtype": "HttpProxy",
125                                                                             "|url": "baseURL + '/Roo/location.php'",
126                                                                             "|xns": "Roo.data"
127                                                                         },
128                                                                         {
129                                                                             "*prop": "reader",
130                                                                             "id": "location_id",
131                                                                             "root": "data",
132                                                                             "totalProperty": "total",
133                                                                             "xtype": "JsonReader",
134                                                                             "|fields": "[\n    {\"name\":\"location_id\",\"type\":\"int\"},\n    {\"name\":\"location_name\",\"type\":\"string\"}\n]",
135                                                                             "|xns": "Roo.data"
136                                                                         }
137                                                                     ]
138                                                                 }
139                                                             ]
140                                                         },
141                                                         {
142                                                             "allowBlank": true,
143                                                             "fieldLabel": "Comments",
144                                                             "name": "invadjgrp_comments",
145                                                             "width": 400,
146                                                             "xtype": "TextField",
147                                                             "|xns": "Roo.form"
148                                                         }
149                                                     ]
150                                                 },
151                                                 {
152                                                     "name": "invadjgrp_id",
153                                                     "xtype": "Hidden",
154                                                     "|xns": "Roo.form"
155                                                 },
156                                                 {
157                                                     "name": "adjustments",
158                                                     "xtype": "Hidden",
159                                                     "|xns": "Roo.form"
160                                                 }
161                                             ]
162                                         }
163                                     ]
164                                 },
165                                 {
166                                     "listeners": {
167                                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.ds.load({});\n    }\n}"
168                                     },
169                                     "background": false,
170                                     "fitContainer": true,
171                                     "fitToframe": true,
172                                     "region": "center",
173                                     "tableName": "invadj",
174                                     "title": "Invadj",
175                                     "xtype": "GridPanel",
176                                     "|xns": "Roo",
177                                     "items": [
178                                         {
179                                             "listeners": {
180                                                 "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.ds.load({});\n    }\n}",
181                                                 "beforeedit": "function (e)\n{\n    if(_this.data.invadjgrp_posted){\n        Roo.MessageBox.alert('Error', 'This group has been posted');\n        return false;\n    }\n    \n    if(e.record.data.invadj_posted){\n        Roo.MessageBox.alert('Error', 'Can not update the posted adjustment');\n        return false;\n    }\n    \n    if(e.field != 'invadj_itemsite_id_item_number'){\n        var itemsite_id = e.record.data.invadj_itemsite_id * 1;\n        if(isNaN(itemsite_id) || itemsite_id < 1){\n            Roo.MessageBox.alert('Error', 'Please select a item first');\n            return false;\n        }\n    }\n}",
182                                                 "afteredit": "function (e)\n{\n    if (e.originalValue == e.value) {\n        return;\n    }\n    \n    switch(e.field) {\n        case 'invadj_qty_by' :\n            e.record.set('invadj_qty_after', parseInt(e.record.data.invadj_qty_before * 1 + e.value * 1));\n            break;\n        \n        case 'invadj_qty_after' :\n            e.record.set('invadj_qty_by', parseInt(e.value * 1 - e.record.data.invadj_qty_before * 1));\n            break;\n        \n        case 'invadj_itemsite_id_item_number' :\n            e.record.set('invadj_qty_after', parseInt(e.record.data.invadj_qty_before * 1 + e.record.data.invadj_qty_by * 1));\n            break;\n    \n    }\n}"
183                                             },
184                                             "*prop": "grid",
185                                             "autoExpandColumn": "invadj_itemsite_id_item_number",
186                                             "clicksToEdit": 1,
187                                             "loadMask": true,
188                                             "xtype": "EditorGrid",
189                                             "|xns": "Roo.grid",
190                                             "items": [
191                                                 {
192                                                     "listeners": {
193                                                         "tabend": "function (_self)\n{\n    _this.addItemBtn.fireEvent('click', _this.addItemBtn);\n}"
194                                                     },
195                                                     "*prop": "sm",
196                                                     "xtype": "CellSelectionModel",
197                                                     "|xns": "Roo.grid"
198                                                 },
199                                                 {
200                                                     "|xns": "Roo",
201                                                     "xtype": "Toolbar",
202                                                     "*prop": "toolbar",
203                                                     "items": [
204                                                         {
205                                                             "listeners": {
206                                                                 "|click": "function()\n{\n    var group = _this.form.findField('invadjgrp_id').getValue() * 1;\n    \n    if(!group || group < 1){\n        Roo.MessageBox.alert('Error', 'Please save the group first!');\n        return;\n    }\n    \n    if(_this.data.invadjgrp_posted){\n        Roo.MessageBox.alert('Error', 'This group has been posted');\n        return;\n    }\n    \n    var nr = _this.grid.ds.reader.newRow({\n        invadj_itemsite_id_item_number : '',\n        invadj_itemsite_id : 0,\n        invadj_qty_before : 0,\n        invadj_qty_by : 0,\n        invadj_qty_after : 0\n        \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, 0); // type..\n   \n}\n",
207                                                                 "render": "function (_self)\n{\n    _this.addItemBtn = _self;\n}"
208                                                             },
209                                                             "cls": "x-btn-text-icon",
210                                                             "text": "Add",
211                                                             "xtype": "Button",
212                                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
213                                                             "|xns": "Roo.Toolbar"
214                                                         },
215                                                         {
216                                                             "listeners": {
217                                                                 "|click": "function ()\n{\n    _this.grid.stopEditing();\n    \n    if(_this.data.invadjgrp_posted){\n        Roo.MessageBox.alert('Error', 'This group has been posted');\n        return;\n    }\n    \n    var s = _this.grid.getSelectionModel().getSelectedCell();\n    \n    if(!s){\n        Roo.MessageBox.alert('Error', 'Please select a adjustment to delete');\n        return;\n    }\n    \n    var i = _this.grid.ds.getAt(s[0]);\n    \n    if(i.data.invadj_posted){\n        Roo.MessageBox.alert('Error', 'Can not delete the posted adjustment');\n        return;\n    }\n    \n     _this.grid.ds.remove(i);\n     \n\n    i = _this.grid.ds.getAt(s[0]);\n    if (i) {\n        _this.grid.selModel.select(s[0], s[1]);\n        return;\n    }\n    var ln = s[0]-1;\n    if (ln < 0) {\n      return;\n    } // nothing left to select..\n    _this.grid.selModel.select(s[0]-1, s[1]);\n    \n    \n   \n}"
218                                                             },
219                                                             "cls": "x-btn-text-icon",
220                                                             "text": "Delete",
221                                                             "xtype": "Button",
222                                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
223                                                             "|xns": "Roo.Toolbar"
224                                                         },
225                                                         {
226                                                             "|xns": "Roo.Toolbar",
227                                                             "xtype": "Fill"
228                                                         },
229                                                         {
230                                                             "cls": "x-btn-text-icon",
231                                                             "text": "Upload",
232                                                             "xtype": "Button",
233                                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
234                                                             "|xns": "Roo.Toolbar",
235                                                             "items": [
236                                                                 {
237                                                                     "|xns": "Roo.menu",
238                                                                     "xtype": "Menu",
239                                                                     "*prop": "menu",
240                                                                     "items": [
241                                                                         {
242                                                                             "listeners": {
243                                                                                 "click": "function (_self, e)\n{\n    var group = _this.form.findField('invadjgrp_id').getValue() * 1;\n    \n    if(!group || group < 1){\n        Roo.MessageBox.alert('Error', 'Please save the group first!');\n        return;\n    }\n    if(_this.data.invadjgrp_posted){\n        Roo.MessageBox.alert('Error', 'This group has been posted');\n        return;\n    }\n    \n    var rn = _this.grid.ds.getCount();\n    \n    var addRow = function(r) {\n        if(r.invadj_itemsite_id * 1 < 1 || r.qty * 1 == 0){\n            return;\n        }\n        \n        var nr = _this.grid.ds.reader.newRow({\n            invadj_itemsite_id_item_number : r.item_number,\n            invadj_itemsite_id : r.itemsite_id,\n            invadj_qty_before : r.balance * 1,\n            invadj_qty_by : r.qty * 1,\n            invadj_qty_after : r.balance * 1 + r.qty * 1\n            \n       });\n        _this.grid.ds.insert(rn++, nr); \n    \n    \n    }\n    \n    Pman.Dialog.Image.show(\n       {\n            timeout : 90000,\n            _url : baseURL+'/Xtuple/Import/InvAdjustment?' + Roo.urlEncode({'invadjgrp_id' : group})\n        \n       },\n       function (r) {\n\n            Roo.each(r, addRow);\n            \n            Roo.MessageBox.alert(\"Notice\", 'UPLOADED');\n       }\n    );\n}"
244                                                                             },
245                                                                             "cls": "x-btn-text-icon",
246                                                                             "text": "Upload Inventory Adjustments (eg. increases or decreases)",
247                                                                             "xtype": "Item",
248                                                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
249                                                                             "|xns": "Roo.menu"
250                                                                         },
251                                                                         {
252                                                                             "listeners": {
253                                                                                 "click": "function (_self, e)\n{\n    var group = _this.form.findField('invadjgrp_id').getValue() * 1;\n    \n    if(!group || group < 1){\n        Roo.MessageBox.alert('Error', 'Please save the group first!');\n        return;\n    }\n    if(_this.data.invadjgrp_posted){\n        Roo.MessageBox.alert('Error', 'This group has been posted');\n        return;\n    }\n    \n    var rn = _this.grid.ds.getCount();\n    \n    var addRow = function(r) {\n        if(r.invadj_itemsite_id * 1 < 1 || (r.qty * 1 - r.balance * 1) == 0){\n            return;\n        }\n        \n        var nr = _this.grid.ds.reader.newRow({\n            invadj_itemsite_id_item_number : r.item_number,\n            invadj_itemsite_id : r.itemsite_id,\n            invadj_qty_before : r.balance * 1,\n            invadj_qty_by : r.qty * 1 - r.balance * 1,\n            invadj_qty_after : r.qty * 1\n            \n       });\n        _this.grid.ds.insert(rn++, nr); \n    \n    \n    }\n    \n    Pman.Dialog.Image.show(\n       {\n            timeout : 90000,\n            _url : baseURL+'/Xtuple/Import/InvAdjustment?' + Roo.urlEncode({'invadjgrp_id' : group})\n        \n       },\n       function (r) {\n\n            Roo.each(r, addRow);\n            \n            Roo.MessageBox.alert(\"Notice\", 'UPLOADED');\n       }\n    );\n}"
254                                                                             },
255                                                                             "cls": "x-btn-text-icon",
256                                                                             "text": "Upload Inventory Stock take Results",
257                                                                             "xtype": "Item",
258                                                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
259                                                                             "|xns": "Roo.menu"
260                                                                         }
261                                                                     ]
262                                                                 }
263                                                             ]
264                                                         },
265                                                         {
266                                                             "listeners": {
267                                                                 "click": "function ()\n{\n    new Pman.Download({\n        grid : _this.grid\n    });\n    Roo.MessageBox.alert(\"Downloading\", \"File is downloading\");\n}"
268                                                             },
269                                                             "cls": "x-btn-text-icon",
270                                                             "text": "Download",
271                                                             "xtype": "Button",
272                                                             "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
273                                                             "|xns": "Roo.Toolbar"
274                                                         }
275                                                     ]
276                                                 },
277                                                 {
278                                                     "listeners": {
279                                                         "beforeload": "function (_self, o){\n    \n    o.params = o.params || {};\n    var group = _this.form.findField('invadjgrp_id').getValue() * 1;\n\n    if(!group || group < 1){\n        _this.grid.ds.removeAll();\n        return false;\n    }\n    o.params.invadj_invadjgrp_id = group;\n\n    o.params._with_detail = 1;    \n    o.params.limit = 99999;\n}\n"
280                                                     },
281                                                     "*prop": "dataSource",
282                                                     "remoteSort": true,
283                                                     "xtype": "Store",
284                                                     "|sortInfo": "{ field : 'invadj_itemsite_id_item_number', direction: 'ASC' }",
285                                                     "|xns": "Roo.data",
286                                                     "items": [
287                                                         {
288                                                             "*prop": "proxy",
289                                                             "method": "GET",
290                                                             "timeout": 90000,
291                                                             "xtype": "HttpProxy",
292                                                             "|url": "baseURL + '/Roo/Invadj.php'",
293                                                             "|xns": "Roo.data"
294                                                         },
295                                                         {
296                                                             "*prop": "reader",
297                                                             "id": "invadj_id",
298                                                             "root": "data",
299                                                             "totalProperty": "total",
300                                                             "xtype": "JsonReader",
301                                                             "|fields": "[\n    {\n        'name': 'invadj_id',\n        'type': 'int'\n    },\n    {\n        'name': 'invadj_qty_by',\n        'type': 'int'\n    }\n]",
302                                                             "|xns": "Roo.data"
303                                                         }
304                                                     ]
305                                                 },
306                                                 {
307                                                     "*prop": "colModel[]",
308                                                     "align": "right",
309                                                     "dataIndex": "invadj_id",
310                                                     "header": "Ref#",
311                                                     "hidden": true,
312                                                     "width": 75,
313                                                     "xtype": "ColumnModel",
314                                                     "|renderer": "function(v) { return String.format('{0}', parseInt(v).toFixed(0)); }",
315                                                     "|xns": "Roo.grid"
316                                                 },
317                                                 {
318                                                     "*prop": "colModel[]",
319                                                     "dataIndex": "invadj_itemsite_id_item_number",
320                                                     "header": "Code",
321                                                     "width": 200,
322                                                     "xtype": "ColumnModel",
323                                                     "|renderer": "function(v) { return String.format('{0}', v); }",
324                                                     "|xns": "Roo.grid",
325                                                     "items": [
326                                                         {
327                                                             "|xns": "Roo.grid",
328                                                             "xtype": "GridEditor",
329                                                             "*prop": "editor",
330                                                             "items": [
331                                                                 {
332                                                                     "listeners": {
333                                                                         "beforeselect": "function (combo, record, index)\n{\n    var ar = _this.grid.activeEditor.record;\n\n    ar.set('invadj_itemsite_id_item_number', record.data.itemsite_item_id_item_number);\n    ar.set('invadj_itemsite_id', record.data.itemsite_id);\n    ar.set('invadj_qty_before', record.data.balance_atdate);\n\n  \n}"
334                                                                     },
335                                                                     "*prop": "field",
336                                                                     "allowBlank": false,
337                                                                     "displayField": "itemsite_item_id_item_number",
338                                                                     "editable": true,
339                                                                     "emptyText": "Select item",
340                                                                     "forceSelection": true,
341                                                                     "hiddenName": "invadj_itemsite_id",
342                                                                     "listWidth": 400,
343                                                                     "loadingText": "Searching...",
344                                                                     "minChars": 2,
345                                                                     "name": "invadj_itemsite_id_item_number",
346                                                                     "pageSize": 20,
347                                                                     "qtip": "Select item",
348                                                                     "queryParam": "query[number]",
349                                                                     "selectOnFocus": true,
350                                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b>  {itemsite_item_id_item_descrip1} ({balance_atdate})</div>",
351                                                                     "triggerAction": "all",
352                                                                     "valueField": "itemsite_id",
353                                                                     "xtype": "ComboBox",
354                                                                     "|xns": "Roo.form",
355                                                                     "items": [
356                                                                         {
357                                                                             "listeners": {
358                                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params._location = _this.form.findField('invadjgrp_location_id').getValue();\n    \n    var dt = _this.form.findField('invadjgrp_transdate').getValue();\n    \n    o.params._atdate = (typeof(dt) == 'string') ? dt : dt.format('Y-m-d');\n}\n"
359                                                                             },
360                                                                             "*prop": "store",
361                                                                             "remoteSort": true,
362                                                                             "xtype": "Store",
363                                                                             "|sortInfo": "{ direction : 'ASC', field: 'itemsite_item_id_item_number' }",
364                                                                             "|xns": "Roo.data",
365                                                                             "items": [
366                                                                                 {
367                                                                                     "*prop": "proxy",
368                                                                                     "method": "GET",
369                                                                                     "xtype": "HttpProxy",
370                                                                                     "|url": "baseURL + '/Roo/itemsite.php'",
371                                                                                     "|xns": "Roo.data"
372                                                                                 },
373                                                                                 {
374                                                                                     "*prop": "reader",
375                                                                                     "id": "item_id",
376                                                                                     "root": "data",
377                                                                                     "totalProperty": "total",
378                                                                                     "xtype": "JsonReader",
379                                                                                     "|fields": "[{\"name\":\"item_id\",\"type\":\"int\"},\"item_number\"]",
380                                                                                     "|xns": "Roo.data"
381                                                                                 }
382                                                                             ]
383                                                                         }
384                                                                     ]
385                                                                 }
386                                                             ]
387                                                         }
388                                                     ]
389                                                 },
390                                                 {
391                                                     "*prop": "colModel[]",
392                                                     "align": "right",
393                                                     "dataIndex": "invadj_qty_before",
394                                                     "header": "Qty Before",
395                                                     "width": 75,
396                                                     "xtype": "ColumnModel",
397                                                     "|renderer": "function(v) { return String.format('{0}', parseInt(v).toFixed(0)); }",
398                                                     "|xns": "Roo.grid"
399                                                 },
400                                                 {
401                                                     "*prop": "colModel[]",
402                                                     "align": "right",
403                                                     "dataIndex": "invadj_qty_by",
404                                                     "header": "Qty",
405                                                     "width": 75,
406                                                     "xtype": "ColumnModel",
407                                                     "|renderer": "function(v) { return String.format('{0}', parseInt(v).toFixed(0)); }",
408                                                     "|xns": "Roo.grid",
409                                                     "items": [
410                                                         {
411                                                             "|xns": "Roo.grid",
412                                                             "xtype": "GridEditor",
413                                                             "*prop": "editor",
414                                                             "items": [
415                                                                 {
416                                                                     "*prop": "field",
417                                                                     "allowDecimals": false,
418                                                                     "decimalPrecision": 0,
419                                                                     "style": "text-align:right",
420                                                                     "xtype": "NumberField",
421                                                                     "|xns": "Roo.form"
422                                                                 }
423                                                             ]
424                                                         }
425                                                     ]
426                                                 },
427                                                 {
428                                                     "*prop": "colModel[]",
429                                                     "align": "right",
430                                                     "dataIndex": "invadj_qty_after",
431                                                     "header": "Qty After",
432                                                     "width": 75,
433                                                     "xtype": "ColumnModel",
434                                                     "|renderer": "function(v) { return String.format('{0}', parseInt(v).toFixed(0)); }",
435                                                     "|xns": "Roo.grid",
436                                                     "items": [
437                                                         {
438                                                             "|xns": "Roo.grid",
439                                                             "xtype": "GridEditor",
440                                                             "*prop": "editor",
441                                                             "items": [
442                                                                 {
443                                                                     "*prop": "field",
444                                                                     "allowDecimals": false,
445                                                                     "decimalPrecision": 0,
446                                                                     "style": "text-align:right",
447                                                                     "xtype": "NumberField",
448                                                                     "|xns": "Roo.form"
449                                                                 }
450                                                             ]
451                                                         }
452                                                     ]
453                                                 }
454                                             ]
455                                         }
456                                     ]
457                                 }
458                             ]
459                         }
460                     ]
461                 },
462                 {
463                     "listeners": {
464                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
465                     },
466                     "*prop": "buttons[]",
467                     "text": "Cancel",
468                     "xtype": "Button",
469                     "|xns": "Roo"
470                 },
471                 {
472                     "listeners": {
473                         "click": "function (_self, e)\n{\n    var items = [];\n    var ar = [];\n    var err = [];\n    \n   _this.grid.ds.each(function (r) {\n        if(r.data.invadj_qty_by * 1 == 0){\n            return;\n        }\n        if(items.indexOf(r.data.invadj_itemsite_id * 1) != -1){\n            err.push(r.data.invadj_itemsite_id_item_number);\n            return;\n        }\n        \n        items.push(r.data.invadj_itemsite_id * 1);\n        \n        ar.push({\n            invadj_id : r.data.invadj_id * 1,\n            invadj_itemsite_id : r.data.invadj_itemsite_id * 1,\n            invadj_qty_by : r.data.invadj_qty_by * 1\n        })\n   });\n   \n   if(err.length){\n        Roo.MessageBox.alert(\"Error\", \"Duplicate Item found : <br/>\" + err.join(\"<br/>\"));\n        return;\n   }\n   \n   _this.form.findField('adjustments').setValue(Roo.encode(ar));\n   _this.form.doAction(\"submit\");\n\n}",
474                         "render": "function (_self)\n{\n    _this.saveBtn = _self;\n}"
475                     },
476                     "*prop": "buttons[]",
477                     "text": "Save",
478                     "xtype": "Button",
479                     "|xns": "Roo"
480                 }
481             ]
482         }
483     ],
484     "permname": "",
485     "modOrder": "001"
486 }