Pman.Tab.XtuplePriceLists.bjs
[Pman.Xtuple] / Pman.Tab.XtuplePriceLists.bjs
1 {
2     "id": "roo-file-56",
3     "name": "Pman.Tab.XtuplePriceLists",
4     "parent": "Pman.Tab.XtupleManage",
5     "title": "Pman.Tab.XtuplePriceLists",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtuplePriceLists.bjs",
7     "items": [
8         {
9             "background": true,
10             "fitContainer": true,
11             "fitToFrame": true,
12             "region": "center",
13             "title": "Price List",
14             "xtype": "NestedLayoutPanel",
15             "|xns": "Roo",
16             "items": [
17                 {
18                     "|xns": "Roo",
19                     "xtype": "BorderLayout",
20                     "*prop": "layout",
21                     "items": [
22                         {
23                             "*prop": "center",
24                             "xtype": "LayoutRegion",
25                             "|xns": "Roo"
26                         },
27                         {
28                             "*prop": "east",
29                             "split": true,
30                             "width": 200,
31                             "xtype": "LayoutRegion",
32                             "|xns": "Roo"
33                         },
34                         {
35                             "listeners": {
36                                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
37                             },
38                             "background": true,
39                             "fitContainer": true,
40                             "fitToframe": true,
41                             "region": "center",
42                             "tableName": "ipshead",
43                             "title": "Price Lists",
44                             "xtype": "GridPanel",
45                             "|xns": "Roo",
46                             "items": [
47                                 {
48                                     "listeners": {
49                                         "|render": "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.XtuplePriceList\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
50                                         "|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}\n"
51                                     },
52                                     "*prop": "grid",
53                                     "autoExpandColumn": "ipshead_descrip",
54                                     "loadMask": true,
55                                     "xtype": "Grid",
56                                     "|xns": "Roo.grid",
57                                     "items": [
58                                         {
59                                             "*prop": "sm",
60                                             "singleSelect": true,
61                                             "xtype": "RowSelectionModel",
62                                             "|xns": "Roo.grid"
63                                         },
64                                         {
65                                             "*prop": "dataSource",
66                                             "xtype": "Store",
67                                             "remoteSort": true,
68                                             "|sortInfo": "{ field : 'ipshead_name', direction: 'ASC' }",
69                                             "|xns": "Roo.data",
70                                             "items": [
71                                                 {
72                                                     "*prop": "proxy",
73                                                     "xtype": "HttpProxy",
74                                                     "method": "GET",
75                                                     "|url": "baseURL + '/Roo/ipshead.php'",
76                                                     "|xns": "Roo.data"
77                                                 },
78                                                 {
79                                                     "|xns": "Roo.data",
80                                                     "xtype": "JsonReader",
81                                                     "totalProperty": "total",
82                                                     "root": "data",
83                                                     "*prop": "reader",
84                                                     "id": "id",
85                                                     "|fields": "[\n    {\n        'name': 'ipshead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_name',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_effective',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'ipshead_expires',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'ipshead_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_updated',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_base',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_symbol',\n        'type': 'string'\n    },\n    {\n        'name': 'ipshead_curr_id_curr_abbr',\n        'type': 'string'\n    }\n]"
86                                                 }
87                                             ]
88                                         },
89                                         {
90                                             "*prop": "footer",
91                                             "displayInfo": true,
92                                             "displayMsg": "Displaying ipshead{0} - {1} of {2}",
93                                             "emptyMsg": "No ipshead found",
94                                             "pageSize": 25,
95                                             "xtype": "PagingToolbar",
96                                             "|xns": "Roo"
97                                         },
98                                         {
99                                             "*prop": "toolbar",
100                                             "xtype": "Toolbar",
101                                             "|xns": "Roo",
102                                             "items": [
103                                                 {
104                                                     "listeners": {
105                                                         "click": "function (_self, e)\n{\n   new Pman.Download({\n        method: 'GET',\n        url : baseURL + '/Roo/Ipsiteminfo',\n        params : {\n            _pricegrid : 1\n        }\n   });\n}"
106                                                     },
107                                                     "text": "Download Price Matrix",
108                                                     "xtype": "Button",
109                                                     "|xns": "Roo.Toolbar"
110                                                 },
111                                                 {
112                                                     "listeners": {
113                                                         "click": "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Pricing'\n        \n       },\n       function (data) {\n            var msg = [];\n            if (data.deleted) {\n                msg.push(\"Deleted \" + data.deleted + \" Price(s)\");\n            }\n            if (data.updated) {\n                msg.push(\"Updated \" + data.updated + \" Price(s)\");\n            }            \n            if (data.inserted) {\n                msg.push(\"Added \" + data.inserted + \" Price(s)\");\n            }\n            if (!msg.length) {\n                msg.push(\"No data changed\");\n            }\n            Roo.MessageBox.alert(\"Notice\", msg.join(\"\\n\"));\n\n       }\n   );\n}"
114                                                     },
115                                                     "text": "Upload Price Matrix",
116                                                     "xtype": "Button",
117                                                     "|xns": "Roo.Toolbar"
118                                                 },
119                                                 {
120                                                     "|xns": "Roo.Toolbar",
121                                                     "xtype": "Fill"
122                                                 },
123                                                 {
124                                                     "text": "Add",
125                                                     "xtype": "Button",
126                                                     "cls": "x-btn-text-icon",
127                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
128                                                     "listeners": {
129                                                         "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
130                                                     },
131                                                     "|xns": "Roo.Toolbar"
132                                                 },
133                                                 {
134                                                     "text": "Delete",
135                                                     "cls": "x-btn-text-icon",
136                                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
137                                                     "xtype": "Button",
138                                                     "listeners": {
139                                                         "|click": "function()\n{\n     Pman.genericDelete(_this, 'ipshead'); \n}\n        "
140                                                     },
141                                                     "|xns": "Roo.Toolbar"
142                                                 }
143                                             ]
144                                         },
145                                         {
146                                             "*prop": "colModel[]",
147                                             "dataIndex": "ipshead_curr_id_curr_name",
148                                             "header": "Ipshead curr",
149                                             "sortable": true,
150                                             "width": 75,
151                                             "xtype": "ColumnModel",
152                                             "|renderer": "function(v) { return String.format('{0}', v); }",
153                                             "|xns": "Roo.grid"
154                                         },
155                                         {
156                                             "*prop": "colModel[]",
157                                             "dataIndex": "ipshead_name",
158                                             "header": "Ipshead name",
159                                             "sortable": true,
160                                             "width": 200,
161                                             "xtype": "ColumnModel",
162                                             "|renderer": "function(v) { return String.format('{0}', v); }",
163                                             "|xns": "Roo.grid"
164                                         },
165                                         {
166                                             "xtype": "ColumnModel",
167                                             "header": "Ipshead descrip",
168                                             "width": 200,
169                                             "dataIndex": "ipshead_descrip",
170                                             "|renderer": "function(v) { return String.format('{0}', v); }",
171                                             "|xns": "Roo.grid",
172                                             "*prop": "colModel[]"
173                                         },
174                                         {
175                                             "xtype": "ColumnModel",
176                                             "header": "Ipshead effective",
177                                             "width": 75,
178                                             "dataIndex": "ipshead_effective",
179                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
180                                             "|xns": "Roo.grid",
181                                             "*prop": "colModel[]"
182                                         },
183                                         {
184                                             "*prop": "colModel[]",
185                                             "dataIndex": "ipshead_expires",
186                                             "header": "Ipshead expires",
187                                             "width": 75,
188                                             "xtype": "ColumnModel",
189                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
190                                             "|xns": "Roo.grid"
191                                         },
192                                         {
193                                             "xtype": "ColumnModel",
194                                             "header": "Ipshead updated",
195                                             "width": 75,
196                                             "dataIndex": "ipshead_updated",
197                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
198                                             "|xns": "Roo.grid",
199                                             "*prop": "colModel[]"
200                                         }
201                                     ]
202                                 }
203                             ]
204                         },
205                         {
206                             "listeners": {
207                                 "|activate": "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n       // _this.igrid.footer.onClick('first');\n    }\n}"
208                             },
209                             "background": true,
210                             "fitContainer": true,
211                             "fitToframe": true,
212                             "region": "east",
213                             "tableName": "item",
214                             "title": "Products",
215                             "xtype": "GridPanel",
216                             "|xns": "Roo",
217                             "items": [
218                                 {
219                                     "listeners": {
220                                         "|render": "function() \n{\n    _this.igrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.ipanel.active) {\n       //this.footer.onClick('first');\n    }\n}",
221                                         "cellclick": "function (_self, row, col, e)\n{\n     var di = _this.grid.colModel.getDataIndex(col);\n     \n     var rec = _this.grid.ds.getAt(row);\n     \n     if(di == 'item_image_filename'){\n        if(!rec.data.item_image_id){\n            return;\n        }\n        var u = baseURL;\n        if(rec.data.item_image_from_hk){\n            u = u.split('/');\n            u.pop();\n            u = u.join('/') + '/hk.php';\n        }\n        Pman.download( {\n           url: u + '/Images/Download/' + rec.data.item_image_id  + '/' + rec.data.item_image_filename\n       });\n       return;\n     }\n     \n     if (di == 'item_active') {\n     \n        var nv = rec.data.item_active ? 0 : 1;\n        new Pman.Request({\n            mask : 'Saving',\n            url : baseURL + '/Roo/Item',\n            params : {\n                item_id : rec.data.item_id,\n                item_active : nv\n            },\n            success : function() {\n                rec.set('item_active', nv);\n            }\n        });\n        return;\n        \n     \n     }\n     \n     if(di == 'itemsrc_active'){\n        if(!rec.data.itemsrc_active){\n            Roo.MessageBox.alert('Error','Please edit it on Xtuple tool');\n            return;\n        }\n        if(rec.data.itemsrc_active){\n            Roo.MessageBox.confirm(\"Confirm\", \"Are you sure this product is no longer purchased\",\n                function (res) {\n                    if(res!='yes') {\n                        return;\n                    }\n                    rec.commit();\n            });\n        }\n    }\n     \n     _this.locgrid.footer.onClick('first');\n     \n     \n     \n     \n}",
222                                         "afteredit": "function (e)\n{\n    \n    \n    Roo.log(e);\n    new Pman.Request({\n        url : baseURL +'/Roo/Charass',\n        params : {\n             charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),\n             charass_value : e.value,\n             charass_target_type : 'I',\n             charass_default : 1,\n             charass_target_id : e.record.data.item_id\n         },\n         method : 'POST'\n     });\n    \n    \n    e.record.commit();\n    \n    \n    \n}",
223                                         "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"
224                                     },
225                                     "*prop": "grid",
226                                     "autoExpandColumn": "item_descrip1",
227                                     "clicksToEdit": 1,
228                                     "loadMask": true,
229                                     "xtype": "EditorGrid",
230                                     "|xns": "Roo.grid",
231                                     "items": [
232                                         {
233                                             "listeners": {
234                                                 "beforeload": "function (_self, o)\n{\n    o.params = o.params || {}\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.ipshead_id * 1 < 1){\n        this.ds.removeAll();\n        return;\n    }\n    \n    o.params.item_active = 1;\n\n}",
235                                                 "update": "function (_self, record, operation)\n{\n    if(operation != 'commit'){\n        return;\n    }\n    \n    var nv  = record.data.itemsrc_active ? 0 : 1;\n    new Pman.Request({\n        mask : 'Saving',\n        url : baseURL + '/Roo/Itemsrc',\n        params : {\n            _update_by_item : 1,\n            item_id : record.data.item_id,\n            itemsrc_active : nv\n        },\n        success : function(res) {\n            record.set('itemsrc_active', nv);\n        }\n    });\n}"
236                                             },
237                                             "*prop": "dataSource",
238                                             "remoteSort": true,
239                                             "xtype": "Store",
240                                             "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
241                                             "|xns": "Roo.data",
242                                             "items": [
243                                                 {
244                                                     "*prop": "proxy",
245                                                     "xtype": "HttpProxy",
246                                                     "method": "GET",
247                                                     "|url": "baseURL + '/Roo/item.php'",
248                                                     "|xns": "Roo.data"
249                                                 },
250                                                 {
251                                                     "|xns": "Roo.data",
252                                                     "xtype": "JsonReader",
253                                                     "totalProperty": "total",
254                                                     "root": "data",
255                                                     "*prop": "reader",
256                                                     "id": "id",
257                                                     "|fields": "[\n    {\n        'name': 'item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'item_descrip1',\n        'type': 'string'\n    },\n    {\n        'name': 'item_descrip2',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_picklist',\n        'type': 'int'\n    },\n    {\n        'name': 'item_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'item_sold',\n        'type': 'int'\n    },\n    {\n        'name': 'item_fractional',\n        'type': 'int'\n    },\n    {\n        'name': 'item_active',\n        'type': 'int'\n    },\n    {\n        'name': 'item_type',\n        'type': 'string'\n    },\n    {\n        'name': 'item_prodweight',\n        'type': 'float'\n    },\n    {\n        'name': 'item_packweight',\n        'type': 'float'\n    },\n    {\n        'name': 'item_prodcat_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_exclusive',\n        'type': 'int'\n    },\n    {\n        'name': 'item_listprice',\n        'type': 'float'\n    },\n    {\n        'name': 'item_config',\n        'type': 'int'\n    },\n    {\n        'name': 'item_extdescrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_upccode',\n        'type': 'string'\n    },\n    {\n        'name': 'item_maxcost',\n        'type': 'float'\n    },\n    {\n        'name': 'item_inv_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_price_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_warrdays',\n        'type': 'int'\n    },\n    {\n        'name': 'item_freightclass_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_tax_recoverable',\n        'type': 'int'\n    },\n    {\n        'name': 'item_price_uom_id_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_price_uom_id_uom_name',\n        'type': 'string'\n    },\n    {\n        'name': 'item_price_uom_id_uom_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_price_uom_id_uom_item_weight',\n        'type': 'int'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_name',\n        'type': 'string'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_item_weight',\n        'type': 'int'\n    },\n    {\n        'name': 'item_freightclass_id_freightclass_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_freightclass_id_freightclass_code',\n        'type': 'string'\n    },\n    {\n        'name': 'item_freightclass_id_freightclass_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_classcode_id_classcode_code',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_mfg',\n        'type': 'int'\n    },\n    {\n        'name': 'item_classcode_id_classcode_creator',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_created',\n        'type': 'date'\n    },\n    {\n        'name': 'item_classcode_id_classcode_modifier',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_modified',\n        'type': 'date'\n    },\n    {\n        'name': 'item_classcode_id_classcode_type',\n        'type': 'string'\n    }\n]"
258                                                 }
259                                             ]
260                                         },
261                                         {
262                                             "*prop": "footer",
263                                             "displayInfo": true,
264                                             "displayMsg": "Displaying item{0} - {1} of {2}",
265                                             "emptyMsg": "No item found",
266                                             "pageSize": 25,
267                                             "xtype": "PagingToolbar",
268                                             "|xns": "Roo",
269                                             "items": [
270                                                 {
271                                                     "listeners": {
272                                                         "click": "function (_self, e)\n{\n   new Pman.Download({\n        method: 'GET',\n        url : baseURL + '/Roo/item',\n        params : {\n            _costgrid : 1\n        }\n   });\n}"
273                                                     },
274                                                     "text": "Download Standard costs",
275                                                     "xtype": "Button",
276                                                     "|xns": "Roo.Toolbar"
277                                                 },
278                                                 {
279                                                     "listeners": {
280                                                         "click": "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Products'\n        \n       },\n       function (data) {\n            var msg = [];\n           \n            if (data.updated) {\n                msg.push(\"Updated \" + data.updated + \" Products(s)\");\n            }            \n            if (data.inserted) {\n                msg.push(\"Added \" + data.inserted + \" Products(s)\");\n            }\n            if (data.skipped) {\n                msg.push(\"Skipped \" + data.skipped);\n            }\n            \n            if (!msg.length) {\n                msg.push(\"No data changed\");\n            }\n            Roo.MessageBox.alert(\"Notice\", msg.join(\"\\n\"));\n\n       }\n   );\n}"
281                                                     },
282                                                     "text": "Upload new products and costs",
283                                                     "xtype": "Button",
284                                                     "|xns": "Roo.Toolbar"
285                                                 },
286                                                 {
287                                                     "listeners": {
288                                                         "click": "function (_self, e)\n{\n    \n    var sel = _this.grid.selModel.getSelectedCell();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a row\");\n        return;\n    }\n    \n    var rec = _this.grid.ds.getAt(sel[0]);\n    if(rec.data.item_id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.Image.show({\n            id : rec.data.item_image_id ? rec.data.item_image_id : 0,\n            onid : rec.data.item_id,\n            ontable : 'Item'\n        }, function(data) {\n            if (data) {\n                _this.grid.footer.onClick('first');\n                \n        }\n        \n    });\n}"
289                                                     },
290                                                     "text": "Upload an image",
291                                                     "xtype": "Button",
292                                                     "|xns": "Roo.Toolbar"
293                                                 },
294                                                 {
295                                                     "listeners": {
296                                                         "click": "function (_self, e)\n{\n  Roo.MessageBox.progress (\"Syncing Stock\", \"Sending\");\n  \n  var offset = 0;\n  \n   function runSync() {\n       \n       new Pman.Request( {\n            url : baseURL+'/Roo/Item',\n            method : 'GET',\n            params : {\n                _syncFromHK : 1,\n                offset : offset\n            },\n            success : function(res) {\n                Roo.log(res);\n                if (!res.data.total) {\n                    Roo.MessageBox.hide();\n                    return;\n                }\n                offset += res.data.limit;\n                Roo.MessageBox.updateProgress ( offset  / res.data.total, \"Done \" + offset + '/' + res.data.total);\n                runSync();\n            }\n            \n        \n       });\n   }\n   runSync();\n}"
297                                                     },
298                                                     "text": "Sync Product Data from HK",
299                                                     "xtype": "Button",
300                                                     "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
301                                                     "|xns": "Roo.Toolbar"
302                                                 }
303                                             ]
304                                         },
305                                         {
306                                             "*prop": "colModel[]",
307                                             "dataIndex": "item_char_brand",
308                                             "header": "Brand",
309                                             "sortable": true,
310                                             "width": 100,
311                                             "xtype": "ColumnModel",
312                                             "|renderer": "function(v) { return String.format('{0}', v); }",
313                                             "|xns": "Roo.grid",
314                                             "items": [
315                                                 {
316                                                     "|xns": "Roo.grid",
317                                                     "xtype": "GridEditor",
318                                                     "*prop": "editor",
319                                                     "items": [
320                                                         {
321                                                             "*prop": "field",
322                                                             "allowBlank": true,
323                                                             "alwaysQuery": true,
324                                                             "displayField": "charass_value",
325                                                             "editable": true,
326                                                             "forceSelection": false,
327                                                             "listWidth": 300,
328                                                             "loadingText": "Searching...",
329                                                             "minChars": 2,
330                                                             "pageSize": 20,
331                                                             "qtip": "Select Brand",
332                                                             "queryParam": "query[charass_value]",
333                                                             "selectOnFocus": true,
334                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
335                                                             "triggerAction": "all",
336                                                             "width": 150,
337                                                             "xtype": "ComboBox",
338                                                             "|xns": "Roo.form",
339                                                             "items": [
340                                                                 {
341                                                                     "listeners": {
342                                                                         "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    // look for all of the charass 's with the same type= eg. brand.\n    \n    o.params.charass_char_id_char_name = 'BRAND';\n    o.params.charass_target_type ='I';\n    o.params._distinct = 'charass_value';\n        o.params._columns = 'charass_value';\n\n}"
343                                                                     },
344                                                                     "*prop": "store",
345                                                                     "remoteSort": true,
346                                                                     "xtype": "Store",
347                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
348                                                                     "|xns": "Roo.data",
349                                                                     "items": [
350                                                                         {
351                                                                             "*prop": "proxy",
352                                                                             "method": "GET",
353                                                                             "xtype": "HttpProxy",
354                                                                             "|url": "baseURL + '/Roo/Charass.php'",
355                                                                             "|xns": "Roo.data"
356                                                                         },
357                                                                         {
358                                                                             "|xns": "Roo.data",
359                                                                             "xtype": "JsonReader",
360                                                                             "totalProperty": "total",
361                                                                             "root": "data",
362                                                                             "*prop": "reader",
363                                                                             "id": "id",
364                                                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]"
365                                                                         }
366                                                                     ]
367                                                                 }
368                                                             ]
369                                                         }
370                                                     ]
371                                                 }
372                                             ]
373                                         },
374                                         {
375                                             "*prop": "colModel[]",
376                                             "dataIndex": "item_char_productgroup",
377                                             "header": "Product Group",
378                                             "width": 100,
379                                             "xtype": "ColumnModel",
380                                             "|renderer": "function(v) { return String.format('{0}', v); }",
381                                             "|xns": "Roo.grid",
382                                             "items": [
383                                                 {
384                                                     "|xns": "Roo.grid",
385                                                     "xtype": "GridEditor",
386                                                     "*prop": "editor",
387                                                     "items": [
388                                                         {
389                                                             "*prop": "field",
390                                                             "allowBlank": true,
391                                                             "alwaysQuery": true,
392                                                             "displayField": "charass_value",
393                                                             "editable": true,
394                                                             "forceSelection": false,
395                                                             "listWidth": 300,
396                                                             "loadingText": "Searching...",
397                                                             "minChars": 2,
398                                                             "pageSize": 20,
399                                                             "qtip": "Select Brand",
400                                                             "queryParam": "query[charass_value]",
401                                                             "selectOnFocus": true,
402                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
403                                                             "triggerAction": "all",
404                                                             "width": 150,
405                                                             "xtype": "ComboBox",
406                                                             "|xns": "Roo.form",
407                                                             "items": [
408                                                                 {
409                                                                     "listeners": {
410                                                                         "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    // look for all of the charass 's with the same type= eg. brand.\n    \n    o.params.charass_char_id_char_name = 'PRODUCTGROUP';\n    o.params.charass_target_type ='I';\n    o.params._distinct = 'charass_value';\n        o.params._columns = 'charass_value';    \n}"
411                                                                     },
412                                                                     "*prop": "store",
413                                                                     "remoteSort": true,
414                                                                     "xtype": "Store",
415                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
416                                                                     "|xns": "Roo.data",
417                                                                     "items": [
418                                                                         {
419                                                                             "*prop": "proxy",
420                                                                             "method": "GET",
421                                                                             "xtype": "HttpProxy",
422                                                                             "|url": "baseURL + '/Roo/Charass.php'",
423                                                                             "|xns": "Roo.data"
424                                                                         },
425                                                                         {
426                                                                             "|xns": "Roo.data",
427                                                                             "xtype": "JsonReader",
428                                                                             "totalProperty": "total",
429                                                                             "root": "data",
430                                                                             "*prop": "reader",
431                                                                             "id": "id",
432                                                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]"
433                                                                         }
434                                                                     ]
435                                                                 }
436                                                             ]
437                                                         }
438                                                     ]
439                                                 }
440                                             ]
441                                         },
442                                         {
443                                             "*prop": "colModel[]",
444                                             "dataIndex": "item_number",
445                                             "header": "Number",
446                                             "width": 100,
447                                             "xtype": "ColumnModel",
448                                             "|renderer": "function(v) { return String.format('{0}', v); }",
449                                             "|xns": "Roo.grid"
450                                         },
451                                         {
452                                             "*prop": "colModel[]",
453                                             "dataIndex": "item_descrip1",
454                                             "header": "Description",
455                                             "width": 200,
456                                             "xtype": "ColumnModel",
457                                             "|renderer": "function(v) { return String.format('{0}', v); }",
458                                             "|xns": "Roo.grid"
459                                         },
460                                         {
461                                             "*prop": "colModel[]",
462                                             "dataIndex": "itemsrc_active",
463                                             "header": "Purchased",
464                                             "width": 75,
465                                             "xtype": "ColumnModel",
466                                             "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
467                                             "|xns": "Roo.grid"
468                                         },
469                                         {
470                                             "*prop": "colModel[]",
471                                             "dataIndex": "item_sold",
472                                             "header": "is Sold?",
473                                             "width": 75,
474                                             "xtype": "ColumnModel",
475                                             "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
476                                             "|xns": "Roo.grid"
477                                         },
478                                         {
479                                             "*prop": "colModel[]",
480                                             "dataIndex": "item_active",
481                                             "header": "is Active?",
482                                             "width": 75,
483                                             "xtype": "ColumnModel",
484                                             "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
485                                             "|xns": "Roo.grid"
486                                         },
487                                         {
488                                             "*prop": "colModel[]",
489                                             "dataIndex": "last_purchase_price",
490                                             "header": "Last purchase price",
491                                             "width": 120,
492                                             "xtype": "ColumnModel",
493                                             "|renderer": "function(v,x,r) {\n\n     return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ; \n     \n }",
494                                             "|xns": "Roo.grid"
495                                         },
496                                         {
497                                             "*prop": "colModel[]",
498                                             "dataIndex": "item_type",
499                                             "header": "Item type",
500                                             "width": 100,
501                                             "xtype": "ColumnModel",
502                                             "|renderer": "function(v) { return String.format('{0}', v); }",
503                                             "|xns": "Roo.grid"
504                                         },
505                                         {
506                                             "*prop": "colModel[]",
507                                             "dataIndex": "item_prodcat_id_prodcat_code",
508                                             "header": "Item prodcat",
509                                             "width": 100,
510                                             "xtype": "ColumnModel",
511                                             "|renderer": "function(v) { return String.format('{0}', v); }",
512                                             "|xns": "Roo.grid"
513                                         },
514                                         {
515                                             "*prop": "colModel[]",
516                                             "align": "right",
517                                             "dataIndex": "item_actcost",
518                                             "header": "Cost",
519                                             "width": 75,
520                                             "xtype": "ColumnModel",
521                                             "|renderer": "function(v,x,r) {\n\n     return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ; \n     \n }",
522                                             "|xns": "Roo.grid"
523                                         },
524                                         {
525                                             "*prop": "colModel[]",
526                                             "align": "right",
527                                             "dataIndex": "item_base_cost",
528                                             "header": "Cost (base)",
529                                             "width": 75,
530                                             "xtype": "ColumnModel",
531                                             "|renderer": "function(v,x,r) {\n\n     return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ; \n     \n }",
532                                             "|xns": "Roo.grid"
533                                         }
534                                     ]
535                                 }
536                             ]
537                         }
538                     ]
539                 }
540             ]
541         }
542     ],
543     "permname": "",
544     "modOrder": "001"
545 }