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                             "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": "ipshead",
41                             "title": "Price Lists",
42                             "xtype": "GridPanel",
43                             "|xns": "Roo",
44                             "items": [
45                                 {
46                                     "listeners": {
47                                         "|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}",
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}\n"
49                                     },
50                                     "*prop": "grid",
51                                     "autoExpandColumn": "ipshead_descrip",
52                                     "loadMask": true,
53                                     "xtype": "Grid",
54                                     "|xns": "Roo.grid",
55                                     "items": [
56                                         {
57                                             "*prop": "dataSource",
58                                             "xtype": "Store",
59                                             "remoteSort": true,
60                                             "|sortInfo": "{ field : 'ipshead_name', direction: 'ASC' }",
61                                             "|xns": "Roo.data",
62                                             "items": [
63                                                 {
64                                                     "*prop": "proxy",
65                                                     "xtype": "HttpProxy",
66                                                     "method": "GET",
67                                                     "|url": "baseURL + '/Roo/ipshead.php'",
68                                                     "|xns": "Roo.data"
69                                                 },
70                                                 {
71                                                     "|xns": "Roo.data",
72                                                     "xtype": "JsonReader",
73                                                     "totalProperty": "total",
74                                                     "root": "data",
75                                                     "*prop": "reader",
76                                                     "id": "id",
77                                                     "|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]"
78                                                 }
79                                             ]
80                                         },
81                                         {
82                                             "*prop": "footer",
83                                             "displayInfo": true,
84                                             "displayMsg": "Displaying ipshead{0} - {1} of {2}",
85                                             "emptyMsg": "No ipshead found",
86                                             "pageSize": 25,
87                                             "xtype": "PagingToolbar",
88                                             "|xns": "Roo"
89                                         },
90                                         {
91                                             "*prop": "toolbar",
92                                             "xtype": "Toolbar",
93                                             "|xns": "Roo",
94                                             "items": [
95                                                 {
96                                                     "listeners": {
97                                                         "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}"
98                                                     },
99                                                     "text": "Download Price Matrix",
100                                                     "xtype": "Button",
101                                                     "|xns": "Roo.Toolbar"
102                                                 },
103                                                 {
104                                                     "listeners": {
105                                                         "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}"
106                                                     },
107                                                     "text": "Upload Price Matrix",
108                                                     "xtype": "Button",
109                                                     "|xns": "Roo.Toolbar"
110                                                 },
111                                                 {
112                                                     "|xns": "Roo.Toolbar",
113                                                     "xtype": "Fill"
114                                                 },
115                                                 {
116                                                     "text": "Add",
117                                                     "xtype": "Button",
118                                                     "cls": "x-btn-text-icon",
119                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
120                                                     "listeners": {
121                                                         "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
122                                                     },
123                                                     "|xns": "Roo.Toolbar"
124                                                 },
125                                                 {
126                                                     "text": "Delete",
127                                                     "cls": "x-btn-text-icon",
128                                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
129                                                     "xtype": "Button",
130                                                     "listeners": {
131                                                         "|click": "function()\n{\n     Pman.genericDelete(_this, 'ipshead'); \n}\n        "
132                                                     },
133                                                     "|xns": "Roo.Toolbar"
134                                                 }
135                                             ]
136                                         },
137                                         {
138                                             "*prop": "colModel[]",
139                                             "dataIndex": "ipshead_curr_id_curr_name",
140                                             "header": "Ipshead curr",
141                                             "sortable": true,
142                                             "width": 75,
143                                             "xtype": "ColumnModel",
144                                             "|renderer": "function(v) { return String.format('{0}', v); }",
145                                             "|xns": "Roo.grid"
146                                         },
147                                         {
148                                             "*prop": "colModel[]",
149                                             "dataIndex": "ipshead_name",
150                                             "header": "Ipshead name",
151                                             "sortable": true,
152                                             "width": 200,
153                                             "xtype": "ColumnModel",
154                                             "|renderer": "function(v) { return String.format('{0}', v); }",
155                                             "|xns": "Roo.grid"
156                                         },
157                                         {
158                                             "xtype": "ColumnModel",
159                                             "header": "Ipshead descrip",
160                                             "width": 200,
161                                             "dataIndex": "ipshead_descrip",
162                                             "|renderer": "function(v) { return String.format('{0}', v); }",
163                                             "|xns": "Roo.grid",
164                                             "*prop": "colModel[]"
165                                         },
166                                         {
167                                             "xtype": "ColumnModel",
168                                             "header": "Ipshead effective",
169                                             "width": 75,
170                                             "dataIndex": "ipshead_effective",
171                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
172                                             "|xns": "Roo.grid",
173                                             "*prop": "colModel[]"
174                                         },
175                                         {
176                                             "*prop": "colModel[]",
177                                             "dataIndex": "ipshead_expires",
178                                             "header": "Ipshead expires",
179                                             "width": 75,
180                                             "xtype": "ColumnModel",
181                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
182                                             "|xns": "Roo.grid"
183                                         },
184                                         {
185                                             "xtype": "ColumnModel",
186                                             "header": "Ipshead updated",
187                                             "width": 75,
188                                             "dataIndex": "ipshead_updated",
189                                             "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
190                                             "|xns": "Roo.grid",
191                                             "*prop": "colModel[]"
192                                         }
193                                     ]
194                                 }
195                             ]
196                         },
197                         {
198                             "listeners": {
199                                 "|activate": "function() {\n    _this.ipanel = this;\n    if (_this.igrid) {\n        _this.igrid.footer.onClick('first');\n    }\n}"
200                             },
201                             "background": true,
202                             "fitContainer": true,
203                             "fitToframe": true,
204                             "region": "center",
205                             "tableName": "item",
206                             "title": "Products",
207                             "xtype": "GridPanel",
208                             "|xns": "Roo",
209                             "items": [
210                                 {
211                                     "listeners": {
212                                         "|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}",
213                                         "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}",
214                                         "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}",
215                                         "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"
216                                     },
217                                     "*prop": "grid",
218                                     "autoExpandColumn": "item_descrip1",
219                                     "clicksToEdit": 1,
220                                     "loadMask": true,
221                                     "xtype": "EditorGrid",
222                                     "|xns": "Roo.grid",
223                                     "items": [
224                                         {
225                                             "listeners": {
226                                                 "beforeload": "function (_self, o)\n{\n  o.params._with_prodcat = 1;\n  o.params._with_char = 1;\n  o.params._with_itemsrc_active = 1;\n  o.params._with_last_purchase_price = 1;\n  o.params._with_image = 1;\n  var s = _this.search.getValue();\n  if (s.length) {\n    o.params['query[number_or_name]'] = s;\n  }\n  if (!_this.active.pressed) {\n    o.params.item_active = 1;\n  }\n  if (_this.brandSel.getValue().length) {\n    o.params._with_brand = _this.brandSel.getValue()\n  }\n}",
227                                                 "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}"
228                                             },
229                                             "*prop": "dataSource",
230                                             "remoteSort": true,
231                                             "xtype": "Store",
232                                             "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
233                                             "|xns": "Roo.data",
234                                             "items": [
235                                                 {
236                                                     "*prop": "proxy",
237                                                     "xtype": "HttpProxy",
238                                                     "method": "GET",
239                                                     "|url": "baseURL + '/Roo/item.php'",
240                                                     "|xns": "Roo.data"
241                                                 },
242                                                 {
243                                                     "|xns": "Roo.data",
244                                                     "xtype": "JsonReader",
245                                                     "totalProperty": "total",
246                                                     "root": "data",
247                                                     "*prop": "reader",
248                                                     "id": "id",
249                                                     "|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]"
250                                                 }
251                                             ]
252                                         },
253                                         {
254                                             "|xns": "Roo",
255                                             "xtype": "Toolbar",
256                                             "*prop": "toolbar",
257                                             "items": [
258                                                 {
259                                                     "listeners": {
260                                                         "render": "function (_self)\n{\n  _this.brandSel = _self;\n}",
261                                                         "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
262                                                     },
263                                                     "allowBlank": true,
264                                                     "alwaysQuery": true,
265                                                     "displayField": "charass_value",
266                                                     "editable": true,
267                                                     "forceSelection": true,
268                                                     "listWidth": 300,
269                                                     "loadingText": "Searching...",
270                                                     "minChars": 2,
271                                                     "pageSize": 20,
272                                                     "qtip": "Select Brand",
273                                                     "queryParam": "query[charass_value]",
274                                                     "selectOnFocus": true,
275                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
276                                                     "triggerAction": "all",
277                                                     "width": 150,
278                                                     "xtype": "ComboBox",
279                                                     "|xns": "Roo.form",
280                                                     "items": [
281                                                         {
282                                                             "listeners": {
283                                                                 "|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}"
284                                                             },
285                                                             "*prop": "store",
286                                                             "remoteSort": true,
287                                                             "xtype": "Store",
288                                                             "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
289                                                             "|xns": "Roo.data",
290                                                             "items": [
291                                                                 {
292                                                                     "*prop": "proxy",
293                                                                     "method": "GET",
294                                                                     "xtype": "HttpProxy",
295                                                                     "|url": "baseURL + '/Roo/Charass.php'",
296                                                                     "|xns": "Roo.data"
297                                                                 },
298                                                                 {
299                                                                     "|xns": "Roo.data",
300                                                                     "xtype": "JsonReader",
301                                                                     "totalProperty": "total",
302                                                                     "root": "data",
303                                                                     "*prop": "reader",
304                                                                     "id": "id",
305                                                                     "|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]"
306                                                                 }
307                                                             ]
308                                                         }
309                                                     ]
310                                                 },
311                                                 {
312                                                     "listeners": {
313                                                         "render": "function (_self)\n{\n  _this.search = _self;\n}",
314                                                         "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
315                                                     },
316                                                     "xtype": "TextField",
317                                                     "|xns": "Roo.form"
318                                                 },
319                                                 {
320                                                     "listeners": {
321                                                         "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
322                                                     },
323                                                     "cls": "x-btn-icon",
324                                                     "xtype": "Button",
325                                                     "|icon": "rootURL + '/Pman/templates/images/search.gif'",
326                                                     "|xns": "Roo.Toolbar"
327                                                 },
328                                                 {
329                                                     "listeners": {
330                                                         "|click": "function (_self, e)\n{\n    _this.search.setValue('');\n    \n\n    \n    _this.grid.footer.onClick('first');\n}"
331                                                     },
332                                                     "cls": "x-btn-icon",
333                                                     "xtype": "Button",
334                                                     "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
335                                                     "|xns": "Roo.Toolbar"
336                                                 },
337                                                 {
338                                                     "|xns": "Roo.Toolbar",
339                                                     "xtype": "Separator"
340                                                 },
341                                                 {
342                                                     "listeners": {
343                                                         "toggle": "function (_self, pressed)\n{\n\n    this.setText(pressed ? \"Hide Inactive\" : \"Show Inactive\");\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}",
344                                                         "render": "function (_self)\n{\n    _this.active = _self;\n}"
345                                                     },
346                                                     "enableToggle": true,
347                                                     "text": "Show Inactive",
348                                                     "xtype": "Button",
349                                                     "|xns": "Roo.Toolbar"
350                                                 },
351                                                 {
352                                                     "|xns": "Roo.Toolbar",
353                                                     "xtype": "Fill"
354                                                 },
355                                                 {
356                                                     "text": "Report start :",
357                                                     "xtype": "TextItem",
358                                                     "|xns": "Roo.Toolbar"
359                                                 },
360                                                 {
361                                                     "listeners": {
362                                                         "render": "function (_self)\n{\n    _this.dateFrom = _self;\n}"
363                                                     },
364                                                     "format": "d/M/Y",
365                                                     "useIso": true,
366                                                     "xtype": "DateField",
367                                                     "|value": "(function() { return (new Date()).format('Y') + '-01-01'; })()",
368                                                     "|xns": "Roo.form"
369                                                 },
370                                                 {
371                                                     "listeners": {
372                                                         "render": "function (_self)\n{\n  _this.datespan  = _self;\n}"
373                                                     },
374                                                     "allowBlank": false,
375                                                     "displayField": "fname",
376                                                     "editable": false,
377                                                     "fieldLabel": "Status",
378                                                     "hiddenName": "cm_status",
379                                                     "listWidth": 200,
380                                                     "mode": "local",
381                                                     "name": "cm_status_name",
382                                                     "triggerAction": "all",
383                                                     "value": 12,
384                                                     "valueField": "ftype",
385                                                     "width": 150,
386                                                     "xtype": "ComboBox",
387                                                     "|xns": "Roo.form",
388                                                     "items": [
389                                                         {
390                                                             "*prop": "store",
391                                                             "xtype": "SimpleStore",
392                                                             "|data": "[ \n    [ '1', \"Single Month Sales\"],\n    [ '3', \"Quarter Sales\"],\n    [ '6', \"Half year Sales\"] ,\n    [ '12', \"Full Year Sales\"] \n]\n",
393                                                             "|fields": "[  'ftype', 'fname']",
394                                                             "|xns": "Roo.data"
395                                                         }
396                                                     ]
397                                                 },
398                                                 {
399                                                     "listeners": {
400                                                         "click": "function (_self, e)\n{\n    if (!_this.brandSel.getValue().length) {\n        Roo.MessageBox.alert(\"Error\", \"Select a brand to download\");\n        return;\n    }\n\n    new Pman.Download({\n        url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',\n        params: { \n            date_from : _this.dateFrom.getValue(),\n            brand : _this.brandSel.getValue(),\n            span : _this.datespan.getValue()\n        }\n    });\n        \n\n}"
401                                                     },
402                                                     "text": "Download Sales Report",
403                                                     "xtype": "Button",
404                                                     "|xns": "Roo.Toolbar"
405                                                 }
406                                             ]
407                                         },
408                                         {
409                                             "*prop": "footer",
410                                             "xtype": "PagingToolbar",
411                                             "pageSize": 25,
412                                             "displayInfo": true,
413                                             "displayMsg": "Displaying item{0} - {1} of {2}",
414                                             "emptyMsg": "No item found",
415                                             "|xns": "Roo",
416                                             "items": [
417                                                 {
418                                                     "listeners": {
419                                                         "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}"
420                                                     },
421                                                     "text": "Download Standard costs",
422                                                     "xtype": "Button",
423                                                     "|xns": "Roo.Toolbar"
424                                                 },
425                                                 {
426                                                     "listeners": {
427                                                         "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}"
428                                                     },
429                                                     "text": "Upload new products and costs",
430                                                     "xtype": "Button",
431                                                     "|xns": "Roo.Toolbar"
432                                                 },
433                                                 {
434                                                     "listeners": {
435                                                         "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}"
436                                                     },
437                                                     "text": "Upload an image",
438                                                     "xtype": "Button",
439                                                     "|xns": "Roo.Toolbar"
440                                                 },
441                                                 {
442                                                     "listeners": {
443                                                         "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}"
444                                                     },
445                                                     "text": "Sync Product Data from HK",
446                                                     "xtype": "Button",
447                                                     "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
448                                                     "|xns": "Roo.Toolbar"
449                                                 }
450                                             ]
451                                         },
452                                         {
453                                             "*prop": "colModel[]",
454                                             "dataIndex": "item_image_filename",
455                                             "header": "Image ( Click to download )",
456                                             "width": 150,
457                                             "xtype": "ColumnModel",
458                                             "|renderer": "function(v,x,r)\r\n{\n   if(!v){\n    return '';\n   }\n   if(r.data.item_image_from_hk){\n        var url = baseURL.split('/');\n        url.pop();\n        url = url.join('/');\n        return '<img src=\"' + url + '/hk.php/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '\" width=\"150\" height=\"150\" />';     \n   }\r\n   return '<img src=\"' + baseURL + '/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '\" width=\"150\" height=\"150\" />';\r\n}",
459                                             "|xns": "Roo.grid"
460                                         },
461                                         {
462                                             "*prop": "colModel[]",
463                                             "dataIndex": "item_char_brand",
464                                             "header": "Brand",
465                                             "sortable": true,
466                                             "width": 100,
467                                             "xtype": "ColumnModel",
468                                             "|renderer": "function(v) { return String.format('{0}', v); }",
469                                             "|xns": "Roo.grid",
470                                             "items": [
471                                                 {
472                                                     "|xns": "Roo.grid",
473                                                     "xtype": "GridEditor",
474                                                     "*prop": "editor",
475                                                     "items": [
476                                                         {
477                                                             "*prop": "field",
478                                                             "allowBlank": true,
479                                                             "alwaysQuery": true,
480                                                             "displayField": "charass_value",
481                                                             "editable": true,
482                                                             "forceSelection": false,
483                                                             "listWidth": 300,
484                                                             "loadingText": "Searching...",
485                                                             "minChars": 2,
486                                                             "pageSize": 20,
487                                                             "qtip": "Select Brand",
488                                                             "queryParam": "query[charass_value]",
489                                                             "selectOnFocus": true,
490                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
491                                                             "triggerAction": "all",
492                                                             "width": 150,
493                                                             "xtype": "ComboBox",
494                                                             "|xns": "Roo.form",
495                                                             "items": [
496                                                                 {
497                                                                     "listeners": {
498                                                                         "|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}"
499                                                                     },
500                                                                     "*prop": "store",
501                                                                     "remoteSort": true,
502                                                                     "xtype": "Store",
503                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
504                                                                     "|xns": "Roo.data",
505                                                                     "items": [
506                                                                         {
507                                                                             "*prop": "proxy",
508                                                                             "method": "GET",
509                                                                             "xtype": "HttpProxy",
510                                                                             "|url": "baseURL + '/Roo/Charass.php'",
511                                                                             "|xns": "Roo.data"
512                                                                         },
513                                                                         {
514                                                                             "|xns": "Roo.data",
515                                                                             "xtype": "JsonReader",
516                                                                             "totalProperty": "total",
517                                                                             "root": "data",
518                                                                             "*prop": "reader",
519                                                                             "id": "id",
520                                                                             "|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]"
521                                                                         }
522                                                                     ]
523                                                                 }
524                                                             ]
525                                                         }
526                                                     ]
527                                                 }
528                                             ]
529                                         },
530                                         {
531                                             "*prop": "colModel[]",
532                                             "dataIndex": "item_char_productgroup",
533                                             "header": "Product Group",
534                                             "width": 100,
535                                             "xtype": "ColumnModel",
536                                             "|renderer": "function(v) { return String.format('{0}', v); }",
537                                             "|xns": "Roo.grid",
538                                             "items": [
539                                                 {
540                                                     "|xns": "Roo.grid",
541                                                     "xtype": "GridEditor",
542                                                     "*prop": "editor",
543                                                     "items": [
544                                                         {
545                                                             "*prop": "field",
546                                                             "allowBlank": true,
547                                                             "alwaysQuery": true,
548                                                             "displayField": "charass_value",
549                                                             "editable": true,
550                                                             "forceSelection": false,
551                                                             "listWidth": 300,
552                                                             "loadingText": "Searching...",
553                                                             "minChars": 2,
554                                                             "pageSize": 20,
555                                                             "qtip": "Select Brand",
556                                                             "queryParam": "query[charass_value]",
557                                                             "selectOnFocus": true,
558                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
559                                                             "triggerAction": "all",
560                                                             "width": 150,
561                                                             "xtype": "ComboBox",
562                                                             "|xns": "Roo.form",
563                                                             "items": [
564                                                                 {
565                                                                     "listeners": {
566                                                                         "|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}"
567                                                                     },
568                                                                     "*prop": "store",
569                                                                     "remoteSort": true,
570                                                                     "xtype": "Store",
571                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
572                                                                     "|xns": "Roo.data",
573                                                                     "items": [
574                                                                         {
575                                                                             "*prop": "proxy",
576                                                                             "method": "GET",
577                                                                             "xtype": "HttpProxy",
578                                                                             "|url": "baseURL + '/Roo/Charass.php'",
579                                                                             "|xns": "Roo.data"
580                                                                         },
581                                                                         {
582                                                                             "|xns": "Roo.data",
583                                                                             "xtype": "JsonReader",
584                                                                             "totalProperty": "total",
585                                                                             "root": "data",
586                                                                             "*prop": "reader",
587                                                                             "id": "id",
588                                                                             "|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]"
589                                                                         }
590                                                                     ]
591                                                                 }
592                                                             ]
593                                                         }
594                                                     ]
595                                                 }
596                                             ]
597                                         },
598                                         {
599                                             "*prop": "colModel[]",
600                                             "dataIndex": "item_number",
601                                             "header": "Number",
602                                             "width": 100,
603                                             "xtype": "ColumnModel",
604                                             "|renderer": "function(v) { return String.format('{0}', v); }",
605                                             "|xns": "Roo.grid"
606                                         },
607                                         {
608                                             "*prop": "colModel[]",
609                                             "dataIndex": "item_descrip1",
610                                             "header": "Description",
611                                             "width": 200,
612                                             "xtype": "ColumnModel",
613                                             "|renderer": "function(v) { return String.format('{0}', v); }",
614                                             "|xns": "Roo.grid"
615                                         },
616                                         {
617                                             "*prop": "colModel[]",
618                                             "dataIndex": "itemsrc_active",
619                                             "header": "Purchased",
620                                             "width": 75,
621                                             "xtype": "ColumnModel",
622                                             "|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 }",
623                                             "|xns": "Roo.grid"
624                                         },
625                                         {
626                                             "*prop": "colModel[]",
627                                             "dataIndex": "item_sold",
628                                             "header": "is Sold?",
629                                             "width": 75,
630                                             "xtype": "ColumnModel",
631                                             "|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 }",
632                                             "|xns": "Roo.grid"
633                                         },
634                                         {
635                                             "*prop": "colModel[]",
636                                             "dataIndex": "item_active",
637                                             "header": "is Active?",
638                                             "width": 75,
639                                             "xtype": "ColumnModel",
640                                             "|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 }",
641                                             "|xns": "Roo.grid"
642                                         },
643                                         {
644                                             "*prop": "colModel[]",
645                                             "dataIndex": "last_purchase_price",
646                                             "header": "Last purchase price",
647                                             "width": 120,
648                                             "xtype": "ColumnModel",
649                                             "|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 }",
650                                             "|xns": "Roo.grid"
651                                         },
652                                         {
653                                             "*prop": "colModel[]",
654                                             "dataIndex": "item_type",
655                                             "header": "Item type",
656                                             "width": 100,
657                                             "xtype": "ColumnModel",
658                                             "|renderer": "function(v) { return String.format('{0}', v); }",
659                                             "|xns": "Roo.grid"
660                                         },
661                                         {
662                                             "*prop": "colModel[]",
663                                             "dataIndex": "item_prodcat_id_prodcat_code",
664                                             "header": "Item prodcat",
665                                             "width": 100,
666                                             "xtype": "ColumnModel",
667                                             "|renderer": "function(v) { return String.format('{0}', v); }",
668                                             "|xns": "Roo.grid"
669                                         },
670                                         {
671                                             "*prop": "colModel[]",
672                                             "align": "right",
673                                             "dataIndex": "item_actcost",
674                                             "header": "Cost",
675                                             "width": 75,
676                                             "xtype": "ColumnModel",
677                                             "|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 }",
678                                             "|xns": "Roo.grid"
679                                         },
680                                         {
681                                             "*prop": "colModel[]",
682                                             "align": "right",
683                                             "dataIndex": "item_base_cost",
684                                             "header": "Cost (base)",
685                                             "width": 75,
686                                             "xtype": "ColumnModel",
687                                             "|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 }",
688                                             "|xns": "Roo.grid"
689                                         }
690                                     ]
691                                 }
692                             ]
693                         }
694                     ]
695                 }
696             ]
697         }
698     ],
699     "permname": "",
700     "modOrder": "001"
701 }