Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleInvHistory.bjs
1 {
2     "id": "roo-file-9",
3     "name": "Pman.Dialog.XtupleInvHistory",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleInvHistory.bjs",
7     "items": [
8         {
9             "closable": false,
10             "collapsible": false,
11             "height": 500,
12             "modal": true,
13             "resizable": false,
14             "title": "View inventory history",
15             "width": 1000,
16             "xtype": "LayoutDialog",
17             "|xns": "Roo",
18             "items": [
19                 {
20                     "*prop": "north",
21                     "height": 50,
22                     "xtype": "LayoutRegion",
23                     "|xns": "Roo"
24                 },
25                 {
26                     "|xns": "Roo",
27                     "xtype": "LayoutRegion",
28                     "*prop": "center"
29                 },
30                 {
31                     "region": "north",
32                     "xtype": "ContentPanel",
33                     "|xns": "Roo",
34                     "items": [
35                         {
36                             "listeners": {
37                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       //_this.dialog.el.mask(\"Loading\");\n       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n       _this.grid.footer.onClick('first');\n       return;\n    }\n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\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",
38                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
39                             },
40                             "method": "POST",
41                             "style": "margin:10px;",
42                             "xtype": "Form",
43                             "|url": "baseURL + '/Roo/invhist.php'",
44                             "|xns": "Roo.form",
45                             "items": [
46                                 {
47                                     "width": 1000,
48                                     "xtype": "Row",
49                                     "|xns": "Roo.form",
50                                     "items": [
51                                         {
52                                             "listeners": {
53                                                 "specialkey": "function (_self, e)\n{\n\n    _this.grid.footer.onClick('first');\n}"
54                                             },
55                                             "fieldLabel": "Search Product",
56                                             "name": "search_name",
57                                             "xtype": "TextField",
58                                             "|xns": "Roo.form"
59                                         },
60                                         {
61                                             "listeners": {
62                                                 "select": "function (combo, record, index)\n{\n  \n \n   (function() { \n     if (_this.grid) {\n        _this.grid.footer.onClick('first'); \n    }\n     }).defer(100);\n}"
63                                             },
64                                             "allowBlank": true,
65                                             "displayField": "itemsite_item_id_item_number",
66                                             "editable": true,
67                                             "emptyText": "Select itemsite",
68                                             "fieldLabel": "Item",
69                                             "forceSelection": true,
70                                             "listWidth": 400,
71                                             "loadingText": "Searching...",
72                                             "minChars": 2,
73                                             "name": "itemsite_item_id_item_number",
74                                             "pageSize": 20,
75                                             "qtip": "Select itemsite",
76                                             "queryParam": "query[number]",
77                                             "selectOnFocus": true,
78                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{itemsite_item_id_item_number}</b> {itemsite_item_id_item_descrip1}</div>",
79                                             "triggerAction": "all",
80                                             "typeAhead": true,
81                                             "valueField": "itemsite_item_id_item_number",
82                                             "width": 200,
83                                             "xtype": "ComboBox",
84                                             "|xns": "Roo.form",
85                                             "items": [
86                                                 {
87                                                     "listeners": {
88                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
89                                                     },
90                                                     "*prop": "store",
91                                                     "remoteSort": true,
92                                                     "xtype": "Store",
93                                                     "|sortInfo": "{ direction : 'ASC', field: 'id' }",
94                                                     "|xns": "Roo.data",
95                                                     "items": [
96                                                         {
97                                                             "*prop": "proxy",
98                                                             "method": "GET",
99                                                             "xtype": "HttpProxy",
100                                                             "|url": "baseURL + '/Roo/itemsite.php'",
101                                                             "|xns": "Roo.data"
102                                                         },
103                                                         {
104                                                             "*prop": "reader",
105                                                             "xtype": "JsonReader",
106                                                             "|xns": "Roo.data",
107                                                             "id": "id",
108                                                             "root": "data",
109                                                             "totalProperty": "total",
110                                                             "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"itemsite_abcclass\",\"type\":\"string\"}]"
111                                                         }
112                                                     ]
113                                                 }
114                                             ]
115                                         },
116                                         {
117                                             "listeners": {
118                                                 "select": "function (combo, record, index)\n{\n  \n \n   (function() { \n     if (_this.grid) {\n        _this.grid.footer.onClick('first'); \n    }\n     }).defer(100);\n}"
119                                             },
120                                             "allowBlank": true,
121                                             "displayField": "location_descrip",
122                                             "editable": true,
123                                             "emptyText": "Select location",
124                                             "fieldLabel": "location",
125                                             "forceSelection": true,
126                                             "hiddenName": "location_name",
127                                             "listWidth": 400,
128                                             "loadingText": "Searching...",
129                                             "minChars": 2,
130                                             "name": "location_descrip",
131                                             "pageSize": 40,
132                                             "qtip": "Select location",
133                                             "queryParam": "query[location_name]",
134                                             "selectOnFocus": true,
135                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{location_descrip}</b> </div>",
136                                             "triggerAction": "all",
137                                             "typeAhead": true,
138                                             "valueField": "location_name",
139                                             "width": 200,
140                                             "xtype": "ComboBox",
141                                             "|xns": "Roo.form",
142                                             "items": [
143                                                 {
144                                                     "listeners": {
145                                                         "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
146                                                     },
147                                                     "*prop": "store",
148                                                     "remoteSort": true,
149                                                     "xtype": "Store",
150                                                     "|sortInfo": "{ direction : 'ASC', field: 'location_name' }",
151                                                     "|xns": "Roo.data",
152                                                     "items": [
153                                                         {
154                                                             "*prop": "proxy",
155                                                             "method": "GET",
156                                                             "xtype": "HttpProxy",
157                                                             "|url": "baseURL + '/Roo/location.php'",
158                                                             "|xns": "Roo.data"
159                                                         },
160                                                         {
161                                                             "*prop": "reader",
162                                                             "xtype": "JsonReader",
163                                                             "|xns": "Roo.data",
164                                                             "id": "id",
165                                                             "root": "data",
166                                                             "totalProperty": "total",
167                                                             "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"location_name\",\"type\":\"string\"}]"
168                                                         }
169                                                     ]
170                                                 }
171                                             ]
172                                         }
173                                     ]
174                                 }
175                             ]
176                         }
177                     ]
178                 },
179                 {
180                     "listeners": {
181                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
182                     },
183                     "background": false,
184                     "fitContainer": true,
185                     "fitToframe": true,
186                     "region": "center",
187                     "tableName": "invhist",
188                     "title": "invhist",
189                     "xtype": "GridPanel",
190                     "|xns": "Roo",
191                     "items": [
192                         {
193                             "listeners": {
194                                 "|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}",
195                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
196                             },
197                             "*prop": "grid",
198                             "autoExpandColumn": "invhist_comments",
199                             "loadMask": true,
200                             "xtype": "Grid",
201                             "|xns": "Roo.grid",
202                             "items": [
203                                 {
204                                     "listeners": {
205                                         "beforeload": "function (_self, o)\n{\n    if (!_this.form.findField('itemsite_item_id_item_number').getValue().length  && \n            !_this.form.findField('location_name').getValue().length\n            &&             !_this.form.findField('search_name').getValue().length ) {\n        _this.grid.ds.removeAll();\n        return false;\n    }\n    o.params['query[item_number]'] = _this.form.findField('itemsite_item_id_item_number').getValue();\n    o.params['query[location_name]']   = _this.form.findField('location_name').getValue();\n    o.params['search[item]'] =     _this.form.findField('search_name').getValue();\n    \n    \n    o.params._with_item =1;\n    o.params._hide_void =1;\n    o.params._with_balance = 1;\n   \n}"
206                                     },
207                                     "*prop": "dataSource",
208                                     "remoteSort": true,
209                                     "xtype": "Store",
210                                     "|sortInfo": "{ field : 'invhist_transdate,invdetail_id', direction: 'DESC' }",
211                                     "|xns": "Roo.data",
212                                     "items": [
213                                         {
214                                             "*prop": "proxy",
215                                             "method": "GET",
216                                             "xtype": "HttpProxy",
217                                             "|url": "baseURL + '/Roo/invdetail.php'",
218                                             "|xns": "Roo.data"
219                                         },
220                                         {
221                                             "|xns": "Roo.data",
222                                             "xtype": "JsonReader",
223                                             "totalProperty": "total",
224                                             "root": "data",
225                                             "*prop": "reader",
226                                             "id": "id",
227                                             "|fields": "[\n    {\n        'name': 'invhist_id',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_itemsite_id',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_transdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'invhist_transtype',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_invqty',\n        'type': 'float'\n    },\n    {\n        'name': 'invhist_invuom',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_ordnumber',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_docnumber',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_qoh_before',\n        'type': 'float'\n    },\n    {\n        'name': 'invhist_qoh_after',\n        'type': 'float'\n    },\n    {\n        'name': 'invhist_unitcost',\n        'type': 'float'\n    },\n    {\n        'name': 'invhist_acct_id',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_xfer_warehous_id',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_posted',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_imported',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_hasdetail',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_ordtype',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_analyze',\n        'type': 'int'\n    },\n    {\n        'name': 'invhist_user',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'invhist_costmethod',\n        'type': 'string'\n    },\n    {\n        'name': 'invhist_value_before',\n        'type': 'float'\n    },\n    {\n        'name': 'invhist_value_after',\n        'type': 'float'\n    },\n    {\n        'name': 'invhist_series',\n        'type': 'int'\n    }\n]"
228                                         }
229                                     ]
230                                 },
231                                 {
232                                     "*prop": "footer",
233                                     "xtype": "PagingToolbar",
234                                     "pageSize": 25,
235                                     "displayInfo": true,
236                                     "displayMsg": "Displaying invhist{0} - {1} of {2}",
237                                     "emptyMsg": "No invhist found",
238                                     "|xns": "Roo"
239                                 },
240                                 {
241                                     "*prop": "colModel[]",
242                                     "dataIndex": "invhist_transdate",
243                                     "header": "Invhist transdate",
244                                     "width": 75,
245                                     "xtype": "ColumnModel",
246                                     "|renderer": "function(v) { \n    var vv = Date.parseDate(v.split(' ')[0],'Y-m-d' );\n    return String.format('{0}', vv ? vv.format('d/M/Y') : '');\n }",
247                                     "|xns": "Roo.grid"
248                                 },
249                                 {
250                                     "*prop": "colModel[]",
251                                     "dataIndex": "invhist_ordnumber",
252                                     "header": "Order#",
253                                     "width": 100,
254                                     "xtype": "ColumnModel",
255                                     "|renderer": "function(v) { return String.format('{0}', v); }",
256                                     "|xns": "Roo.grid"
257                                 },
258                                 {
259                                     "*prop": "colModel[]",
260                                     "dataIndex": "item_number",
261                                     "header": "SKU",
262                                     "width": 50,
263                                     "xtype": "ColumnModel",
264                                     "|renderer": "function(v) { return String.format('{0}', v); }",
265                                     "|xns": "Roo.grid"
266                                 },
267                                 {
268                                     "*prop": "colModel[]",
269                                     "dataIndex": "item_descrip1",
270                                     "header": "Descr.",
271                                     "width": 100,
272                                     "xtype": "ColumnModel",
273                                     "|renderer": "function(v) { return String.format('{0}', v); }",
274                                     "|xns": "Roo.grid"
275                                 },
276                                 {
277                                     "*prop": "colModel[]",
278                                     "dataIndex": "invhist_docnumber",
279                                     "header": "doc#",
280                                     "width": 75,
281                                     "xtype": "ColumnModel",
282                                     "|renderer": "function(v) { return String.format('{0}', v); }",
283                                     "|xns": "Roo.grid"
284                                 },
285                                 {
286                                     "*prop": "colModel[]",
287                                     "dataIndex": "invhist_transtype",
288                                     "header": "Type",
289                                     "width": 50,
290                                     "xtype": "ColumnModel",
291                                     "|renderer": "function(v,x,r) { return String.format('{0}/{1}', v,r.data.invhist_ordtype); }",
292                                     "|xns": "Roo.grid"
293                                 },
294                                 {
295                                     "*prop": "colModel[]",
296                                     "align": "right",
297                                     "dataIndex": "invhist_unitcost",
298                                     "header": " unitcost",
299                                     "width": 50,
300                                     "xtype": "ColumnModel",
301                                     "|renderer": "function(v) { return String.format('{0}', v); }",
302                                     "|xns": "Roo.grid"
303                                 },
304                                 {
305                                     "*prop": "colModel[]",
306                                     "dataIndex": "location_name",
307                                     "header": "Location",
308                                     "width": 100,
309                                     "xtype": "ColumnModel",
310                                     "|renderer": "function(v) { return String.format('<B>{0}</B>', v); }",
311                                     "|xns": "Roo.grid"
312                                 },
313                                 {
314                                     "*prop": "colModel[]",
315                                     "align": "right",
316                                     "dataIndex": "invdetail_qty",
317                                     "header": "Change",
318                                     "width": 50,
319                                     "xtype": "ColumnModel",
320                                     "|renderer": "function(v) { return String.format('{0}', parseInt( v)); }",
321                                     "|xns": "Roo.grid"
322                                 },
323                                 {
324                                     "*prop": "colModel[]",
325                                     "align": "right",
326                                     "dataIndex": "invdetail_before_qty",
327                                     "header": "Opening Balance",
328                                     "width": 90,
329                                     "xtype": "ColumnModel",
330                                     "|renderer": "function(v) { return String.format('{0}', parseInt( v)); }",
331                                     "|xns": "Roo.grid"
332                                 },
333                                 {
334                                     "*prop": "colModel[]",
335                                     "align": "right",
336                                     "dataIndex": "invdetail_balance_qty",
337                                     "header": "Closing Balance",
338                                     "width": 85,
339                                     "xtype": "ColumnModel",
340                                     "|renderer": "function(v) { return String.format('{0}', parseInt( v)); }",
341                                     "|xns": "Roo.grid"
342                                 },
343                                 {
344                                     "*prop": "colModel[]",
345                                     "dataIndex": "invhist_comments",
346                                     "header": "Invhist comments",
347                                     "width": 150,
348                                     "xtype": "ColumnModel",
349                                     "|renderer": "function(v) { return String.format('{0}', v); }",
350                                     "|xns": "Roo.grid"
351                                 }
352                             ]
353                         }
354                     ]
355                 },
356                 {
357                     "listeners": {
358                         "click": "function (_self, e)\n{\n   Pman.Dialog.XtupleInvHistoryOld.show({\n        itemsite_item_id_item_number   : _this.data.itemsite_item_id_item_number,\n\n        location_name : _this.data.location_name,\n        location_descrip : _this.data.location_descrip,        \n        invhist_transdate : _this.data.invhist_transdate\n    }); \n}"
359                     },
360                     "*prop": "buttons[]",
361                     "text": "View (HK  data)",
362                     "xtype": "Button",
363                     "|hidden": "(function() {\n    return !!baseURL.match(/hk\\.php/);\n})()",
364                     "|xns": "Roo"
365                 },
366                 {
367                     "listeners": {
368                         "click": "function (_self, e)\n{\n    new Pman.Download({\n        grid : _this.grid\n    });\n}"
369                     },
370                     "*prop": "buttons[]",
371                     "text": "Download",
372                     "xtype": "Button",
373                     "|xns": "Roo"
374                 },
375                 {
376                     "listeners": {
377                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
378                     },
379                     "*prop": "buttons[]",
380                     "text": "Close",
381                     "xtype": "Button",
382                     "|xns": "Roo"
383                 }
384             ]
385         }
386     ],
387     "permname": "",
388     "modOrder": "001"
389 }