Pman.Tab.XtupleItem.bjs
[Pman.Xtuple] / Pman.Tab.XtupleItem.bjs
1 {
2     "id": "roo-file-44",
3     "name": "Pman.Tab.XtupleItem",
4     "parent": "Pman.Tab.XtupleManage",
5     "title": "Pman.Tab.XtupleItem",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleItem.bjs",
7     "items": [
8         {
9             "background": true,
10             "region": "center",
11             "title": "Products",
12             "xtype": "NestedLayoutPanel",
13             "|xns": "Roo",
14             "items": [
15                 {
16                     "|xns": "Roo",
17                     "xtype": "BorderLayout",
18                     "*prop": "layout",
19                     "items": [
20                         {
21                             "|xns": "Roo",
22                             "xtype": "LayoutRegion",
23                             "*prop": "center"
24                         },
25                         {
26                             "*prop": "east",
27                             "split": true,
28                             "width": 200,
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": "item",
41                             "title": "Products",
42                             "xtype": "GridPanel",
43                             "|xns": "Roo",
44                             "items": [
45                                 {
46                                     "listeners": {
47                                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
48                                         "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}",
49                                         "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}",
50                                         "celldblclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var s = _this.grid.ds.getAt(rowIndex);\n    \n    Pman.Dialog.XtupleItem.show( { item_id : s.data.item_id } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}"
51                                     },
52                                     "*prop": "grid",
53                                     "autoExpandColumn": "item_descrip1",
54                                     "clicksToEdit": 1,
55                                     "loadMask": true,
56                                     "xtype": "EditorGrid",
57                                     "|xns": "Roo.grid",
58                                     "items": [
59                                         {
60                                             "listeners": {
61                                                 "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  \n  o.params._with_stock_balance = 1;\n}",
62                                                 "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}",
63                                                 "load": "function (_self, records, options)\n{\n\n    var cm = _this.grid.getColumnModel();\n    if(records.length){\n        cm.setColumnHeader(cm.getIndexByDataIndex('item_stock_balance'),records[0].data.default_location_name);\n    }\n}"
64                                             },
65                                             "*prop": "dataSource",
66                                             "remoteSort": true,
67                                             "xtype": "Store",
68                                             "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
69                                             "|xns": "Roo.data",
70                                             "items": [
71                                                 {
72                                                     "*prop": "proxy",
73                                                     "xtype": "HttpProxy",
74                                                     "method": "GET",
75                                                     "|url": "baseURL + '/Roo/item.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': '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]"
86                                                 }
87                                             ]
88                                         },
89                                         {
90                                             "|xns": "Roo",
91                                             "xtype": "Toolbar",
92                                             "*prop": "toolbar",
93                                             "items": [
94                                                 {
95                                                     "listeners": {
96                                                         "render": "function (_self)\n{\n  _this.brandSel = _self;\n}",
97                                                         "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
98                                                     },
99                                                     "allowBlank": true,
100                                                     "alwaysQuery": true,
101                                                     "displayField": "charass_value",
102                                                     "editable": true,
103                                                     "emptyText": "Select Brand",
104                                                     "forceSelection": true,
105                                                     "listWidth": 300,
106                                                     "loadingText": "Searching...",
107                                                     "minChars": 2,
108                                                     "pageSize": 20,
109                                                     "qtip": "Select Brand",
110                                                     "queryParam": "query[charass_value]",
111                                                     "selectOnFocus": true,
112                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
113                                                     "triggerAction": "all",
114                                                     "width": 150,
115                                                     "xtype": "ComboBox",
116                                                     "|xns": "Roo.form",
117                                                     "items": [
118                                                         {
119                                                             "listeners": {
120                                                                 "|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}"
121                                                             },
122                                                             "*prop": "store",
123                                                             "remoteSort": true,
124                                                             "xtype": "Store",
125                                                             "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
126                                                             "|xns": "Roo.data",
127                                                             "items": [
128                                                                 {
129                                                                     "*prop": "proxy",
130                                                                     "method": "GET",
131                                                                     "xtype": "HttpProxy",
132                                                                     "|url": "baseURL + '/Roo/Charass.php'",
133                                                                     "|xns": "Roo.data"
134                                                                 },
135                                                                 {
136                                                                     "|xns": "Roo.data",
137                                                                     "xtype": "JsonReader",
138                                                                     "totalProperty": "total",
139                                                                     "root": "data",
140                                                                     "*prop": "reader",
141                                                                     "id": "id",
142                                                                     "|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]"
143                                                                 }
144                                                             ]
145                                                         }
146                                                     ]
147                                                 },
148                                                 {
149                                                     "listeners": {
150                                                         "render": "function (_self)\n{\n  _this.search = _self;\n}",
151                                                         "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
152                                                     },
153                                                     "emptyText": "Search Product",
154                                                     "xtype": "TextField",
155                                                     "|xns": "Roo.form"
156                                                 },
157                                                 {
158                                                     "listeners": {
159                                                         "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
160                                                     },
161                                                     "cls": "x-btn-icon",
162                                                     "xtype": "Button",
163                                                     "|icon": "rootURL + '/Pman/templates/images/search.gif'",
164                                                     "|xns": "Roo.Toolbar"
165                                                 },
166                                                 {
167                                                     "listeners": {
168                                                         "|click": "function (_self, e)\n{\n    _this.search.setValue('');\n    \n\n    \n    _this.grid.footer.onClick('first');\n}"
169                                                     },
170                                                     "cls": "x-btn-icon",
171                                                     "xtype": "Button",
172                                                     "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
173                                                     "|xns": "Roo.Toolbar"
174                                                 },
175                                                 {
176                                                     "|xns": "Roo.Toolbar",
177                                                     "xtype": "Separator"
178                                                 },
179                                                 {
180                                                     "listeners": {
181                                                         "toggle": "function (_self, pressed)\n{\n\n    this.setText(pressed ? \"Hide Inactive\" : \"Show Inactive\");\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}",
182                                                         "render": "function (_self)\n{\n    _this.active = _self;\n}"
183                                                     },
184                                                     "enableToggle": true,
185                                                     "text": "Show Inactive",
186                                                     "xtype": "Button",
187                                                     "|xns": "Roo.Toolbar"
188                                                 },
189                                                 {
190                                                     "|xns": "Roo.Toolbar",
191                                                     "xtype": "Fill"
192                                                 },
193                                                 {
194                                                     "listeners": {
195                                                         "|click": "function()\n{\n\n   Pman.Dialog.XtupleItem.show( { item_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
196                                                     },
197                                                     "cls": "x-btn-text-icon",
198                                                     "text": "Add",
199                                                     "xtype": "Button",
200                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
201                                                     "|xns": "Roo.Toolbar"
202                                                 },
203                                                 {
204                                                     "listeners": {
205                                                         "|click": "function()\n{\n    var s = _this.grid.selModel.getSelectedCell();\n    if (!s) {\n        Roo.MessageBox.alert(\"Error\", \"Select a product\");\n        return;\n    } \n    var rec = _this.grid.ds.getAt(s[0]);\n    \n    var params = [];\n    \n    Roo.MessageBox.prompt(\n        \"Rename SKU\", \n        \"Warning changing SKU names affects historical data, and should only be done if you are sure that this is ok\",\n        function(r,v) {\n            if (r != 'ok') {\n                return;\n                \n            }\n            params = {\n                _rename_sku : v,\n                item_id : rec.data.item_id,\n                _check : 1\n            }\n\n            change(params);\n            \n            return;\n                \n            \n\n        }\n    );\n    \n    var change = function(params){\n        new Pman.Request({\n            url : baseURL + '/Roo/Item',\n            mask : \"Renaming\",\n            method : 'POST',\n            params : params,\n            success : function(res) {\n                Roo.log(res);\n                _this.grid.footer.onClick('refresh');\n                if(typeof(res.data) == 'string'){\n                    Roo.MessageBox.alert(\"Notice\", 'SKU has been renamed');\n                    return\n                }\n                var offices = [];\n                Roo.each(res.data, function(o){\n                    offices.push(Pman.Xtuple.offices[o]);\n                })\n                Roo.MessageBox.alert(\"Notice\", 'SKU has been renamed in ' + offices.join(\", \"));\n                \n            },\n            failure : function(res) {\n                Roo.log(res);\n                try {\n                    if (res.errors.confirm.length) {\n                        var offices = [];\n                        Roo.each(res.errors.confirm, function(o){\n                            offices.push(Pman.Xtuple.offices[o]);\n                        })\n                        Roo.MessageBox.confirm(\n                            \"Confirm\", \n                            \" Do you want to change the name in \" + offices.join(\", \") + \"?\",\n                            function(x) {\n                                if (x != 'yes') {\n                                    Roo.MessageBox.alert(\"Notice\", 'SKU was not changed');\n                                    return;\n                                }\n                                delete params['_check'];\n                                params._can_change_sku = 1;\n                                change(params);\n                            }\n                        );\n                        return;\n                    }\n                } catch(e) { }\n                Roo.MessageBox.alert(\"Error\", res.errorMsg);\n                \n            }\n        });\n    }\n   \n}\n"
206                                                     },
207                                                     "text": "Rename SKU",
208                                                     "xtype": "Button",
209                                                     "|xns": "Roo.Toolbar"
210                                                 },
211                                                 {
212                                                     "|xns": "Roo.Toolbar",
213                                                     "xtype": "Separator"
214                                                 },
215                                                 {
216                                                     "text": "Report start :",
217                                                     "xtype": "TextItem",
218                                                     "|xns": "Roo.Toolbar"
219                                                 },
220                                                 {
221                                                     "listeners": {
222                                                         "render": "function (_self)\n{\n    _this.dateFrom = _self;\n}"
223                                                     },
224                                                     "format": "d/M/Y",
225                                                     "useIso": true,
226                                                     "xtype": "DateField",
227                                                     "|value": "(function() { return (new Date()).format('Y') + '-01-01'; })()",
228                                                     "|xns": "Roo.form"
229                                                 },
230                                                 {
231                                                     "listeners": {
232                                                         "render": "function (_self)\n{\n  _this.datespan  = _self;\n}"
233                                                     },
234                                                     "allowBlank": false,
235                                                     "displayField": "fname",
236                                                     "editable": false,
237                                                     "fieldLabel": "Status",
238                                                     "hiddenName": "cm_status",
239                                                     "listWidth": 200,
240                                                     "mode": "local",
241                                                     "name": "cm_status_name",
242                                                     "triggerAction": "all",
243                                                     "value": 12,
244                                                     "valueField": "ftype",
245                                                     "width": 150,
246                                                     "xtype": "ComboBox",
247                                                     "|xns": "Roo.form",
248                                                     "items": [
249                                                         {
250                                                             "*prop": "store",
251                                                             "xtype": "SimpleStore",
252                                                             "|data": "[ \n    [ '1', \"Single Month Sales\"],\n    [ '3', \"Quarter Sales\"],\n    [ '6', \"Half year Sales\"] ,\n    [ '12', \"Full Year Sales\"] \n]\n",
253                                                             "|fields": "[  'ftype', 'fname']",
254                                                             "|xns": "Roo.data"
255                                                         }
256                                                     ]
257                                                 },
258                                                 {
259                                                     "listeners": {
260                                                         "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}"
261                                                     },
262                                                     "text": "Download Sales Report",
263                                                     "xtype": "Button",
264                                                     "|xns": "Roo.Toolbar"
265                                                 }
266                                             ]
267                                         },
268                                         {
269                                             "*prop": "footer",
270                                             "xtype": "PagingToolbar",
271                                             "pageSize": 25,
272                                             "displayInfo": true,
273                                             "displayMsg": "Displaying item{0} - {1} of {2}",
274                                             "emptyMsg": "No item found",
275                                             "|xns": "Roo",
276                                             "items": [
277                                                 {
278                                                     "text": "Tools - Upload/Download",
279                                                     "xtype": "Button",
280                                                     "|xns": "Roo.Toolbar",
281                                                     "items": [
282                                                         {
283                                                             "|xns": "Roo.menu",
284                                                             "xtype": "Menu",
285                                                             "*prop": "menu",
286                                                             "items": [
287                                                                 {
288                                                                     "listeners": {
289                                                                         "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}"
290                                                                     },
291                                                                     "text": "Download Standard costs",
292                                                                     "xtype": "Item",
293                                                                     "|xns": "Roo.menu"
294                                                                 },
295                                                                 {
296                                                                     "listeners": {
297                                                                         "click": "function (_self, e)\n{\n//   Roo.MessageBox.alert(\"Disabled\", \"Can you please send Alan the test file for this - there is a problem and we need to fix it before you use this again\");\n //  return;\n   \n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Products',\n            timeout : 60000\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}"
298                                                                     },
299                                                                     "text": "Upload new products and costs",
300                                                                     "xtype": "Item",
301                                                                     "|xns": "Roo.menu"
302                                                                 },
303                                                                 {
304                                                                     "|xns": "Roo.menu",
305                                                                     "xtype": "Separator"
306                                                                 },
307                                                                 {
308                                                                     "listeners": {
309                                                                         "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            timeout: 60000,\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}"
310                                                                     },
311                                                                     "text": "Sync Product Data from HK",
312                                                                     "xtype": "Item",
313                                                                     "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
314                                                                     "|xns": "Roo.menu"
315                                                                 },
316                                                                 {
317                                                                     "listeners": {
318                                                                         "click": "function (_self, e)\n{\n  Roo.MessageBox.progress (\"Syncing Stock\", \"Sending\");\n  \n  var offset = 0;\n  \n   \n       \n   new Pman.Request( {\n        url : baseURL+'/Roo/Item',\n        method : 'GET',\n        params : {\n            _syncFromHK : 1,\n            _new_only : 1\n        },\n        success : function(res) {\n            Roo.log(res);\n            \n                Roo.MessageBox.hide();\n             _this.grid.footer.onClick('refresh');\n            \n             \n        }\n        \n    \n   });\n    \n}"
319                                                                     },
320                                                                     "text": "Sync Product from HK (New Products Only)",
321                                                                     "xtype": "Item",
322                                                                     "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
323                                                                     "|xns": "Roo.menu"
324                                                                 },
325                                                                 {
326                                                                     "listeners": {
327                                                                         "click": "function (_self, e)\n{\n  Roo.MessageBox.progress (\"Syncing Stock\", \"Sending\");\n  \n  var offset = 0;\n  \n   \n       \n   new Pman.Request( {\n        url : baseURL+'/Roo/Item',\n        method : 'GET',\n        params : {\n            _syncFromHK : 1,\n            item_number : _this.search.getValue()\n        },\n        success : function(res) {\n            Roo.log(res);\n            \n                Roo.MessageBox.hide();\n             _this.grid.footer.onClick('refresh');\n            \n             \n        }\n        \n    \n   });\n    \n}"
328                                                                     },
329                                                                     "text": "Sync Product from HK (Based on Search)",
330                                                                     "xtype": "Item",
331                                                                     "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
332                                                                     "|xns": "Roo.menu"
333                                                                 }
334                                                             ]
335                                                         }
336                                                     ]
337                                                 }
338                                             ]
339                                         },
340                                         {
341                                             "*prop": "colModel[]",
342                                             "dataIndex": "item_image_filename",
343                                             "header": "Brand",
344                                             "sortable": true,
345                                             "width": 100,
346                                             "xtype": "ColumnModel",
347                                             "|renderer": "function(v) { return String.format('{0}', v); }",
348                                             "|xns": "Roo.grid",
349                                             "items": [
350                                                 {
351                                                     "|xns": "Roo.grid",
352                                                     "xtype": "GridEditor",
353                                                     "*prop": "editor",
354                                                     "items": [
355                                                         {
356                                                             "*prop": "field",
357                                                             "allowBlank": true,
358                                                             "alwaysQuery": true,
359                                                             "displayField": "charass_value",
360                                                             "editable": true,
361                                                             "forceSelection": false,
362                                                             "listWidth": 300,
363                                                             "loadingText": "Searching...",
364                                                             "minChars": 2,
365                                                             "pageSize": 20,
366                                                             "qtip": "Select Brand",
367                                                             "queryParam": "query[charass_value]",
368                                                             "selectOnFocus": true,
369                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
370                                                             "triggerAction": "all",
371                                                             "width": 150,
372                                                             "xtype": "ComboBox",
373                                                             "|xns": "Roo.form",
374                                                             "items": [
375                                                                 {
376                                                                     "listeners": {
377                                                                         "|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}"
378                                                                     },
379                                                                     "*prop": "store",
380                                                                     "remoteSort": true,
381                                                                     "xtype": "Store",
382                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
383                                                                     "|xns": "Roo.data",
384                                                                     "items": [
385                                                                         {
386                                                                             "*prop": "proxy",
387                                                                             "method": "GET",
388                                                                             "xtype": "HttpProxy",
389                                                                             "|url": "baseURL + '/Roo/Charass.php'",
390                                                                             "|xns": "Roo.data"
391                                                                         },
392                                                                         {
393                                                                             "|xns": "Roo.data",
394                                                                             "xtype": "JsonReader",
395                                                                             "totalProperty": "total",
396                                                                             "root": "data",
397                                                                             "*prop": "reader",
398                                                                             "id": "id",
399                                                                             "|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]"
400                                                                         }
401                                                                     ]
402                                                                 }
403                                                             ]
404                                                         }
405                                                     ]
406                                                 }
407                                             ]
408                                         },
409                                         {
410                                             "*prop": "colModel[]",
411                                             "dataIndex": "item_char_brand",
412                                             "header": "Brand",
413                                             "sortable": true,
414                                             "width": 100,
415                                             "xtype": "ColumnModel",
416                                             "|renderer": "function(v) { return String.format('{0}', v); }",
417                                             "|xns": "Roo.grid",
418                                             "items": [
419                                                 {
420                                                     "|xns": "Roo.grid",
421                                                     "xtype": "GridEditor",
422                                                     "*prop": "editor",
423                                                     "items": [
424                                                         {
425                                                             "*prop": "field",
426                                                             "allowBlank": true,
427                                                             "alwaysQuery": true,
428                                                             "displayField": "charass_value",
429                                                             "editable": true,
430                                                             "forceSelection": false,
431                                                             "listWidth": 300,
432                                                             "loadingText": "Searching...",
433                                                             "minChars": 2,
434                                                             "pageSize": 20,
435                                                             "qtip": "Select Brand",
436                                                             "queryParam": "query[charass_value]",
437                                                             "selectOnFocus": true,
438                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
439                                                             "triggerAction": "all",
440                                                             "width": 150,
441                                                             "xtype": "ComboBox",
442                                                             "|xns": "Roo.form",
443                                                             "items": [
444                                                                 {
445                                                                     "listeners": {
446                                                                         "|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}"
447                                                                     },
448                                                                     "*prop": "store",
449                                                                     "remoteSort": true,
450                                                                     "xtype": "Store",
451                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
452                                                                     "|xns": "Roo.data",
453                                                                     "items": [
454                                                                         {
455                                                                             "*prop": "proxy",
456                                                                             "method": "GET",
457                                                                             "xtype": "HttpProxy",
458                                                                             "|url": "baseURL + '/Roo/Charass.php'",
459                                                                             "|xns": "Roo.data"
460                                                                         },
461                                                                         {
462                                                                             "|xns": "Roo.data",
463                                                                             "xtype": "JsonReader",
464                                                                             "totalProperty": "total",
465                                                                             "root": "data",
466                                                                             "*prop": "reader",
467                                                                             "id": "id",
468                                                                             "|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]"
469                                                                         }
470                                                                     ]
471                                                                 }
472                                                             ]
473                                                         }
474                                                     ]
475                                                 }
476                                             ]
477                                         },
478                                         {
479                                             "*prop": "colModel[]",
480                                             "dataIndex": "item_char_productgroup",
481                                             "header": "Product Group",
482                                             "sortable": true,
483                                             "width": 100,
484                                             "xtype": "ColumnModel",
485                                             "|renderer": "function(v) { return String.format('{0}', v); }",
486                                             "|xns": "Roo.grid",
487                                             "items": [
488                                                 {
489                                                     "|xns": "Roo.grid",
490                                                     "xtype": "GridEditor",
491                                                     "*prop": "editor",
492                                                     "items": [
493                                                         {
494                                                             "*prop": "field",
495                                                             "allowBlank": true,
496                                                             "alwaysQuery": true,
497                                                             "displayField": "charass_value",
498                                                             "editable": true,
499                                                             "forceSelection": false,
500                                                             "listWidth": 300,
501                                                             "loadingText": "Searching...",
502                                                             "minChars": 2,
503                                                             "pageSize": 20,
504                                                             "qtip": "Select Brand",
505                                                             "queryParam": "query[charass_value]",
506                                                             "selectOnFocus": true,
507                                                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
508                                                             "triggerAction": "all",
509                                                             "width": 150,
510                                                             "xtype": "ComboBox",
511                                                             "|xns": "Roo.form",
512                                                             "items": [
513                                                                 {
514                                                                     "listeners": {
515                                                                         "|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}"
516                                                                     },
517                                                                     "*prop": "store",
518                                                                     "remoteSort": true,
519                                                                     "xtype": "Store",
520                                                                     "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
521                                                                     "|xns": "Roo.data",
522                                                                     "items": [
523                                                                         {
524                                                                             "*prop": "proxy",
525                                                                             "method": "GET",
526                                                                             "xtype": "HttpProxy",
527                                                                             "|url": "baseURL + '/Roo/Charass.php'",
528                                                                             "|xns": "Roo.data"
529                                                                         },
530                                                                         {
531                                                                             "|xns": "Roo.data",
532                                                                             "xtype": "JsonReader",
533                                                                             "totalProperty": "total",
534                                                                             "root": "data",
535                                                                             "*prop": "reader",
536                                                                             "id": "id",
537                                                                             "|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]"
538                                                                         }
539                                                                     ]
540                                                                 }
541                                                             ]
542                                                         }
543                                                     ]
544                                                 }
545                                             ]
546                                         },
547                                         {
548                                             "*prop": "colModel[]",
549                                             "dataIndex": "item_number",
550                                             "header": "Number",
551                                             "sortable": true,
552                                             "width": 100,
553                                             "xtype": "ColumnModel",
554                                             "|renderer": "function(v) { return String.format('<B>{0}</B>', v); }",
555                                             "|xns": "Roo.grid"
556                                         },
557                                         {
558                                             "*prop": "colModel[]",
559                                             "dataIndex": "item_char_pickface_location",
560                                             "header": "Pickface",
561                                             "sortable": true,
562                                             "width": 100,
563                                             "xtype": "ColumnModel",
564                                             "|renderer": "function(v) { return String.format('{0}', v); }",
565                                             "|xns": "Roo.grid",
566                                             "items": [
567                                                 {
568                                                     "|xns": "Roo.grid",
569                                                     "xtype": "GridEditor",
570                                                     "*prop": "editor",
571                                                     "items": [
572                                                         {
573                                                             "|xns": "Roo.form",
574                                                             "xtype": "TextField",
575                                                             "*prop": "field"
576                                                         }
577                                                     ]
578                                                 }
579                                             ]
580                                         },
581                                         {
582                                             "*prop": "colModel[]",
583                                             "dataIndex": "item_char_pallet_location",
584                                             "header": "Pallet",
585                                             "sortable": true,
586                                             "width": 100,
587                                             "xtype": "ColumnModel",
588                                             "|renderer": "function(v) { return String.format('{0}', v); }",
589                                             "|xns": "Roo.grid",
590                                             "items": [
591                                                 {
592                                                     "|xns": "Roo.grid",
593                                                     "xtype": "GridEditor",
594                                                     "*prop": "editor",
595                                                     "items": [
596                                                         {
597                                                             "|xns": "Roo.form",
598                                                             "xtype": "TextField",
599                                                             "*prop": "field"
600                                                         }
601                                                     ]
602                                                 }
603                                             ]
604                                         },
605                                         {
606                                             "*prop": "colModel[]",
607                                             "dataIndex": "item_descrip1",
608                                             "header": "Description",
609                                             "sortable": true,
610                                             "width": 200,
611                                             "xtype": "ColumnModel",
612                                             "|renderer": "function(v) { return String.format('{0}', v); }",
613                                             "|xns": "Roo.grid"
614                                         },
615                                         {
616                                             "*prop": "colModel[]",
617                                             "dataIndex": "itemsrc_active",
618                                             "header": "Purchased",
619                                             "width": 55,
620                                             "xtype": "ColumnModel",
621                                             "|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 }",
622                                             "|xns": "Roo.grid"
623                                         },
624                                         {
625                                             "*prop": "colModel[]",
626                                             "dataIndex": "item_sold",
627                                             "header": "is Sold?",
628                                             "width": 50,
629                                             "xtype": "ColumnModel",
630                                             "|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 }",
631                                             "|xns": "Roo.grid"
632                                         },
633                                         {
634                                             "*prop": "colModel[]",
635                                             "dataIndex": "item_active",
636                                             "header": "is Active?",
637                                             "width": 50,
638                                             "xtype": "ColumnModel",
639                                             "|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 }",
640                                             "|xns": "Roo.grid"
641                                         },
642                                         {
643                                             "*prop": "colModel[]",
644                                             "align": "right",
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_prodcat_id_prodcat_code",
655                                             "header": "Item prodcat",
656                                             "width": 100,
657                                             "xtype": "ColumnModel",
658                                             "|renderer": "function(v,x,r) { \n    return String.format('{0}/{1}', r.data.item_type, v); \n    }",
659                                             "|xns": "Roo.grid"
660                                         },
661                                         {
662                                             "*prop": "colModel[]",
663                                             "align": "right",
664                                             "dataIndex": "item_actcost",
665                                             "header": "Cost",
666                                             "width": 75,
667                                             "xtype": "ColumnModel",
668                                             "|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 }",
669                                             "|xns": "Roo.grid"
670                                         },
671                                         {
672                                             "*prop": "colModel[]",
673                                             "align": "right",
674                                             "dataIndex": "item_base_cost",
675                                             "header": "Cost (base)",
676                                             "width": 75,
677                                             "xtype": "ColumnModel",
678                                             "|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 }",
679                                             "|xns": "Roo.grid"
680                                         },
681                                         {
682                                             "*prop": "colModel[]",
683                                             "align": "right",
684                                             "dataIndex": "item_stock_balance",
685                                             "header": "Balance",
686                                             "width": 100,
687                                             "xtype": "ColumnModel",
688                                             "|renderer": "function(v) { return String.format('{0}', v ? parseInt( v) : ''); }",
689                                             "|xns": "Roo.grid"
690                                         }
691                                     ]
692                                 }
693                             ]
694                         },
695                         {
696                             "listeners": {
697                                 "|activate": "function() {\n    _this.locpanel = this;\n \n}"
698                             },
699                             "background": true,
700                             "fitContainer": true,
701                             "fitToframe": true,
702                             "region": "east",
703                             "tableName": "itemloc",
704                             "title": "itemloc",
705                             "xtype": "GridPanel",
706                             "|xns": "Roo",
707                             "items": [
708                                 {
709                                     "listeners": {
710                                         "|render": "function() \n{\n    _this.locgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    \n}",
711                                         "|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"
712                                     },
713                                     "*prop": "grid",
714                                     "autoExpandColumn": "location_name",
715                                     "loadMask": true,
716                                     "xtype": "Grid",
717                                     "|xns": "Roo.grid",
718                                     "items": [
719                                         {
720                                             "listeners": {
721                                                 "beforeload": "function (_self, o)\n{\n    var sel = _this.grid.selModel.getSelectedCell();\n    if (!sel) {\n        this.removeAll();\n        return false;\n    }\n    var rec = _this.grid.ds.getAt(sel[0]);\n    o.params._stock_for_item_id = rec.data.item_id;\n    //o.params['!itemloc_qty'] = 0;\n    \n    \n}"
722                                             },
723                                             "*prop": "dataSource",
724                                             "remoteSort": true,
725                                             "xtype": "Store",
726                                             "|sortInfo": "{ field : 'location_name', direction: 'ASC' }",
727                                             "|xns": "Roo.data",
728                                             "items": [
729                                                 {
730                                                     "*prop": "proxy",
731                                                     "method": "GET",
732                                                     "xtype": "HttpProxy",
733                                                     "|url": "baseURL + '/Roo/location.php'",
734                                                     "|xns": "Roo.data"
735                                                 },
736                                                 {
737                                                     "|xns": "Roo.data",
738                                                     "xtype": "JsonReader",
739                                                     "totalProperty": "total",
740                                                     "root": "data",
741                                                     "*prop": "reader",
742                                                     "id": "id",
743                                                     "|fields": "[\n    {\n        'name': 'itemloc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemloc_itemsite_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemloc_location_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemloc_qty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemloc_expiration',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'itemloc_consolflag',\n        'type': 'int'\n    },\n    {\n        'name': 'itemloc_ls_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemloc_warrpurc',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    }\n]"
744                                                 }
745                                             ]
746                                         },
747                                         {
748                                             "*prop": "footer",
749                                             "xtype": "PagingToolbar",
750                                             "pageSize": 25,
751                                             "displayInfo": true,
752                                             "displayMsg": "Displaying itemloc{0} - {1} of {2}",
753                                             "emptyMsg": "No itemloc found",
754                                             "|xns": "Roo"
755                                         },
756                                         {
757                                             "*prop": "colModel[]",
758                                             "dataIndex": "location_name",
759                                             "header": "Location",
760                                             "width": 75,
761                                             "xtype": "ColumnModel",
762                                             "|renderer": "function(v) { return String.format('{0}', v); }",
763                                             "|xns": "Roo.grid"
764                                         },
765                                         {
766                                             "*prop": "colModel[]",
767                                             "dataIndex": "itemloc_realqty",
768                                             "header": "Itemloc qty",
769                                             "width": 75,
770                                             "xtype": "ColumnModel",
771                                             "|renderer": "function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); }",
772                                             "|xns": "Roo.grid"
773                                         }
774                                     ]
775                                 }
776                             ]
777                         }
778                     ]
779                 }
780             ]
781         }
782     ],
783     "permname": "",
784     "modOrder": "200"
785 }