Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleLanded.bjs
1 {
2     "id": "roo-file-45",
3     "name": "Pman.Tab.XtupleLanded",
4     "parent": "Pman.Tab.XtuplePurchases",
5     "title": "Pman.Tab.XtupleLanded",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleLanded.bjs",
7     "items": [
8         {
9             "background": true,
10             "region": "center",
11             "title": "Landed Costs",
12             "xtype": "NestedLayoutPanel",
13             "|xns": "Roo",
14             "items": [
15                 {
16                     "|xns": "Roo",
17                     "xtype": "BorderLayout",
18                     "*prop": "layout",
19                     "items": [
20                         {
21                             "|xns": "Roo",
22                             "xtype": "LayoutRegion",
23                             "*prop": "center"
24                         },
25                         {
26                             "*prop": "east",
27                             "split": true,
28                             "width": 500,
29                             "xtype": "LayoutRegion",
30                             "|xns": "Roo"
31                         },
32                         {
33                             "listeners": {
34                                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
35                             },
36                             "background": true,
37                             "fitContainer": true,
38                             "fitToframe": true,
39                             "region": "center",
40                             "tableName": "vohead",
41                             "title": "vohead",
42                             "xtype": "GridPanel",
43                             "|xns": "Roo",
44                             "items": [
45                                 {
46                                     "listeners": {
47                                         "|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}",
48                                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
49                                     },
50                                     "*prop": "grid",
51                                     "autoExpandColumn": "vohead_reference",
52                                     "loadMask": true,
53                                     "xtype": "Grid",
54                                     "|xns": "Roo.grid",
55                                     "items": [
56                                         {
57                                             "listeners": {
58                                                 "beforeload": "function (_self, options)\n{\n    options.params._landed = 1;\n    if (!_this.vsearch) {\n        return false;\n    }\n    options.params._landed_status = _this.status.getValue();    \n \n\n    options.params._search = _this.vsearch.getValue();\n}",
59                                                 "load": "function (_self, records, options)\n{\n_this.rgrid.footer.onClick('refresh');\n}"
60                                             },
61                                             "*prop": "dataSource",
62                                             "remoteSort": true,
63                                             "xtype": "Store",
64                                             "|sortInfo": "{ field : 'vohead_gldistdate', direction: 'DESC' }",
65                                             "|xns": "Roo.data",
66                                             "items": [
67                                                 {
68                                                     "*prop": "proxy",
69                                                     "xtype": "HttpProxy",
70                                                     "method": "GET",
71                                                     "|url": "baseURL + '/Roo/vohead.php'",
72                                                     "|xns": "Roo.data"
73                                                 },
74                                                 {
75                                                     "|xns": "Roo.data",
76                                                     "xtype": "JsonReader",
77                                                     "totalProperty": "total",
78                                                     "root": "data",
79                                                     "*prop": "reader",
80                                                     "id": "id",
81                                                     "|fields": "[\n    {\n        'name': 'vohead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_number',\n        'type': 'string'\n    },\n    {\n        'name': 'vohead_pohead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_posted',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_duedate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'vohead_invcnumber',\n        'type': 'string'\n    },\n    {\n        'name': 'vohead_amount',\n        'type': 'float'\n    },\n    {\n        'name': 'vohead_docdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'vohead_1099',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_distdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'vohead_reference',\n        'type': 'string'\n    },\n    {\n        'name': 'vohead_terms_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_adjtaxtype_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_freighttaxtype_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_gldistdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'vohead_misc',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_taxzone_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_taxtype_id',\n        'type': 'int'\n    },\n    {\n        'name': 'vohead_notes',\n        'type': 'string'\n    }\n]"
82                                                 }
83                                             ]
84                                         },
85                                         {
86                                             "listeners": {
87                                                 "afterselectionchange": "function (_self)\n{\n    _this.rsearch.setValue('');\n    _this.rgrid.footer.onClick('first');\n}"
88                                             },
89                                             "*prop": "sm",
90                                             "singleSelect": true,
91                                             "xtype": "RowSelectionModel",
92                                             "|xns": "Roo.grid"
93                                         },
94                                         {
95                                             "*prop": "footer",
96                                             "xtype": "PagingToolbar",
97                                             "pageSize": 25,
98                                             "displayInfo": true,
99                                             "displayMsg": "Displaying vohead{0} - {1} of {2}",
100                                             "emptyMsg": "No vohead found",
101                                             "|xns": "Roo"
102                                         },
103                                         {
104                                             "*prop": "toolbar",
105                                             "xtype": "Toolbar",
106                                             "|xns": "Roo",
107                                             "items": [
108                                                 {
109                                                     "listeners": {
110                                                         "render": "function (_self)\n{\n  _this.status = _self;\n}",
111                                                         "select": "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
112                                                     },
113                                                     "allowBlank": false,
114                                                     "displayField": "fname",
115                                                     "editable": false,
116                                                     "fieldLabel": "Status",
117                                                     "hiddenName": "cm_status",
118                                                     "listWidth": 200,
119                                                     "mode": "local",
120                                                     "name": "cm_status_name",
121                                                     "triggerAction": "all",
122                                                     "value": "NOTASSIGN",
123                                                     "valueField": "ftype",
124                                                     "width": 150,
125                                                     "xtype": "ComboBox",
126                                                     "|xns": "Roo.form",
127                                                     "items": [
128                                                         {
129                                                             "*prop": "store",
130                                                             "xtype": "SimpleStore",
131                                                             "|data": "[ \n    [ 'NOTASSIGN', \"Not Assigned\"],\n    [ 'ASSIGNED' , \"Assigned\"]\n]\n",
132                                                             "|fields": "[  'ftype', 'fname']",
133                                                             "|xns": "Roo.data"
134                                                         }
135                                                     ]
136                                                 },
137                                                 {
138                                                     "listeners": {
139                                                         "render": "function (_self)\n{\n    _this.vsearch = _self;\n}",
140                                                         "specialkey": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
141                                                     },
142                                                     "xtype": "TextField",
143                                                     "|xns": "Roo.form"
144                                                 },
145                                                 {
146                                                     "listeners": {
147                                                         "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
148                                                     },
149                                                     "cls": "x-btn-icon",
150                                                     "xtype": "Button",
151                                                     "|icon": "rootURL + '/Pman/templates/images/search.gif'",
152                                                     "|xns": "Roo.Toolbar"
153                                                 }
154                                             ]
155                                         },
156                                         {
157                                             "*prop": "colModel[]",
158                                             "dataIndex": "vohead_gldistdate",
159                                             "header": "Date",
160                                             "width": 75,
161                                             "xtype": "ColumnModel",
162                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
163                                             "|xns": "Roo.grid"
164                                         },
165                                         {
166                                             "*prop": "colModel[]",
167                                             "dataIndex": "vohead_number",
168                                             "header": "no#",
169                                             "width": 100,
170                                             "xtype": "ColumnModel",
171                                             "|renderer": "function(v,x,r) { \n    return String.format('{0} / {1}', v,r.data.vohead_invcnumber); \n}",
172                                             "|xns": "Roo.grid"
173                                         },
174                                         {
175                                             "*prop": "colModel[]",
176                                             "dataIndex": "vohead_reference",
177                                             "header": "Ref#",
178                                             "width": 120,
179                                             "xtype": "ColumnModel",
180                                             "|renderer": "function(v) { return String.format('{0}', v); }",
181                                             "|xns": "Roo.grid"
182                                         },
183                                         {
184                                             "*prop": "colModel[]",
185                                             "dataIndex": "vohead_vend_id_vend_name",
186                                             "header": "Vohead vend",
187                                             "width": 150,
188                                             "xtype": "ColumnModel",
189                                             "|renderer": "function(v) { return String.format('{0}', v); }",
190                                             "|xns": "Roo.grid"
191                                         },
192                                         {
193                                             "*prop": "colModel[]",
194                                             "align": "right",
195                                             "dataIndex": "vohead_total",
196                                             "header": "Amount",
197                                             "width": 100,
198                                             "xtype": "ColumnModel",
199                                             "|renderer": "function(v,x,r) { \n  \n    \n    return String.format('{0} {1}', r.data.vohead_curr_id_curr_symbol,v); \n}",
200                                             "|xns": "Roo.grid"
201                                         },
202                                         {
203                                             "*prop": "colModel[]",
204                                             "align": "right",
205                                             "dataIndex": "assigned",
206                                             "header": "Assigned",
207                                             "width": 100,
208                                             "xtype": "ColumnModel",
209                                             "|renderer": "function(v,x,r) { \n    return v ? String.format('${0}',  v) : ''; \n}",
210                                             "|xns": "Roo.grid"
211                                         }
212                                     ]
213                                 }
214                             ]
215                         },
216                         {
217                             "listeners": {
218                                 "|activate": "function() {\n    _this.rpanel = this;\n    //if (_this.rgrid) {\n      //  _this.rgrid.footer.onClick('first');\n    //}\n}"
219                             },
220                             "background": true,
221                             "fitContainer": true,
222                             "fitToframe": true,
223                             "region": "east",
224                             "tableName": "recvgrp",
225                             "title": "recvgrp",
226                             "xtype": "GridPanel",
227                             "|xns": "Roo",
228                             "items": [
229                                 {
230                                     "listeners": {
231                                         "|render": "function() \n{\n    _this.rgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    //if (_this.panel.active) {\n   //    this.footer.onClick('first');\n    //}\n}",
232                                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
233                                     },
234                                     "*prop": "grid",
235                                     "autoExpandColumn": "recvgrp_number",
236                                     "loadMask": true,
237                                     "xtype": "Grid",
238                                     "|xns": "Roo.grid",
239                                     "items": [
240                                         {
241                                             "listeners": {
242                                                 "beforeload": "function (_self, o)\n{\n    var sel = _this.grid.selModel.getSelected();\n    if (!sel) {\n        this.removeAll();\n        return false;\n    }\n    o.params =  o.params || {};\n    o.params._landed_vohead = sel.data.vohead_id;\n    o.params._search = _this.rsearch.getValue();\n    \n    \n}"
243                                             },
244                                             "*prop": "dataSource",
245                                             "remoteSort": true,
246                                             "xtype": "Store",
247                                             "|sortInfo": "{ field : 'recvgrp_date', direction: 'ASC' }",
248                                             "|xns": "Roo.data",
249                                             "items": [
250                                                 {
251                                                     "*prop": "proxy",
252                                                     "xtype": "HttpProxy",
253                                                     "method": "GET",
254                                                     "|url": "baseURL + '/Roo/recvgrp.php'",
255                                                     "|xns": "Roo.data"
256                                                 },
257                                                 {
258                                                     "|xns": "Roo.data",
259                                                     "xtype": "JsonReader",
260                                                     "totalProperty": "total",
261                                                     "root": "data",
262                                                     "*prop": "reader",
263                                                     "id": "id",
264                                                     "|fields": "[\n    {\n        'name': 'recvgrp_id',\n        'type': 'int'\n    },\n    {\n        'name': 'recvgrp_number',\n        'type': 'string'\n    }\n]"
265                                                 }
266                                             ]
267                                         },
268                                         {
269                                             "*prop": "footer",
270                                             "xtype": "PagingToolbar",
271                                             "pageSize": 25,
272                                             "displayInfo": true,
273                                             "displayMsg": "Displaying recvgrp{0} - {1} of {2}",
274                                             "emptyMsg": "No recvgrp found",
275                                             "|xns": "Roo"
276                                         },
277                                         {
278                                             "*prop": "toolbar",
279                                             "xtype": "Toolbar",
280                                             "|xns": "Roo",
281                                             "items": [
282                                                 {
283                                                     "listeners": {
284                                                         "render": "function (_self)\n{\n    _this.rsearch = _self;\n}",
285                                                         "specialkey": "function (_self, e)\n{\n_this.rgrid.footer.onClick('first');\n}"
286                                                     },
287                                                     "xtype": "TextField",
288                                                     "|xns": "Roo.form"
289                                                 },
290                                                 {
291                                                     "listeners": {
292                                                         "|click": "function (_self, e)\n{\n_this.rgrid.footer.onClick('first');\n}"
293                                                     },
294                                                     "cls": "x-btn-icon",
295                                                     "xtype": "Button",
296                                                     "|icon": "rootURL + '/Pman/templates/images/search.gif'",
297                                                     "|xns": "Roo.Toolbar"
298                                                 },
299                                                 {
300                                                     "|xns": "Roo.Toolbar",
301                                                     "xtype": "Fill"
302                                                 },
303                                                 {
304                                                     "listeners": {
305                                                         "click": "function (_self, e)\n{\n    var recv = _this.rgrid.selModel.getSelected();\n    var vo = _this.grid.selModel.getSelected();\n    if (!vo || !recv) {\n        return;\n    }\n    new Pman.Request({\n        mask : 'saving',\n        method  : 'POST',\n        url : baseURL + '/Roo/Recvgrpland',\n        params : {\n            recvgrpland_vohead_id : vo.data.vohead_id,\n            recvgrpland_recvgrp_id : recv.data.recvgrp_id, \n            recvgrpland_cost : vo.data.vohead_total,\n            recvgrpland_curr_id : vo.data.vohead_curr_id\n        },\n        success : function () {\n            _this.grid.footer.onClick('refresh');\n        }\n    });\n            \n    \n    \n}"
306                                                     },
307                                                     "text": "Assign All",
308                                                     "xtype": "Button",
309                                                     "|xns": "Roo.Toolbar"
310                                                 },
311                                                 {
312                                                     "listeners": {
313                                                         "click": "function (_self, e)\n{\n    var recv = _this.rgrid.selModel.getSelected();\n    var vo = _this.grid.selModel.getSelected();\n    if (!vo || !recv) {\n        return;\n    }\n    \n    var avail = ((1*vo.data.vohead_total) - (1*vo.data.assigned)).toFixed(2);\n    \n    Roo.MessageBox.prompt(\"How much to assign?\",\n        \"The total available to assign is \" + vo.data.vohead_curr_id_curr_symbol +\n             ' ' + Roo.util.Format.number(avail,2),\n        function (b, n) {\n            if (b != 'ok') {\n                return;\n            }\n            n = n*1;\n            if (isNaN(n)) {\n                Roo.MessageBox.alert(\"Error\", \"did not get a number\");\n                return;\n            }\n\n            //vo.data.vohead_total\n            if (n*1 > avail) {\n                Roo.MessageBox.alert(\"Error\", \"you assigned to much, try again\");\n                return;\n            }\n            \n            \n            new Pman.Request({\n                mask : 'saving',\n                method  : 'POST',\n                url : baseURL + '/Roo/Recvgrpland',\n                params : {\n                    recvgrpland_vohead_id : vo.data.vohead_id,\n                    recvgrpland_recvgrp_id : recv.data.recvgrp_id, \n                    recvgrpland_cost : n,\n                    recvgrpland_curr_id : vo.data.vohead_curr_id\n                },\n                success : function () {\n                    _this.grid.footer.onClick('refresh');\n                }\n            });\n        }\n    );\n    \n    \n}\n\n"
314                                                     },
315                                                     "text": "Assign Some",
316                                                     "xtype": "Button",
317                                                     "|xns": "Roo.Toolbar"
318                                                 },
319                                                 {
320                                                     "listeners": {
321                                                         "click": "function (_self, e)\n{\n    var recv = _this.rgrid.selModel.getSelected();\n    var vo = _this.grid.selModel.getSelected();\n    if (!vo || !recv) {\n        return;\n    }\n   var av = recv.data.assigned_landed * 1;\n    if (!av) {\n        return;\n    }\n    \n    new Pman.Request({\n        mask : 'saving',\n        method  : 'POST',\n        url : baseURL + '/Roo/Recvgrpland',\n        params : {\n            _void : 1,\n            recvgrpland_vohead_id : vo.data.vohead_id,\n            recvgrpland_recvgrp_id : recv.data.recvgrp_id\n        },\n        success : function () {\n            _this.grid.footer.onClick('refresh');\n        }\n    });\n            \n    \n    \n}"
322                                                     },
323                                                     "text": "Remove Assign",
324                                                     "xtype": "Button",
325                                                     "|xns": "Roo.Toolbar"
326                                                 }
327                                             ]
328                                         },
329                                         {
330                                             "*prop": "colModel[]",
331                                             "dataIndex": "recvgrp_date",
332                                             "header": "Date",
333                                             "width": 50,
334                                             "xtype": "ColumnModel",
335                                             "|renderer": "function(v) { return String.format('{0}', v.format('d/M/Y')); }",
336                                             "|xns": "Roo.grid"
337                                         },
338                                         {
339                                             "*prop": "colModel[]",
340                                             "dataIndex": "recvgrp_pohead_id_pohead_number",
341                                             "header": "Po#",
342                                             "width": 75,
343                                             "xtype": "ColumnModel",
344                                             "|renderer": "function(v) { return String.format('{0}', v); }",
345                                             "|xns": "Roo.grid"
346                                         },
347                                         {
348                                             "*prop": "colModel[]",
349                                             "dataIndex": "recvgrp_number",
350                                             "header": "ref#",
351                                             "width": 100,
352                                             "xtype": "ColumnModel",
353                                             "|renderer": "function(v) { return String.format('{0}', v); }",
354                                             "|xns": "Roo.grid"
355                                         },
356                                         {
357                                             "*prop": "colModel[]",
358                                             "dataIndex": "vend_name",
359                                             "header": "Vendor",
360                                             "width": 75,
361                                             "xtype": "ColumnModel",
362                                             "|renderer": "function(v) { return String.format('{0}', v); }",
363                                             "|xns": "Roo.grid"
364                                         },
365                                         {
366                                             "*prop": "colModel[]",
367                                             "dataIndex": "recvgrp_location_id_location_descrip",
368                                             "header": "loc",
369                                             "width": 75,
370                                             "xtype": "ColumnModel",
371                                             "|renderer": "function(v) { return String.format('{0}', v); }",
372                                             "|xns": "Roo.grid"
373                                         },
374                                         {
375                                             "*prop": "colModel[]",
376                                             "align": "right",
377                                             "dataIndex": "recv_qty",
378                                             "header": "Qty",
379                                             "width": 75,
380                                             "xtype": "ColumnModel",
381                                             "|renderer": "function(v) { \n    if (v*1 <= 0.0) {\n        return '';\n    }\n    return Roo.util.Format.number(v, 2); \n}",
382                                             "|xns": "Roo.grid"
383                                         },
384                                         {
385                                             "*prop": "colModel[]",
386                                             "align": "right",
387                                             "dataIndex": "recvgrp_landed_cost",
388                                             "header": "Old landed",
389                                             "hidden": true,
390                                             "width": 75,
391                                             "xtype": "ColumnModel",
392                                             "|renderer": "function(v) { \n    if (v*1 <= 0.0) {\n        return '';\n    }\n    return Roo.util.Format.number(v, 2); \n}",
393                                             "|xns": "Roo.grid"
394                                         },
395                                         {
396                                             "*prop": "colModel[]",
397                                             "align": "right",
398                                             "dataIndex": "assigned_landed",
399                                             "header": "Assigned Value",
400                                             "width": 75,
401                                             "xtype": "ColumnModel",
402                                             "|renderer": "function(v,x,r) { \n    if (v*1 <= 0.0) {\n    \n        if (r.data.total_landed_cost*1 > 0) {\n            return '<span style=\"color:#ccc\">' + \n             String.format('{0}', r.data.base_curr_symbol) + \n             Roo.util.Format.number(r.data.total_landed_cost, 2) + '</span>';\n        }\n    \n        return '';\n    }\n    return  String.format('{0}', r.data.base_curr_symbol) +  Roo.util.Format.number(v, 2); \n}",
403                                             "|xns": "Roo.grid"
404                                         }
405                                     ]
406                                 }
407                             ]
408                         }
409                     ]
410                 }
411             ]
412         }
413     ],
414     "permname": "",
415     "modOrder": "100"
416 }