Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleItem.bjs
index 8a24355..5be1478 100644 (file)
 {
-    "id": "roo-file-44",
-    "name": "Pman.Tab.XtupleItem",
-    "parent": "Pman.Tab.XtupleManage",
-    "title": "Pman.Tab.XtupleItem",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleItem.bjs",
-    "items": [
+ "name" : "Pman.Tab.XtupleItem",
+ "parent" : "Pman.Tab.XtupleManage",
+ "title" : "Pman.Tab.XtupleItem",
+ "path" : "/home/edward/gitlive/Pman.Xtuple/Pman.Tab.XtupleItem.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
+  "41e902bb1b2db625736ede3bacc41fe0" : "is Sold?",
+  "ce4ee01637f4279d02d0f232459dc9a4" : "Purchased",
+  "1be6f9eb563f3bf85c78b4219bf09de9" : "Brand",
+  "aa554e9e2270df2127bfe9096f1bd9ce" : "Displaying item{0} - {1} of {2}",
+  "ce5bf551379459c1c61d2a204061c455" : "Location",
+  "44ca8ce0e02dee5d520525ac21bcbee9" : "Sync Product from HK (Based on Search)",
+  "068f80c7519d0528fb08e82137a72131" : "Products",
+  "68f43fdcf074903d65da764642a4b968" : "is Active?",
+  "759d259249621c817551c5fe726d5c57" : "itemloc",
+  "89217b1527e14cced20e78111a8f5027" : "Item prodcat",
+  "e924991fc4c883bc237e69efe884d674" : "Download Sales Report",
+  "ee3585dbcb1e8f8826f3403c1e9d898c" : "Rename SKU",
+  "20b4f77bd00b4f63a49ec8e08f3bf6a6" : "Cost",
+  "fe78f3efbfa84d8485d589031596c5b8" : "Pallet",
+  "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
+  "19029645d5286771ac708d1bcd118bf4" : "Displaying itemloc{0} - {1} of {2}",
+  "1243daf593fa297e07ab03bf06d925af" : "Searching...",
+  "99a808d8d16122d70e44bd7f709d30fb" : "Balance",
+  "9a8faafb674c03474827bcb6fcde43a3" : "Search Product",
+  "f1c3ca6cadc4a9f57a08d5f7482a3f83" : "No item found",
+  "d6ea9efa48916e9563d76ddc233ebe2a" : "Sync Product from HK (New Products Only)",
+  "ec53a8c4f07baed5d8825072c89799be" : "Status",
+  "2cfd827c6e37453fe1ddde82a5bd9474" : "No itemloc found",
+  "d8ab3576a67fe0cc175ee77d57d0fd85" : "Pickface",
+  "5bc3fd20294c17c9803942958fd7f26d" : "Show Inactive",
+  "70cd7e06502a63356290711ec3b11223" : "Upload new products and costs",
+  "c6ca371871d835c79c8654b5cd788cc7" : "Product Group",
+  "695dbdb13fad32669a68d8fec8541c7f" : "Download Standard costs",
+  "156567f65fc207d39cadbf045687c521" : "Itemloc qty",
+  "c2f1d503b95bf9f3aa4d775a216c5c73" : "Sync Product Data from HK",
+  "36c454c4130e4444e8410f11d6d998f0" : "Tools - Upload/Download",
+  "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
+  "7fee866379427143414dd7a72e56414b" : "Report start :",
+  "a9e35d03ee7f31f5bb199379a6d3547a" : "Select Brand",
+  "35be52be39d3efcd0cd2b3721fc3c298" : "Cost (base)",
+  "750587d31c68779e7f615c190a9dc23f" : "Last purchase price",
+  "b2ee912b91d69b435159c7c3f6df7f5f" : "Number",
+  "173cf046739c17fd7c97ec3540d58807" : "(function() { return (new Date()).format('Y') + '-01-01'; })()",
+  "c20ad4d76fe97759aa27a0c99bff6710" : "12"
+ },
+ "items" : [
+  {
+   "background" : false,
+   "region" : "center",
+   "title" : "Products",
+   "xtype" : "NestedLayoutPanel",
+   "$ xns" : "Roo",
+   "items" : [
+    {
+     "xtype" : "BorderLayout",
+     "$ xns" : "Roo",
+     "* prop" : "layout",
+     "items" : [
+      {
+       "xtype" : "LayoutRegion",
+       "$ xns" : "Roo",
+       "* prop" : "center"
+      },
+      {
+       "xtype" : "LayoutRegion",
+       "width" : 200,
+       "$ xns" : "Roo",
+       "split" : true,
+       "* prop" : "east"
+      },
+      {
+       "listeners" : {
+        "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+       },
+       "background" : false,
+       "region" : "center",
+       "fitToframe" : true,
+       "title" : "Products",
+       "xtype" : "GridPanel",
+       "fitContainer" : true,
+       "$ xns" : "Roo",
+       "tableName" : "item",
+       "items" : [
         {
-            "background": true,
-            "region": "center",
-            "title": "Products",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+         "listeners" : {
+          "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     \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     \n     \n     \n\n        if(rec.data.itemsrc_active * 1){\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.set('itemsrc_active', 0);\n                    rec.commit();\n            });\n            return;\n        }\n        \n        Pman.Dialog.XtupleItem.show( { item_id : rec.data.item_id } , function() {\n            _this.grid.footer.onClick('first');\n       }); \n       return;\n        \n    }\n     \n     _this.locgrid.footer.onClick('first');\n     \n     \n     \n     \n}",
+          "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}",
+          "|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}",
+          "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}"
+         },
+         "autoExpandColumn" : "item_descrip1",
+         "xtype" : "EditorGrid",
+         "loadMask" : true,
+         "clicksToEdit" : 1,
+         "$ xns" : "Roo.grid",
+         "* prop" : "grid",
+         "items" : [
+          {
+           "listeners" : {
+            "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}",
+            "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}",
+            "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}"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ field : 'item_number', direction: 'ASC' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "dataSource",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/item.php'",
+             "method" : "GET",
+             "xtype" : "HttpProxy",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ 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]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          },
+          {
+           "xtype" : "Toolbar",
+           "$ xns" : "Roo",
+           "* prop" : "toolbar",
+           "items" : [
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n  _this.brandSel = _self;\n}",
+              "select" : "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
+             },
+             "alwaysQuery" : true,
+             "listWidth" : 300,
+             "triggerAction" : "all",
+             "forceSelection" : true,
+             "selectOnFocus" : true,
+             "pageSize" : 20,
+             "displayField" : "charass_value",
+             "emptyText" : "Select Brand",
+             "minChars" : 2,
+             "xtype" : "ComboBox",
+             "allowBlank" : true,
+             "editable" : true,
+             "width" : 150,
+             "$ xns" : "Roo.form",
+             "qtip" : "Select Brand",
+             "queryParam" : "query[charass_value]",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
+             "loadingText" : "Searching...",
+             "items" : [
+              {
+               "listeners" : {
+                "|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}"
+               },
+               "xtype" : "Store",
+               "remoteSort" : true,
+               "$ sortInfo" : "{ field : 'charass_value' , direction : 'ASC' }",
+               "$ xns" : "Roo.data",
+               "* prop" : "store",
+               "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
-                        {
-                            "|xns": "Roo",
-                            "xtype": "LayoutRegion",
-                            "*prop": "center"
-                        },
-                        {
-                            "*prop": "east",
-                            "split": true,
-                            "width": 200,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
-                        },
-                        {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
-                            },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "item",
-                            "title": "Products",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
-                                {
-                                    "listeners": {
-                                        "|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}",
-                                        "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}",
-                                        "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}",
-                                        "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}"
-                                    },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "item_descrip1",
-                                    "clicksToEdit": 1,
-                                    "loadMask": true,
-                                    "xtype": "EditorGrid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
-                                        {
-                                            "listeners": {
-                                                "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}",
-                                                "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}",
-                                                "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}"
-                                            },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'item_number', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
-                                                {
-                                                    "*prop": "proxy",
-                                                    "xtype": "HttpProxy",
-                                                    "method": "GET",
-                                                    "|url": "baseURL + '/Roo/item.php'",
-                                                    "|xns": "Roo.data"
-                                                },
-                                                {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "|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]"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.brandSel = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "allowBlank": true,
-                                                    "alwaysQuery": true,
-                                                    "displayField": "charass_value",
-                                                    "editable": true,
-                                                    "emptyText": "Select Brand",
-                                                    "forceSelection": true,
-                                                    "listWidth": 300,
-                                                    "loadingText": "Searching...",
-                                                    "minChars": 2,
-                                                    "pageSize": 20,
-                                                    "qtip": "Select Brand",
-                                                    "queryParam": "query[charass_value]",
-                                                    "selectOnFocus": true,
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "width": 150,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
-                                                        {
-                                                            "listeners": {
-                                                                "|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}"
-                                                            },
-                                                            "*prop": "store",
-                                                            "remoteSort": true,
-                                                            "xtype": "Store",
-                                                            "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                            "|xns": "Roo.data",
-                                                            "items": [
-                                                                {
-                                                                    "*prop": "proxy",
-                                                                    "method": "GET",
-                                                                    "xtype": "HttpProxy",
-                                                                    "|url": "baseURL + '/Roo/Charass.php'",
-                                                                    "|xns": "Roo.data"
-                                                                },
-                                                                {
-                                                                    "|xns": "Roo.data",
-                                                                    "xtype": "JsonReader",
-                                                                    "totalProperty": "total",
-                                                                    "root": "data",
-                                                                    "*prop": "reader",
-                                                                    "id": "id",
-                                                                    "|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]"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.search = _self;\n}",
-                                                        "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "emptyText": "Search Product",
-                                                    "xtype": "TextField",
-                                                    "|xns": "Roo.form"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "|click": "function (_self, e)\n{\n    _this.search.setValue('');\n    \n\n    \n    _this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Separator"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "toggle": "function (_self, pressed)\n{\n\n    this.setText(pressed ? \"Hide Inactive\" : \"Show Inactive\");\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}",
-                                                        "render": "function (_self)\n{\n    _this.active = _self;\n}"
-                                                    },
-                                                    "enableToggle": true,
-                                                    "text": "Show Inactive",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "|click": "function()\n{\n\n   Pman.Dialog.XtupleItem.show( { item_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
-                                                    },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Add",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "|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"
-                                                    },
-                                                    "text": "Rename SKU",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Separator"
-                                                },
-                                                {
-                                                    "text": "Report start :",
-                                                    "xtype": "TextItem",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.dateFrom = _self;\n}"
-                                                    },
-                                                    "format": "d/M/Y",
-                                                    "useIso": true,
-                                                    "xtype": "DateField",
-                                                    "|value": "(function() { return (new Date()).format('Y') + '-01-01'; })()",
-                                                    "|xns": "Roo.form"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.datespan  = _self;\n}"
-                                                    },
-                                                    "allowBlank": false,
-                                                    "displayField": "fname",
-                                                    "editable": false,
-                                                    "fieldLabel": "Status",
-                                                    "hiddenName": "cm_status",
-                                                    "listWidth": 200,
-                                                    "mode": "local",
-                                                    "name": "cm_status_name",
-                                                    "triggerAction": "all",
-                                                    "value": 12,
-                                                    "valueField": "ftype",
-                                                    "width": 150,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "store",
-                                                            "xtype": "SimpleStore",
-                                                            "|data": "[ \n    [ '1', \"Single Month Sales\"],\n    [ '3', \"Quarter Sales\"],\n    [ '6', \"Half year Sales\"] ,\n    [ '12', \"Full Year Sales\"] \n]\n",
-                                                            "|fields": "[  'ftype', 'fname']",
-                                                            "|xns": "Roo.data"
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "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}"
-                                                    },
-                                                    "text": "Download Sales Report",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "footer",
-                                            "xtype": "PagingToolbar",
-                                            "pageSize": 25,
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying item{0} - {1} of {2}",
-                                            "emptyMsg": "No item found",
-                                            "|xns": "Roo",
-                                            "items": [
-                                                {
-                                                    "text": "Tools - Upload/Download",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar",
-                                                    "items": [
-                                                        {
-                                                            "|xns": "Roo.menu",
-                                                            "xtype": "Menu",
-                                                            "*prop": "menu",
-                                                            "items": [
-                                                                {
-                                                                    "listeners": {
-                                                                        "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}"
-                                                                    },
-                                                                    "text": "Download Standard costs",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
-                                                                },
-                                                                {
-                                                                    "listeners": {
-                                                                        "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}"
-                                                                    },
-                                                                    "text": "Upload new products and costs",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
-                                                                },
-                                                                {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
-                                                                },
-                                                                {
-                                                                    "listeners": {
-                                                                        "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}"
-                                                                    },
-                                                                    "text": "Sync Product Data from HK",
-                                                                    "xtype": "Item",
-                                                                    "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
-                                                                    "|xns": "Roo.menu"
-                                                                },
-                                                                {
-                                                                    "listeners": {
-                                                                        "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}"
-                                                                    },
-                                                                    "text": "Sync Product from HK (New Products Only)",
-                                                                    "xtype": "Item",
-                                                                    "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
-                                                                    "|xns": "Roo.menu"
-                                                                },
-                                                                {
-                                                                    "listeners": {
-                                                                        "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}"
-                                                                    },
-                                                                    "text": "Sync Product from HK (Based on Search)",
-                                                                    "xtype": "Item",
-                                                                    "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
-                                                                    "|xns": "Roo.menu"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_char_brand",
-                                            "header": "Brand",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "field",
-                                                            "allowBlank": true,
-                                                            "alwaysQuery": true,
-                                                            "displayField": "charass_value",
-                                                            "editable": true,
-                                                            "forceSelection": false,
-                                                            "listWidth": 300,
-                                                            "loadingText": "Searching...",
-                                                            "minChars": 2,
-                                                            "pageSize": 20,
-                                                            "qtip": "Select Brand",
-                                                            "queryParam": "query[charass_value]",
-                                                            "selectOnFocus": true,
-                                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                            "triggerAction": "all",
-                                                            "width": 150,
-                                                            "xtype": "ComboBox",
-                                                            "|xns": "Roo.form",
-                                                            "items": [
-                                                                {
-                                                                    "listeners": {
-                                                                        "|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}"
-                                                                    },
-                                                                    "*prop": "store",
-                                                                    "remoteSort": true,
-                                                                    "xtype": "Store",
-                                                                    "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                                    "|xns": "Roo.data",
-                                                                    "items": [
-                                                                        {
-                                                                            "*prop": "proxy",
-                                                                            "method": "GET",
-                                                                            "xtype": "HttpProxy",
-                                                                            "|url": "baseURL + '/Roo/Charass.php'",
-                                                                            "|xns": "Roo.data"
-                                                                        },
-                                                                        {
-                                                                            "|xns": "Roo.data",
-                                                                            "xtype": "JsonReader",
-                                                                            "totalProperty": "total",
-                                                                            "root": "data",
-                                                                            "*prop": "reader",
-                                                                            "id": "id",
-                                                                            "|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]"
-                                                                        }
-                                                                    ]
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_char_brand",
-                                            "header": "Brand",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "field",
-                                                            "allowBlank": true,
-                                                            "alwaysQuery": true,
-                                                            "displayField": "charass_value",
-                                                            "editable": true,
-                                                            "forceSelection": false,
-                                                            "listWidth": 300,
-                                                            "loadingText": "Searching...",
-                                                            "minChars": 2,
-                                                            "pageSize": 20,
-                                                            "qtip": "Select Brand",
-                                                            "queryParam": "query[charass_value]",
-                                                            "selectOnFocus": true,
-                                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                            "triggerAction": "all",
-                                                            "width": 150,
-                                                            "xtype": "ComboBox",
-                                                            "|xns": "Roo.form",
-                                                            "items": [
-                                                                {
-                                                                    "listeners": {
-                                                                        "|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}"
-                                                                    },
-                                                                    "*prop": "store",
-                                                                    "remoteSort": true,
-                                                                    "xtype": "Store",
-                                                                    "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                                    "|xns": "Roo.data",
-                                                                    "items": [
-                                                                        {
-                                                                            "*prop": "proxy",
-                                                                            "method": "GET",
-                                                                            "xtype": "HttpProxy",
-                                                                            "|url": "baseURL + '/Roo/Charass.php'",
-                                                                            "|xns": "Roo.data"
-                                                                        },
-                                                                        {
-                                                                            "|xns": "Roo.data",
-                                                                            "xtype": "JsonReader",
-                                                                            "totalProperty": "total",
-                                                                            "root": "data",
-                                                                            "*prop": "reader",
-                                                                            "id": "id",
-                                                                            "|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]"
-                                                                        }
-                                                                    ]
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_char_productgroup",
-                                            "header": "Product Group",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "field",
-                                                            "allowBlank": true,
-                                                            "alwaysQuery": true,
-                                                            "displayField": "charass_value",
-                                                            "editable": true,
-                                                            "forceSelection": false,
-                                                            "listWidth": 300,
-                                                            "loadingText": "Searching...",
-                                                            "minChars": 2,
-                                                            "pageSize": 20,
-                                                            "qtip": "Select Brand",
-                                                            "queryParam": "query[charass_value]",
-                                                            "selectOnFocus": true,
-                                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                            "triggerAction": "all",
-                                                            "width": 150,
-                                                            "xtype": "ComboBox",
-                                                            "|xns": "Roo.form",
-                                                            "items": [
-                                                                {
-                                                                    "listeners": {
-                                                                        "|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}"
-                                                                    },
-                                                                    "*prop": "store",
-                                                                    "remoteSort": true,
-                                                                    "xtype": "Store",
-                                                                    "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                                    "|xns": "Roo.data",
-                                                                    "items": [
-                                                                        {
-                                                                            "*prop": "proxy",
-                                                                            "method": "GET",
-                                                                            "xtype": "HttpProxy",
-                                                                            "|url": "baseURL + '/Roo/Charass.php'",
-                                                                            "|xns": "Roo.data"
-                                                                        },
-                                                                        {
-                                                                            "|xns": "Roo.data",
-                                                                            "xtype": "JsonReader",
-                                                                            "totalProperty": "total",
-                                                                            "root": "data",
-                                                                            "*prop": "reader",
-                                                                            "id": "id",
-                                                                            "|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]"
-                                                                        }
-                                                                    ]
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_number",
-                                            "header": "Number",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('<B>{0}</B>', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_char_pickface_location",
-                                            "header": "Pickface",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
-                                                        {
-                                                            "|xns": "Roo.form",
-                                                            "xtype": "TextField",
-                                                            "*prop": "field"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_char_pallet_location",
-                                            "header": "Pallet",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
-                                                        {
-                                                            "|xns": "Roo.form",
-                                                            "xtype": "TextField",
-                                                            "*prop": "field"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_descrip1",
-                                            "header": "Description",
-                                            "sortable": true,
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "itemsrc_active",
-                                            "header": "Purchased",
-                                            "width": 55,
-                                            "xtype": "ColumnModel",
-                                            "|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 }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_sold",
-                                            "header": "is Sold?",
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|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 }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_active",
-                                            "header": "is Active?",
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|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 }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "last_purchase_price",
-                                            "header": "Last purchase price",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|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 }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_prodcat_id_prodcat_code",
-                                            "header": "Item prodcat",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    return String.format('{0}/{1}', r.data.item_type, v); \n    }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "item_actcost",
-                                            "header": "Cost",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|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 }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "item_base_cost",
-                                            "header": "Cost (base)",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|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 }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "item_stock_balance",
-                                            "header": "Balance",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? parseInt( v) : ''); }",
-                                            "|xns": "Roo.grid"
-                                        }
-                                    ]
-                                }
-                            ]
-                        },
-                        {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.locpanel = this;\n \n}"
-                            },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "east",
-                            "tableName": "itemloc",
-                            "title": "itemloc",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
-                                {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.locgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    \n}",
-                                        "|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"
-                                    },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "location_name",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
-                                        {
-                                            "listeners": {
-                                                "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}"
-                                            },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'location_name', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
-                                                {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/location.php'",
-                                                    "|xns": "Roo.data"
-                                                },
-                                                {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "|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]"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "footer",
-                                            "xtype": "PagingToolbar",
-                                            "pageSize": 25,
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying itemloc{0} - {1} of {2}",
-                                            "emptyMsg": "No itemloc found",
-                                            "|xns": "Roo"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "location_name",
-                                            "header": "Location",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "itemloc_realqty",
-                                            "header": "Itemloc qty",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); }",
-                                            "|xns": "Roo.grid"
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
+                 "$ url" : "baseURL + '/Roo/Charass.php'",
+                 "xtype" : "HttpProxy",
+                 "method" : "GET",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
+                },
+                {
+                 "id" : "id",
+                 "root" : "data",
+                 "xtype" : "JsonReader",
+                 "$ xns" : "Roo.data",
+                 "$ 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]",
+                 "* prop" : "reader",
+                 "totalProperty" : "total"
+                }
+               ]
+              }
+             ]
+            },
+            {
+             "listeners" : {
+              "specialkey" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}",
+              "render" : "function (_self)\n{\n  _this.search = _self;\n}"
+             },
+             "emptyText" : "Search Product",
+             "xtype" : "TextField",
+             "$ xns" : "Roo.form"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function (_self, e)\n{\n    _this.search.setValue('');\n    \n\n    \n    _this.grid.footer.onClick('first');\n}"
+             },
+             "xtype" : "Button",
+             "cls" : "x-btn-icon",
+             "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Separator",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "toggle" : "function (_self, pressed)\n{\n\n    this.setText(pressed ? \"Hide Inactive\" : \"Show Inactive\");\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}",
+              "render" : "function (_self)\n{\n    _this.active = _self;\n}"
+             },
+             "text" : "Show Inactive",
+             "enableToggle" : true,
+             "xtype" : "Button",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Fill",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n\n   Pman.Dialog.XtupleItem.show( { item_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+             },
+             "text" : "Add",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "|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"
+             },
+             "text" : "Rename SKU",
+             "xtype" : "Button",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "xtype" : "Separator",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "text" : "Report start :",
+             "xtype" : "TextItem",
+             "$ xns" : "Roo.Toolbar"
+            },
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n    _this.dateFrom = _self;\n}"
+             },
+             "format" : "d/M/Y",
+             "xtype" : "DateField",
+             "useIso" : true,
+             "| value" : "(function() { return (new Date()).format('Y') + '-01-01'; })()",
+             "$ xns" : "Roo.form"
+            },
+            {
+             "listeners" : {
+              "render" : "function (_self)\n{\n  _this.datespan  = _self;\n}"
+             },
+             "listWidth" : 200,
+             "triggerAction" : "all",
+             "fieldLabel" : "Status",
+             "displayField" : "fname",
+             "hiddenName" : "cm_status",
+             "value" : 12,
+             "valueField" : "ftype",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "editable" : false,
+             "width" : 150,
+             "$ xns" : "Roo.form",
+             "mode" : "local",
+             "name" : "cm_status_name",
+             "items" : [
+              {
+               "xtype" : "SimpleStore",
+               "$ data" : "[ \n    [ '1', \"Single Month Sales\"],\n    [ '3', \"Quarter Sales\"],\n    [ '6', \"Half year Sales\"] ,\n    [ '12', \"Full Year Sales\"] \n]\n",
+               "$ fields" : "[  'ftype', 'fname']",
+               "$ xns" : "Roo.data",
+               "* prop" : "store"
+              }
+             ]
+            },
+            {
+             "listeners" : {
+              "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}"
+             },
+             "text" : "Download Sales Report",
+             "xtype" : "Button",
+             "$ xns" : "Roo.Toolbar"
+            }
+           ]
+          },
+          {
+           "pageSize" : 25,
+           "xtype" : "PagingToolbar",
+           "emptyMsg" : "No item found",
+           "$ xns" : "Roo",
+           "displayInfo" : true,
+           "displayMsg" : "Displaying item{0} - {1} of {2}",
+           "* prop" : "footer",
+           "items" : [
+            {
+             "text" : "Tools - Upload/Download",
+             "xtype" : "Button",
+             "$ xns" : "Roo.Toolbar",
+             "items" : [
+              {
+               "xtype" : "Menu",
+               "$ xns" : "Roo.menu",
+               "* prop" : "menu",
+               "items" : [
+                {
+                 "listeners" : {
+                  "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}"
+                 },
+                 "text" : "Download Standard costs",
+                 "xtype" : "Item",
+                 "$ xns" : "Roo.menu"
+                },
+                {
+                 "listeners" : {
+                  "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}"
+                 },
+                 "text" : "Upload new products and costs",
+                 "xtype" : "Item",
+                 "$ xns" : "Roo.menu"
+                },
+                {
+                 "xtype" : "Separator",
+                 "$ xns" : "Roo.menu"
+                },
+                {
+                 "listeners" : {
+                  "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}"
+                 },
+                 "text" : "Sync Product Data from HK",
+                 "xtype" : "Item",
+                 "$ xns" : "Roo.menu",
+                 "| hidden" : "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()"
+                },
+                {
+                 "listeners" : {
+                  "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}"
+                 },
+                 "text" : "Sync Product from HK (New Products Only)",
+                 "xtype" : "Item",
+                 "$ xns" : "Roo.menu",
+                 "| hidden" : "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()"
+                },
+                {
+                 "listeners" : {
+                  "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}"
+                 },
+                 "text" : "Sync Product from HK (Based on Search)",
+                 "xtype" : "Item",
+                 "$ xns" : "Roo.menu",
+                 "| hidden" : "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()"
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : false,
+           "header" : "Image",
+           "width" : 150,
+           "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/50/{1}/{2}\" height=\"50\">', baseURL, v, r.data.item_image_filename); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_image_id"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Brand",
+           "width" : 100,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_char_brand",
+           "items" : [
+            {
+             "xtype" : "GridEditor",
+             "$ xns" : "Roo.grid",
+             "* prop" : "editor",
+             "items" : [
+              {
+               "alwaysQuery" : true,
+               "listWidth" : 300,
+               "triggerAction" : "all",
+               "forceSelection" : false,
+               "selectOnFocus" : true,
+               "pageSize" : 20,
+               "displayField" : "charass_value",
+               "minChars" : 2,
+               "xtype" : "ComboBox",
+               "allowBlank" : true,
+               "editable" : true,
+               "width" : 150,
+               "$ xns" : "Roo.form",
+               "* prop" : "field",
+               "qtip" : "Select Brand",
+               "queryParam" : "query[charass_value]",
+               "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
+               "loadingText" : "Searching...",
+               "items" : [
+                {
+                 "listeners" : {
+                  "|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}"
+                 },
+                 "xtype" : "Store",
+                 "remoteSort" : true,
+                 "$ sortInfo" : "{ field : 'charass_value' , direction : 'ASC' }",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "store",
+                 "items" : [
+                  {
+                   "$ url" : "baseURL + '/Roo/Charass.php'",
+                   "xtype" : "HttpProxy",
+                   "method" : "GET",
+                   "$ xns" : "Roo.data",
+                   "* prop" : "proxy"
+                  },
+                  {
+                   "id" : "id",
+                   "root" : "data",
+                   "xtype" : "JsonReader",
+                   "$ xns" : "Roo.data",
+                   "$ 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]",
+                   "* prop" : "reader",
+                   "totalProperty" : "total"
+                  }
+                 ]
                 }
-            ]
+               ]
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Product Group",
+           "width" : 100,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_char_productgroup",
+           "items" : [
+            {
+             "xtype" : "GridEditor",
+             "$ xns" : "Roo.grid",
+             "* prop" : "editor",
+             "items" : [
+              {
+               "alwaysQuery" : true,
+               "listWidth" : 300,
+               "triggerAction" : "all",
+               "forceSelection" : false,
+               "selectOnFocus" : true,
+               "pageSize" : 20,
+               "displayField" : "charass_value",
+               "minChars" : 2,
+               "xtype" : "ComboBox",
+               "allowBlank" : true,
+               "editable" : true,
+               "width" : 150,
+               "$ xns" : "Roo.form",
+               "* prop" : "field",
+               "qtip" : "Select Brand",
+               "queryParam" : "query[charass_value]",
+               "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
+               "loadingText" : "Searching...",
+               "items" : [
+                {
+                 "listeners" : {
+                  "|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}"
+                 },
+                 "xtype" : "Store",
+                 "remoteSort" : true,
+                 "$ sortInfo" : "{ field : 'charass_value' , direction : 'ASC' }",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "store",
+                 "items" : [
+                  {
+                   "$ url" : "baseURL + '/Roo/Charass.php'",
+                   "xtype" : "HttpProxy",
+                   "method" : "GET",
+                   "$ xns" : "Roo.data",
+                   "* prop" : "proxy"
+                  },
+                  {
+                   "id" : "id",
+                   "root" : "data",
+                   "xtype" : "JsonReader",
+                   "$ xns" : "Roo.data",
+                   "$ 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]",
+                   "* prop" : "reader",
+                   "totalProperty" : "total"
+                  }
+                 ]
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Number",
+           "width" : 100,
+           "$ renderer" : "function(v) { return String.format('<B>{0}</B>', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_number"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Pickface",
+           "width" : 100,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_char_pickface_location",
+           "items" : [
+            {
+             "xtype" : "GridEditor",
+             "$ xns" : "Roo.grid",
+             "* prop" : "editor",
+             "items" : [
+              {
+               "xtype" : "TextField",
+               "$ xns" : "Roo.form",
+               "* prop" : "field"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Pallet",
+           "width" : 100,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_char_pallet_location",
+           "items" : [
+            {
+             "xtype" : "GridEditor",
+             "$ xns" : "Roo.grid",
+             "* prop" : "editor",
+             "items" : [
+              {
+               "xtype" : "TextField",
+               "$ xns" : "Roo.form",
+               "* prop" : "field"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Description",
+           "width" : 200,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_descrip1"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "Purchased",
+           "width" : 55,
+           "$ 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 }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "itemsrc_active"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "is Sold?",
+           "width" : 50,
+           "$ 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 }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_sold"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "sortable" : true,
+           "header" : "is Active?",
+           "width" : 50,
+           "$ 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 }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_active"
+          },
+          {
+           "align" : "right",
+           "xtype" : "ColumnModel",
+           "header" : "Last purchase price",
+           "width" : 120,
+           "$ 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 }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "last_purchase_price"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "header" : "Item prodcat",
+           "width" : 100,
+           "$ renderer" : "function(v,x,r) { \n    return String.format('{0}/{1}', r.data.item_type, v); \n    }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_prodcat_id_prodcat_code"
+          },
+          {
+           "align" : "right",
+           "xtype" : "ColumnModel",
+           "header" : "Cost",
+           "width" : 75,
+           "$ 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 }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_actcost"
+          },
+          {
+           "align" : "right",
+           "xtype" : "ColumnModel",
+           "header" : "Cost (base)",
+           "width" : 75,
+           "$ 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 }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_base_cost"
+          },
+          {
+           "align" : "right",
+           "xtype" : "ColumnModel",
+           "header" : "Balance",
+           "width" : 100,
+           "$ renderer" : "function(v) { return String.format('{0}', v ? parseInt( v) : ''); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "item_stock_balance"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "|activate" : "function() {\n    _this.locpanel = this;\n \n}"
+       },
+       "background" : true,
+       "region" : "east",
+       "fitToframe" : true,
+       "title" : "itemloc",
+       "xtype" : "GridPanel",
+       "fitContainer" : true,
+       "$ xns" : "Roo",
+       "tableName" : "itemloc",
+       "items" : [
+        {
+         "listeners" : {
+          "|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",
+          "|render" : "function() \n{\n    _this.locgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    \n}"
+         },
+         "autoExpandColumn" : "location_name",
+         "xtype" : "Grid",
+         "loadMask" : true,
+         "$ xns" : "Roo.grid",
+         "* prop" : "grid",
+         "items" : [
+          {
+           "listeners" : {
+            "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}"
+           },
+           "xtype" : "Store",
+           "remoteSort" : true,
+           "$ sortInfo" : "{ field : 'location_name', direction: 'ASC' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "dataSource",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Roo/location.php'",
+             "xtype" : "HttpProxy",
+             "method" : "GET",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
+            },
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ 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]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          },
+          {
+           "pageSize" : 25,
+           "xtype" : "PagingToolbar",
+           "emptyMsg" : "No itemloc found",
+           "$ xns" : "Roo",
+           "displayInfo" : true,
+           "displayMsg" : "Displaying itemloc{0} - {1} of {2}",
+           "* prop" : "footer"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "header" : "Location",
+           "width" : 75,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "location_name"
+          },
+          {
+           "xtype" : "ColumnModel",
+           "header" : "Itemloc qty",
+           "width" : 75,
+           "$ renderer" : "function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "itemloc_realqty"
+          }
+         ]
         }
-    ],
-    "permname": "",
-    "modOrder": "200"
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file