Pman.Tab.XtupleItem.bjs
authoredward <edward@roojs.com>
Thu, 14 Apr 2016 04:42:10 +0000 (12:42 +0800)
committeredward <edward@roojs.com>
Thu, 14 Apr 2016 04:42:10 +0000 (12:42 +0800)
Pman.Tab.XtupleItem.js

Pman.Tab.XtupleItem.bjs
Pman.Tab.XtupleItem.js

index dad28b0..5be1478 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Pman.Tab.XtupleItem",
  "parent" : "Pman.Tab.XtupleManage",
  "title" : "Pman.Tab.XtupleItem",
- "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleItem.bjs",
+ "path" : "/home/edward/gitlive/Pman.Xtuple/Pman.Tab.XtupleItem.bjs",
  "permname" : "",
  "modOrder" : "001",
  "strings" : {
@@ -28,6 +28,7 @@
   "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",
@@ -66,8 +67,8 @@
       },
       {
        "xtype" : "LayoutRegion",
-       "$ xns" : "Roo",
        "width" : 200,
+       "$ xns" : "Roo",
        "split" : true,
        "* prop" : "east"
       },
@@ -75,9 +76,9 @@
        "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,
-       "background" : false,
        "title" : "Products",
        "xtype" : "GridPanel",
        "fitContainer" : true,
@@ -86,9 +87,9 @@
        "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}",
-          "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}",
           "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",
            "items" : [
             {
              "$ url" : "baseURL + '/Roo/item.php'",
-             "xtype" : "HttpProxy",
              "method" : "GET",
+             "xtype" : "HttpProxy",
              "$ xns" : "Roo.data",
              "* prop" : "proxy"
             },
                "items" : [
                 {
                  "$ url" : "baseURL + '/Roo/Charass.php'",
-                 "method" : "GET",
                  "xtype" : "HttpProxy",
+                 "method" : "GET",
                  "$ xns" : "Roo.data",
                  "* prop" : "proxy"
                 },
               "render" : "function (_self)\n{\n    _this.dateFrom = _self;\n}"
              },
              "format" : "d/M/Y",
-             "useIso" : true,
              "xtype" : "DateField",
+             "useIso" : true,
              "| value" : "(function() { return (new Date()).format('Y') + '-01-01'; })()",
              "$ xns" : "Roo.form"
             },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Charass.php'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
                  "items" : [
                   {
                    "$ url" : "baseURL + '/Roo/Charass.php'",
-                   "method" : "GET",
                    "xtype" : "HttpProxy",
+                   "method" : "GET",
                    "$ xns" : "Roo.data",
                    "* prop" : "proxy"
                   },
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 100,
            "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[]",
        "listeners" : {
         "|activate" : "function() {\n    _this.locpanel = this;\n \n}"
        },
+       "background" : true,
        "region" : "east",
        "fitToframe" : true,
-       "background" : true,
        "title" : "itemloc",
        "xtype" : "GridPanel",
        "fitContainer" : true,
            "items" : [
             {
              "$ url" : "baseURL + '/Roo/location.php'",
-             "method" : "GET",
              "xtype" : "HttpProxy",
+             "method" : "GET",
              "$ xns" : "Roo.data",
              "* prop" : "proxy"
             },
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 75,
            "header" : "Location",
+           "width" : 75,
            "$ renderer" : "function(v) { return String.format('{0}', v); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
           },
           {
            "xtype" : "ColumnModel",
-           "width" : 75,
            "header" : "Itemloc qty",
+           "width" : 75,
            "$ renderer" : "function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); }",
            "$ xns" : "Roo.grid",
            "* prop" : "colModel[]",
index 9596bde..3b0f5be 100644 (file)
@@ -29,6 +29,7 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
   '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",
@@ -60,299 +61,425 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
    var _this = this;
    var MODULE = this;
    return {
+   background : false,
+   region : 'center',
+   title : _this._strings['068f80c7519d0528fb08e82137a72131'] /* Products */,
+   xns : Roo,
+   '|xns' : 'Roo',
+   xtype : 'NestedLayoutPanel',
    layout : {
+    xns : Roo,
+    '|xns' : 'Roo',
+    xtype : 'BorderLayout',
     center : {
-     '|xns' : 'Roo',
      xns : Roo,
+     '|xns' : 'Roo',
      xtype : 'LayoutRegion'
     },
     east : {
-     '|xns' : 'Roo',
      split : true,
      width : 200,
      xns : Roo,
+     '|xns' : 'Roo',
      xtype : 'LayoutRegion'
     },
-    '|xns' : 'Roo',
-    xns : Roo,
-    xtype : 'BorderLayout',
-    items : [
+    items  : [
      {
-      grid : {
-       dataSource : {
-        proxy : {
-         '|xns' : 'Roo.data',
-         method : 'GET',
-         url : baseURL + '/Roo/item.php',
-         xns : Roo.data,
-         xtype : 'HttpProxy'
-        },
-        reader : {
-         '|xns' : 'Roo.data',
-         fields : [
-             {
-                 'name': 'item_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_number',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_descrip1',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_descrip2',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_classcode_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_picklist',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_comments',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_sold',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_fractional',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_active',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_type',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_prodweight',
-                 'type': 'float'
-             },
-             {
-                 'name': 'item_packweight',
-                 'type': 'float'
-             },
-             {
-                 'name': 'item_prodcat_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_exclusive',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_listprice',
-                 'type': 'float'
-             },
-             {
-                 'name': 'item_config',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_extdescrip',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_upccode',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_maxcost',
-                 'type': 'float'
-             },
-             {
-                 'name': 'item_inv_uom_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_price_uom_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_warrdays',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_freightclass_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_tax_recoverable',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_price_uom_id_uom_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_price_uom_id_uom_name',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_price_uom_id_uom_descrip',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_price_uom_id_uom_item_weight',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_inv_uom_id_uom_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_inv_uom_id_uom_name',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_inv_uom_id_uom_descrip',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_inv_uom_id_uom_item_weight',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_freightclass_id_freightclass_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_freightclass_id_freightclass_code',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_freightclass_id_freightclass_descrip',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_id',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_code',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_descrip',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_mfg',
-                 'type': 'int'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_creator',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_created',
-                 'type': 'date'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_modifier',
-                 'type': 'string'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_modified',
-                 'type': 'date'
-             },
-             {
-                 'name': 'item_classcode_id_classcode_type',
-                 'type': 'string'
-             }
-         ],
-         id : 'id',
-         root : 'data',
-         totalProperty : 'total',
-         xns : Roo.data,
-         xtype : 'JsonReader'
-        },
-        '|xns' : 'Roo.data',
-        remoteSort : true,
-        sortInfo : { field : 'item_number', direction: 'ASC' },
-        xns : Roo.data,
-        xtype : 'Store',
-        listeners : {
-         beforeload : function (_self, o)
-          {
-            o.params._with_prodcat = 1;
-            o.params._with_char = 1;
-            o.params._with_itemsrc_active = 1;
-            o.params._with_last_purchase_price = 1;
-            o.params._with_image = 1;
-            var s = _this.search.getValue();
-            if (s.length) {
-              o.params['query[number_or_name]'] = s;
-            }
-            if (!_this.active.pressed) {
-              o.params.item_active = 1;
-            }
-            if (_this.brandSel.getValue().length) {
-              o.params._with_brand = _this.brandSel.getValue()
+      background : false,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'item',
+      title : _this._strings['068f80c7519d0528fb08e82137a72131'] /* Products */,
+      xns : Roo,
+      '|xns' : 'Roo',
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.panel = this;
+            if (_this.grid) {
+                _this.grid.footer.onClick('first');
             }
-            
-            o.params._with_stock_balance = 1;
-          },
-         load : function (_self, records, options)
-          {
-          
-              var cm = _this.grid.getColumnModel();
-              if(records.length){
-                  cm.setColumnHeader(cm.getIndexByDataIndex('item_stock_balance'),records[0].data.default_location_name);
-              }
-          },
-         update : function (_self, record, operation)
-          {
-              if(operation != 'commit'){
-                  return;
+        }
+      },
+      grid : {
+       autoExpandColumn : 'item_descrip1',
+       clicksToEdit : 1,
+       loadMask : true,
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       xtype : 'EditorGrid',
+       listeners : {
+        afteredit : function (e)
+         {
+             
+             
+             Roo.log(e);
+             new Pman.Request({
+                 url : baseURL +'/Roo/Charass',
+                 params : {
+                      charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
+                      charass_value : e.value,
+                      charass_target_type : 'I',
+                      charass_default : 1,
+                      charass_target_id : e.record.data.item_id
+                  },
+                  method : 'POST'
+              });
+             
+             
+             e.record.commit();
+             
+             
+             
+         },
+        cellclick : function (_self, row, col, e)
+         {
+              var di = _this.grid.colModel.getDataIndex(col);
+              
+              var rec = _this.grid.ds.getAt(row);
+              
+              
+              if (di == 'item_active') {
+              
+                 var nv = rec.data.item_active ? 0 : 1;
+                 new Pman.Request({
+                     mask : 'Saving',
+                     url : baseURL + '/Roo/Item',
+                     params : {
+                         item_id : rec.data.item_id,
+                         item_active : nv
+                     },
+                     success : function() {
+                         rec.set('item_active', nv);
+                     }
+                 });
+                 return;
+                 
+              
               }
               
-              var nv  = record.data.itemsrc_active ? 0 : 1;
-              new Pman.Request({
-                  mask : 'Saving',
-                  url : baseURL + '/Roo/Itemsrc',
-                  params : {
-                      _update_by_item : 1,
-                      item_id : record.data.item_id,
-                      itemsrc_active : nv
-                  },
-                  success : function(res) {
-                      record.set('itemsrc_active', nv);
+              if(di == 'itemsrc_active'){
+              
+              
+              
+         
+                 if(rec.data.itemsrc_active * 1){
+                     Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
+                         function (res) {
+                             if(res!='yes') {
+                                 return;
+                             }
+                             rec.set('itemsrc_active', 0);
+                             rec.commit();
+                     });
+                     return;
+                 }
+                 
+                 Pman.Dialog.XtupleItem.show( { item_id : rec.data.item_id } , function() {
+                     _this.grid.footer.onClick('first');
+                }); 
+                return;
+                 
+             }
+              
+              _this.locgrid.footer.onClick('first');
+              
+              
+              
+              
+         },
+        celldblclick : function (_self, rowIndex, columnIndex, e)
+         {
+             var s = _this.grid.ds.getAt(rowIndex);
+             
+             Pman.Dialog.XtupleItem.show( { item_id : s.data.item_id } , function() {
+                 _this.grid.footer.onClick('first');
+            }); 
+         },
+        render : function() 
+         {
+             _this.grid = this; 
+             //_this.dialog = Pman.Dialog.FILL_IN
+             if (_this.panel.active) {
+                this.footer.onClick('first');
+             }
+         }
+       },
+       footer : {
+        displayInfo : true,
+        displayMsg : _this._strings['aa554e9e2270df2127bfe9096f1bd9ce'] /* Displaying item{0} - {1} of {2} */,
+        emptyMsg : _this._strings['f1c3ca6cadc4a9f57a08d5f7482a3f83'] /* No item found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo',
+        xtype : 'PagingToolbar',
+        items  : [
+         {
+          text : _this._strings['36c454c4130e4444e8410f11d6d998f0'] /* Tools - Upload/Download */,
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          menu : {
+           xns : Roo.menu,
+           '|xns' : 'Roo.menu',
+           xtype : 'Menu',
+           items  : [
+            {
+             text : _this._strings['695dbdb13fad32669a68d8fec8541c7f'] /* Download Standard costs */,
+             xns : Roo.menu,
+             '|xns' : 'Roo.menu',
+             xtype : 'Item',
+             listeners : {
+              click : function (_self, e)
+               {
+                  new Pman.Download({
+                       method: 'GET',
+                       url : baseURL + '/Roo/item',
+                       params : {
+                           _costgrid : 1
+                       }
+                  });
+               }
+             }
+            },
+            {
+             text : _this._strings['70cd7e06502a63356290711ec3b11223'] /* Upload new products and costs */,
+             xns : Roo.menu,
+             '|xns' : 'Roo.menu',
+             xtype : 'Item',
+             listeners : {
+              click : function (_self, e)
+               {
+               //   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");
+                //  return;
+                  
+                  Pman.Dialog.Image.show(
+                      {
+                           _url : baseURL+'/Xtuple/Import/Products',
+                           timeout : 60000
+                       
+                      },
+                      function (data) {
+                           var msg = [];
+                          
+                           if (data.updated) {
+                               msg.push("Updated " + data.updated + " Products(s)");
+                           }            
+                           if (data.inserted) {
+                               msg.push("Added " + data.inserted + " Products(s)");
+                           }
+                           if (data.skipped) {
+                               msg.push("Skipped " + data.skipped);
+                           }
+                           
+                           if (!msg.length) {
+                               msg.push("No data changed");
+                           }
+                           Roo.MessageBox.alert("Notice", msg.join("\n"));
+               
+                      }
+                  );
+               }
+             }
+            },
+            {
+             xns : Roo.menu,
+             '|xns' : 'Roo.menu',
+             xtype : 'Separator'
+            },
+            {
+             hidden : (function() {
+             
+                 return baseURL.match(/hk\.php$/) ? true : false;
+             })(),
+             text : _this._strings['c2f1d503b95bf9f3aa4d775a216c5c73'] /* Sync Product Data from HK */,
+             xns : Roo.menu,
+             '|xns' : 'Roo.menu',
+             xtype : 'Item',
+             listeners : {
+              click : function (_self, e)
+               {
+                 Roo.MessageBox.progress ("Syncing Stock", "Sending");
+                 
+                 var offset = 0;
+                 
+                  function runSync() {
+                      
+                      new Pman.Request( {
+                           url : baseURL+'/Roo/Item',
+                           method : 'GET',
+                           timeout: 60000,
+                           params : {
+                               _syncFromHK : 1,
+                               offset : offset
+                           },
+                           success : function(res) {
+                               Roo.log(res);
+                               if (!res.data.total) {
+                                   Roo.MessageBox.hide();
+                                   return;
+                               }
+                               offset += res.data.limit;
+                               Roo.MessageBox.updateProgress ( offset  / res.data.total, "Done " + offset + '/' + res.data.total);
+                               runSync();
+                           }
+                           
+                       
+                      });
                   }
-              });
+                  runSync();
+               }
+             }
+            },
+            {
+             hidden : (function() {
+             
+                 return baseURL.match(/hk\.php$/) ? true : false;
+             })(),
+             text : _this._strings['d6ea9efa48916e9563d76ddc233ebe2a'] /* Sync Product from HK (New Products Only) */,
+             xns : Roo.menu,
+             '|xns' : 'Roo.menu',
+             xtype : 'Item',
+             listeners : {
+              click : function (_self, e)
+               {
+                 Roo.MessageBox.progress ("Syncing Stock", "Sending");
+                 
+                 var offset = 0;
+                 
+                  
+                      
+                  new Pman.Request( {
+                       url : baseURL+'/Roo/Item',
+                       method : 'GET',
+                       params : {
+                           _syncFromHK : 1,
+                           _new_only : 1
+                       },
+                       success : function(res) {
+                           Roo.log(res);
+                           
+                               Roo.MessageBox.hide();
+                            _this.grid.footer.onClick('refresh');
+                           
+                            
+                       }
+                       
+                   
+                  });
+                   
+               }
+             }
+            },
+            {
+             hidden : (function() {
+             
+                 return baseURL.match(/hk\.php$/) ? true : false;
+             })(),
+             text : _this._strings['44ca8ce0e02dee5d520525ac21bcbee9'] /* Sync Product from HK (Based on Search) */,
+             xns : Roo.menu,
+             '|xns' : 'Roo.menu',
+             xtype : 'Item',
+             listeners : {
+              click : function (_self, e)
+               {
+                 Roo.MessageBox.progress ("Syncing Stock", "Sending");
+                 
+                 var offset = 0;
+                 
+                  
+                      
+                  new Pman.Request( {
+                       url : baseURL+'/Roo/Item',
+                       method : 'GET',
+                       params : {
+                           _syncFromHK : 1,
+                           item_number : _this.search.getValue()
+                       },
+                       success : function(res) {
+                           Roo.log(res);
+                           
+                               Roo.MessageBox.hide();
+                            _this.grid.footer.onClick('refresh');
+                           
+                            
+                       }
+                       
+                   
+                  });
+                   
+               }
+             }
+            }
+           ]
           }
-        },
-        items : [
-
+         }
         ]
-
        },
        toolbar : {
-        '|xns' : 'Roo',
         xns : Roo,
+        '|xns' : 'Roo',
         xtype : 'Toolbar',
-        items : [
+        items  : [
          {
+          allowBlank : true,
+          alwaysQuery : true,
+          displayField : 'charass_value',
+          editable : true,
+          emptyText : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* Select Brand */,
+          forceSelection : true,
+          listWidth : 300,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+          minChars : 2,
+          pageSize : 20,
+          qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* 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,
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          xtype : 'ComboBox',
+          listeners : {
+           render : function (_self)
+            {
+              _this.brandSel = _self;
+            },
+           select : function (combo, record, index)
+            {
+                _this.grid.footer.onClick('first');
+            }
+          },
           store : {
+           remoteSort : true,
+           sortInfo : { field : 'charass_value' , direction : 'ASC' },
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           xtype : 'Store',
+           listeners : {
+            beforeload : function (_self, o)
+             {
+                 o.params = o.params || {};
+                 // staff can see all logs, other companies can only see their own.
+                 // look for all of the charass 's with the same type= eg. brand.
+                 
+                 o.params.charass_char_id_char_name = 'BRAND';
+                 o.params.charass_target_type ='I';
+                 o.params._distinct = 'charass_value';
+                     o.params._columns = 'charass_value';
+             
+             }
+           },
            proxy : {
-            '|xns' : 'Roo.data',
             method : 'GET',
             url : baseURL + '/Roo/Charass.php',
             xns : Roo.data,
+            '|xns' : 'Roo.data',
             xtype : 'HttpProxy'
            },
            reader : {
-            '|xns' : 'Roo.data',
             fields : [
                 {
                     'name': 'id',
@@ -468,70 +595,15 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
             root : 'data',
             totalProperty : 'total',
             xns : Roo.data,
+            '|xns' : 'Roo.data',
             xtype : 'JsonReader'
-           },
-           '|xns' : 'Roo.data',
-           remoteSort : true,
-           sortInfo : { field : 'charass_value' , direction : 'ASC' },
-           xns : Roo.data,
-           xtype : 'Store',
-           listeners : {
-            beforeload : function (_self, o)
-             {
-                 o.params = o.params || {};
-                 // staff can see all logs, other companies can only see their own.
-                 // look for all of the charass 's with the same type= eg. brand.
-                 
-                 o.params.charass_char_id_char_name = 'BRAND';
-                 o.params.charass_target_type ='I';
-                 o.params._distinct = 'charass_value';
-                     o.params._columns = 'charass_value';
-             
-             }
-           },
-           items : [
-
-           ]
-
-          },
-          '|xns' : 'Roo.form',
-          allowBlank : true,
-          alwaysQuery : true,
-          displayField : 'charass_value',
-          editable : true,
-          emptyText : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
-          forceSelection : true,
-          listWidth : 300,
-          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
-          minChars : 2,
-          pageSize : 20,
-          qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
-          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,
-          xns : Roo.form,
-          xtype : 'ComboBox',
-          listeners : {
-           render : function (_self)
-            {
-              _this.brandSel = _self;
-            },
-           select : function (combo, record, index)
-            {
-                _this.grid.footer.onClick('first');
-            }
-          },
-          items : [
-
-          ]
-
+           }
+          }
          },
          {
-          '|xns' : 'Roo.form',
-          emptyText : _this._strings['9a8faafb674c03474827bcb6fcde43a3'],
+          emptyText : _this._strings['9a8faafb674c03474827bcb6fcde43a3'] /* Search Product */,
           xns : Roo.form,
+          '|xns' : 'Roo.form',
           xtype : 'TextField',
           listeners : {
            render : function (_self)
@@ -545,10 +617,10 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          '|xns' : 'Roo.Toolbar',
           cls : 'x-btn-icon',
           icon : rootURL + '/Pman/templates/images/search.gif',
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
           listeners : {
            click : function (_self, e)
@@ -558,10 +630,10 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          '|xns' : 'Roo.Toolbar',
           cls : 'x-btn-icon',
           icon : rootURL + '/Pman/templates/images/edit-clear.gif',
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
           listeners : {
            click : function (_self, e)
@@ -575,15 +647,15 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          '|xns' : 'Roo.Toolbar',
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Separator'
          },
          {
-          '|xns' : 'Roo.Toolbar',
           enableToggle : true,
-          text : _this._strings['5bc3fd20294c17c9803942958fd7f26d'],
+          text : _this._strings['5bc3fd20294c17c9803942958fd7f26d'] /* Show Inactive */,
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
           listeners : {
            render : function (_self)
@@ -599,16 +671,16 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          '|xns' : 'Roo.Toolbar',
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Fill'
          },
          {
-          '|xns' : 'Roo.Toolbar',
           cls : 'x-btn-text-icon',
           icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
-          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'],
+          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
           listeners : {
            click : function()
@@ -621,9 +693,9 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          '|xns' : 'Roo.Toolbar',
-          text : _this._strings['ee3585dbcb1e8f8826f3403c1e9d898c'],
+          text : _this._strings['ee3585dbcb1e8f8826f3403c1e9d898c'] /* Rename SKU */,
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
           listeners : {
            click : function()
@@ -714,22 +786,22 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          '|xns' : 'Roo.Toolbar',
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Separator'
          },
          {
-          '|xns' : 'Roo.Toolbar',
-          text : _this._strings['7fee866379427143414dd7a72e56414b'],
+          text : _this._strings['7fee866379427143414dd7a72e56414b'] /* Report start : */,
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'TextItem'
          },
          {
-          '|xns' : 'Roo.form',
           format : 'd/M/Y',
           useIso : true,
           value : (function() { return (new Date()).format('Y') + '-01-01'; })(),
           xns : Roo.form,
+          '|xns' : 'Roo.form',
           xtype : 'DateField',
           listeners : {
            render : function (_self)
@@ -739,23 +811,10 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           }
          },
          {
-          store : {
-           '|xns' : 'Roo.data',
-           data : [ 
-               [ '1', "Single Month Sales"],
-               [ '3', "Quarter Sales"],
-               [ '6', "Half year Sales"] ,
-               [ '12', "Full Year Sales"] 
-           ],
-           fields : [  'ftype', 'fname'],
-           xns : Roo.data,
-           xtype : 'SimpleStore'
-          },
-          '|xns' : 'Roo.form',
           allowBlank : false,
           displayField : 'fname',
           editable : false,
-          fieldLabel : 'Status',
+          fieldLabel : _this._strings['ec53a8c4f07baed5d8825072c89799be'] /* Status */,
           hiddenName : 'cm_status',
           listWidth : 200,
           mode : 'local',
@@ -765,6 +824,7 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
           valueField : 'ftype',
           width : 150,
           xns : Roo.form,
+          '|xns' : 'Roo.form',
           xtype : 'ComboBox',
           listeners : {
            render : function (_self)
@@ -772,990 +832,921 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
               _this.datespan  = _self;
             }
           },
-          items : [
-
-          ]
-
-         },
-         {
-          '|xns' : 'Roo.Toolbar',
-          text : _this._strings['e924991fc4c883bc237e69efe884d674'],
-          xns : Roo.Toolbar,
-          xtype : 'Button',
-          listeners : {
-           click : function (_self, e)
-            {
-                if (!_this.brandSel.getValue().length) {
-                    Roo.MessageBox.alert("Error", "Select a brand to download");
-                    return;
-                }
-            
-                new Pman.Download({
-                    url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
-                    params: { 
-                        date_from : _this.dateFrom.getValue(),
-                        brand : _this.brandSel.getValue(),
-                        span : _this.datespan.getValue()
-                    }
-                });
-                    
-            
-            }
-          }
-         }
-        ]
-
-       },
-       footer : {
-        '|xns' : 'Roo',
-        displayInfo : true,
-        displayMsg : _this._strings['aa554e9e2270df2127bfe9096f1bd9ce'],
-        emptyMsg : _this._strings['f1c3ca6cadc4a9f57a08d5f7482a3f83'],
-        pageSize : 25,
-        xns : Roo,
-        xtype : 'PagingToolbar',
-        items : [
-         {
-          menu : {
-           '|xns' : 'Roo.menu',
-           xns : Roo.menu,
-           xtype : 'Menu',
-           items : [
-            {
-             '|xns' : 'Roo.menu',
-             text : _this._strings['695dbdb13fad32669a68d8fec8541c7f'],
-             xns : Roo.menu,
-             xtype : 'Item',
-             listeners : {
-              click : function (_self, e)
-               {
-                  new Pman.Download({
-                       method: 'GET',
-                       url : baseURL + '/Roo/item',
-                       params : {
-                           _costgrid : 1
-                       }
-                  });
-               }
-             }
-            },
-            {
-             '|xns' : 'Roo.menu',
-             text : _this._strings['70cd7e06502a63356290711ec3b11223'],
-             xns : Roo.menu,
-             xtype : 'Item',
-             listeners : {
-              click : function (_self, e)
-               {
-               //   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");
-                //  return;
-                  
-                  Pman.Dialog.Image.show(
-                      {
-                           _url : baseURL+'/Xtuple/Import/Products',
-                           timeout : 60000
-                       
-                      },
-                      function (data) {
-                           var msg = [];
-                          
-                           if (data.updated) {
-                               msg.push("Updated " + data.updated + " Products(s)");
-                           }            
-                           if (data.inserted) {
-                               msg.push("Added " + data.inserted + " Products(s)");
-                           }
-                           if (data.skipped) {
-                               msg.push("Skipped " + data.skipped);
-                           }
-                           
-                           if (!msg.length) {
-                               msg.push("No data changed");
-                           }
-                           Roo.MessageBox.alert("Notice", msg.join("\n"));
-               
-                      }
-                  );
-               }
-             }
-            },
-            {
-             '|xns' : 'Roo.menu',
-             xns : Roo.menu,
-             xtype : 'Separator'
-            },
-            {
-             '|xns' : 'Roo.menu',
-             hidden : (function() {
-             
-                 return baseURL.match(/hk\.php$/) ? true : false;
-             })(),
-             text : _this._strings['c2f1d503b95bf9f3aa4d775a216c5c73'],
-             xns : Roo.menu,
-             xtype : 'Item',
-             listeners : {
-              click : function (_self, e)
-               {
-                 Roo.MessageBox.progress ("Syncing Stock", "Sending");
-                 
-                 var offset = 0;
-                 
-                  function runSync() {
-                      
-                      new Pman.Request( {
-                           url : baseURL+'/Roo/Item',
-                           method : 'GET',
-                           timeout: 60000,
-                           params : {
-                               _syncFromHK : 1,
-                               offset : offset
-                           },
-                           success : function(res) {
-                               Roo.log(res);
-                               if (!res.data.total) {
-                                   Roo.MessageBox.hide();
-                                   return;
-                               }
-                               offset += res.data.limit;
-                               Roo.MessageBox.updateProgress ( offset  / res.data.total, "Done " + offset + '/' + res.data.total);
-                               runSync();
-                           }
-                           
-                       
-                      });
-                  }
-                  runSync();
-               }
-             }
-            },
-            {
-             '|xns' : 'Roo.menu',
-             hidden : (function() {
-             
-                 return baseURL.match(/hk\.php$/) ? true : false;
-             })(),
-             text : _this._strings['d6ea9efa48916e9563d76ddc233ebe2a'],
-             xns : Roo.menu,
-             xtype : 'Item',
-             listeners : {
-              click : function (_self, e)
-               {
-                 Roo.MessageBox.progress ("Syncing Stock", "Sending");
-                 
-                 var offset = 0;
-                 
-                  
-                      
-                  new Pman.Request( {
-                       url : baseURL+'/Roo/Item',
-                       method : 'GET',
-                       params : {
-                           _syncFromHK : 1,
-                           _new_only : 1
-                       },
-                       success : function(res) {
-                           Roo.log(res);
-                           
-                               Roo.MessageBox.hide();
-                            _this.grid.footer.onClick('refresh');
-                           
-                            
-                       }
-                       
-                   
-                  });
-                   
-               }
-             }
-            },
-            {
-             '|xns' : 'Roo.menu',
-             hidden : (function() {
-             
-                 return baseURL.match(/hk\.php$/) ? true : false;
-             })(),
-             text : _this._strings['44ca8ce0e02dee5d520525ac21bcbee9'],
-             xns : Roo.menu,
-             xtype : 'Item',
-             listeners : {
-              click : function (_self, e)
-               {
-                 Roo.MessageBox.progress ("Syncing Stock", "Sending");
-                 
-                 var offset = 0;
-                 
-                  
-                      
-                  new Pman.Request( {
-                       url : baseURL+'/Roo/Item',
-                       method : 'GET',
-                       params : {
-                           _syncFromHK : 1,
-                           item_number : _this.search.getValue()
-                       },
-                       success : function(res) {
-                           Roo.log(res);
-                           
-                               Roo.MessageBox.hide();
-                            _this.grid.footer.onClick('refresh');
-                           
-                            
-                       }
-                       
-                   
-                  });
-                   
-               }
-             }
-            }
-           ]
-
-          },
-          '|xns' : 'Roo.Toolbar',
-          text : _this._strings['36c454c4130e4444e8410f11d6d998f0'],
+          store : {
+           data : [ 
+               [ '1', "Single Month Sales"],
+               [ '3', "Quarter Sales"],
+               [ '6', "Half year Sales"] ,
+               [ '12', "Full Year Sales"] 
+           ],
+           fields : [  'ftype', 'fname'],
+           xns : Roo.data,
+           '|xns' : 'Roo.data',
+           xtype : 'SimpleStore'
+          }
+         },
+         {
+          text : _this._strings['e924991fc4c883bc237e69efe884d674'] /* Download Sales Report */,
           xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
           xtype : 'Button',
-          items : [
-
-          ]
-
+          listeners : {
+           click : function (_self, e)
+            {
+                if (!_this.brandSel.getValue().length) {
+                    Roo.MessageBox.alert("Error", "Select a brand to download");
+                    return;
+                }
+            
+                new Pman.Download({
+                    url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',
+                    params: { 
+                        date_from : _this.dateFrom.getValue(),
+                        brand : _this.brandSel.getValue(),
+                        span : _this.datespan.getValue()
+                    }
+                });
+                    
+            
+            }
+          }
          }
         ]
-
        },
-       '|xns' : 'Roo.grid',
-       autoExpandColumn : 'item_descrip1',
-       clicksToEdit : 1,
-       loadMask : true,
-       xns : Roo.grid,
-       xtype : 'EditorGrid',
-       colModel : [
-         {
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_image_id',
-          header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'],
-          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); },
-          sortable : false,
-          width : 150,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          editor : {
-           field : {
-            store : {
-             proxy : {
-              '|xns' : 'Roo.data',
-              method : 'GET',
-              url : baseURL + '/Roo/Charass.php',
-              xns : Roo.data,
-              xtype : 'HttpProxy'
+       dataSource : {
+        remoteSort : true,
+        sortInfo : { field : 'item_number', direction: 'ASC' },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+            o.params._with_prodcat = 1;
+            o.params._with_char = 1;
+            o.params._with_itemsrc_active = 1;
+            o.params._with_last_purchase_price = 1;
+            o.params._with_image = 1;
+            var s = _this.search.getValue();
+            if (s.length) {
+              o.params['query[number_or_name]'] = s;
+            }
+            if (!_this.active.pressed) {
+              o.params.item_active = 1;
+            }
+            if (_this.brandSel.getValue().length) {
+              o.params._with_brand = _this.brandSel.getValue()
+            }
+            
+            o.params._with_stock_balance = 1;
+          },
+         load : function (_self, records, options)
+          {
+          
+              var cm = _this.grid.getColumnModel();
+              if(records.length){
+                  cm.setColumnHeader(cm.getIndexByDataIndex('item_stock_balance'),records[0].data.default_location_name);
+              }
+          },
+         update : function (_self, record, operation)
+          {
+              if(operation != 'commit'){
+                  return;
+              }
+              
+              var nv  = record.data.itemsrc_active ? 0 : 1;
+              new Pman.Request({
+                  mask : 'Saving',
+                  url : baseURL + '/Roo/Itemsrc',
+                  params : {
+                      _update_by_item : 1,
+                      item_id : record.data.item_id,
+                      itemsrc_active : nv
+                  },
+                  success : function(res) {
+                      record.set('itemsrc_active', nv);
+                  }
+              });
+          }
+        },
+        proxy : {
+         method : 'GET',
+         url : baseURL + '/Roo/item.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         fields : [
+             {
+                 'name': 'item_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_number',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_descrip1',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_descrip2',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_classcode_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_picklist',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_comments',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_sold',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_fractional',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_type',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_prodweight',
+                 'type': 'float'
+             },
+             {
+                 'name': 'item_packweight',
+                 'type': 'float'
+             },
+             {
+                 'name': 'item_prodcat_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_exclusive',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_listprice',
+                 'type': 'float'
+             },
+             {
+                 'name': 'item_config',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_extdescrip',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_upccode',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_maxcost',
+                 'type': 'float'
+             },
+             {
+                 'name': 'item_inv_uom_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_price_uom_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_warrdays',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_freightclass_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_tax_recoverable',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_price_uom_id_uom_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_price_uom_id_uom_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_price_uom_id_uom_descrip',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_price_uom_id_uom_item_weight',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_inv_uom_id_uom_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_inv_uom_id_uom_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_inv_uom_id_uom_descrip',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_inv_uom_id_uom_item_weight',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_freightclass_id_freightclass_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_freightclass_id_freightclass_code',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_freightclass_id_freightclass_descrip',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_classcode_id_classcode_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'item_classcode_id_classcode_code',
+                 'type': 'string'
+             },
+             {
+                 'name': 'item_classcode_id_classcode_descrip',
+                 'type': 'string'
              },
-             reader : {
-              '|xns' : 'Roo.data',
-              fields : [
-                  {
-                      'name': 'id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_name',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'event_when',
-                      'type': 'date',
-                      'dateFormat': 'Y-m-d'
-                  },
-                  {
-                      'name': 'action',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'ipaddr',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'on_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'on_table',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'remarks',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_office_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_name',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_phone',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_fax',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_email',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_company_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_role',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_active',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_remarks',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_passwd',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_owner_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_lang',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_no_reset_sent',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_action_type',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_project_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_deleted_by',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_deleted_dt',
-                      'type': 'date'
-                  }
-              ],
-              id : 'id',
-              root : 'data',
-              totalProperty : 'total',
-              xns : Roo.data,
-              xtype : 'JsonReader'
+             {
+                 'name': 'item_classcode_id_classcode_mfg',
+                 'type': 'int'
              },
-             '|xns' : 'Roo.data',
-             remoteSort : true,
-             sortInfo : { field : 'charass_value' , direction : 'ASC' },
-             xns : Roo.data,
-             xtype : 'Store',
-             listeners : {
-              beforeload : function (_self, o)
-               {
-                   o.params = o.params || {};
-                   // staff can see all logs, other companies can only see their own.
-                   // look for all of the charass 's with the same type= eg. brand.
-                   
-                   o.params.charass_char_id_char_name = 'BRAND';
-                   o.params.charass_target_type ='I';
-                   o.params._distinct = 'charass_value';
-                       o.params._columns = 'charass_value';
-               
-               }
+             {
+                 'name': 'item_classcode_id_classcode_creator',
+                 'type': 'string'
              },
-             items : [
-
-             ]
-
-            },
-            '|xns' : 'Roo.form',
-            allowBlank : true,
-            alwaysQuery : true,
-            displayField : 'charass_value',
-            editable : true,
-            forceSelection : false,
-            listWidth : 300,
-            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
-            minChars : 2,
-            pageSize : 20,
-            qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
-            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,
-            xns : Roo.form,
-            xtype : 'ComboBox',
-            items : [
-
-            ]
-
-           },
-           '|xns' : 'Roo.grid',
-           xns : Roo.grid,
-           xtype : 'GridEditor',
-           items : [
-
-           ]
-
-          },
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_char_brand',
-          header : _this._strings['1be6f9eb563f3bf85c78b4219bf09de9'],
-          renderer : function(v) { return String.format('{0}', v); },
-          sortable : true,
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel',
-          items : [
-
-          ]
-
-         },
-{
-          editor : {
-           field : {
-            store : {
-             proxy : {
-              '|xns' : 'Roo.data',
-              method : 'GET',
-              url : baseURL + '/Roo/Charass.php',
-              xns : Roo.data,
-              xtype : 'HttpProxy'
+             {
+                 'name': 'item_classcode_id_classcode_created',
+                 'type': 'date'
              },
-             reader : {
-              '|xns' : 'Roo.data',
-              fields : [
-                  {
-                      'name': 'id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_name',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'event_when',
-                      'type': 'date',
-                      'dateFormat': 'Y-m-d'
-                  },
-                  {
-                      'name': 'action',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'ipaddr',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'on_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'on_table',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'remarks',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_office_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_name',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_phone',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_fax',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_email',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_company_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_role',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_active',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_remarks',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_passwd',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_owner_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_lang',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_no_reset_sent',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_action_type',
-                      'type': 'string'
-                  },
-                  {
-                      'name': 'person_id_project_id',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_deleted_by',
-                      'type': 'int'
-                  },
-                  {
-                      'name': 'person_id_deleted_dt',
-                      'type': 'date'
-                  }
-              ],
-              id : 'id',
-              root : 'data',
-              totalProperty : 'total',
-              xns : Roo.data,
-              xtype : 'JsonReader'
+             {
+                 'name': 'item_classcode_id_classcode_modifier',
+                 'type': 'string'
              },
-             '|xns' : 'Roo.data',
-             remoteSort : true,
-             sortInfo : { field : 'charass_value' , direction : 'ASC' },
-             xns : Roo.data,
-             xtype : 'Store',
-             listeners : {
-              beforeload : function (_self, o)
-               {
-                   o.params = o.params || {};
-                   // staff can see all logs, other companies can only see their own.
-                   // look for all of the charass 's with the same type= eg. brand.
-                   
-                   o.params.charass_char_id_char_name = 'PRODUCTGROUP';
-                   o.params.charass_target_type ='I';
-                   o.params._distinct = 'charass_value';
-                       o.params._columns = 'charass_value';    
-               }
+             {
+                 'name': 'item_classcode_id_classcode_modified',
+                 'type': 'date'
              },
-             items : [
-
-             ]
-
-            },
-            '|xns' : 'Roo.form',
-            allowBlank : true,
-            alwaysQuery : true,
-            displayField : 'charass_value',
-            editable : true,
-            forceSelection : false,
-            listWidth : 300,
-            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
-            minChars : 2,
-            pageSize : 20,
-            qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'],
-            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,
-            xns : Roo.form,
-            xtype : 'ComboBox',
-            items : [
-
-            ]
-
-           },
-           '|xns' : 'Roo.grid',
-           xns : Roo.grid,
-           xtype : 'GridEditor',
-           items : [
-
-           ]
-
-          },
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_char_productgroup',
-          header : _this._strings['c6ca371871d835c79c8654b5cd788cc7'],
-          renderer : function(v) { return String.format('{0}', v); },
-          sortable : true,
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel',
-          items : [
-
-          ]
-
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_number',
-          header : _this._strings['b2ee912b91d69b435159c7c3f6df7f5f'],
-          renderer : function(v) { return String.format('<B>{0}</B>', v); },
-          sortable : true,
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          editor : {
-           field : {
-            '|xns' : 'Roo.form',
-            xns : Roo.form,
-            xtype : 'TextField'
-           },
-           '|xns' : 'Roo.grid',
-           xns : Roo.grid,
-           xtype : 'GridEditor',
-           items : [
-
-           ]
-
-          },
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_char_pickface_location',
-          header : _this._strings['d8ab3576a67fe0cc175ee77d57d0fd85'],
-          renderer : function(v) { return String.format('{0}', v); },
-          sortable : true,
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel',
-          items : [
-
-          ]
-
-         },
-{
-          editor : {
-           field : {
-            '|xns' : 'Roo.form',
-            xns : Roo.form,
-            xtype : 'TextField'
-           },
-           '|xns' : 'Roo.grid',
-           xns : Roo.grid,
-           xtype : 'GridEditor',
-           items : [
-
-           ]
-
-          },
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_char_pallet_location',
-          header : _this._strings['fe78f3efbfa84d8485d589031596c5b8'],
-          renderer : function(v) { return String.format('{0}', v); },
-          sortable : true,
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel',
-          items : [
-
-          ]
-
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_descrip1',
-          header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'],
-          renderer : function(v) { return String.format('{0}', v); },
-          sortable : true,
-          width : 200,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'itemsrc_active',
-          header : _this._strings['ce4ee01637f4279d02d0f232459dc9a4'],
-          renderer : function(v) {  
-              var state = v * 1 > 0 ?  '-checked' : '';
-          
-              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                          
-           },
-          sortable : true,
-          width : 55,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_sold',
-          header : _this._strings['41e902bb1b2db625736ede3bacc41fe0'],
-          renderer : function(v) {  
-              var state = v * 1 > 0 ?  '-checked' : '';
-          
-              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                          
-           },
-          sortable : true,
-          width : 50,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_active',
-          header : _this._strings['68f43fdcf074903d65da764642a4b968'],
-          renderer : function(v) {  
-              var state = v * 1 > 0 ?  '-checked' : '';
-          
-              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                          
-           },
-          sortable : true,
-          width : 50,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          align : 'right',
-          dataIndex : 'last_purchase_price',
-          header : _this._strings['750587d31c68779e7f615c190a9dc23f'],
-          renderer : function(v,x,r) {
-          
-               return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ; 
-               
-           },
-          width : 120,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'item_prodcat_id_prodcat_code',
-          header : _this._strings['89217b1527e14cced20e78111a8f5027'],
-          renderer : function(v,x,r) { 
-              return String.format('{0}/{1}', r.data.item_type, v); 
-              },
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          align : 'right',
-          dataIndex : 'item_actcost',
-          header : _this._strings['20b4f77bd00b4f63a49ec8e08f3bf6a6'],
-          renderer : function(v,x,r) {
-          
-               return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ; 
-               
-           },
-          width : 75,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          align : 'right',
-          dataIndex : 'item_base_cost',
-          header : _this._strings['35be52be39d3efcd0cd2b3721fc3c298'],
-          renderer : function(v,x,r) {
-          
-               return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ; 
-               
-           },
-          width : 75,
+             {
+                 'name': 'item_classcode_id_classcode_type',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         xtype : 'JsonReader'
+        }
+       },
+       colModel : [
+        {
+         dataIndex : 'item_image_id',
+         header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'] /* Image */,
+         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); },
+         sortable : false,
+         width : 150,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'item_char_brand',
+         header : _this._strings['1be6f9eb563f3bf85c78b4219bf09de9'] /* Brand */,
+         renderer : function(v) { return String.format('{0}', v); },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel',
+         editor : {
           xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
           '|xns' : 'Roo.grid',
-          align : 'right',
-          dataIndex : 'item_stock_balance',
-          header : _this._strings['99a808d8d16122d70e44bd7f709d30fb'],
-          renderer : function(v) { return String.format('{0}', v ? parseInt( v) : ''); },
-          width : 100,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         }
-       ],
-       listeners : {
-        afteredit : function (e)
-         {
-             
-             
-             Roo.log(e);
-             new Pman.Request({
-                 url : baseURL +'/Roo/Charass',
-                 params : {
-                      charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),
-                      charass_value : e.value,
-                      charass_target_type : 'I',
-                      charass_default : 1,
-                      charass_target_id : e.record.data.item_id
-                  },
-                  method : 'POST'
-              });
-             
-             
-             e.record.commit();
-             
-             
-             
-         },
-        cellclick : function (_self, row, col, e)
-         {
-              var di = _this.grid.colModel.getDataIndex(col);
-              
-              var rec = _this.grid.ds.getAt(row);
-              
-              
-              if (di == 'item_active') {
-              
-                 var nv = rec.data.item_active ? 0 : 1;
-                 new Pman.Request({
-                     mask : 'Saving',
-                     url : baseURL + '/Roo/Item',
-                     params : {
-                         item_id : rec.data.item_id,
-                         item_active : nv
-                     },
-                     success : function() {
-                         rec.set('item_active', nv);
-                     }
-                 });
-                 return;
-                 
+          xtype : 'GridEditor',
+          field : {
+           allowBlank : true,
+           alwaysQuery : true,
+           displayField : 'charass_value',
+           editable : true,
+           forceSelection : false,
+           listWidth : 300,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           pageSize : 20,
+           qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* 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,
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           xtype : 'ComboBox',
+           store : {
+            remoteSort : true,
+            sortInfo : { field : 'charass_value' , direction : 'ASC' },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            xtype : 'Store',
+            listeners : {
+             beforeload : function (_self, o)
+              {
+                  o.params = o.params || {};
+                  // staff can see all logs, other companies can only see their own.
+                  // look for all of the charass 's with the same type= eg. brand.
+                  
+                  o.params.charass_char_id_char_name = 'BRAND';
+                  o.params.charass_target_type ='I';
+                  o.params._distinct = 'charass_value';
+                      o.params._columns = 'charass_value';
               
               }
-              
-              if(di == 'itemsrc_active'){
-              
-              
-              
-         
-                 if(rec.data.itemsrc_active * 1){
-                     Roo.MessageBox.confirm("Confirm", "Are you sure this product is no longer purchased",
-                         function (res) {
-                             if(res!='yes') {
-                                 return;
-                             }
-                             rec.set('itemsrc_active', 0);
-                             rec.commit();
-                     });
-                     return;
+            },
+            proxy : {
+             method : 'GET',
+             url : baseURL + '/Roo/Charass.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             xtype : 'HttpProxy'
+            },
+            reader : {
+             fields : [
+                 {
+                     'name': 'id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_name',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'event_when',
+                     'type': 'date',
+                     'dateFormat': 'Y-m-d'
+                 },
+                 {
+                     'name': 'action',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'ipaddr',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'on_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'on_table',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'remarks',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_office_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_name',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_phone',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_fax',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_email',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_company_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_role',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_active',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_remarks',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_passwd',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_owner_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_lang',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_no_reset_sent',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_action_type',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_project_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_deleted_by',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_deleted_dt',
+                     'type': 'date'
+                 }
+             ],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             xtype : 'JsonReader'
+            }
+           }
+          }
+         }
+        },
+        {
+         dataIndex : 'item_char_productgroup',
+         header : _this._strings['c6ca371871d835c79c8654b5cd788cc7'] /* Product Group */,
+         renderer : function(v) { return String.format('{0}', v); },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel',
+         editor : {
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          xtype : 'GridEditor',
+          field : {
+           allowBlank : true,
+           alwaysQuery : true,
+           displayField : 'charass_value',
+           editable : true,
+           forceSelection : false,
+           listWidth : 300,
+           loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
+           minChars : 2,
+           pageSize : 20,
+           qtip : _this._strings['a9e35d03ee7f31f5bb199379a6d3547a'] /* 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,
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           xtype : 'ComboBox',
+           store : {
+            remoteSort : true,
+            sortInfo : { field : 'charass_value' , direction : 'ASC' },
+            xns : Roo.data,
+            '|xns' : 'Roo.data',
+            xtype : 'Store',
+            listeners : {
+             beforeload : function (_self, o)
+              {
+                  o.params = o.params || {};
+                  // staff can see all logs, other companies can only see their own.
+                  // look for all of the charass 's with the same type= eg. brand.
+                  
+                  o.params.charass_char_id_char_name = 'PRODUCTGROUP';
+                  o.params.charass_target_type ='I';
+                  o.params._distinct = 'charass_value';
+                      o.params._columns = 'charass_value';    
+              }
+            },
+            proxy : {
+             method : 'GET',
+             url : baseURL + '/Roo/Charass.php',
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             xtype : 'HttpProxy'
+            },
+            reader : {
+             fields : [
+                 {
+                     'name': 'id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_name',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'event_when',
+                     'type': 'date',
+                     'dateFormat': 'Y-m-d'
+                 },
+                 {
+                     'name': 'action',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'ipaddr',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'on_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'on_table',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'remarks',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_office_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_name',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_phone',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_fax',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_email',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_company_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_role',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_active',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_remarks',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_passwd',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_owner_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_lang',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_no_reset_sent',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_action_type',
+                     'type': 'string'
+                 },
+                 {
+                     'name': 'person_id_project_id',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_deleted_by',
+                     'type': 'int'
+                 },
+                 {
+                     'name': 'person_id_deleted_dt',
+                     'type': 'date'
                  }
-                 
-                 Pman.Dialog.XtupleItem.show( { item_id : rec.data.item_id } , function() {
-                     _this.grid.footer.onClick('first');
-                }); 
-                return;
-                 
-             }
-              
-              _this.locgrid.footer.onClick('first');
-              
+             ],
+             id : 'id',
+             root : 'data',
+             totalProperty : 'total',
+             xns : Roo.data,
+             '|xns' : 'Roo.data',
+             xtype : 'JsonReader'
+            }
+           }
+          }
+         }
+        },
+        {
+         dataIndex : 'item_number',
+         header : _this._strings['b2ee912b91d69b435159c7c3f6df7f5f'] /* Number */,
+         renderer : function(v) { return String.format('<B>{0}</B>', v); },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'item_char_pickface_location',
+         header : _this._strings['d8ab3576a67fe0cc175ee77d57d0fd85'] /* Pickface */,
+         renderer : function(v) { return String.format('{0}', v); },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel',
+         editor : {
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          xtype : 'GridEditor',
+          field : {
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           xtype : 'TextField'
+          }
+         }
+        },
+        {
+         dataIndex : 'item_char_pallet_location',
+         header : _this._strings['fe78f3efbfa84d8485d589031596c5b8'] /* Pallet */,
+         renderer : function(v) { return String.format('{0}', v); },
+         sortable : true,
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel',
+         editor : {
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          xtype : 'GridEditor',
+          field : {
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           xtype : 'TextField'
+          }
+         }
+        },
+        {
+         dataIndex : 'item_descrip1',
+         header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
+         renderer : function(v) { return String.format('{0}', v); },
+         sortable : true,
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'itemsrc_active',
+         header : _this._strings['ce4ee01637f4279d02d0f232459dc9a4'] /* Purchased */,
+         renderer : function(v) {  
+             var state = v * 1 > 0 ?  '-checked' : '';
+         
+             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                         
+          },
+         sortable : true,
+         width : 55,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'item_sold',
+         header : _this._strings['41e902bb1b2db625736ede3bacc41fe0'] /* is Sold? */,
+         renderer : function(v) {  
+             var state = v * 1 > 0 ?  '-checked' : '';
+         
+             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                         
+          },
+         sortable : true,
+         width : 50,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'item_active',
+         header : _this._strings['68f43fdcf074903d65da764642a4b968'] /* is Active? */,
+         renderer : function(v) {  
+             var state = v * 1 > 0 ?  '-checked' : '';
+         
+             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                         
+          },
+         sortable : true,
+         width : 50,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         align : 'right',
+         dataIndex : 'last_purchase_price',
+         header : _this._strings['750587d31c68779e7f615c190a9dc23f'] /* Last purchase price */,
+         renderer : function(v,x,r) {
+         
+              return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ; 
               
+          },
+         width : 120,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'item_prodcat_id_prodcat_code',
+         header : _this._strings['89217b1527e14cced20e78111a8f5027'] /* Item prodcat */,
+         renderer : function(v,x,r) { 
+             return String.format('{0}/{1}', r.data.item_type, v); 
+             },
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         align : 'right',
+         dataIndex : 'item_actcost',
+         header : _this._strings['20b4f77bd00b4f63a49ec8e08f3bf6a6'] /* Cost */,
+         renderer : function(v,x,r) {
+         
+              return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ; 
               
+          },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         align : 'right',
+         dataIndex : 'item_base_cost',
+         header : _this._strings['35be52be39d3efcd0cd2b3721fc3c298'] /* Cost (base) */,
+         renderer : function(v,x,r) {
+         
+              return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ; 
               
-         },
-        celldblclick : function (_self, rowIndex, columnIndex, e)
-         {
-             var s = _this.grid.ds.getAt(rowIndex);
-             
-             Pman.Dialog.XtupleItem.show( { item_id : s.data.item_id } , function() {
-                 _this.grid.footer.onClick('first');
-            }); 
-         },
-        render : function() 
-         {
-             _this.grid = this; 
-             //_this.dialog = Pman.Dialog.FILL_IN
-             if (_this.panel.active) {
-                this.footer.onClick('first');
-             }
-         }
-       },
-       items : [
-
+          },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         align : 'right',
+         dataIndex : 'item_stock_balance',
+         header : _this._strings['99a808d8d16122d70e44bd7f709d30fb'] /* Balance */,
+         renderer : function(v) { return String.format('{0}', v ? parseInt( v) : ''); },
+         width : 100,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        }
        ]
-
-      },
-      '|xns' : 'Roo',
-      background : false,
+      }
+     },
+     {
+      background : true,
       fitContainer : true,
       fitToframe : true,
-      region : 'center',
-      tableName : 'item',
-      title : _this._strings['068f80c7519d0528fb08e82137a72131'],
+      region : 'east',
+      tableName : 'itemloc',
+      title : _this._strings['759d259249621c817551c5fe726d5c57'] /* itemloc */,
       xns : Roo,
+      '|xns' : 'Roo',
       xtype : 'GridPanel',
       listeners : {
        activate : function() {
-            _this.panel = this;
-            if (_this.grid) {
-                _this.grid.footer.onClick('first');
-            }
+            _this.locpanel = this;
+         
         }
       },
-      items : [
-
-      ]
-
-     },
-     {
       grid : {
+       autoExpandColumn : 'location_name',
+       loadMask : true,
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       xtype : 'Grid',
+       listeners : {
+        render : function() 
+         {
+             _this.locgrid = this; 
+             //_this.dialog = Pman.Dialog.FILL_IN
+             
+         },
+        rowdblclick : function (_self, rowIndex, e)
+         {
+             if (!_this.dialog) return;
+             _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
+                 _this.grid.footer.onClick('first');
+             }); 
+         }
+       },
+       footer : {
+        displayInfo : true,
+        displayMsg : _this._strings['19029645d5286771ac708d1bcd118bf4'] /* Displaying itemloc{0} - {1} of {2} */,
+        emptyMsg : _this._strings['2cfd827c6e37453fe1ddde82a5bd9474'] /* No itemloc found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo',
+        xtype : 'PagingToolbar'
+       },
        dataSource : {
+        remoteSort : true,
+        sortInfo : { field : 'location_name', direction: 'ASC' },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+              var sel = _this.grid.selModel.getSelectedCell();
+              if (!sel) {
+                  this.removeAll();
+                  return false;
+              }
+              var rec = _this.grid.ds.getAt(sel[0]);
+              o.params._stock_for_item_id = rec.data.item_id;
+              //o.params['!itemloc_qty'] = 0;
+              
+              
+          }
+        },
         proxy : {
-         '|xns' : 'Roo.data',
          method : 'GET',
          url : baseURL + '/Roo/location.php',
          xns : Roo.data,
+         '|xns' : 'Roo.data',
          xtype : 'HttpProxy'
         },
         reader : {
-         '|xns' : 'Roo.data',
          fields : [
              {
                  'name': 'itemloc_id',
@@ -1796,119 +1787,33 @@ Pman.Tab.XtupleItem = new Roo.XComponent({
          root : 'data',
          totalProperty : 'total',
          xns : Roo.data,
+         '|xns' : 'Roo.data',
          xtype : 'JsonReader'
-        },
-        '|xns' : 'Roo.data',
-        remoteSort : true,
-        sortInfo : { field : 'location_name', direction: 'ASC' },
-        xns : Roo.data,
-        xtype : 'Store',
-        listeners : {
-         beforeload : function (_self, o)
-          {
-              var sel = _this.grid.selModel.getSelectedCell();
-              if (!sel) {
-                  this.removeAll();
-                  return false;
-              }
-              var rec = _this.grid.ds.getAt(sel[0]);
-              o.params._stock_for_item_id = rec.data.item_id;
-              //o.params['!itemloc_qty'] = 0;
-              
-              
-          }
-        },
-        items : [
-
-        ]
-
-       },
-       footer : {
-        '|xns' : 'Roo',
-        displayInfo : true,
-        displayMsg : _this._strings['19029645d5286771ac708d1bcd118bf4'],
-        emptyMsg : _this._strings['2cfd827c6e37453fe1ddde82a5bd9474'],
-        pageSize : 25,
-        xns : Roo,
-        xtype : 'PagingToolbar'
+        }
        },
-       '|xns' : 'Roo.grid',
-       autoExpandColumn : 'location_name',
-       loadMask : true,
-       xns : Roo.grid,
-       xtype : 'Grid',
        colModel : [
-         {
-          '|xns' : 'Roo.grid',
-          dataIndex : 'location_name',
-          header : _this._strings['ce5bf551379459c1c61d2a204061c455'],
-          renderer : function(v) { return String.format('{0}', v); },
-          width : 75,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         },
-{
-          '|xns' : 'Roo.grid',
-          dataIndex : 'itemloc_realqty',
-          header : _this._strings['156567f65fc207d39cadbf045687c521'],
-          renderer : function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); },
-          width : 75,
-          xns : Roo.grid,
-          xtype : 'ColumnModel'
-         }
-       ],
-       listeners : {
-        render : function() 
-         {
-             _this.locgrid = this; 
-             //_this.dialog = Pman.Dialog.FILL_IN
-             
-         },
-        rowdblclick : function (_self, rowIndex, e)
-         {
-             if (!_this.dialog) return;
-             _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
-                 _this.grid.footer.onClick('first');
-             }); 
-         }
-       },
-       items : [
-
-       ]
-
-      },
-      '|xns' : 'Roo',
-      background : true,
-      fitContainer : true,
-      fitToframe : true,
-      region : 'east',
-      tableName : 'itemloc',
-      title : _this._strings['759d259249621c817551c5fe726d5c57'],
-      xns : Roo,
-      xtype : 'GridPanel',
-      listeners : {
-       activate : function() {
-            _this.locpanel = this;
-         
+        {
+         dataIndex : 'location_name',
+         header : _this._strings['ce5bf551379459c1c61d2a204061c455'] /* Location */,
+         renderer : function(v) { return String.format('{0}', v); },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'itemloc_realqty',
+         header : _this._strings['156567f65fc207d39cadbf045687c521'] /* Itemloc qty */,
+         renderer : function(v) { return String.format('{0}', v*1 ? (v*1).toFixed(0) : ''); },
+         width : 75,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
         }
-      },
-      items : [
-
-      ]
-
+       ]
+      }
      }
     ]
-
-   },
-   '|xns' : 'Roo',
-   background : false,
-   region : 'center',
-   title : _this._strings['068f80c7519d0528fb08e82137a72131'],
-   xns : Roo,
-   xtype : 'NestedLayoutPanel',
-   items : [
-
-   ]
-
+   }
   };  }
 });