Pman.Dialog.XtupleItem.bjs
authorEdward <edward@roojs.com>
Wed, 3 Jun 2015 10:16:05 +0000 (18:16 +0800)
committerEdward <edward@roojs.com>
Wed, 3 Jun 2015 10:16:05 +0000 (18:16 +0800)
Pman.Dialog.XtupleItem.js

Pman.Dialog.XtupleItem.bjs
Pman.Dialog.XtupleItem.js

index 5d75325..2540d83 100644 (file)
 {
-    "name" : "Pman.Dialog.XtupleItem",
-    "parent" : "",
-    "title" : "",
-    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleItem.bjs",
-    "permname" : "",
-    "modOrder" : "001",
-    "items" : [
+ "name" : "Pman.Dialog.XtupleItem",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleItem.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
+  "346577d22bb510368e3eddab5df2ca13" : "Reference Files",
+  "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
+  "956e816fa19ca04485c7101adbe07762" : "Displaying records {0} - {1} of {2}",
+  "82a43f89af6d331d80d441624c5c71fa" : "Default Location",
+  "538a3c9d82a4ea4250b987a357d41184" : "Item Parts",
+  "69395719de41dd8a31905b1e94c91816" : "Select classcode",
+  "03ab340b3f99e03cff9e84314ead38c0" : "Qty",
+  "5b8c99dad1893a85076709b2d3c2d2d0" : "IP Address",
+  "045a1ac263ac3a9b7420208bdc2df423" : "Select costcat",
+  "0c81971f67c0bd4b33799c5365ec2bf5" : "No Images found",
+  "151ccf95db9b81c11bb20fbc302af4b6" : "Select terms",
+  "786410e93beb0193d89f8608c54feb4b" : "Select item",
+  "0ac9012a8c03a76ee76f04321b3b7fda" : "Lead time",
+  "675c9bd3bbae30af03fe74346dcae9a7" : "Edit / Create item",
+  "dd24f967299e81b9603cb071693d5c32" : "Select vendinfo",
+  "023a5dfa857c4aa0156e6685231a1dbd" : "Select Type",
+  "e8586011952b0d098b0e568f20ca2b1f" : "Select Currency",
+  "8413c683b4b27cc3f4dbd4c90329d8ba" : "Comments",
+  "820dbd2b8f606aff866c0bbfb6b737c1" : "Changed",
+  "0eceeb45861f9585dd7a97a3e36f85c6" : "Created",
+  "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
+  "9076cbba1d9ef79280b4f39e2aa0d115" : "Nothing found",
+  "386c339d37e737a436499d423a77df0c" : "Currency",
+  "1243daf593fa297e07ab03bf06d925af" : "Searching...",
+  "7be1fa478799242847d4ef861ff6f8e1" : "Min Qty",
+  "76729937a5eb6b0fd88c42581161facd" : "Select Category",
+  "19df363d15888baa395364fbcd230c05" : "No itemsrc found",
+  "49ee3087348e8d44e1feda1917443987" : "Name",
+  "0d122b17933ab4173e9d75d55fc5e764" : "Standard Cost",
+  "df2ad52a14d681b1cd8495f8650fdb56" : "Select prodcat",
+  "e5353fc67b122d1b42181073b46cd060" : "Vendor Ref#",
+  "c19ea8f7a11074ac743c58d34830b233" : "Select plancode",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "20f39d1311ccbd3b7e61cdd4978719f9" : "Itemsite Settings",
+  "1656a671ba692e15836cd85df374556c" : "Price List",
+  "bb8913cd17d59f182acc7be1020007b7" : "UOM",
+  "76d5bf9597c882d6513f71759df298d5" : "Displaying parts {0} - {1} of {2}",
+  "3601146c4e948c32b6424d2c0a7f0118" : "Price",
+  "1814d65a76028fdfbadab64a5a8076df" : "Suppliers",
+  "90e4ac2e5a22e53df63b6b186d8727ba" : "No Events found",
+  "4ee972120bcda675f75222c87cb9d356" : "Who",
+  "16d2b386b2034b9488996466aaae0b57" : "History",
+  "089ba2b5edc96565fc22c584ecfbb1a6" : "Displaying events{0} - {1} of {2}",
+  "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
+  "7f841b4d2f7280eb82318988c6d649d1" : "Displaying itemsrc{0} - {1} of {2}",
+  "c0ed345ec857c06b31f7e88745c9bc40" : "Displaying Images  {0} - {1} of {2}",
+  "a254c25adc7d10d7e9c4889484f875a5" : "Detail",
+  "c9cc8cce247e49bae79f15173ce97354" : "Save",
+  "ec9ceefe0c19f4c029008c23e3c947b7" : "Vendor",
+  "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
+  "004bf6c9a40003140292e97330236c53" : "Action",
+  "f4c6f851b00d5518bf888815de279aba" : "Notes",
+  "f9838de820f2a2e16241033270c68e29" : "Select uom",
+  "1063e38cb53d94d386f21227fcd84717" : "Remove",
+  "7996af9149ed376ce252e35c4da7146b" : "Select Vendor"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "show" : "function (_self)\n{\n     _this.dialog.layout.getRegion('center').showPanel(0);\n}"
+   },
+   "modal" : true,
+   "collapsible" : false,
+   "title" : "Edit / Create item",
+   "xtype" : "LayoutDialog",
+   "width" : 800,
+   "$ xns" : "Roo",
+   "closable" : false,
+   "resizable" : false,
+   "height" : 550,
+   "items" : [
+    {
+     "alwaysShowTabs" : true,
+     "xtype" : "LayoutRegion",
+     "tabPosition" : "top",
+     "$ xns" : "Roo",
+     "* prop" : "center"
+    },
+    {
+     "region" : "center",
+     "title" : "Detail",
+     "xtype" : "ContentPanel",
+     "$ xns" : "Roo",
+     "items" : [
+      {
+       "listeners" : {
+        "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       _this.form.findField('item_number').el.dom.readOnly = true;\n       _this.form.findField('item_type').disabled = true; \n       \n       if(_this.data.item_id * 1 > 0){\n            \n            this.load({ \n                method: 'GET', \n                params: {\n                     '_id' : _this.data.item_id,\n                     '_with_itemsite' : 1,\n                     '_with_itemcost' : 1,\n                     '_with_prodcat' : 1 ,\n                     '_with_salesaccnt' : 1 \n                }\n            });\n            return;\n       }\n       // if it's new..\n       _this.form.findField('item_number').el.dom.readOnly = false;\n       _this.form.findField('item_type').disabled = false; \n       _this.form.findField('item_salesaccnt').setValue('');\n       \n       _this.form.findField('item_type').showHide();\n       \n       return;\n    }\n    if (action.type == 'load') {\n       _this.form.findField('item_type').showHide();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        var id = _this.form.findField('item_id').getValue() * 1;\n        if (id < 1) {\n        \n            this.load({ \n                method: 'GET', \n                params: {\n                     '_id' : action.result.data.item_id,\n                     '_with_itemsite' : 1,\n                     '_with_itemcost' : 1,\n                     '_with_prodcat' : 1 ,\n                     '_with_salesaccnt' : 1 \n                }\n            });\n            return;\n        }\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
+        "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
+       },
+       "$ url" : "baseURL + '/Roo/item.php'",
+       "method" : "POST",
+       "style" : "margin:10px;",
+       "xtype" : "Form",
+       "labelWidth" : 120,
+       "$ xns" : "Roo.form",
+       "items" : [
         {
-            "listeners" : {
-                "show" : "function (_self)\n{\n     _this.dialog.layout.getRegion('center').showPanel(0);\n}"
-            },
-            "modal" : true,
-            "collapsible" : false,
-            "title" : "Edit / Create item",
-            "xtype" : "LayoutDialog",
-            "width" : 800,
-            "$ xns" : "Roo",
-            "closable" : false,
-            "resizable" : false,
-            "height" : 550,
-            "items" : [
+         "fieldLabel" : "SKU",
+         "xtype" : "TextField",
+         "allowBlank" : false,
+         "width" : 200,
+         "$ xns" : "Roo.form",
+         "name" : "item_number"
+        },
+        {
+         "fieldLabel" : "Description",
+         "xtype" : "TextField",
+         "width" : 400,
+         "$ xns" : "Roo.form",
+         "name" : "item_descrip1"
+        },
+        {
+         "fieldLabel" : "Description (2)",
+         "xtype" : "TextField",
+         "width" : 400,
+         "$ xns" : "Roo.form",
+         "name" : "item_descrip2"
+        },
+        {
+         "xtype" : "Column",
+         "labelWidth" : 120,
+         "$ xns" : "Roo.form",
+         "items" : [
+          {
+           "listeners" : {
+            "beforeselect" : "function (combo, record, index)\n{\n    (function() { combo.showHide(); }).defer(100);\n}"
+           },
+           "listWidth" : 200,
+           "triggerAction" : "all",
+           "fieldLabel" : "Type",
+           "displayField" : "fname",
+           "emptyText" : "Select Type",
+           "hiddenName" : "item_type",
+           "valueField" : "ftype",
+           "xtype" : "ComboBox",
+           "allowBlank" : false,
+           "$ showHide" : "function() {\n\n    var it = this.getValue();\n    \n    var options = [ \n        'item_itemcost_id_itemcost_curr_id',\n        'item_itemcost_id_itemcost_actcost',\n        'item_itemsite_id_itemsite_reorderlevel',\n        'item_itemsite_id_itemsite_leadtime',\n        'item_itemsite_id_itemsite_location_id',\n        'item_itemsite_id_itemsite_loccntrl',\n        'item_itemsite_id_itemsite_stocked',\n        'item_itemsite_id_itemsite_perishable',\n        \n        'item_itemsite_id_itemsite_safetystock',\n        'item_itemsite_id_itemsite_controlmethod',\n        'item_itemsite_id_itemsite_plancode_id',\n        'item_itemsite_id_itemsite_costcat_id',\n        'item_itemsite_id_itemsite_active',\n        'item_itemsite_id_itemsite_sold'\n        \n    ];\n    \n    var r_req = [ \n        'item_listprice'\n    ];\n    \n    var state = true;\n    \n    _this.standardCostFieldSet.show();\n    _this.itemsiteFieldSet.show();\n\n    \n    switch(it) {\n        case 'K':\n            state = false;\n\n            _this.form.findField('item_listprice').allowBlank = false;\n            _this.form.findField('item_listprice').actionMode = 'fieldEl';\n            _this.form.findField('item_listprice').hideMode = 'display';\n            _this.form.findField('item_listprice').show();\n                        \n            break;\n            \n        case 'R': // refrence\n            options = options.concat(r_req);\n            state = false;\n            _this.standardCostFieldSet.hide();\n            break;\n            \n        case 'P': // purchased..\n            options = options.concat(r_req);\n            // must have\n            break;\n    }\n    \n    Roo.each(options, function(n) {\n        var ff = _this.form.findField(n);\n        ff.allowBlank = !state;\n        ff.actionMode = 'fieldEl';\n        ff.hideMode = 'display';\n        state ? ff.show() : ff.hide(); \n        \n    });\n    \n    \n    if(!state){\n        _this.standardCostFieldSet.hide();\n        _this.itemsiteFieldSet.hide();\n\n    }\n    \n  \n           \n}\n",
+           "editable" : false,
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "mode" : "local",
+           "name" : "item_type_name",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
+           "items" : [
+            {
+             "xtype" : "SimpleStore",
+             "$ data" : "[ \n    [ 'P', \"Purchased (eg. a standard product)\"],\n    [ 'R' , \"Reference (Non-Product)\"],\n    [ 'K', \"Kit (made up of products)\"]  \n]\n",
+             "$ fields" : "[  'ftype', 'fname']",
+             "$ xns" : "Roo.data",
+             "* prop" : "store"
+            }
+           ]
+          },
+          {
+           "listWidth" : 400,
+           "triggerAction" : "all",
+           "fieldLabel" : "Class",
+           "forceSelection" : true,
+           "selectOnFocus" : true,
+           "pageSize" : 20,
+           "displayField" : "classcode_code",
+           "emptyText" : "Select classcode",
+           "hiddenName" : "item_classcode_id",
+           "minChars" : 2,
+           "valueField" : "classcode_id",
+           "xtype" : "ComboBox",
+           "allowBlank" : false,
+           "typeAhead" : true,
+           "editable" : false,
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_classcode_id_classcode_code",
+           "qtip" : "Select classcode",
+           "queryParam" : "",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>",
+           "loadingText" : "Searching...",
+           "items" : [
+            {
+             "listeners" : {
+              "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+             },
+             "xtype" : "Store",
+             "remoteSort" : true,
+             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Roo/classcode.php'",
+               "method" : "GET",
+               "xtype" : "HttpProxy",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              },
+              {
+               "id" : "id",
+               "root" : "data",
+               "xtype" : "JsonReader",
+               "$ xns" : "Roo.data",
+               "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"classcode_code\",\"type\":\"string\"}]",
+               "* prop" : "reader",
+               "totalProperty" : "total"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "listWidth" : 400,
+           "triggerAction" : "all",
+           "fieldLabel" : "Invoice UOM",
+           "forceSelection" : true,
+           "selectOnFocus" : true,
+           "pageSize" : 20,
+           "displayField" : "uom_descrip",
+           "emptyText" : "Select uom",
+           "hiddenName" : "item_inv_uom_id",
+           "minChars" : 2,
+           "valueField" : "uom_id",
+           "xtype" : "ComboBox",
+           "allowBlank" : false,
+           "typeAhead" : true,
+           "editable" : false,
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_inv_uom_id_uom_descrip",
+           "qtip" : "Select classcode",
+           "queryParam" : "",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>",
+           "loadingText" : "Searching...",
+           "items" : [
+            {
+             "listeners" : {
+              "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+             },
+             "xtype" : "Store",
+             "remoteSort" : true,
+             "$ sortInfo" : "{ direction : 'ASC', field: 'uom_name' }",
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Roo/uom.php'",
+               "method" : "GET",
+               "xtype" : "HttpProxy",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              },
+              {
+               "id" : "id",
+               "root" : "data",
+               "xtype" : "JsonReader",
+               "$ xns" : "Roo.data",
+               "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"uom_name\",\"type\":\"string\"},\n    {\"name\":\"uom_descrip\",\"type\":\"string\"},\n]",
+               "* prop" : "reader",
+               "totalProperty" : "total"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "listWidth" : 400,
+           "triggerAction" : "all",
+           "fieldLabel" : "Price UOM",
+           "forceSelection" : true,
+           "selectOnFocus" : true,
+           "pageSize" : 20,
+           "displayField" : "uom_descrip",
+           "emptyText" : "Select uom",
+           "hiddenName" : "item_price_uom_id",
+           "minChars" : 2,
+           "valueField" : "uom_id",
+           "xtype" : "ComboBox",
+           "allowBlank" : false,
+           "typeAhead" : true,
+           "editable" : false,
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_price_uom_id_uom_descrip",
+           "qtip" : "Select classcode",
+           "queryParam" : "",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>",
+           "loadingText" : "Searching...",
+           "items" : [
+            {
+             "listeners" : {
+              "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+             },
+             "xtype" : "Store",
+             "remoteSort" : true,
+             "$ sortInfo" : "{ direction : 'ASC', field: 'uom_name' }",
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Roo/uom.php'",
+               "xtype" : "HttpProxy",
+               "method" : "GET",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              },
+              {
+               "id" : "id",
+               "root" : "data",
+               "xtype" : "JsonReader",
+               "$ xns" : "Roo.data",
+               "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"uom_name\",\"type\":\"string\"},\n    {\"name\":\"uom_descrip\",\"type\":\"string\"},\n]",
+               "* prop" : "reader",
+               "totalProperty" : "total"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "fieldLabel" : "Weight",
+           "xtype" : "NumberField",
+           "allowBlank" : false,
+           "allowDecimals" : true,
+           "decimalPrecision" : 2,
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_prodweight"
+          },
+          {
+           "fieldLabel" : "Item comments",
+           "xtype" : "TextArea",
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_comments",
+           "height" : 100
+          },
+          {
+           "fieldLabel" : "Item sold",
+           "inputValue" : true,
+           "xtype" : "Checkbox",
+           "valueOff" : 0,
+           "width" : 75,
+           "$ xns" : "Roo.form",
+           "name" : "item_sold"
+          },
+          {
+           "fieldLabel" : "Item active",
+           "inputValue" : true,
+           "xtype" : "Checkbox",
+           "valueOff" : 0,
+           "width" : 75,
+           "$ xns" : "Roo.form",
+           "name" : "item_active"
+          },
+          {
+           "listeners" : {
+            "add" : "function (combo)\n{\n    Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});\n}",
+            "edit" : "function (combo, record)\n{\n    var s = _this.form.findField('item_prodcat_id').getValue() * 1;\n    if(s < 1){\n        Roo.MessageBox.alert('Error','Please select a account assignment');\n        return;\n    }\n    Pman.Dialog.XtupleProdcat.show({prodcat_id : s});\n}"
+           },
+           "alwaysQuery" : true,
+           "listWidth" : 400,
+           "triggerAction" : "all",
+           "fieldLabel" : "Product Category",
+           "forceSelection" : true,
+           "selectOnFocus" : true,
+           "pageSize" : 20,
+           "displayField" : "prodcat_code",
+           "emptyText" : "Select Category",
+           "hiddenName" : "item_prodcat_id",
+           "minChars" : 2,
+           "valueField" : "prodcat_id",
+           "xtype" : "ComboBox",
+           "allowBlank" : false,
+           "typeAhead" : true,
+           "editable" : false,
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_prodcat_id_prodcat_code",
+           "qtip" : "Select prodcat",
+           "queryParam" : "",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>",
+           "loadingText" : "Searching...",
+           "items" : [
+            {
+             "listeners" : {
+              "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+             },
+             "xtype" : "Store",
+             "remoteSort" : true,
+             "$ xns" : "Roo.data",
+             "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Roo/prodcat.php'",
+               "xtype" : "HttpProxy",
+               "method" : "GET",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              },
+              {
+               "id" : "id",
+               "root" : "data",
+               "xtype" : "JsonReader",
+               "$ xns" : "Roo.data",
+               "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"prodcat_code\",\"type\":\"string\"}]",
+               "* prop" : "reader",
+               "totalProperty" : "total"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "fieldLabel" : "Sales Account",
+           "xtype" : "DisplayField",
+           "$ xns" : "Roo.form",
+           "name" : "item_salesaccnt"
+          },
+          {
+           "fieldLabel" : "Item listprice",
+           "xtype" : "NumberField",
+           "width" : 200,
+           "$ xns" : "Roo.form",
+           "name" : "item_listprice"
+          },
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.standardCostFieldSet = _self;\n}"
+           },
+           "style" : "width:320px",
+           "xtype" : "FieldSet",
+           "legend" : "Standard Cost",
+           "$ xns" : "Roo.form",
+           "items" : [
+            {
+             "listWidth" : 400,
+             "triggerAction" : "all",
+             "fieldLabel" : "Currency",
+             "forceSelection" : true,
+             "selectOnFocus" : true,
+             "pageSize" : 20,
+             "displayField" : "curr_name",
+             "emptyText" : "Select Currency",
+             "hiddenName" : "item_itemcost_id_itemcost_curr_id",
+             "minChars" : 2,
+             "valueField" : "curr_id",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "typeAhead" : true,
+             "editable" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "curr_name",
+             "qtip" : "Select Currency",
+             "queryParam" : "query[curr_name]",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
+             "loadingText" : "Searching...",
+             "items" : [
+              {
+               "listeners" : {
+                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n   \n}\n"
+               },
+               "xtype" : "Store",
+               "remoteSort" : true,
+               "$ sortInfo" : "{ direction : 'ASC', field: 'curr_symbol' }",
+               "$ xns" : "Roo.data",
+               "* prop" : "store",
+               "items" : [
                 {
-                    "alwaysShowTabs" : true,
-                    "xtype" : "LayoutRegion",
-                    "tabPosition" : "top",
-                    "$ xns" : "Roo",
-                    "* prop" : "center"
+                 "$ url" : "baseURL + '/Roo/curr_symbol.php'",
+                 "xtype" : "HttpProxy",
+                 "method" : "GET",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
                 },
                 {
-                    "region" : "center",
-                    "xtype" : "ContentPanel",
-                    "title" : "Detail",
-                    "$ xns" : "Roo",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "|actioncomplete" : "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       _this.form.findField('item_number').el.dom.readOnly = true;\n       _this.form.findField('item_type').disabled = true; \n       \n       if(_this.data.item_id * 1 > 0){\n            \n            this.load({ \n                method: 'GET', \n                params: {\n                     '_id' : _this.data.item_id,\n                     '_with_itemsite' : 1,\n                     '_with_itemcost' : 1,\n                     '_with_prodcat' : 1 ,\n                     '_with_salesaccnt' : 1 \n                }\n            });\n            return;\n       }\n       // if it's new..\n       _this.form.findField('item_number').el.dom.readOnly = false;\n       _this.form.findField('item_type').disabled = false; \n       _this.form.findField('item_salesaccnt').setValue('');\n       \n       _this.form.findField('item_type').showHide();\n       \n       return;\n    }\n    if (action.type == 'load') {\n       _this.form.findField('item_type').showHide();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        var id = _this.form.findField('item_id').getValue() * 1;\n        if (id < 1) {\n        \n            this.load({ \n                method: 'GET', \n                params: {\n                     '_id' : action.result.data.item_id,\n                     '_with_itemsite' : 1,\n                     '_with_itemcost' : 1,\n                     '_with_prodcat' : 1 ,\n                     '_with_salesaccnt' : 1 \n                }\n            });\n            return;\n        }\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
-                                "|rendered" : "function (form)\n{\n    _this.form= form;\n}\n"
-                            },
-                            "$ url" : "baseURL + '/Roo/item.php'",
-                            "style" : "margin:10px;",
-                            "method" : "POST",
-                            "xtype" : "Form",
-                            "labelWidth" : 120,
-                            "$ xns" : "Roo.form",
-                            "items" : [
-                                {
-                                    "fieldLabel" : "SKU",
-                                    "xtype" : "TextField",
-                                    "allowBlank" : false,
-                                    "width" : 200,
-                                    "$ xns" : "Roo.form",
-                                    "name" : "item_number"
-                                },
-                                {
-                                    "fieldLabel" : "Description",
-                                    "xtype" : "TextField",
-                                    "width" : 400,
-                                    "$ xns" : "Roo.form",
-                                    "name" : "item_descrip1"
-                                },
-                                {
-                                    "fieldLabel" : "Description (2)",
-                                    "xtype" : "TextField",
-                                    "width" : 400,
-                                    "$ xns" : "Roo.form",
-                                    "name" : "item_descrip2"
-                                },
-                                {
-                                    "xtype" : "Column",
-                                    "labelWidth" : 120,
-                                    "$ xns" : "Roo.form",
-                                    "items" : [
-                                        {
-                                            "listeners" : {
-                                                "beforeselect" : "function (combo, record, index)\n{\n    (function() { combo.showHide(); }).defer(100);\n}"
-                                            },
-                                            "listWidth" : 200,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "Type",
-                                            "displayField" : "fname",
-                                            "emptyText" : "Select Type",
-                                            "hiddenName" : "item_type",
-                                            "valueField" : "ftype",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : false,
-                                            "$ showHide" : "function() {\n\n    var it = this.getValue();\n    \n    var options = [ \n        'item_itemcost_id_itemcost_curr_id',\n        'item_itemcost_id_itemcost_actcost',\n        'item_itemsite_id_itemsite_reorderlevel',\n        'item_itemsite_id_itemsite_leadtime',\n        'item_itemsite_id_itemsite_location_id',\n        'item_itemsite_id_itemsite_loccntrl',\n        'item_itemsite_id_itemsite_stocked',\n        'item_itemsite_id_itemsite_perishable',\n        \n        'item_itemsite_id_itemsite_safetystock',\n        'item_itemsite_id_itemsite_controlmethod',\n        'item_itemsite_id_itemsite_plancode_id',\n        'item_itemsite_id_itemsite_costcat_id',\n        'item_itemsite_id_itemsite_active',\n        'item_itemsite_id_itemsite_sold'\n        \n    ];\n    \n    var r_req = [ \n        'item_listprice'\n    ];\n    \n    var state = true;\n    \n    _this.standardCostFieldSet.show();\n    _this.itemsiteFieldSet.show();\n\n    \n    switch(it) {\n        case 'K':\n            state = false;\n\n            _this.form.findField('item_listprice').allowBlank = false;\n            _this.form.findField('item_listprice').actionMode = 'fieldEl';\n            _this.form.findField('item_listprice').hideMode = 'display';\n            _this.form.findField('item_listprice').show();\n                        \n            break;\n            \n        case 'R': // refrence\n            options = options.concat(r_req);\n            state = false;\n            _this.standardCostFieldSet.hide();\n            break;\n            \n        case 'P': // purchased..\n            options = options.concat(r_req);\n            // must have\n            break;\n    }\n    \n    Roo.each(options, function(n) {\n        var ff = _this.form.findField(n);\n        ff.allowBlank = !state;\n        ff.actionMode = 'fieldEl';\n        ff.hideMode = 'display';\n        state ? ff.show() : ff.hide(); \n        \n    });\n    \n    \n    if(!state){\n        _this.standardCostFieldSet.hide();\n        _this.itemsiteFieldSet.hide();\n\n    }\n    \n  \n           \n}\n",
-                                            "editable" : false,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "mode" : "local",
-                                            "name" : "item_type_name",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
-                                            "items" : [
-                                                {
-                                                    "xtype" : "SimpleStore",
-                                                    "$ data" : "[ \n    [ 'P', \"Purchased (eg. a standard product)\"],\n    [ 'R' , \"Reference (Non-Product)\"],\n    [ 'K', \"Kit (made up of products)\"]  \n]\n",
-                                                    "$ fields" : "[  'ftype', 'fname']",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "listWidth" : 400,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "Class",
-                                            "forceSelection" : true,
-                                            "selectOnFocus" : true,
-                                            "pageSize" : 20,
-                                            "displayField" : "classcode_code",
-                                            "emptyText" : "Select classcode",
-                                            "hiddenName" : "item_classcode_id",
-                                            "minChars" : 2,
-                                            "valueField" : "classcode_id",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : false,
-                                            "typeAhead" : true,
-                                            "editable" : false,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_classcode_id_classcode_code",
-                                            "qtip" : "Select classcode",
-                                            "queryParam" : "",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>",
-                                            "loadingText" : "Searching...",
-                                            "items" : [
-                                                {
-                                                    "listeners" : {
-                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                    },
-                                                    "xtype" : "Store",
-                                                    "remoteSort" : true,
-                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store",
-                                                    "items" : [
-                                                        {
-                                                            "$ url" : "baseURL + '/Roo/classcode.php'",
-                                                            "xtype" : "HttpProxy",
-                                                            "method" : "GET",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "proxy"
-                                                        },
-                                                        {
-                                                            "id" : "id",
-                                                            "root" : "data",
-                                                            "xtype" : "JsonReader",
-                                                            "$ xns" : "Roo.data",
-                                                            "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"classcode_code\",\"type\":\"string\"}]",
-                                                            "* prop" : "reader",
-                                                            "totalProperty" : "total"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "listWidth" : 400,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "Invoice UOM",
-                                            "forceSelection" : true,
-                                            "selectOnFocus" : true,
-                                            "pageSize" : 20,
-                                            "displayField" : "uom_descrip",
-                                            "emptyText" : "Select uom",
-                                            "hiddenName" : "item_inv_uom_id",
-                                            "minChars" : 2,
-                                            "valueField" : "uom_id",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : false,
-                                            "typeAhead" : true,
-                                            "editable" : false,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_inv_uom_id_uom_descrip",
-                                            "qtip" : "Select classcode",
-                                            "queryParam" : "",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>",
-                                            "loadingText" : "Searching...",
-                                            "items" : [
-                                                {
-                                                    "listeners" : {
-                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                    },
-                                                    "xtype" : "Store",
-                                                    "remoteSort" : true,
-                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'uom_name' }",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store",
-                                                    "items" : [
-                                                        {
-                                                            "$ url" : "baseURL + '/Roo/uom.php'",
-                                                            "xtype" : "HttpProxy",
-                                                            "method" : "GET",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "proxy"
-                                                        },
-                                                        {
-                                                            "id" : "id",
-                                                            "root" : "data",
-                                                            "xtype" : "JsonReader",
-                                                            "$ xns" : "Roo.data",
-                                                            "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"uom_name\",\"type\":\"string\"},\n    {\"name\":\"uom_descrip\",\"type\":\"string\"},\n]",
-                                                            "* prop" : "reader",
-                                                            "totalProperty" : "total"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "listWidth" : 400,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "Price UOM",
-                                            "forceSelection" : true,
-                                            "selectOnFocus" : true,
-                                            "pageSize" : 20,
-                                            "displayField" : "uom_descrip",
-                                            "emptyText" : "Select uom",
-                                            "hiddenName" : "item_price_uom_id",
-                                            "minChars" : 2,
-                                            "valueField" : "uom_id",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : false,
-                                            "typeAhead" : true,
-                                            "editable" : false,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_price_uom_id_uom_descrip",
-                                            "qtip" : "Select classcode",
-                                            "queryParam" : "",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>",
-                                            "loadingText" : "Searching...",
-                                            "items" : [
-                                                {
-                                                    "listeners" : {
-                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                    },
-                                                    "xtype" : "Store",
-                                                    "remoteSort" : true,
-                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'uom_name' }",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store",
-                                                    "items" : [
-                                                        {
-                                                            "$ url" : "baseURL + '/Roo/uom.php'",
-                                                            "method" : "GET",
-                                                            "xtype" : "HttpProxy",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "proxy"
-                                                        },
-                                                        {
-                                                            "id" : "id",
-                                                            "root" : "data",
-                                                            "xtype" : "JsonReader",
-                                                            "$ xns" : "Roo.data",
-                                                            "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"uom_name\",\"type\":\"string\"},\n    {\"name\":\"uom_descrip\",\"type\":\"string\"},\n]",
-                                                            "* prop" : "reader",
-                                                            "totalProperty" : "total"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "fieldLabel" : "Weight",
-                                            "xtype" : "NumberField",
-                                            "allowBlank" : false,
-                                            "allowDecimals" : true,
-                                            "decimalPrecision" : 2,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_prodweight"
-                                        },
-                                        {
-                                            "fieldLabel" : "Item comments",
-                                            "xtype" : "TextArea",
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_comments",
-                                            "height" : 100
-                                        },
-                                        {
-                                            "fieldLabel" : "Item sold",
-                                            "inputValue" : true,
-                                            "xtype" : "Checkbox",
-                                            "valueOff" : 0,
-                                            "width" : 75,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_sold"
-                                        },
-                                        {
-                                            "fieldLabel" : "Item active",
-                                            "inputValue" : true,
-                                            "xtype" : "Checkbox",
-                                            "valueOff" : 0,
-                                            "width" : 75,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_active"
-                                        },
-                                        {
-                                            "listeners" : {
-                                                "add" : "function (combo)\n{\n    Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});\n}",
-                                                "edit" : "function (combo, record)\n{\n    var s = _this.form.findField('item_prodcat_id').getValue() * 1;\n    if(s < 1){\n        Roo.MessageBox.alert('Error','Please select a account assignment');\n        return;\n    }\n    Pman.Dialog.XtupleProdcat.show({prodcat_id : s});\n}"
-                                            },
-                                            "alwaysQuery" : true,
-                                            "listWidth" : 400,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "Product Category",
-                                            "forceSelection" : true,
-                                            "selectOnFocus" : true,
-                                            "pageSize" : 20,
-                                            "displayField" : "prodcat_code",
-                                            "emptyText" : "Select Category",
-                                            "hiddenName" : "item_prodcat_id",
-                                            "minChars" : 2,
-                                            "valueField" : "prodcat_id",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : false,
-                                            "typeAhead" : true,
-                                            "editable" : false,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_prodcat_id_prodcat_code",
-                                            "qtip" : "Select prodcat",
-                                            "queryParam" : "",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>",
-                                            "loadingText" : "Searching...",
-                                            "items" : [
-                                                {
-                                                    "listeners" : {
-                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                    },
-                                                    "xtype" : "Store",
-                                                    "remoteSort" : true,
-                                                    "$ xns" : "Roo.data",
-                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
-                                                    "* prop" : "store",
-                                                    "items" : [
-                                                        {
-                                                            "$ url" : "baseURL + '/Roo/prodcat.php'",
-                                                            "method" : "GET",
-                                                            "xtype" : "HttpProxy",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "proxy"
-                                                        },
-                                                        {
-                                                            "id" : "id",
-                                                            "root" : "data",
-                                                            "xtype" : "JsonReader",
-                                                            "$ xns" : "Roo.data",
-                                                            "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"prodcat_code\",\"type\":\"string\"}]",
-                                                            "* prop" : "reader",
-                                                            "totalProperty" : "total"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "fieldLabel" : "Sales Account",
-                                            "xtype" : "DisplayField",
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_salesaccnt"
-                                        },
-                                        {
-                                            "fieldLabel" : "Item listprice",
-                                            "xtype" : "NumberField",
-                                            "width" : 200,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "item_listprice"
-                                        },
-                                        {
-                                            "listeners" : {
-                                                "render" : "function (_self)\n{\n    _this.standardCostFieldSet = _self;\n}"
-                                            },
-                                            "xtype" : "FieldSet",
-                                            "legend" : "Standard Cost",
-                                            "style" : "width:320px",
-                                            "$ xns" : "Roo.form",
-                                            "items" : [
-                                                {
-                                                    "listWidth" : 400,
-                                                    "triggerAction" : "all",
-                                                    "fieldLabel" : "Currency",
-                                                    "forceSelection" : true,
-                                                    "selectOnFocus" : true,
-                                                    "pageSize" : 20,
-                                                    "displayField" : "curr_name",
-                                                    "emptyText" : "Select Currency",
-                                                    "hiddenName" : "item_itemcost_id_itemcost_curr_id",
-                                                    "minChars" : 2,
-                                                    "valueField" : "curr_id",
-                                                    "xtype" : "ComboBox",
-                                                    "allowBlank" : false,
-                                                    "typeAhead" : true,
-                                                    "editable" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "curr_name",
-                                                    "qtip" : "Select Currency",
-                                                    "queryParam" : "query[curr_name]",
-                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>",
-                                                    "loadingText" : "Searching...",
-                                                    "items" : [
-                                                        {
-                                                            "listeners" : {
-                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n   \n}\n"
-                                                            },
-                                                            "xtype" : "Store",
-                                                            "remoteSort" : true,
-                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'curr_symbol' }",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "store",
-                                                            "items" : [
-                                                                {
-                                                                    "$ url" : "baseURL + '/Roo/curr_symbol.php'",
-                                                                    "method" : "GET",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "* prop" : "proxy"
-                                                                },
-                                                                {
-                                                                    "id" : "curr_id",
-                                                                    "root" : "data",
-                                                                    "xtype" : "JsonReader",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "$ fields" : "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]",
-                                                                    "* prop" : "reader",
-                                                                    "totalProperty" : "total"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "fieldLabel" : "Value",
-                                                    "xtype" : "NumberField",
-                                                    "allowBlank" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemcost_id_itemcost_actcost"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "Column",
-                                    "$ xns" : "Roo.form",
-                                    "items" : [
-                                        {
-                                            "listeners" : {
-                                                "render" : "function (_self)\n{\n    _this.itemsiteFieldSet = _self;\n}"
-                                            },
-                                            "xtype" : "FieldSet",
-                                            "legend" : "Itemsite Settings",
-                                            "$ xns" : "Roo.form",
-                                            "String/Object/Function style" : "width:335px;",
-                                            "Number labelWidth" : 120,
-                                            "items" : [
-                                                {
-                                                    "fieldLabel" : "Reorder Level",
-                                                    "xtype" : "NumberField",
-                                                    "allowBlank" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_reorderlevel"
-                                                },
-                                                {
-                                                    "fieldLabel" : "Stock Safety Level",
-                                                    "xtype" : "NumberField",
-                                                    "allowBlank" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_safetystock"
-                                                },
-                                                {
-                                                    "fieldLabel" : "Lead time (Days)",
-                                                    "xtype" : "NumberField",
-                                                    "allowBlank" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_leadtime"
-                                                },
-                                                {
-                                                    "listWidth" : 200,
-                                                    "triggerAction" : "all",
-                                                    "fieldLabel" : "Control Method",
-                                                    "displayField" : "fname",
-                                                    "hiddenName" : "item_itemsite_id_itemsite_controlmethod",
-                                                    "valueField" : "ftype",
-                                                    "xtype" : "ComboBox",
-                                                    "allowBlank" : false,
-                                                    "editable" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "mode" : "local",
-                                                    "name" : "item_itemsite_id_itemsite_controlmethod_name",
-                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
-                                                    "items" : [
-                                                        {
-                                                            "xtype" : "SimpleStore",
-                                                            "$ data" : "[ \n    [ 'N', \"None\"],\n    [ 'R' , \"Regular\"]\n]\n",
-                                                            "$ fields" : "[  'ftype', 'fname']",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "store"
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "listWidth" : 400,
-                                                    "triggerAction" : "all",
-                                                    "fieldLabel" : "Planner Code",
-                                                    "forceSelection" : true,
-                                                    "selectOnFocus" : true,
-                                                    "pageSize" : 20,
-                                                    "displayField" : "plancode_name",
-                                                    "emptyText" : "Select plancode",
-                                                    "hiddenName" : "item_itemsite_id_itemsite_plancode_id",
-                                                    "minChars" : 2,
-                                                    "valueField" : "plancode_id",
-                                                    "xtype" : "ComboBox",
-                                                    "allowBlank" : false,
-                                                    "typeAhead" : true,
-                                                    "editable" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "plancode_name",
-                                                    "qtip" : "Select plancode",
-                                                    "queryParam" : "",
-                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>",
-                                                    "loadingText" : "Searching...",
-                                                    "items" : [
-                                                        {
-                                                            "listeners" : {
-                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                            },
-                                                            "xtype" : "Store",
-                                                            "remoteSort" : true,
-                                                            "$ xns" : "Roo.data",
-                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
-                                                            "* prop" : "store",
-                                                            "items" : [
-                                                                {
-                                                                    "$ url" : "baseURL + '/Roo/plancode.php'",
-                                                                    "method" : "GET",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "* prop" : "proxy"
-                                                                },
-                                                                {
-                                                                    "id" : "id",
-                                                                    "root" : "data",
-                                                                    "xtype" : "JsonReader",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"plancode_code\",\"type\":\"string\"}]",
-                                                                    "* prop" : "reader",
-                                                                    "totalProperty" : "total"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "listWidth" : 400,
-                                                    "triggerAction" : "all",
-                                                    "fieldLabel" : "Costcat",
-                                                    "forceSelection" : true,
-                                                    "selectOnFocus" : true,
-                                                    "pageSize" : 20,
-                                                    "displayField" : "costcat_code",
-                                                    "emptyText" : "Select costcat",
-                                                    "hiddenName" : "item_itemsite_id_itemsite_costcat_id",
-                                                    "minChars" : 2,
-                                                    "valueField" : "costcat_id",
-                                                    "xtype" : "ComboBox",
-                                                    "allowBlank" : false,
-                                                    "typeAhead" : true,
-                                                    "editable" : false,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "costcat_code",
-                                                    "qtip" : "Select costcat",
-                                                    "queryParam" : "",
-                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>",
-                                                    "loadingText" : "Searching...",
-                                                    "items" : [
-                                                        {
-                                                            "listeners" : {
-                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                            },
-                                                            "xtype" : "Store",
-                                                            "remoteSort" : true,
-                                                            "$ xns" : "Roo.data",
-                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
-                                                            "* prop" : "store",
-                                                            "items" : [
-                                                                {
-                                                                    "$ url" : "baseURL + '/Roo/costcat.php'",
-                                                                    "method" : "GET",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "* prop" : "proxy"
-                                                                },
-                                                                {
-                                                                    "id" : "id",
-                                                                    "root" : "data",
-                                                                    "xtype" : "JsonReader",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"costcat_code\",\"type\":\"string\"}]",
-                                                                    "* prop" : "reader",
-                                                                    "totalProperty" : "total"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "fieldLabel" : "Active",
-                                                    "inputValue" : true,
-                                                    "xtype" : "Checkbox",
-                                                    "valueOff" : 0,
-                                                    "width" : 75,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_active"
-                                                },
-                                                {
-                                                    "fieldLabel" : "Sold",
-                                                    "inputValue" : true,
-                                                    "xtype" : "Checkbox",
-                                                    "valueOff" : 0,
-                                                    "width" : 75,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_sold"
-                                                },
-                                                {
-                                                    "fieldLabel" : "Stocked",
-                                                    "inputValue" : true,
-                                                    "xtype" : "Checkbox",
-                                                    "valueOff" : 0,
-                                                    "width" : 75,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_stocked"
-                                                },
-                                                {
-                                                    "fieldLabel" : "Perishable",
-                                                    "inputValue" : true,
-                                                    "xtype" : "Checkbox",
-                                                    "valueOff" : 0,
-                                                    "width" : 75,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_perishable"
-                                                },
-                                                {
-                                                    "fieldLabel" : "Multi Location",
-                                                    "inputValue" : true,
-                                                    "xtype" : "Checkbox",
-                                                    "valueOff" : 0,
-                                                    "width" : 100,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "item_itemsite_id_itemsite_loccntrl"
-                                                },
-                                                {
-                                                    "listWidth" : 400,
-                                                    "triggerAction" : "all",
-                                                    "fieldLabel" : "Default Location",
-                                                    "forceSelection" : true,
-                                                    "selectOnFocus" : true,
-                                                    "pageSize" : 200,
-                                                    "displayField" : "location_name",
-                                                    "emptyText" : "Default Location",
-                                                    "hiddenName" : "item_itemsite_id_itemsite_location_id",
-                                                    "minChars" : 2,
-                                                    "valueField" : "location_id",
-                                                    "xtype" : "ComboBox",
-                                                    "allowBlank" : false,
-                                                    "typeAhead" : false,
-                                                    "editable" : true,
-                                                    "width" : 200,
-                                                    "$ xns" : "Roo.form",
-                                                    "name" : "location_name",
-                                                    "qtip" : "Select terms",
-                                                    "queryParam" : "query[location_name]",
-                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>",
-                                                    "loadingText" : "Searching...",
-                                                    "items" : [
-                                                        {
-                                                            "listeners" : {
-                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n     o.params.location_netable = 1;\n     o.params._notinternalcompany = 1;\n     o.params.location_restrict = 0;\n}\n"
-                                                            },
-                                                            "xtype" : "Store",
-                                                            "remoteSort" : true,
-                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'location_name' }",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "store",
-                                                            "items" : [
-                                                                {
-                                                                    "$ url" : "baseURL + '/Roo/location.php'",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "method" : "GET",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "* prop" : "proxy"
-                                                                },
-                                                                {
-                                                                    "id" : "location_id",
-                                                                    "root" : "data",
-                                                                    "xtype" : "JsonReader",
-                                                                    "$ fields" : "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "* prop" : "reader",
-                                                                    "totalProperty" : "total"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "Hidden",
-                                    "width" : 75,
-                                    "$ xns" : "Roo.form",
-                                    "name" : "item_id"
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "id" : "curr_id",
+                 "root" : "data",
+                 "xtype" : "JsonReader",
+                 "$ xns" : "Roo.data",
+                 "$ fields" : "[{\"name\":\"curr_id\",\"type\":\"int\"},\"curr_symbol\"]",
+                 "* prop" : "reader",
+                 "totalProperty" : "total"
+                }
+               ]
+              }
+             ]
+            },
+            {
+             "fieldLabel" : "Value",
+             "xtype" : "NumberField",
+             "allowBlank" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemcost_id_itemcost_actcost"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Column",
+         "$ xns" : "Roo.form",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.itemsiteFieldSet = _self;\n}"
+           },
+           "xtype" : "FieldSet",
+           "legend" : "Itemsite Settings",
+           "$ xns" : "Roo.form",
+           "String/Object/Function style" : "width:335px;",
+           "Number labelWidth" : 120,
+           "items" : [
+            {
+             "fieldLabel" : "Reorder Level",
+             "xtype" : "NumberField",
+             "allowBlank" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_reorderlevel"
+            },
+            {
+             "fieldLabel" : "Stock Safety Level",
+             "xtype" : "NumberField",
+             "allowBlank" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_safetystock"
+            },
+            {
+             "fieldLabel" : "Lead time (Days)",
+             "xtype" : "NumberField",
+             "allowBlank" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_leadtime"
+            },
+            {
+             "listWidth" : 200,
+             "triggerAction" : "all",
+             "fieldLabel" : "Control Method",
+             "displayField" : "fname",
+             "hiddenName" : "item_itemsite_id_itemsite_controlmethod",
+             "valueField" : "ftype",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "editable" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "mode" : "local",
+             "name" : "item_itemsite_id_itemsite_controlmethod_name",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>",
+             "items" : [
+              {
+               "xtype" : "SimpleStore",
+               "$ data" : "[ \n    [ 'N', \"None\"],\n    [ 'R' , \"Regular\"]\n]\n",
+               "$ fields" : "[  'ftype', 'fname']",
+               "$ xns" : "Roo.data",
+               "* prop" : "store"
+              }
+             ]
+            },
+            {
+             "listWidth" : 400,
+             "triggerAction" : "all",
+             "fieldLabel" : "Planner Code",
+             "forceSelection" : true,
+             "selectOnFocus" : true,
+             "pageSize" : 20,
+             "displayField" : "plancode_name",
+             "emptyText" : "Select plancode",
+             "hiddenName" : "item_itemsite_id_itemsite_plancode_id",
+             "minChars" : 2,
+             "valueField" : "plancode_id",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "typeAhead" : true,
+             "editable" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "plancode_name",
+             "qtip" : "Select plancode",
+             "queryParam" : "",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>",
+             "loadingText" : "Searching...",
+             "items" : [
+              {
+               "listeners" : {
+                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+               },
+               "xtype" : "Store",
+               "remoteSort" : true,
+               "$ xns" : "Roo.data",
+               "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
+               "* prop" : "store",
+               "items" : [
                 {
-                    "listeners" : {
-                        "|activate" : "function() {\n    _this.partspanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding parts\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    var type = _this.form.findField('item_type').getValue();\n    \n    if(!type.length || type != 'K'){\n        Roo.MessageBox.alert(\"Error\", \"Can't add parts to non-kit item\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.partsgrid) {\n        _this.partsgrid.footer.onClick('first');\n    \n     }\n}"
-                    },
-                    "region" : "center",
-                    "fitToframe" : true,
-                    "background" : true,
-                    "title" : "Item Parts",
-                    "xtype" : "GridPanel",
-                    "fitContainer" : true,
-                    "$ xns" : "Roo",
-                    "tableName" : "bomitem",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "beforeedit" : "function (e)\n{\n    if(e.field != 'bomitem_qtyper'){\n        return false;\n    }\n    \n}",
-                                "|render" : "function() \n{\n    _this.partsgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.partspanel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                "afteredit" : "function (e)\n{\n    if(e.originalValue == e.value){\n        return false;\n    }\n    \n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/bomitem.php',\n        mask : 'Saving',\n        params : {\n            bomitem_id : e.record.data.bomitem_id,\n            bomitem_qtyper : e.value\n        },\n        success : function() {\n            e.record.set('bomitem_qtyper', e.value);\n        }\n    \n    });\n        \n         \n        \n        \n}"
-                            },
-                            "autoExpandColumn" : "bomitem_item_id_item_descrip1",
-                            "xtype" : "EditorGrid",
-                            "loadMask" : true,
-                            "clicksToEdit" : 1,
-                            "$ xns" : "Roo.grid",
-                            "* prop" : "grid",
-                            "items" : [
-                                {
-                                    "xtype" : "Toolbar",
-                                    "$ xns" : "Roo",
-                                    "* prop" : "toolbar",
-                                    "items" : [
-                                        {
-                                            "listeners" : {
-                                                "render" : "function (_self)\n{\n    _this.partsBox = _self;\n}",
-                                                "select" : "function (combo, record, index)\n{\n    var item_id = _this.form.findField('item_id').getValue() * 1;\n    \n    if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){\n        return;\n    }\n    \n    var err = false;\n\n    _this.partsgrid.ds.each(function(d){\n        if(record.data.item_id == d.data.bomitem_item_id){\n            err = true;\n        }\n    });\n\n    if(err){\n        Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');\n        _this.partsBox.reset();\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/bomitem.php',\n        method : 'POST',\n        params : {\n            bomitem_parent_item_id : item_id,\n            bomitem_item_id : record.data.item_id,\n            bomitem_qtyper : 1\n        }, \n        success : function(res) {\n            _this.partsBox.reset();\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n}"
-                                            },
-                                            "alwaysQuery" : true,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "Item",
-                                            "forceSelection" : true,
-                                            "selectOnFocus" : true,
-                                            "pageSize" : 20,
-                                            "displayField" : "item_number",
-                                            "emptyText" : "Select item",
-                                            "minChars" : 2,
-                                            "valueField" : "id",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : true,
-                                            "typeAhead" : true,
-                                            "editable" : true,
-                                            "width" : 200,
-                                            "$ xns" : "Roo.bootstrap",
-                                            "qtip" : "Select item",
-                                            "queryParam" : "query[number_or_name]",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>",
-                                            "loadingText" : "Searching...",
-                                            "items" : [
-                                                {
-                                                    "listeners" : {
-                                                        "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params.item_active = 1;\n    o.params['!item_type'] = 'K';\n}\n"
-                                                    },
-                                                    "xtype" : "Store",
-                                                    "remoteSort" : true,
-                                                    "$ sortInfo" : "{ direction : 'ASC', field: 'item_number' }",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store",
-                                                    "items" : [
-                                                        {
-                                                            "$ url" : "baseURL + '/Roo/item.php'",
-                                                            "xtype" : "HttpProxy",
-                                                            "method" : "GET",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "proxy"
-                                                        },
-                                                        {
-                                                            "id" : "id",
-                                                            "root" : "data",
-                                                            "xtype" : "JsonReader",
-                                                            "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"item_number\",\"type\":\"string\"}\n]",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "reader",
-                                                            "totalProperty" : "total"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "xtype" : "Fill",
-                                            "$ xns" : "Roo.Toolbar"
-                                        },
-                                        {
-                                            "listeners" : {
-                                                "|click" : "function ()\n{\n    var sel = _this.partsgrid.getSelectionModel().getSelectedCell();\n    \n    if(!sel || !sel.length){\n        Roo.MessageBox.alert(\"Error\", \"Please select a item from below list\");\n        return;\n    }\n    \n    var d = _this.partsgrid.ds.getAt(sel[0]);      \n  \n    if(d.data.bomitem_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Invaild selection\");\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/bomitem.php',\n        method : 'POST',\n        params : {\n            _delete : d.data.bomitem_id\n        }, \n        success : function(res) {\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n   \n}"
-                                            },
-                                            "text" : "Remove",
-                                            "xtype" : "Button",
-                                            "cls" : "x-btn-text-icon",
-                                            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
-                                            "$ xns" : "Roo"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "listeners" : {
-                                        "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   \n   var id  = _this.form.findField('item_id').getValue() * 1;\n   if(id < 1){\n        return false;\n   }\n   \n   o.params.bom_parent_item_id = id;\n}"
-                                    },
-                                    "xtype" : "Store",
-                                    "remoteSort" : true,
-                                    "$ sortInfo" : "{ field : 'bomitem_item_id_item_name', direction: 'ASC' }",
-                                    "$ xns" : "Roo.data",
-                                    "* prop" : "dataSource",
-                                    "items" : [
-                                        {
-                                            "$ url" : "baseURL + '/Roo/bomitem.php'",
-                                            "method" : "GET",
-                                            "xtype" : "HttpProxy",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "proxy"
-                                        },
-                                        {
-                                            "id" : "bom_id",
-                                            "root" : "data",
-                                            "xtype" : "JsonReader",
-                                            "$ fields" : "[\n    {\n        'name': 'bomitem_id',\n        'type': 'int'\n    }\n]",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "reader",
-                                            "totalProperty" : "total"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "pageSize" : 50,
-                                    "xtype" : "PagingToolbar",
-                                    "emptyMsg" : "Nothing found",
-                                    "$ xns" : "Roo",
-                                    "displayMsg" : "Displaying parts {0} - {1} of {2}",
-                                    "displayInfo" : true,
-                                    "* prop" : "footer"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "width" : 150,
-                                    "header" : "Name",
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "bomitem_item_id_item_number"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "width" : 150,
-                                    "header" : "Description",
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "bomitem_item_id_item_descrip1"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "String align" : "right",
-                                    "header" : "Qty",
-                                    "width" : 100,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "bomitem_qtyper",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "Boolean allowBlank" : false,
-                                                    "String cls" : "align-right",
-                                                    "xtype" : "NumberField",
-                                                    "Number decimalPrecision" : 0,
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field",
-                                                    "Number minValue" : 0
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
+                 "$ url" : "baseURL + '/Roo/plancode.php'",
+                 "xtype" : "HttpProxy",
+                 "method" : "GET",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
                 },
                 {
-                    "listeners" : {
-                        "|activate" : "function() {\n    _this.panel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding image\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    \n     }\n}"
-                    },
-                    "fitToframe" : true,
-                    "background" : true,
-                    "region" : "center",
-                    "title" : "Reference Files",
-                    "xtype" : "GridPanel",
-                    "fitContainer" : true,
-                    "$ xns" : "Roo",
-                    "tableName" : "Images",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "|rowdblclick" : "function (_self, rowIndex, e)\n{\n  \n   var s =  _self.getDataSource().getAt(rowIndex);\n   new Pman.Download({\n        url : baseURL + '/Images/Download/' + s.data.id\n    });\n   \n}",
-                                "|render" : "function() { \n    _this.grid = this; \n\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
-                            },
-                            "autoExpandColumn" : "id",
-                            "xtype" : "Grid",
-                            "loadMask" : true,
-                            "$ xns" : "Roo.grid",
-                            "* prop" : "grid",
-                            "items" : [
-                                {
-                                    "listeners" : {
-                                        "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    var id = _this.form.findField('item_id').getValue();\n    \n    if(id * 1 < 1){\n        return false;\n    }\n    \n    o.params.onid = id;\n    o.params.ontable = 'item';\n    \n}"
-                                    },
-                                    "xtype" : "Store",
-                                    "remoteSort" : true,
-                                    "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }",
-                                    "$ xns" : "Roo.data",
-                                    "* prop" : "dataSource",
-                                    "items" : [
-                                        {
-                                            "id" : "id",
-                                            "root" : "data",
-                                            "xtype" : "JsonReader",
-                                            "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    }\n]",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "reader",
-                                            "totalProperty" : "total"
-                                        },
-                                        {
-                                            "$ url" : "baseURL + '/Roo/Images.php'",
-                                            "method" : "GET",
-                                            "xtype" : "HttpProxy",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "proxy"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "pageSize" : 25,
-                                    "xtype" : "PagingToolbar",
-                                    "emptyMsg" : "No Images found",
-                                    "$ xns" : "Roo",
-                                    "displayInfo" : true,
-                                    "displayMsg" : "Displaying Images  {0} - {1} of {2}",
-                                    "* prop" : "footer"
-                                },
-                                {
-                                    "xtype" : "Toolbar",
-                                    "$ xns" : "Roo",
-                                    "* prop" : "toolbar",
-                                    "items" : [
-                                        {
-                                            "listeners" : {
-                                                "|click" : "function()\n{\n    Pman.Dialog.Image.show({\n        id : 0, \n        ontable: 'item',\n        onid: _this.form.findField('item_id').getValue() * 1,\n        imgtype : ''\n    }, function(data){\n        if (!data) { return; } \n        _this.grid.footer.onClick('first');\n    }); \n\n}       "
-                                            },
-                                            "text" : "Add",
-                                            "xtype" : "Button",
-                                            "cls" : "x-btn-text-icon",
-                                            "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                            "$ xns" : "Roo.Toolbar"
-                                        },
-                                        {
-                                            "listeners" : {
-                                                "|click" : "function()\n{\n    Pman.genericDelete(_this, 'Images'); \n}\n        "
-                                            },
-                                            "text" : "Delete",
-                                            "xtype" : "Button",
-                                            "cls" : "x-btn-text-icon",
-                                            "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
-                                            "$ xns" : "Roo.Toolbar"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "sortable" : true,
-                                    "header" : "Created",
-                                    "width" : 200,
-                                    "$ renderer" : "function(v,x,r) {\n       return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',\n            v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n    r.data.width, r.data.height\n    ); \n}\n     ",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "created"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Image",
-                                    "width" : 100,
-                                    "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" height=\"100\">', baseURL, v, r.data.filename); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "id"
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "id" : "id",
+                 "root" : "data",
+                 "xtype" : "JsonReader",
+                 "$ xns" : "Roo.data",
+                 "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"plancode_code\",\"type\":\"string\"}]",
+                 "* prop" : "reader",
+                 "totalProperty" : "total"
+                }
+               ]
+              }
+             ]
+            },
+            {
+             "listWidth" : 400,
+             "triggerAction" : "all",
+             "fieldLabel" : "Costcat",
+             "forceSelection" : true,
+             "selectOnFocus" : true,
+             "pageSize" : 20,
+             "displayField" : "costcat_code",
+             "emptyText" : "Select costcat",
+             "hiddenName" : "item_itemsite_id_itemsite_costcat_id",
+             "minChars" : 2,
+             "valueField" : "costcat_id",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "typeAhead" : true,
+             "editable" : false,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "costcat_code",
+             "qtip" : "Select costcat",
+             "queryParam" : "",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>",
+             "loadingText" : "Searching...",
+             "items" : [
+              {
+               "listeners" : {
+                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+               },
+               "xtype" : "Store",
+               "remoteSort" : true,
+               "$ xns" : "Roo.data",
+               "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
+               "* prop" : "store",
+               "items" : [
                 {
-                    "listeners" : {
-                        "|activate" : "function() {\n    _this.lpanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding image\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.lgrid) {\n        _this.lgrid.footer.onClick('first');\n    \n     }\n}"
-                    },
-                    "fitToframe" : true,
-                    "background" : true,
-                    "region" : "center",
-                    "title" : "Price List",
-                    "xtype" : "GridPanel",
-                    "fitContainer" : true,
-                    "$ xns" : "Roo",
-                    "tableName" : "ipshead",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "beforeedit" : "function (e)\n{\n    if(e.field != 'ipshead_ipsitem_price'){\n        return false;\n    }\n    \n}",
-                                "|render" : "function() \n{\n    _this.lgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.lpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                "afteredit" : "function (e)\n{\n    if(e.originalValue == e.value){\n        return false;\n    }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if(id < 1){\n        return false;\n    }\n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/ipsiteminfo',\n        mask : 'Saving',\n        params : {\n            ipsitem_ipshead_id : e.record.data.ipshead_id,\n            ipsitem_item_id : id,\n            ipsitem_price : e.record.data.ipshead_ipsitem_price,\n            ipsitem_id : e.record.data.ipshead_ipsitem_id\n        }\n    \n    });\n        \n         \n        \n        \n}"
-                            },
-                            "autoExpandColumn" : "ipshead_descrip",
-                            "xtype" : "EditorGrid",
-                            "loadMask" : true,
-                            "clicksToEdit" : 1,
-                            "$ xns" : "Roo.grid",
-                            "* prop" : "grid",
-                            "items" : [
-                                {
-                                    "listeners" : {
-                                        "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   \n   var id  = _this.form.findField('item_id').getValue() * 1;\n   if(id < 1){\n        return false;\n   }\n   \n   o.params._with_item = id;\n}"
-                                    },
-                                    "xtype" : "Store",
-                                    "remoteSort" : true,
-                                    "$ sortInfo" : "{ field : 'ipshead_id', direction: 'ASC' }",
-                                    "$ xns" : "Roo.data",
-                                    "* prop" : "dataSource",
-                                    "items" : [
-                                        {
-                                            "$ url" : "baseURL + '/Roo/ipshead.php'",
-                                            "xtype" : "HttpProxy",
-                                            "method" : "GET",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "proxy"
-                                        },
-                                        {
-                                            "id" : "ipshead_id",
-                                            "root" : "data",
-                                            "xtype" : "JsonReader",
-                                            "$ fields" : "[\n    {\n        'name': 'ipshead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_name',\n        'type': 'string'\n    }\n]",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "reader",
-                                            "totalProperty" : "total"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "pageSize" : 50,
-                                    "xtype" : "PagingToolbar",
-                                    "emptyMsg" : "Nothing found",
-                                    "$ xns" : "Roo",
-                                    "displayMsg" : "Displaying records {0} - {1} of {2}",
-                                    "displayInfo" : true,
-                                    "* prop" : "footer"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Name",
-                                    "width" : 150,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "ipshead_name"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Description",
-                                    "width" : 150,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "ipshead_descrip"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Currency",
-                                    "width" : 100,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "ipshead_curr_id_curr_name"
-                                },
-                                {
-                                    "align" : "right",
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Price",
-                                    "width" : 120,
-                                    "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "ipshead_ipsitem_price",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "xtype" : "NumberField",
-                                                    "cls" : "align-right",
-                                                    "decimalPrecision" : 2,
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
+                 "$ url" : "baseURL + '/Roo/costcat.php'",
+                 "xtype" : "HttpProxy",
+                 "method" : "GET",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
                 },
                 {
-                    "listeners" : {
-                        "|activate" : "function() {\n    _this.itemsrcpanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding suppliers\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return false;\n    }\n    \n    var type = _this.form.findField('item_type').getValue();\n    \n    if(type == 'K'){\n        Roo.MessageBox.alert(\"Error\", \"Can't add suppliers to kit item\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return false;\n    }\n    \n    if (_this.itemsrcgrid) {\n        _this.itemsrcgrid.footer.onClick('first');\n    }\n}"
-                    },
-                    "fitToframe" : true,
-                    "background" : true,
-                    "region" : "center",
-                    "title" : "Suppliers",
-                    "xtype" : "GridPanel",
-                    "fitContainer" : true,
-                    "$ xns" : "Roo",
-                    "tableName" : "itemsrc",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
-                                "|render" : "function() \n{\n    _this.itemsrcgrid = this; \n    \n    if (_this.itemsrcpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                "afteredit" : "function (e)\n{\n    e.record.commit();\n}"
-                            },
-                            "autoExpandColumn" : "itemsrc_comments",
-                            "xtype" : "EditorGrid",
-                            "loadMask" : true,
-                            "clicksToEdit" : 1,
-                            "$ xns" : "Roo.grid",
-                            "* prop" : "grid",
-                            "items" : [
-                                {
-                                    "listeners" : {
-                                        "update" : "function (_self, record, operation)\n{\n    Roo.log(operation);\n      Roo.log(record);\n   \n    if (operation != 'commit') {\n        return;\n    }\n    if (record.data.itemsrc_vend_id * 1 < 1) {\n        return; // do not save.\n    }\n    if (record.data.itemsrc_id * 1 < 0) {\n        return; // do not save. -- updating at present...\n    }\n    \n    var p = Roo.apply({}, record.data);\n    record.set('itemsrc_id', -1);    \n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Itemsrc',\n        params : p,\n        method : 'POST',\n        success: function(res) {\n            if (record.data.itemsrc_id *1  < 1) { \n                record.set('itemsrc_id', res.data.itemsrc_id);\n            }\n        }\n    });\n    \n    \n}",
-                                        "beforeload" : "function (_self, o)\n{\n    \n    var id = 1 * _this.form.findField('item_id').getValue();\n    if (!id) {\n        this.removeAll();\n        return false;\n    }\n    o.params.itemsrc_item_id = id;\n}"
-                                    },
-                                    "xtype" : "Store",
-                                    "remoteSort" : true,
-                                    "$ sortInfo" : "{ field : 'itemsrc_vend_id_vend_name', direction: 'ASC' }",
-                                    "$ xns" : "Roo.data",
-                                    "* prop" : "dataSource",
-                                    "items" : [
-                                        {
-                                            "$ url" : "baseURL + '/Roo/itemsrc.php'",
-                                            "method" : "GET",
-                                            "xtype" : "HttpProxy",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "proxy"
-                                        },
-                                        {
-                                            "id" : "id",
-                                            "root" : "data",
-                                            "xtype" : "JsonReader",
-                                            "$ xns" : "Roo.data",
-                                            "$ fields" : "[\n    {\n        'name': 'itemsrc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_uom',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_invvendoruomratio',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_minordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_multordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_leadtime',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_ranking',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_active',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_manuf_name',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_default',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_upccode',\n        'type': 'string'\n    }\n]",
-                                            "* prop" : "reader",
-                                            "totalProperty" : "total"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "pageSize" : 25,
-                                    "xtype" : "PagingToolbar",
-                                    "emptyMsg" : "No itemsrc found",
-                                    "$ xns" : "Roo",
-                                    "displayInfo" : true,
-                                    "displayMsg" : "Displaying itemsrc{0} - {1} of {2}",
-                                    "* prop" : "footer"
-                                },
-                                {
-                                    "xtype" : "Toolbar",
-                                    "$ xns" : "Roo",
-                                    "* prop" : "toolbar",
-                                    "items" : [
-                                        {
-                                            "listeners" : {
-                                                "|click" : "function()\n{\n     \n    Roo.log(\"add presed\");\n     \n    // work out last \n    var grid = _this.itemsrcgrid;\n     \n    // uses form defaults or last row value.\n    var nr = grid.ds.reader.newRow({\n         itemsrc_id : 0,\n         itemsrc_item_id : _this.form.findField('item_id').getValue(),\n         itemsrc_vend_id : 0,\n         itemsrc_vend_id_vend_name : '',\n         itemsrc_vend_item_number : '',\n         itemsrc_vend_item_descrip : '',\n         itemsrc_comments           : '',\n         itemsrc_vend_uom  :           'EA',\n         itemsrc_invvendoruomratio : 1.0,\n         itemsrc_minordqty        : 0,\n         itemsrc_multordqty        : 0,\n         itemsrc_leadtime         :  30,\n         itemsrc_ranking         :   0,\n         itemsrc_active          :   true,\n         itemsrc_manuf_name       :  '',\n         itemsrc_manuf_item_number : '',\n         itemsrc_manuf_item_descrip: '',\n         itemsrc_default          : true,\n         itemsrc_upccode    : ''\n                        \n    });\n    grid.stopEditing();\n    grid.ds.insert(0, nr); \n    grid.startEditing(0, 0); // type..\n\n}\n \n"
-                                            },
-                                            "text" : "Add",
-                                            "xtype" : "Button",
-                                            "cls" : "x-btn-text-icon",
-                                            "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                            "$ xns" : "Roo.Toolbar"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Vendor",
-                                    "width" : 120,
-                                    "$ renderer" : "function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_vend_id",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "listWidth" : 400,
-                                                    "triggerAction" : "all",
-                                                    "forceSelection" : true,
-                                                    "selectOnFocus" : true,
-                                                    "pageSize" : 20,
-                                                    "displayField" : "vend_name",
-                                                    "emptyText" : "Select Vendor",
-                                                    "hiddenName" : "itemsrc_vend_id",
-                                                    "minChars" : 2,
-                                                    "valueField" : "vend_id",
-                                                    "xtype" : "ComboBox",
-                                                    "allowBlank" : false,
-                                                    "typeAhead" : true,
-                                                    "editable" : true,
-                                                    "width" : 300,
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field",
-                                                    "name" : "itemsrc_vend_id_vend_name",
-                                                    "qtip" : "Select vendinfo",
-                                                    "queryParam" : "q[search]",
-                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>",
-                                                    "loadingText" : "Searching...",
-                                                    "items" : [
-                                                        {
-                                                            "listeners" : {
-                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
-                                                            },
-                                                            "xtype" : "Store",
-                                                            "remoteSort" : true,
-                                                            "$ xns" : "Roo.data",
-                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
-                                                            "* prop" : "store",
-                                                            "items" : [
-                                                                {
-                                                                    "$ url" : "baseURL + '/Roo/vendinfo.php'",
-                                                                    "method" : "GET",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "* prop" : "proxy"
-                                                                },
-                                                                {
-                                                                    "id" : "id",
-                                                                    "root" : "data",
-                                                                    "xtype" : "JsonReader",
-                                                                    "$ xns" : "Roo.data",
-                                                                    "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"vend_name\",\"type\":\"string\"}]",
-                                                                    "* prop" : "reader",
-                                                                    "totalProperty" : "total"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Vendor Ref#",
-                                    "width" : 100,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_vend_item_number",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "xtype" : "TextField",
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Comments",
-                                    "width" : 200,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_comments",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "xtype" : "TextField",
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "UOM",
-                                    "width" : 50,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_vend_uom"
-                                },
-                                {
-                                    "align" : "right",
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Min Qty",
-                                    "width" : 50,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_minordqty",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "minValue" : 0,
-                                                    "xtype" : "NumberField",
-                                                    "decimalPrecision" : 0,
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "align" : "right",
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Lead time",
-                                    "width" : 75,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_leadtime",
-                                    "items" : [
-                                        {
-                                            "xtype" : "GridEditor",
-                                            "$ xns" : "Roo.grid",
-                                            "* prop" : "editor",
-                                            "items" : [
-                                                {
-                                                    "minValue" : 0,
-                                                    "xtype" : "NumberField",
-                                                    "decimalPrecision" : 0,
-                                                    "$ xns" : "Roo.form",
-                                                    "* prop" : "field"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Active",
-                                    "width" : 50,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "itemsrc_active"
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "id" : "id",
+                 "root" : "data",
+                 "xtype" : "JsonReader",
+                 "$ xns" : "Roo.data",
+                 "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"costcat_code\",\"type\":\"string\"}]",
+                 "* prop" : "reader",
+                 "totalProperty" : "total"
+                }
+               ]
+              }
+             ]
+            },
+            {
+             "fieldLabel" : "Active",
+             "inputValue" : true,
+             "xtype" : "Checkbox",
+             "valueOff" : 0,
+             "width" : 75,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_active"
+            },
+            {
+             "fieldLabel" : "Sold",
+             "inputValue" : true,
+             "xtype" : "Checkbox",
+             "valueOff" : 0,
+             "width" : 75,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_sold"
+            },
+            {
+             "fieldLabel" : "Stocked",
+             "inputValue" : true,
+             "xtype" : "Checkbox",
+             "valueOff" : 0,
+             "width" : 75,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_stocked"
+            },
+            {
+             "fieldLabel" : "Perishable",
+             "inputValue" : true,
+             "xtype" : "Checkbox",
+             "valueOff" : 0,
+             "width" : 75,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_perishable"
+            },
+            {
+             "fieldLabel" : "Multi Location",
+             "inputValue" : true,
+             "xtype" : "Checkbox",
+             "valueOff" : 0,
+             "width" : 100,
+             "$ xns" : "Roo.form",
+             "name" : "item_itemsite_id_itemsite_loccntrl"
+            },
+            {
+             "listWidth" : 400,
+             "triggerAction" : "all",
+             "fieldLabel" : "Default Location",
+             "forceSelection" : true,
+             "selectOnFocus" : true,
+             "pageSize" : 200,
+             "displayField" : "location_name",
+             "emptyText" : "Default Location",
+             "hiddenName" : "item_itemsite_id_itemsite_location_id",
+             "minChars" : 2,
+             "valueField" : "location_id",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "typeAhead" : false,
+             "editable" : true,
+             "width" : 200,
+             "$ xns" : "Roo.form",
+             "name" : "location_name",
+             "qtip" : "Select terms",
+             "queryParam" : "query[location_name]",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>",
+             "loadingText" : "Searching...",
+             "items" : [
+              {
+               "listeners" : {
+                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n     o.params.location_netable = 1;\n     o.params._notinternalcompany = 1;\n     o.params.location_restrict = 0;\n}\n"
+               },
+               "xtype" : "Store",
+               "remoteSort" : true,
+               "$ sortInfo" : "{ direction : 'ASC', field: 'location_name' }",
+               "$ xns" : "Roo.data",
+               "* prop" : "store",
+               "items" : [
                 {
-                    "listeners" : {
-                        "|activate" : "function() {\n    _this.hpanel = this;\n    if (_this.hgrid) {\n        _this.hgrid.footer.onClick('first');\n    }\n}"
-                    },
-                    "fitToframe" : true,
-                    "background" : true,
-                    "region" : "center",
-                    "title" : "History",
-                    "xtype" : "GridPanel",
-                    "fitContainer" : true,
-                    "$ xns" : "Roo",
-                    "tableName" : "events",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "|render" : "function() \n{\n    _this.hgrid = this; \n    if (_this.hpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
-                            },
-                            "autoExpandColumn" : "remarks",
-                            "xtype" : "Grid",
-                            "loadMask" : true,
-                            "$ xns" : "Roo.grid",
-                            "* prop" : "grid",
-                            "items" : [
-                                {
-                                    "listeners" : {
-                                        "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params.on_table = 'item';\n    options.params.on_id = _this.form.findField('item_id').getValue();\n}"
-                                    },
-                                    "xtype" : "Store",
-                                    "remoteSort" : true,
-                                    "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }",
-                                    "$ xns" : "Roo.data",
-                                    "* prop" : "dataSource",
-                                    "items" : [
-                                        {
-                                            "$ url" : "baseURL + '/Roo/events.php'",
-                                            "xtype" : "HttpProxy",
-                                            "method" : "GET",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "proxy"
-                                        },
-                                        {
-                                            "id" : "id",
-                                            "root" : "data",
-                                            "xtype" : "JsonReader",
-                                            "$ fields" : "[\n    {\n        'name': 'event_when',\n        'type': 'date'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    }\n]",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "reader",
-                                            "totalProperty" : "total"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "pageSize" : 25,
-                                    "xtype" : "PagingToolbar",
-                                    "emptyMsg" : "No Events found",
-                                    "$ xns" : "Roo",
-                                    "displayMsg" : "Displaying events{0} - {1} of {2}",
-                                    "displayInfo" : true,
-                                    "* prop" : "footer"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Changed",
-                                    "width" : 120,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "event_when"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Action",
-                                    "width" : 200,
-                                    "$ renderer" : "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "action"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "IP Address",
-                                    "width" : 200,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "ipaddr"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Who",
-                                    "width" : 75,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "person_id_name"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Notes",
-                                    "width" : 200,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "remarks"
-                                }
-                            ]
-                        }
-                    ]
+                 "$ url" : "baseURL + '/Roo/location.php'",
+                 "method" : "GET",
+                 "xtype" : "HttpProxy",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
                 },
                 {
-                    "listeners" : {
-                        "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
-                    },
-                    "text" : "Cancel",
-                    "xtype" : "Button",
-                    "$ xns" : "Roo",
-                    "* prop" : "buttons[]"
+                 "id" : "location_id",
+                 "root" : "data",
+                 "xtype" : "JsonReader",
+                 "$ fields" : "[{\"name\":\"location_id\",\"type\":\"int\"},\"location_name\"]",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "reader",
+                 "totalProperty" : "total"
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "Hidden",
+         "$ xns" : "Roo.form",
+         "width" : 75,
+         "name" : "item_id"
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "|activate" : "function() {\n    _this.partspanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding parts\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    var type = _this.form.findField('item_type').getValue();\n    \n    if(!type.length || type != 'K'){\n        Roo.MessageBox.alert(\"Error\", \"Can't add parts to non-kit item\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.partsgrid) {\n        _this.partsgrid.footer.onClick('first');\n    \n     }\n}"
+     },
+     "background" : true,
+     "region" : "center",
+     "fitToframe" : true,
+     "title" : "Item Parts",
+     "xtype" : "GridPanel",
+     "fitContainer" : true,
+     "$ xns" : "Roo",
+     "tableName" : "bomitem",
+     "items" : [
+      {
+       "listeners" : {
+        "beforeedit" : "function (e)\n{\n    if(e.field != 'bomitem_qtyper'){\n        return false;\n    }\n    \n}",
+        "|render" : "function() \n{\n    _this.partsgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.partspanel.active) {\n       this.footer.onClick('first');\n    }\n}",
+        "afteredit" : "function (e)\n{\n    if(e.originalValue == e.value){\n        return false;\n    }\n    \n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/bomitem.php',\n        mask : 'Saving',\n        params : {\n            bomitem_id : e.record.data.bomitem_id,\n            bomitem_qtyper : e.value\n        },\n        success : function() {\n            e.record.set('bomitem_qtyper', e.value);\n        }\n    \n    });\n        \n         \n        \n        \n}"
+       },
+       "autoExpandColumn" : "bomitem_item_id_item_descrip1",
+       "xtype" : "EditorGrid",
+       "loadMask" : true,
+       "clicksToEdit" : 1,
+       "$ xns" : "Roo.grid",
+       "* prop" : "grid",
+       "items" : [
+        {
+         "xtype" : "Toolbar",
+         "$ xns" : "Roo",
+         "* prop" : "toolbar",
+         "items" : [
+          {
+           "listeners" : {
+            "render" : "function (_self)\n{\n    _this.partsBox = _self;\n}",
+            "select" : "function (combo, record, index)\n{\n    var item_id = _this.form.findField('item_id').getValue() * 1;\n    \n    if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){\n        return;\n    }\n    \n    var err = false;\n\n    _this.partsgrid.ds.each(function(d){\n        if(record.data.item_id == d.data.bomitem_item_id){\n            err = true;\n        }\n    });\n\n    if(err){\n        Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');\n        _this.partsBox.reset();\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/bomitem.php',\n        method : 'POST',\n        params : {\n            bomitem_parent_item_id : item_id,\n            bomitem_item_id : record.data.item_id,\n            bomitem_qtyper : 1\n        }, \n        success : function(res) {\n            _this.partsBox.reset();\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n}"
+           },
+           "alwaysQuery" : true,
+           "triggerAction" : "all",
+           "fieldLabel" : "Item",
+           "forceSelection" : true,
+           "selectOnFocus" : true,
+           "pageSize" : 20,
+           "displayField" : "item_number",
+           "emptyText" : "Select item",
+           "minChars" : 2,
+           "valueField" : "id",
+           "xtype" : "ComboBox",
+           "allowBlank" : true,
+           "typeAhead" : true,
+           "editable" : true,
+           "width" : 200,
+           "$ xns" : "Roo.bootstrap",
+           "qtip" : "Select item",
+           "queryParam" : "query[number_or_name]",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>",
+           "loadingText" : "Searching...",
+           "items" : [
+            {
+             "listeners" : {
+              "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    \n    o.params.item_active = 1;\n    o.params['!item_type'] = 'K';\n}\n"
+             },
+             "xtype" : "Store",
+             "remoteSort" : true,
+             "$ sortInfo" : "{ direction : 'ASC', field: 'item_number' }",
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Roo/item.php'",
+               "method" : "GET",
+               "xtype" : "HttpProxy",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              },
+              {
+               "id" : "id",
+               "root" : "data",
+               "xtype" : "JsonReader",
+               "$ fields" : "[\n    {\"name\":\"id\",\"type\":\"int\"},\n    {\"name\":\"item_number\",\"type\":\"string\"}\n]",
+               "$ xns" : "Roo.data",
+               "* prop" : "reader",
+               "totalProperty" : "total"
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "xtype" : "Fill",
+           "$ xns" : "Roo.Toolbar"
+          },
+          {
+           "listeners" : {
+            "|click" : "function ()\n{\n    var sel = _this.partsgrid.getSelectionModel().getSelectedCell();\n    \n    if(!sel || !sel.length){\n        Roo.MessageBox.alert(\"Error\", \"Please select a item from below list\");\n        return;\n    }\n    \n    var d = _this.partsgrid.ds.getAt(sel[0]);      \n  \n    if(d.data.bomitem_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Invaild selection\");\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/bomitem.php',\n        method : 'POST',\n        params : {\n            _delete : d.data.bomitem_id\n        }, \n        success : function(res) {\n            _this.partsgrid.footer.onClick('first');\n        }\n    }); \n   \n}"
+           },
+           "text" : "Remove",
+           "xtype" : "Button",
+           "cls" : "x-btn-text-icon",
+           "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+           "$ xns" : "Roo"
+          }
+         ]
+        },
+        {
+         "listeners" : {
+          "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   \n   var id  = _this.form.findField('item_id').getValue() * 1;\n   if(id < 1){\n        return false;\n   }\n   \n   o.params.bom_parent_item_id = id;\n}"
+         },
+         "xtype" : "Store",
+         "remoteSort" : true,
+         "$ sortInfo" : "{ field : 'bomitem_item_id_item_name', direction: 'ASC' }",
+         "$ xns" : "Roo.data",
+         "* prop" : "dataSource",
+         "items" : [
+          {
+           "$ url" : "baseURL + '/Roo/bomitem.php'",
+           "xtype" : "HttpProxy",
+           "method" : "GET",
+           "$ xns" : "Roo.data",
+           "* prop" : "proxy"
+          },
+          {
+           "id" : "bom_id",
+           "root" : "data",
+           "xtype" : "JsonReader",
+           "$ fields" : "[\n    {\n        'name': 'bomitem_id',\n        'type': 'int'\n    }\n]",
+           "$ xns" : "Roo.data",
+           "* prop" : "reader",
+           "totalProperty" : "total"
+          }
+         ]
+        },
+        {
+         "pageSize" : 50,
+         "xtype" : "PagingToolbar",
+         "emptyMsg" : "Nothing found",
+         "$ xns" : "Roo",
+         "displayMsg" : "Displaying parts {0} - {1} of {2}",
+         "displayInfo" : true,
+         "* prop" : "footer"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "header" : "Name",
+         "width" : 150,
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "bomitem_item_id_item_number"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "header" : "Description",
+         "width" : 150,
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "bomitem_item_id_item_descrip1"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "String align" : "right",
+         "header" : "Qty",
+         "width" : 100,
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "bomitem_qtyper",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "Boolean allowBlank" : false,
+             "String cls" : "align-right",
+             "xtype" : "NumberField",
+             "Number decimalPrecision" : 0,
+             "$ xns" : "Roo.form",
+             "* prop" : "field",
+             "Number minValue" : 0
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "|activate" : "function() {\n    _this.panel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding image\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    \n     }\n}"
+     },
+     "region" : "center",
+     "fitToframe" : true,
+     "background" : true,
+     "title" : "Reference Files",
+     "xtype" : "GridPanel",
+     "fitContainer" : true,
+     "$ xns" : "Roo",
+     "tableName" : "Images",
+     "items" : [
+      {
+       "listeners" : {
+        "|rowdblclick" : "function (_self, rowIndex, e)\n{\n  \n   var s =  _self.getDataSource().getAt(rowIndex);\n   new Pman.Download({\n        url : baseURL + '/Images/Download/' + s.data.id\n    });\n   \n}",
+        "|render" : "function() { \n    _this.grid = this; \n\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+       },
+       "autoExpandColumn" : "id",
+       "xtype" : "Grid",
+       "loadMask" : true,
+       "$ xns" : "Roo.grid",
+       "* prop" : "grid",
+       "items" : [
+        {
+         "listeners" : {
+          "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    var id = _this.form.findField('item_id').getValue();\n    \n    if(id * 1 < 1){\n        return false;\n    }\n    \n    o.params.onid = id;\n    o.params.ontable = 'item';\n    \n}"
+         },
+         "xtype" : "Store",
+         "remoteSort" : true,
+         "$ sortInfo" : "{ field: 'created' , direction: 'DESC' }",
+         "$ xns" : "Roo.data",
+         "* prop" : "dataSource",
+         "items" : [
+          {
+           "id" : "id",
+           "root" : "data",
+           "xtype" : "JsonReader",
+           "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat' : 'Y-m-d H:i:s'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    }\n]",
+           "$ xns" : "Roo.data",
+           "* prop" : "reader",
+           "totalProperty" : "total"
+          },
+          {
+           "$ url" : "baseURL + '/Roo/Images.php'",
+           "xtype" : "HttpProxy",
+           "method" : "GET",
+           "$ xns" : "Roo.data",
+           "* prop" : "proxy"
+          }
+         ]
+        },
+        {
+         "pageSize" : 25,
+         "xtype" : "PagingToolbar",
+         "emptyMsg" : "No Images found",
+         "$ xns" : "Roo",
+         "displayInfo" : true,
+         "displayMsg" : "Displaying Images  {0} - {1} of {2}",
+         "* prop" : "footer"
+        },
+        {
+         "xtype" : "Toolbar",
+         "$ xns" : "Roo",
+         "* prop" : "toolbar",
+         "items" : [
+          {
+           "listeners" : {
+            "|click" : "function()\n{\n    Pman.Dialog.Image.show({\n        id : 0, \n        ontable: 'item',\n        onid: _this.form.findField('item_id').getValue() * 1,\n        imgtype : ''\n    }, function(data){\n        if (!data) { return; } \n        _this.grid.footer.onClick('first');\n    }); \n\n}       "
+           },
+           "text" : "Add",
+           "xtype" : "Button",
+           "cls" : "x-btn-text-icon",
+           "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+           "$ xns" : "Roo.Toolbar"
+          },
+          {
+           "listeners" : {
+            "|click" : "function()\n{\n    Pman.genericDelete(_this, 'Images'); \n}\n        "
+           },
+           "text" : "Delete",
+           "xtype" : "Button",
+           "cls" : "x-btn-text-icon",
+           "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+           "$ xns" : "Roo.Toolbar"
+          }
+         ]
+        },
+        {
+         "xtype" : "ColumnModel",
+         "sortable" : true,
+         "header" : "Created",
+         "width" : 200,
+         "$ renderer" : "function(v,x,r) {\n       return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',\n            v.format('d/M/Y'), r.data.mimetype, r.data.filename,\n    r.data.width, r.data.height\n    ); \n}\n     ",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "created"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 100,
+         "header" : "Image",
+         "$ renderer" : "function(v,x,r) { return String.format('<img src=\"{0}/Images/Thumb/100/{1}/{2}\" height=\"100\">', baseURL, v, r.data.filename); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "id"
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "|activate" : "function() {\n    _this.lpanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding image\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return;\n    }\n    \n    if (_this.lgrid) {\n        _this.lgrid.footer.onClick('first');\n    \n     }\n}"
+     },
+     "region" : "center",
+     "fitToframe" : true,
+     "background" : true,
+     "title" : "Price List",
+     "xtype" : "GridPanel",
+     "fitContainer" : true,
+     "$ xns" : "Roo",
+     "tableName" : "ipshead",
+     "items" : [
+      {
+       "listeners" : {
+        "beforeedit" : "function (e)\n{\n    if(e.field != 'ipshead_ipsitem_price'){\n        return false;\n    }\n    \n}",
+        "|render" : "function() \n{\n    _this.lgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.lpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
+        "afteredit" : "function (e)\n{\n    if(e.originalValue == e.value){\n        return false;\n    }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if(id < 1){\n        return false;\n    }\n    \n    new Pman.Request({\n        method : 'POST',\n        url : baseURL + '/Roo/ipsiteminfo',\n        mask : 'Saving',\n        params : {\n            ipsitem_ipshead_id : e.record.data.ipshead_id,\n            ipsitem_item_id : id,\n            ipsitem_price : e.record.data.ipshead_ipsitem_price,\n            ipsitem_id : e.record.data.ipshead_ipsitem_id\n        }\n    \n    });\n        \n         \n        \n        \n}"
+       },
+       "autoExpandColumn" : "ipshead_descrip",
+       "xtype" : "EditorGrid",
+       "loadMask" : true,
+       "clicksToEdit" : 1,
+       "$ xns" : "Roo.grid",
+       "* prop" : "grid",
+       "items" : [
+        {
+         "listeners" : {
+          "beforeload" : "function (_self, o)\n{\n   o.params = o.params || {};\n   \n   var id  = _this.form.findField('item_id').getValue() * 1;\n   if(id < 1){\n        return false;\n   }\n   \n   o.params._with_item = id;\n}"
+         },
+         "xtype" : "Store",
+         "remoteSort" : true,
+         "$ sortInfo" : "{ field : 'ipshead_id', direction: 'ASC' }",
+         "$ xns" : "Roo.data",
+         "* prop" : "dataSource",
+         "items" : [
+          {
+           "$ url" : "baseURL + '/Roo/ipshead.php'",
+           "method" : "GET",
+           "xtype" : "HttpProxy",
+           "$ xns" : "Roo.data",
+           "* prop" : "proxy"
+          },
+          {
+           "id" : "ipshead_id",
+           "root" : "data",
+           "xtype" : "JsonReader",
+           "$ fields" : "[\n    {\n        'name': 'ipshead_id',\n        'type': 'int'\n    },\n    {\n        'name': 'ipshead_name',\n        'type': 'string'\n    }\n]",
+           "$ xns" : "Roo.data",
+           "* prop" : "reader",
+           "totalProperty" : "total"
+          }
+         ]
+        },
+        {
+         "pageSize" : 50,
+         "xtype" : "PagingToolbar",
+         "emptyMsg" : "Nothing found",
+         "$ xns" : "Roo",
+         "displayMsg" : "Displaying records {0} - {1} of {2}",
+         "displayInfo" : true,
+         "* prop" : "footer"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 150,
+         "header" : "Name",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "ipshead_name"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 150,
+         "header" : "Description",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "ipshead_descrip"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 100,
+         "header" : "Currency",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "ipshead_curr_id_curr_name"
+        },
+        {
+         "align" : "right",
+         "xtype" : "ColumnModel",
+         "header" : "Price",
+         "width" : 120,
+         "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "ipshead_ipsitem_price",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "xtype" : "NumberField",
+             "cls" : "align-right",
+             "decimalPrecision" : 2,
+             "$ xns" : "Roo.form",
+             "* prop" : "field"
+            }
+           ]
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "|activate" : "function() {\n    _this.itemsrcpanel = this;\n    \n    try { if (MODULE.isBuilder) {\n        return;\n    } } catch(e) { }\n    \n    var id = _this.form.findField('item_id').getValue() * 1;\n    if (id < 1) {\n        Roo.MessageBox.alert(\"Save First\", \"Save the item first, before adding suppliers\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return false;\n    }\n    \n    var type = _this.form.findField('item_type').getValue();\n    \n    if(type == 'K'){\n        Roo.MessageBox.alert(\"Error\", \"Can't add suppliers to kit item\");\n        _this.dialog.layout.getRegion('center').showPanel(0);\n        return false;\n    }\n    \n    if (_this.itemsrcgrid) {\n        _this.itemsrcgrid.footer.onClick('first');\n    }\n}"
+     },
+     "region" : "center",
+     "fitToframe" : true,
+     "background" : true,
+     "title" : "Suppliers",
+     "xtype" : "GridPanel",
+     "fitContainer" : true,
+     "$ xns" : "Roo",
+     "tableName" : "itemsrc",
+     "items" : [
+      {
+       "listeners" : {
+        "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
+        "|render" : "function() \n{\n    _this.itemsrcgrid = this; \n    \n    if (_this.itemsrcpanel.active) {\n       this.footer.onClick('first');\n    }\n}",
+        "afteredit" : "function (e)\n{\n    e.record.commit();\n}"
+       },
+       "autoExpandColumn" : "itemsrc_comments",
+       "xtype" : "EditorGrid",
+       "loadMask" : true,
+       "clicksToEdit" : 1,
+       "$ xns" : "Roo.grid",
+       "* prop" : "grid",
+       "items" : [
+        {
+         "listeners" : {
+          "update" : "function (_self, record, operation)\n{\n    Roo.log(operation);\n      Roo.log(record);\n   \n    if (operation != 'commit') {\n        return;\n    }\n    if (record.data.itemsrc_vend_id * 1 < 1) {\n        return; // do not save.\n    }\n    if (record.data.itemsrc_id * 1 < 0) {\n        return; // do not save. -- updating at present...\n    }\n    \n    var p = Roo.apply({}, record.data);\n    record.set('itemsrc_id', -1);    \n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Itemsrc',\n        params : p,\n        method : 'POST',\n        success: function(res) {\n            if (record.data.itemsrc_id *1  < 1) { \n                record.set('itemsrc_id', res.data.itemsrc_id);\n            }\n        }\n    });\n    \n    \n}",
+          "beforeload" : "function (_self, o)\n{\n    \n    var id = 1 * _this.form.findField('item_id').getValue();\n    if (!id) {\n        this.removeAll();\n        return false;\n    }\n    o.params.itemsrc_item_id = id;\n}"
+         },
+         "xtype" : "Store",
+         "remoteSort" : true,
+         "$ sortInfo" : "{ field : 'itemsrc_vend_id_vend_name', direction: 'ASC' }",
+         "$ xns" : "Roo.data",
+         "* prop" : "dataSource",
+         "items" : [
+          {
+           "$ url" : "baseURL + '/Roo/itemsrc.php'",
+           "xtype" : "HttpProxy",
+           "method" : "GET",
+           "$ xns" : "Roo.data",
+           "* prop" : "proxy"
+          },
+          {
+           "id" : "id",
+           "root" : "data",
+           "xtype" : "JsonReader",
+           "$ xns" : "Roo.data",
+           "$ fields" : "[\n    {\n        'name': 'itemsrc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_uom',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_invvendoruomratio',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_minordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_multordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_leadtime',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_ranking',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_active',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_manuf_name',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_default',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_upccode',\n        'type': 'string'\n    }\n]",
+           "* prop" : "reader",
+           "totalProperty" : "total"
+          }
+         ]
+        },
+        {
+         "pageSize" : 25,
+         "xtype" : "PagingToolbar",
+         "emptyMsg" : "No itemsrc found",
+         "$ xns" : "Roo",
+         "displayInfo" : true,
+         "displayMsg" : "Displaying itemsrc{0} - {1} of {2}",
+         "* prop" : "footer"
+        },
+        {
+         "xtype" : "Toolbar",
+         "$ xns" : "Roo",
+         "* prop" : "toolbar",
+         "items" : [
+          {
+           "listeners" : {
+            "|click" : "function()\n{\n     \n    Roo.log(\"add presed\");\n     \n    // work out last \n    var grid = _this.itemsrcgrid;\n     \n    // uses form defaults or last row value.\n    var nr = grid.ds.reader.newRow({\n         itemsrc_id : 0,\n         itemsrc_item_id : _this.form.findField('item_id').getValue(),\n         itemsrc_vend_id : 0,\n         itemsrc_vend_id_vend_name : '',\n         itemsrc_vend_item_number : '',\n         itemsrc_vend_item_descrip : '',\n         itemsrc_comments           : '',\n         itemsrc_vend_uom  :           'EA',\n         itemsrc_invvendoruomratio : 1.0,\n         itemsrc_minordqty        : 0,\n         itemsrc_multordqty        : 0,\n         itemsrc_leadtime         :  30,\n         itemsrc_ranking         :   0,\n         itemsrc_active          :   true,\n         itemsrc_manuf_name       :  '',\n         itemsrc_manuf_item_number : '',\n         itemsrc_manuf_item_descrip: '',\n         itemsrc_default          : true,\n         itemsrc_upccode    : ''\n                        \n    });\n    grid.stopEditing();\n    grid.ds.insert(0, nr); \n    grid.startEditing(0, 0); // type..\n\n}\n \n"
+           },
+           "text" : "Add",
+           "xtype" : "Button",
+           "cls" : "x-btn-text-icon",
+           "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+           "$ xns" : "Roo.Toolbar"
+          }
+         ]
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 120,
+         "header" : "Vendor",
+         "$ renderer" : "function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_vend_id",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "listWidth" : 400,
+             "triggerAction" : "all",
+             "forceSelection" : true,
+             "selectOnFocus" : true,
+             "pageSize" : 20,
+             "displayField" : "vend_name",
+             "emptyText" : "Select Vendor",
+             "hiddenName" : "itemsrc_vend_id",
+             "minChars" : 2,
+             "valueField" : "vend_id",
+             "xtype" : "ComboBox",
+             "allowBlank" : false,
+             "typeAhead" : true,
+             "editable" : true,
+             "width" : 300,
+             "$ xns" : "Roo.form",
+             "* prop" : "field",
+             "name" : "itemsrc_vend_id_vend_name",
+             "qtip" : "Select vendinfo",
+             "queryParam" : "q[search]",
+             "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>",
+             "loadingText" : "Searching...",
+             "items" : [
+              {
+               "listeners" : {
+                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+               },
+               "xtype" : "Store",
+               "remoteSort" : true,
+               "$ xns" : "Roo.data",
+               "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
+               "* prop" : "store",
+               "items" : [
+                {
+                 "$ url" : "baseURL + '/Roo/vendinfo.php'",
+                 "xtype" : "HttpProxy",
+                 "method" : "GET",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
                 },
                 {
-                    "listeners" : {
-                        "render" : "function (_self)\n{\n    _this.saveBtn = this;\n}",
-                        "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n  //  _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
-                    },
-                    "text" : "Save",
-                    "xtype" : "Button",
-                    "$ xns" : "Roo",
-                    "* prop" : "buttons[]"
+                 "id" : "id",
+                 "root" : "data",
+                 "xtype" : "JsonReader",
+                 "$ xns" : "Roo.data",
+                 "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"vend_name\",\"type\":\"string\"}]",
+                 "* prop" : "reader",
+                 "totalProperty" : "total"
                 }
-            ]
+               ]
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 100,
+         "header" : "Vendor Ref#",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_vend_item_number",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "xtype" : "TextField",
+             "$ xns" : "Roo.form",
+             "* prop" : "field"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 200,
+         "header" : "Comments",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_comments",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "xtype" : "TextField",
+             "$ xns" : "Roo.form",
+             "* prop" : "field"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 50,
+         "header" : "UOM",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_vend_uom"
+        },
+        {
+         "align" : "right",
+         "xtype" : "ColumnModel",
+         "header" : "Min Qty",
+         "width" : 50,
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_minordqty",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "minValue" : 0,
+             "xtype" : "NumberField",
+             "decimalPrecision" : 0,
+             "$ xns" : "Roo.form",
+             "* prop" : "field"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "align" : "right",
+         "xtype" : "ColumnModel",
+         "header" : "Lead time",
+         "width" : 75,
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_leadtime",
+         "items" : [
+          {
+           "xtype" : "GridEditor",
+           "$ xns" : "Roo.grid",
+           "* prop" : "editor",
+           "items" : [
+            {
+             "minValue" : 0,
+             "xtype" : "NumberField",
+             "decimalPrecision" : 0,
+             "$ xns" : "Roo.form",
+             "* prop" : "field"
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 50,
+         "header" : "Active",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "itemsrc_active"
+        }
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "|activate" : "function() {\n    _this.hpanel = this;\n    if (_this.hgrid) {\n        _this.hgrid.footer.onClick('first');\n    }\n}"
+     },
+     "region" : "center",
+     "fitToframe" : true,
+     "background" : true,
+     "title" : "History",
+     "xtype" : "GridPanel",
+     "fitContainer" : true,
+     "$ xns" : "Roo",
+     "tableName" : "events",
+     "items" : [
+      {
+       "listeners" : {
+        "|render" : "function() \n{\n    _this.hgrid = this; \n    if (_this.hpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
+       },
+       "autoExpandColumn" : "remarks",
+       "xtype" : "Grid",
+       "loadMask" : true,
+       "$ xns" : "Roo.grid",
+       "* prop" : "grid",
+       "items" : [
+        {
+         "listeners" : {
+          "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params.on_table = 'item';\n    options.params.on_id = _this.form.findField('item_id').getValue();\n}"
+         },
+         "xtype" : "Store",
+         "remoteSort" : true,
+         "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }",
+         "$ xns" : "Roo.data",
+         "* prop" : "dataSource",
+         "items" : [
+          {
+           "$ url" : "baseURL + '/Roo/events.php'",
+           "method" : "GET",
+           "xtype" : "HttpProxy",
+           "$ xns" : "Roo.data",
+           "* prop" : "proxy"
+          },
+          {
+           "id" : "id",
+           "root" : "data",
+           "xtype" : "JsonReader",
+           "$ fields" : "[\n    {\n        'name': 'event_when',\n        'type': 'date'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    }\n]",
+           "$ xns" : "Roo.data",
+           "* prop" : "reader",
+           "totalProperty" : "total"
+          }
+         ]
+        },
+        {
+         "pageSize" : 25,
+         "xtype" : "PagingToolbar",
+         "emptyMsg" : "No Events found",
+         "$ xns" : "Roo",
+         "displayMsg" : "Displaying events{0} - {1} of {2}",
+         "displayInfo" : true,
+         "* prop" : "footer"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 120,
+         "header" : "Changed",
+         "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "event_when"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 200,
+         "header" : "Action",
+         "$ renderer" : "function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "action"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 200,
+         "header" : "IP Address",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "ipaddr"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 75,
+         "header" : "Who",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "person_id_name"
+        },
+        {
+         "xtype" : "ColumnModel",
+         "width" : 200,
+         "header" : "Notes",
+         "$ renderer" : "function(v) { return String.format('{0}', v); }",
+         "$ xns" : "Roo.grid",
+         "* prop" : "colModel[]",
+         "dataIndex" : "remarks"
         }
-    ]
+       ]
+      }
+     ]
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+     },
+     "text" : "Cancel",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "render" : "function (_self)\n{\n    _this.saveBtn = this;\n}",
+      "click" : "function (_self, e)\n{\n    // do some checks?\n     \n    \n  //  _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
+     },
+     "text" : "Save",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file
index 84062dc..3735395 100644 (file)
@@ -6,2559 +6,2618 @@ Roo.namespace('Pman.Dialog');
 
 Pman.Dialog.XtupleItem = {
 
-    dialog : false,
-    callback:  false,
+ _strings : {
+  'be53a0541a6d36f6ecb879fa2c584b08' :"Image",
+  '346577d22bb510368e3eddab5df2ca13' :"Reference Files",
+  'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
+  '956e816fa19ca04485c7101adbe07762' :"Displaying records {0} - {1} of {2}",
+  '82a43f89af6d331d80d441624c5c71fa' :"Default Location",
+  '538a3c9d82a4ea4250b987a357d41184' :"Item Parts",
+  '69395719de41dd8a31905b1e94c91816' :"Select classcode",
+  '03ab340b3f99e03cff9e84314ead38c0' :"Qty",
+  '5b8c99dad1893a85076709b2d3c2d2d0' :"IP Address",
+  '045a1ac263ac3a9b7420208bdc2df423' :"Select costcat",
+  '0c81971f67c0bd4b33799c5365ec2bf5' :"No Images found",
+  '151ccf95db9b81c11bb20fbc302af4b6' :"Select terms",
+  '786410e93beb0193d89f8608c54feb4b' :"Select item",
+  '0ac9012a8c03a76ee76f04321b3b7fda' :"Lead time",
+  '675c9bd3bbae30af03fe74346dcae9a7' :"Edit / Create item",
+  'dd24f967299e81b9603cb071693d5c32' :"Select vendinfo",
+  '023a5dfa857c4aa0156e6685231a1dbd' :"Select Type",
+  'e8586011952b0d098b0e568f20ca2b1f' :"Select Currency",
+  '8413c683b4b27cc3f4dbd4c90329d8ba' :"Comments",
+  '820dbd2b8f606aff866c0bbfb6b737c1' :"Changed",
+  '0eceeb45861f9585dd7a97a3e36f85c6' :"Created",
+  'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
+  '9076cbba1d9ef79280b4f39e2aa0d115' :"Nothing found",
+  '386c339d37e737a436499d423a77df0c' :"Currency",
+  '1243daf593fa297e07ab03bf06d925af' :"Searching...",
+  '7be1fa478799242847d4ef861ff6f8e1' :"Min Qty",
+  '76729937a5eb6b0fd88c42581161facd' :"Select Category",
+  '19df363d15888baa395364fbcd230c05' :"No itemsrc found",
+  '49ee3087348e8d44e1feda1917443987' :"Name",
+  '0d122b17933ab4173e9d75d55fc5e764' :"Standard Cost",
+  'df2ad52a14d681b1cd8495f8650fdb56' :"Select prodcat",
+  'e5353fc67b122d1b42181073b46cd060' :"Vendor Ref#",
+  'c19ea8f7a11074ac743c58d34830b233' :"Select plancode",
+  'ea4788705e6873b424c65e91c2846b19' :"Cancel",
+  '20f39d1311ccbd3b7e61cdd4978719f9' :"Itemsite Settings",
+  '1656a671ba692e15836cd85df374556c' :"Price List",
+  'bb8913cd17d59f182acc7be1020007b7' :"UOM",
+  '76d5bf9597c882d6513f71759df298d5' :"Displaying parts {0} - {1} of {2}",
+  '3601146c4e948c32b6424d2c0a7f0118' :"Price",
+  '1814d65a76028fdfbadab64a5a8076df' :"Suppliers",
+  '90e4ac2e5a22e53df63b6b186d8727ba' :"No Events found",
+  '4ee972120bcda675f75222c87cb9d356' :"Who",
+  '16d2b386b2034b9488996466aaae0b57' :"History",
+  '089ba2b5edc96565fc22c584ecfbb1a6' :"Displaying events{0} - {1} of {2}",
+  'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
+  '7f841b4d2f7280eb82318988c6d649d1' :"Displaying itemsrc{0} - {1} of {2}",
+  'c0ed345ec857c06b31f7e88745c9bc40' :"Displaying Images  {0} - {1} of {2}",
+  'a254c25adc7d10d7e9c4889484f875a5' :"Detail",
+  'c9cc8cce247e49bae79f15173ce97354' :"Save",
+  'ec9ceefe0c19f4c029008c23e3c947b7' :"Vendor",
+  '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
+  '004bf6c9a40003140292e97330236c53' :"Action",
+  'f4c6f851b00d5518bf888815de279aba' :"Notes",
+  'f9838de820f2a2e16241033270c68e29' :"Select uom",
+  '1063e38cb53d94d386f21227fcd84717' :"Remove",
+  '7996af9149ed376ce252e35c4da7146b' :"Select Vendor"
+ },
+
+ dialog : false,
+ callback:  false,
+
+ show : function(data, cb)
+ {
+  if (!this.dialog) {
+   this.create();
+  }
+
+  this.callback = cb;
+  this.data = data;
+  this.dialog.show(this.data._el);
+  if (this.form) {
+   this.form.reset();
+   this.form.setValues(data);
+   this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+  }
+
+ },
+
+ create : function()
+ {
+   var _this = this;
+   this.dialog = Roo.factory({
+    center : {
+     '|xns' : 'Roo',
+     alwaysShowTabs : true,
+     tabPosition : 'top',
+     xns : Roo,
+     xtype : 'LayoutRegion'
+    },
+    '|xns' : 'Roo',
+    closable : false,
+    collapsible : false,
+    height : 550,
+    modal : true,
+    resizable : false,
+    title : _this._strings['675c9bd3bbae30af03fe74346dcae9a7'],
+    width : 800,
+    xns : Roo,
+    xtype : 'LayoutDialog',
+    buttons : [
+      {
+       '|xns' : 'Roo',
+       text : _this._strings['ea4788705e6873b424c65e91c2846b19'],
+       xns : Roo,
+       xtype : 'Button',
+       listeners : {
+        click : function (_self, e)
+         {
+             _this.dialog.hide();
+         }
+       }
+      },
+{
+       '|xns' : 'Roo',
+       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'],
+       xns : Roo,
+       xtype : 'Button',
+       listeners : {
+        click : function (_self, e)
+         {
+             // do some checks?
+              
+             
+           //  _this.dialog.el.mask("Saving");
+             _this.form.doAction("submit");
+         
+         },
+        render : function (_self)
+         {
+             _this.saveBtn = this;
+         }
+       }
+      }
+    ],
+    listeners : {
+     show : function (_self)
+      {
+           _this.dialog.layout.getRegion('center').showPanel(0);
+      }
+    },
+    items : [
+     {
+      '|xns' : 'Roo',
+      region : 'center',
+      title : _this._strings['a254c25adc7d10d7e9c4889484f875a5'],
+      xns : Roo,
+      xtype : 'ContentPanel',
+      items : [
+       {
+        '|xns' : 'Roo.form',
+        labelWidth : 120,
+        method : 'POST',
+        style : 'margin:10px;',
+        url : baseURL + '/Roo/item.php',
+        xns : Roo.form,
+        xtype : 'Form',
+        listeners : {
+         actioncomplete : function(_self,action)
+          {
+              if (action.type == 'setdata') {
+                 _this.form.findField('item_number').el.dom.readOnly = true;
+                 _this.form.findField('item_type').disabled = true; 
+                 
+                 if(_this.data.item_id * 1 > 0){
+                      
+                      this.load({ 
+                          method: 'GET', 
+                          params: {
+                               '_id' : _this.data.item_id,
+                               '_with_itemsite' : 1,
+                               '_with_itemcost' : 1,
+                               '_with_prodcat' : 1 ,
+                               '_with_salesaccnt' : 1 
+                          }
+                      });
+                      return;
+                 }
+                 // if it's new..
+                 _this.form.findField('item_number').el.dom.readOnly = false;
+                 _this.form.findField('item_type').disabled = false; 
+                 _this.form.findField('item_salesaccnt').setValue('');
+                 
+                 _this.form.findField('item_type').showHide();
+                 
+                 return;
+              }
+              if (action.type == 'load') {
+                 _this.form.findField('item_type').showHide();
+                  return;
+              }
+              if (action.type =='submit') {
+              
+                  var id = _this.form.findField('item_id').getValue() * 1;
+                  if (id < 1) {
+                  
+                      this.load({ 
+                          method: 'GET', 
+                          params: {
+                               '_id' : action.result.data.item_id,
+                               '_with_itemsite' : 1,
+                               '_with_itemcost' : 1,
+                               '_with_prodcat' : 1 ,
+                               '_with_salesaccnt' : 1 
+                          }
+                      });
+                      return;
+                  }
+                  _this.dialog.hide();
+              
+                   if (_this.callback) {
+                      _this.callback.call(_this, _this.form.getValues());
+                   }
+                   _this.form.reset();
+                   return;
+              }
+          },
+         rendered : function (form)
+          {
+              _this.form= form;
+          }
+        },
+        items : [
+         {
+          '|xns' : 'Roo.form',
+          allowBlank : false,
+          fieldLabel : 'SKU',
+          name : 'item_number',
+          width : 200,
+          xns : Roo.form,
+          xtype : 'TextField'
+         },
+         {
+          '|xns' : 'Roo.form',
+          fieldLabel : 'Description',
+          name : 'item_descrip1',
+          width : 400,
+          xns : Roo.form,
+          xtype : 'TextField'
+         },
+         {
+          '|xns' : 'Roo.form',
+          fieldLabel : 'Description (2)',
+          name : 'item_descrip2',
+          width : 400,
+          xns : Roo.form,
+          xtype : 'TextField'
+         },
+         {
+          '|xns' : 'Roo.form',
+          labelWidth : 120,
+          xns : Roo.form,
+          xtype : 'Column',
+          items : [
+           {
+            store : {
+             '|xns' : 'Roo.data',
+             data : [ 
+                 [ 'P', "Purchased (eg. a standard product)"],
+                 [ 'R' , "Reference (Non-Product)"],
+                 [ 'K', "Kit (made up of products)"]  
+             ],
+             fields : [  'ftype', 'fname'],
+             xns : Roo.data,
+             xtype : 'SimpleStore'
+            },
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            displayField : 'fname',
+            editable : false,
+            emptyText : _this._strings['023a5dfa857c4aa0156e6685231a1dbd'],
+            fieldLabel : 'Type',
+            hiddenName : 'item_type',
+            listWidth : 200,
+            mode : 'local',
+            name : 'item_type_name',
+            showHide : function() {
+            
+                var it = this.getValue();
+                
+                var options = [ 
+                    'item_itemcost_id_itemcost_curr_id',
+                    'item_itemcost_id_itemcost_actcost',
+                    'item_itemsite_id_itemsite_reorderlevel',
+                    'item_itemsite_id_itemsite_leadtime',
+                    'item_itemsite_id_itemsite_location_id',
+                    'item_itemsite_id_itemsite_loccntrl',
+                    'item_itemsite_id_itemsite_stocked',
+                    'item_itemsite_id_itemsite_perishable',
+                    
+                    'item_itemsite_id_itemsite_safetystock',
+                    'item_itemsite_id_itemsite_controlmethod',
+                    'item_itemsite_id_itemsite_plancode_id',
+                    'item_itemsite_id_itemsite_costcat_id',
+                    'item_itemsite_id_itemsite_active',
+                    'item_itemsite_id_itemsite_sold'
+                    
+                ];
+                
+                var r_req = [ 
+                    'item_listprice'
+                ];
+                
+                var state = true;
+                
+                _this.standardCostFieldSet.show();
+                _this.itemsiteFieldSet.show();
+            
+                
+                switch(it) {
+                    case 'K':
+                        state = false;
+            
+                        _this.form.findField('item_listprice').allowBlank = false;
+                        _this.form.findField('item_listprice').actionMode = 'fieldEl';
+                        _this.form.findField('item_listprice').hideMode = 'display';
+                        _this.form.findField('item_listprice').show();
+                                    
+                        break;
+                        
+                    case 'R': // refrence
+                        options = options.concat(r_req);
+                        state = false;
+                        _this.standardCostFieldSet.hide();
+                        break;
+                        
+                    case 'P': // purchased..
+                        options = options.concat(r_req);
+                        // must have
+                        break;
+                }
+                
+                Roo.each(options, function(n) {
+                    var ff = _this.form.findField(n);
+                    ff.allowBlank = !state;
+                    ff.actionMode = 'fieldEl';
+                    ff.hideMode = 'display';
+                    state ? ff.show() : ff.hide(); 
+                    
+                });
+                
+                
+                if(!state){
+                    _this.standardCostFieldSet.hide();
+                    _this.itemsiteFieldSet.hide();
+            
+                }
+                
+              
+                       
+            },
+            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
+            triggerAction : 'all',
+            valueField : 'ftype',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'ComboBox',
+            listeners : {
+             beforeselect : function (combo, record, index)
+              {
+                  (function() { combo.showHide(); }).defer(100);
+              }
+            },
+            items : [
 
-    show : function(data, cb)
-    {
-        if (!this.dialog) {
-            this.create();
-        }
+            ]
 
-        this.callback = cb;
-        this.data = data;
-        this.dialog.show(this.data._el);
-        if (this.form) {
-           this.form.reset();
-           this.form.setValues(data);
-           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
-        }
+           },
+           {
+            store : {
+             proxy : {
+              '|xns' : 'Roo.data',
+              method : 'GET',
+              url : baseURL + '/Roo/classcode.php',
+              xns : Roo.data,
+              xtype : 'HttpProxy'
+             },
+             reader : {
+              '|xns' : 'Roo.data',
+              fields : [{"name":"id","type":"int"},{"name":"classcode_code","type":"string"}],
+              id : 'id',
+              root : 'data',
+              totalProperty : 'total',
+              xns : Roo.data,
+              xtype : 'JsonReader'
+             },
+             '|xns' : 'Roo.data',
+             remoteSort : true,
+             sortInfo : { direction : 'ASC', field: 'id' },
+             xns : Roo.data,
+             xtype : 'Store',
+             listeners : {
+              beforeload : function (_self, o){
+                   o.params = o.params || {};
+                   // set more here
+               }
+             },
+             items : [
+
+             ]
 
-    },
+            },
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            displayField : 'classcode_code',
+            editable : false,
+            emptyText : _this._strings['69395719de41dd8a31905b1e94c91816'],
+            fieldLabel : 'Class',
+            forceSelection : true,
+            hiddenName : 'item_classcode_id',
+            listWidth : 400,
+            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+            minChars : 2,
+            name : 'item_classcode_id_classcode_code',
+            pageSize : 20,
+            qtip : _this._strings['69395719de41dd8a31905b1e94c91816'],
+            queryParam : '',
+            selectOnFocus : true,
+            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>',
+            triggerAction : 'all',
+            typeAhead : true,
+            valueField : 'classcode_id',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'ComboBox',
+            items : [
+
+            ]
+
+           },
+           {
+            store : {
+             proxy : {
+              '|xns' : 'Roo.data',
+              method : 'GET',
+              url : baseURL + '/Roo/uom.php',
+              xns : Roo.data,
+              xtype : 'HttpProxy'
+             },
+             reader : {
+              '|xns' : 'Roo.data',
+              fields : [
+                  {"name":"id","type":"int"},
+                  {"name":"uom_name","type":"string"},
+                  {"name":"uom_descrip","type":"string"},
+              ],
+              id : 'id',
+              root : 'data',
+              totalProperty : 'total',
+              xns : Roo.data,
+              xtype : 'JsonReader'
+             },
+             '|xns' : 'Roo.data',
+             remoteSort : true,
+             sortInfo : { direction : 'ASC', field: 'uom_name' },
+             xns : Roo.data,
+             xtype : 'Store',
+             listeners : {
+              beforeload : function (_self, o){
+                   o.params = o.params || {};
+                   // set more here
+               }
+             },
+             items : [
+
+             ]
 
-    create : function()
-    {
-        var _this = this;
-        this.dialog = Roo.factory({
-            center : {
-                '|xns' : 'Roo',
-                alwaysShowTabs : true,
-                xtype : 'LayoutRegion',
-                tabPosition : 'top',
-                xns : Roo
             },
-            '|xns' : 'Roo',
-            modal : true,
-            collapsible : false,
-            title : "Edit / Create item",
-            xtype : 'LayoutDialog',
-            width : 800,
-            xns : Roo,
-            closable : false,
-            resizable : false,
-            height : 550,
-            buttons : [
-                {
-                       '|xns' : 'Roo',
-                       text : "Cancel",
-                       xtype : 'Button',
-                       xns : Roo,
-                       listeners : {
-                               click : function (_self, e)
-                                  {
-                                      _this.dialog.hide();
-                                  }
-                       }
-                   },
-{
-                       '|xns' : 'Roo',
-                       text : "Save",
-                       xtype : 'Button',
-                       xns : Roo,
-                       listeners : {
-                               render : function (_self)
-                                  {
-                                      _this.saveBtn = this;
-                                  },
-                               click : function (_self, e)
-                                  {
-                                      // do some checks?
-                                       
-                                      
-                                    //  _this.dialog.el.mask("Saving");
-                                      _this.form.doAction("submit");
-                                  
-                                  }
-                       }
-                   }
-            ],
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            displayField : 'uom_descrip',
+            editable : false,
+            emptyText : _this._strings['f9838de820f2a2e16241033270c68e29'],
+            fieldLabel : 'Invoice UOM',
+            forceSelection : true,
+            hiddenName : 'item_inv_uom_id',
+            listWidth : 400,
+            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+            minChars : 2,
+            name : 'item_inv_uom_id_uom_descrip',
+            pageSize : 20,
+            qtip : _this._strings['69395719de41dd8a31905b1e94c91816'],
+            queryParam : '',
+            selectOnFocus : true,
+            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
+            triggerAction : 'all',
+            typeAhead : true,
+            valueField : 'uom_id',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'ComboBox',
+            items : [
+
+            ]
+
+           },
+           {
+            store : {
+             proxy : {
+              '|xns' : 'Roo.data',
+              method : 'GET',
+              url : baseURL + '/Roo/uom.php',
+              xns : Roo.data,
+              xtype : 'HttpProxy'
+             },
+             reader : {
+              '|xns' : 'Roo.data',
+              fields : [
+                  {"name":"id","type":"int"},
+                  {"name":"uom_name","type":"string"},
+                  {"name":"uom_descrip","type":"string"},
+              ],
+              id : 'id',
+              root : 'data',
+              totalProperty : 'total',
+              xns : Roo.data,
+              xtype : 'JsonReader'
+             },
+             '|xns' : 'Roo.data',
+             remoteSort : true,
+             sortInfo : { direction : 'ASC', field: 'uom_name' },
+             xns : Roo.data,
+             xtype : 'Store',
+             listeners : {
+              beforeload : function (_self, o){
+                   o.params = o.params || {};
+                   // set more here
+               }
+             },
+             items : [
+
+             ]
+
+            },
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            displayField : 'uom_descrip',
+            editable : false,
+            emptyText : _this._strings['f9838de820f2a2e16241033270c68e29'],
+            fieldLabel : 'Price UOM',
+            forceSelection : true,
+            hiddenName : 'item_price_uom_id',
+            listWidth : 400,
+            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+            minChars : 2,
+            name : 'item_price_uom_id_uom_descrip',
+            pageSize : 20,
+            qtip : _this._strings['69395719de41dd8a31905b1e94c91816'],
+            queryParam : '',
+            selectOnFocus : true,
+            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
+            triggerAction : 'all',
+            typeAhead : true,
+            valueField : 'uom_id',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'ComboBox',
+            items : [
+
+            ]
+
+           },
+           {
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            allowDecimals : true,
+            decimalPrecision : 2,
+            fieldLabel : 'Weight',
+            name : 'item_prodweight',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'NumberField'
+           },
+           {
+            '|xns' : 'Roo.form',
+            fieldLabel : 'Item comments',
+            height : 100,
+            name : 'item_comments',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'TextArea'
+           },
+           {
+            '|xns' : 'Roo.form',
+            fieldLabel : 'Item sold',
+            inputValue : true,
+            name : 'item_sold',
+            valueOff : 0,
+            width : 75,
+            xns : Roo.form,
+            xtype : 'Checkbox'
+           },
+           {
+            '|xns' : 'Roo.form',
+            fieldLabel : 'Item active',
+            inputValue : true,
+            name : 'item_active',
+            valueOff : 0,
+            width : 75,
+            xns : Roo.form,
+            xtype : 'Checkbox'
+           },
+           {
+            store : {
+             proxy : {
+              '|xns' : 'Roo.data',
+              method : 'GET',
+              url : baseURL + '/Roo/prodcat.php',
+              xns : Roo.data,
+              xtype : 'HttpProxy'
+             },
+             reader : {
+              '|xns' : 'Roo.data',
+              fields : [{"name":"id","type":"int"},{"name":"prodcat_code","type":"string"}],
+              id : 'id',
+              root : 'data',
+              totalProperty : 'total',
+              xns : Roo.data,
+              xtype : 'JsonReader'
+             },
+             '|xns' : 'Roo.data',
+             remoteSort : true,
+             sortInfo : { direction : 'ASC', field: 'id' },
+             xns : Roo.data,
+             xtype : 'Store',
+             listeners : {
+              beforeload : function (_self, o){
+                   o.params = o.params || {};
+                   // set more here
+               }
+             },
+             items : [
+
+             ]
+
+            },
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            alwaysQuery : true,
+            displayField : 'prodcat_code',
+            editable : false,
+            emptyText : _this._strings['76729937a5eb6b0fd88c42581161facd'],
+            fieldLabel : 'Product Category',
+            forceSelection : true,
+            hiddenName : 'item_prodcat_id',
+            listWidth : 400,
+            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+            minChars : 2,
+            name : 'item_prodcat_id_prodcat_code',
+            pageSize : 20,
+            qtip : _this._strings['df2ad52a14d681b1cd8495f8650fdb56'],
+            queryParam : '',
+            selectOnFocus : true,
+            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>',
+            triggerAction : 'all',
+            typeAhead : true,
+            valueField : 'prodcat_id',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'ComboBox',
+            listeners : {
+             add : function (combo)
+              {
+                  Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});
+              },
+             edit : function (combo, record)
+              {
+                  var s = _this.form.findField('item_prodcat_id').getValue() * 1;
+                  if(s < 1){
+                      Roo.MessageBox.alert('Error','Please select a account assignment');
+                      return;
+                  }
+                  Pman.Dialog.XtupleProdcat.show({prodcat_id : s});
+              }
+            },
+            items : [
+
+            ]
+
+           },
+           {
+            '|xns' : 'Roo.form',
+            fieldLabel : 'Sales Account',
+            name : 'item_salesaccnt',
+            xns : Roo.form,
+            xtype : 'DisplayField'
+           },
+           {
+            '|xns' : 'Roo.form',
+            fieldLabel : 'Item listprice',
+            name : 'item_listprice',
+            width : 200,
+            xns : Roo.form,
+            xtype : 'NumberField'
+           },
+           {
+            '|xns' : 'Roo.form',
+            legend : _this._strings['0d122b17933ab4173e9d75d55fc5e764'],
+            style : 'width:320px',
+            xns : Roo.form,
+            xtype : 'FieldSet',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.standardCostFieldSet = _self;
+              }
+            },
+            items : [
+             {
+              store : {
+               proxy : {
+                '|xns' : 'Roo.data',
+                method : 'GET',
+                url : baseURL + '/Roo/curr_symbol.php',
+                xns : Roo.data,
+                xtype : 'HttpProxy'
+               },
+               reader : {
+                '|xns' : 'Roo.data',
+                fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
+                id : 'curr_id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                xtype : 'JsonReader'
+               },
+               '|xns' : 'Roo.data',
+               remoteSort : true,
+               sortInfo : { direction : 'ASC', field: 'curr_symbol' },
+               xns : Roo.data,
+               xtype : 'Store',
+               listeners : {
+                beforeload : function (_self, o){
+                     o.params = o.params || {};
+                     // set more here
+                    
+                 }
+               },
+               items : [
+
+               ]
+
+              },
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              displayField : 'curr_name',
+              editable : false,
+              emptyText : _this._strings['e8586011952b0d098b0e568f20ca2b1f'],
+              fieldLabel : 'Currency',
+              forceSelection : true,
+              hiddenName : 'item_itemcost_id_itemcost_curr_id',
+              listWidth : 400,
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+              minChars : 2,
+              name : 'curr_name',
+              pageSize : 20,
+              qtip : _this._strings['e8586011952b0d098b0e568f20ca2b1f'],
+              queryParam : 'query[curr_name]',
+              selectOnFocus : true,
+              tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
+              triggerAction : 'all',
+              typeAhead : true,
+              valueField : 'curr_id',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'ComboBox',
+              items : [
+
+              ]
+
+             },
+             {
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              fieldLabel : 'Value',
+              name : 'item_itemcost_id_itemcost_actcost',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'NumberField'
+             }
+            ]
+
+           }
+          ]
+
+         },
+         {
+          '|xns' : 'Roo.form',
+          xns : Roo.form,
+          xtype : 'Column',
+          items : [
+           {
+            '|xns' : 'Roo.form',
+            labelWidth : 120,
+            legend : _this._strings['20f39d1311ccbd3b7e61cdd4978719f9'],
+            style : 'width:335px;',
+            xns : Roo.form,
+            xtype : 'FieldSet',
             listeners : {
-               show : function (_self)
-                  {
-                       _this.dialog.layout.getRegion('center').showPanel(0);
-                  }
+             render : function (_self)
+              {
+                  _this.itemsiteFieldSet = _self;
+              }
             },
             items : [
-               {
-                    '|xns' : 'Roo',
-                    region : 'center',
-                    xtype : 'ContentPanel',
-                    title : "Detail",
-                    xns : Roo,
-                    items : [
-                       {
-                            '|xns' : 'Roo.form',
-                            url : baseURL + '/Roo/item.php',
-                            style : 'margin:10px;',
-                            method : 'POST',
-                            xtype : 'Form',
-                            labelWidth : 120,
-                            xns : Roo.form,
-                            listeners : {
-                               actioncomplete : function(_self,action)
-                                  {
-                                      if (action.type == 'setdata') {
-                                         _this.form.findField('item_number').el.dom.readOnly = true;
-                                         _this.form.findField('item_type').disabled = true; 
-                                         
-                                         if(_this.data.item_id * 1 > 0){
-                                              
-                                              this.load({ 
-                                                  method: 'GET', 
-                                                  params: {
-                                                       '_id' : _this.data.item_id,
-                                                       '_with_itemsite' : 1,
-                                                       '_with_itemcost' : 1,
-                                                       '_with_prodcat' : 1 ,
-                                                       '_with_salesaccnt' : 1 
-                                                  }
-                                              });
-                                              return;
-                                         }
-                                         // if it's new..
-                                         _this.form.findField('item_number').el.dom.readOnly = false;
-                                         _this.form.findField('item_type').disabled = false; 
-                                         _this.form.findField('item_salesaccnt').setValue('');
-                                         
-                                         _this.form.findField('item_type').showHide();
-                                         
-                                         return;
-                                      }
-                                      if (action.type == 'load') {
-                                         _this.form.findField('item_type').showHide();
-                                          return;
-                                      }
-                                      if (action.type =='submit') {
-                                      
-                                          var id = _this.form.findField('item_id').getValue() * 1;
-                                          if (id < 1) {
-                                          
-                                              this.load({ 
-                                                  method: 'GET', 
-                                                  params: {
-                                                       '_id' : action.result.data.item_id,
-                                                       '_with_itemsite' : 1,
-                                                       '_with_itemcost' : 1,
-                                                       '_with_prodcat' : 1 ,
-                                                       '_with_salesaccnt' : 1 
-                                                  }
-                                              });
-                                              return;
-                                          }
-                                          _this.dialog.hide();
-                                      
-                                           if (_this.callback) {
-                                              _this.callback.call(_this, _this.form.getValues());
-                                           }
-                                           _this.form.reset();
-                                           return;
-                                      }
-                                  },
-                               rendered : function (form)
-                                  {
-                                      _this.form= form;
-                                  }
-                            },
-                            items : [
-                               {
-                                    '|xns' : 'Roo.form',
-                                    fieldLabel : 'SKU',
-                                    xtype : 'TextField',
-                                    allowBlank : false,
-                                    width : 200,
-                                    xns : Roo.form,
-                                    name : 'item_number'
-                                },
-                               {
-                                    '|xns' : 'Roo.form',
-                                    fieldLabel : 'Description',
-                                    xtype : 'TextField',
-                                    width : 400,
-                                    xns : Roo.form,
-                                    name : 'item_descrip1'
-                                },
-                               {
-                                    '|xns' : 'Roo.form',
-                                    fieldLabel : 'Description (2)',
-                                    xtype : 'TextField',
-                                    width : 400,
-                                    xns : Roo.form,
-                                    name : 'item_descrip2'
-                                },
-                               {
-                                    '|xns' : 'Roo.form',
-                                    xtype : 'Column',
-                                    labelWidth : 120,
-                                    xns : Roo.form,
-                                    items : [
-                                       {
-                                            store : {
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'SimpleStore',
-                                                data : [ 
-                                                    [ 'P', "Purchased (eg. a standard product)"],
-                                                    [ 'R' , "Reference (Non-Product)"],
-                                                    [ 'K', "Kit (made up of products)"]  
-                                                ],
-                                                fields : [  'ftype', 'fname'],
-                                                xns : Roo.data
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            listWidth : 200,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'Type',
-                                            displayField : 'fname',
-                                            emptyText : "Select Type",
-                                            hiddenName : 'item_type',
-                                            valueField : 'ftype',
-                                            xtype : 'ComboBox',
-                                            allowBlank : false,
-                                            showHide : function() {
-                                            
-                                                var it = this.getValue();
-                                                
-                                                var options = [ 
-                                                    'item_itemcost_id_itemcost_curr_id',
-                                                    'item_itemcost_id_itemcost_actcost',
-                                                    'item_itemsite_id_itemsite_reorderlevel',
-                                                    'item_itemsite_id_itemsite_leadtime',
-                                                    'item_itemsite_id_itemsite_location_id',
-                                                    'item_itemsite_id_itemsite_loccntrl',
-                                                    'item_itemsite_id_itemsite_stocked',
-                                                    'item_itemsite_id_itemsite_perishable',
-                                                    
-                                                    'item_itemsite_id_itemsite_safetystock',
-                                                    'item_itemsite_id_itemsite_controlmethod',
-                                                    'item_itemsite_id_itemsite_plancode_id',
-                                                    'item_itemsite_id_itemsite_costcat_id',
-                                                    'item_itemsite_id_itemsite_active',
-                                                    'item_itemsite_id_itemsite_sold'
-                                                    
-                                                ];
-                                                
-                                                var r_req = [ 
-                                                    'item_listprice'
-                                                ];
-                                                
-                                                var state = true;
-                                                
-                                                _this.standardCostFieldSet.show();
-                                                _this.itemsiteFieldSet.show();
-                                            
-                                                
-                                                switch(it) {
-                                                    case 'K':
-                                                        state = false;
-                                            
-                                                        _this.form.findField('item_listprice').allowBlank = false;
-                                                        _this.form.findField('item_listprice').actionMode = 'fieldEl';
-                                                        _this.form.findField('item_listprice').hideMode = 'display';
-                                                        _this.form.findField('item_listprice').show();
-                                                                    
-                                                        break;
-                                                        
-                                                    case 'R': // refrence
-                                                        options = options.concat(r_req);
-                                                        state = false;
-                                                        _this.standardCostFieldSet.hide();
-                                                        break;
-                                                        
-                                                    case 'P': // purchased..
-                                                        options = options.concat(r_req);
-                                                        // must have
-                                                        break;
-                                                }
-                                                
-                                                Roo.each(options, function(n) {
-                                                    var ff = _this.form.findField(n);
-                                                    ff.allowBlank = !state;
-                                                    ff.actionMode = 'fieldEl';
-                                                    ff.hideMode = 'display';
-                                                    state ? ff.show() : ff.hide(); 
-                                                    
-                                                });
-                                                
-                                                
-                                                if(!state){
-                                                    _this.standardCostFieldSet.hide();
-                                                    _this.itemsiteFieldSet.hide();
-                                            
-                                                }
-                                                
-                                              
-                                                       
-                                            },
-                                            editable : false,
-                                            width : 200,
-                                            xns : Roo.form,
-                                            mode : 'local',
-                                            name : 'item_type_name',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
-                                            listeners : {
-                                               beforeselect : function (combo, record, index)
-                                                  {
-                                                      (function() { combo.showHide(); }).defer(100);
-                                                  }
-                                            },
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Roo/classcode.php',
-                                                    xtype : 'HttpProxy',
-                                                    method : 'GET',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    xns : Roo.data,
-                                                    fields : [{"name":"id","type":"int"},{"name":"classcode_code","type":"string"}],
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'id' },
-                                                xns : Roo.data,
-                                                listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              // set more here
-                                                          }
-                                                },
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'Class',
-                                            forceSelection : true,
-                                            selectOnFocus : true,
-                                            pageSize : 20,
-                                            displayField : 'classcode_code',
-                                            emptyText : "Select classcode",
-                                            hiddenName : 'item_classcode_id',
-                                            minChars : 2,
-                                            valueField : 'classcode_id',
-                                            xtype : 'ComboBox',
-                                            allowBlank : false,
-                                            typeAhead : true,
-                                            editable : false,
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_classcode_id_classcode_code',
-                                            qtip : "Select classcode",
-                                            queryParam : '',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{classcode_code}</b> </div>',
-                                            loadingText : "Searching...",
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Roo/uom.php',
-                                                    xtype : 'HttpProxy',
-                                                    method : 'GET',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    xns : Roo.data,
-                                                    fields : [
-                                                        {"name":"id","type":"int"},
-                                                        {"name":"uom_name","type":"string"},
-                                                        {"name":"uom_descrip","type":"string"},
-                                                    ],
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'uom_name' },
-                                                xns : Roo.data,
-                                                listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              // set more here
-                                                          }
-                                                },
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'Invoice UOM',
-                                            forceSelection : true,
-                                            selectOnFocus : true,
-                                            pageSize : 20,
-                                            displayField : 'uom_descrip',
-                                            emptyText : "Select uom",
-                                            hiddenName : 'item_inv_uom_id',
-                                            minChars : 2,
-                                            valueField : 'uom_id',
-                                            xtype : 'ComboBox',
-                                            allowBlank : false,
-                                            typeAhead : true,
-                                            editable : false,
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_inv_uom_id_uom_descrip',
-                                            qtip : "Select classcode",
-                                            queryParam : '',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
-                                            loadingText : "Searching...",
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Roo/uom.php',
-                                                    method : 'GET',
-                                                    xtype : 'HttpProxy',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    xns : Roo.data,
-                                                    fields : [
-                                                        {"name":"id","type":"int"},
-                                                        {"name":"uom_name","type":"string"},
-                                                        {"name":"uom_descrip","type":"string"},
-                                                    ],
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'uom_name' },
-                                                xns : Roo.data,
-                                                listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              // set more here
-                                                          }
-                                                },
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'Price UOM',
-                                            forceSelection : true,
-                                            selectOnFocus : true,
-                                            pageSize : 20,
-                                            displayField : 'uom_descrip',
-                                            emptyText : "Select uom",
-                                            hiddenName : 'item_price_uom_id',
-                                            minChars : 2,
-                                            valueField : 'uom_id',
-                                            xtype : 'ComboBox',
-                                            allowBlank : false,
-                                            typeAhead : true,
-                                            editable : false,
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_price_uom_id_uom_descrip',
-                                            qtip : "Select classcode",
-                                            queryParam : '',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{uom_descrip}</b> </div>',
-                                            loadingText : "Searching...",
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Weight',
-                                            xtype : 'NumberField',
-                                            allowBlank : false,
-                                            allowDecimals : true,
-                                            decimalPrecision : 2,
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_prodweight'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Item comments',
-                                            xtype : 'TextArea',
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_comments',
-                                            height : 100
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Item sold',
-                                            inputValue : true,
-                                            xtype : 'Checkbox',
-                                            valueOff : 0,
-                                            width : 75,
-                                            xns : Roo.form,
-                                            name : 'item_sold'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Item active',
-                                            inputValue : true,
-                                            xtype : 'Checkbox',
-                                            valueOff : 0,
-                                            width : 75,
-                                            xns : Roo.form,
-                                            name : 'item_active'
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Roo/prodcat.php',
-                                                    method : 'GET',
-                                                    xtype : 'HttpProxy',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    id : 'id',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    xns : Roo.data,
-                                                    fields : [{"name":"id","type":"int"},{"name":"prodcat_code","type":"string"}],
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                remoteSort : true,
-                                                xns : Roo.data,
-                                                sortInfo : { direction : 'ASC', field: 'id' },
-                                                listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              // set more here
-                                                          }
-                                                },
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            alwaysQuery : true,
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'Product Category',
-                                            forceSelection : true,
-                                            selectOnFocus : true,
-                                            pageSize : 20,
-                                            displayField : 'prodcat_code',
-                                            emptyText : "Select Category",
-                                            hiddenName : 'item_prodcat_id',
-                                            minChars : 2,
-                                            valueField : 'prodcat_id',
-                                            xtype : 'ComboBox',
-                                            allowBlank : false,
-                                            typeAhead : true,
-                                            editable : false,
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_prodcat_id_prodcat_code',
-                                            qtip : "Select prodcat",
-                                            queryParam : '',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{prodcat_code}</b> </div>',
-                                            loadingText : "Searching...",
-                                            listeners : {
-                                               add : function (combo)
-                                                  {
-                                                      Pman.Dialog.XtupleProdcat.show({prodcat_id : 0});
-                                                  },
-                                               edit : function (combo, record)
-                                                  {
-                                                      var s = _this.form.findField('item_prodcat_id').getValue() * 1;
-                                                      if(s < 1){
-                                                          Roo.MessageBox.alert('Error','Please select a account assignment');
-                                                          return;
-                                                      }
-                                                      Pman.Dialog.XtupleProdcat.show({prodcat_id : s});
-                                                  }
-                                            },
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Sales Account',
-                                            xtype : 'DisplayField',
-                                            xns : Roo.form,
-                                            name : 'item_salesaccnt'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Item listprice',
-                                            xtype : 'NumberField',
-                                            width : 200,
-                                            xns : Roo.form,
-                                            name : 'item_listprice'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            xtype : 'FieldSet',
-                                            legend : "Standard Cost",
-                                            style : 'width:320px',
-                                            xns : Roo.form,
-                                            listeners : {
-                                               render : function (_self)
-                                                  {
-                                                      _this.standardCostFieldSet = _self;
-                                                  }
-                                            },
-                                            items : [
-                                               {
-                                                    store : {
-                                                        proxy : {
-                                                            '|xns' : 'Roo.data',
-                                                            url : baseURL + '/Roo/curr_symbol.php',
-                                                            method : 'GET',
-                                                            xtype : 'HttpProxy',
-                                                            xns : Roo.data
-                                                        },
-                                                        reader : {
-                                                            '|xns' : 'Roo.data',
-                                                            id : 'curr_id',
-                                                            root : 'data',
-                                                            xtype : 'JsonReader',
-                                                            xns : Roo.data,
-                                                            fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
-                                                            totalProperty : 'total'
-                                                        },
-                                                        '|xns' : 'Roo.data',
-                                                        xtype : 'Store',
-                                                        remoteSort : true,
-                                                        sortInfo : { direction : 'ASC', field: 'curr_symbol' },
-                                                        xns : Roo.data,
-                                                        listeners : {
-                                                               beforeload : function (_self, o){
-                                                                      o.params = o.params || {};
-                                                                      // set more here
-                                                                     
-                                                                  }
-                                                        },
-                                                        items : [
-
-                                                        ]
-
-                                                    },
-                                                    '|xns' : 'Roo.form',
-                                                    listWidth : 400,
-                                                    triggerAction : 'all',
-                                                    fieldLabel : 'Currency',
-                                                    forceSelection : true,
-                                                    selectOnFocus : true,
-                                                    pageSize : 20,
-                                                    displayField : 'curr_name',
-                                                    emptyText : "Select Currency",
-                                                    hiddenName : 'item_itemcost_id_itemcost_curr_id',
-                                                    minChars : 2,
-                                                    valueField : 'curr_id',
-                                                    xtype : 'ComboBox',
-                                                    allowBlank : false,
-                                                    typeAhead : true,
-                                                    editable : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'curr_name',
-                                                    qtip : "Select Currency",
-                                                    queryParam : 'query[curr_name]',
-                                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_name}</b> </div>',
-                                                    loadingText : "Searching...",
-                                                    items : [
-
-                                                    ]
-
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Value',
-                                                    xtype : 'NumberField',
-                                                    allowBlank : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemcost_id_itemcost_actcost'
-                                                }
-                                            ]
-
-                                        }
-                                    ]
-
-                                },
-                               {
-                                    '|xns' : 'Roo.form',
-                                    xtype : 'Column',
-                                    xns : Roo.form,
-                                    items : [
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            xtype : 'FieldSet',
-                                            legend : "Itemsite Settings",
-                                            xns : Roo.form,
-                                            style : 'width:335px;',
-                                            labelWidth : 120,
-                                            listeners : {
-                                               render : function (_self)
-                                                  {
-                                                      _this.itemsiteFieldSet = _self;
-                                                  }
-                                            },
-                                            items : [
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Reorder Level',
-                                                    xtype : 'NumberField',
-                                                    allowBlank : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_reorderlevel'
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Stock Safety Level',
-                                                    xtype : 'NumberField',
-                                                    allowBlank : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_safetystock'
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Lead time (Days)',
-                                                    xtype : 'NumberField',
-                                                    allowBlank : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_leadtime'
-                                                },
-                                               {
-                                                    store : {
-                                                        '|xns' : 'Roo.data',
-                                                        xtype : 'SimpleStore',
-                                                        data : [ 
-                                                            [ 'N', "None"],
-                                                            [ 'R' , "Regular"]
-                                                        ],
-                                                        fields : [  'ftype', 'fname'],
-                                                        xns : Roo.data
-                                                    },
-                                                    '|xns' : 'Roo.form',
-                                                    listWidth : 200,
-                                                    triggerAction : 'all',
-                                                    fieldLabel : 'Control Method',
-                                                    displayField : 'fname',
-                                                    hiddenName : 'item_itemsite_id_itemsite_controlmethod',
-                                                    valueField : 'ftype',
-                                                    xtype : 'ComboBox',
-                                                    allowBlank : false,
-                                                    editable : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    mode : 'local',
-                                                    name : 'item_itemsite_id_itemsite_controlmethod_name',
-                                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
-                                                    items : [
-
-                                                    ]
-
-                                                },
-                                               {
-                                                    store : {
-                                                        proxy : {
-                                                            '|xns' : 'Roo.data',
-                                                            url : baseURL + '/Roo/plancode.php',
-                                                            method : 'GET',
-                                                            xtype : 'HttpProxy',
-                                                            xns : Roo.data
-                                                        },
-                                                        reader : {
-                                                            '|xns' : 'Roo.data',
-                                                            id : 'id',
-                                                            root : 'data',
-                                                            xtype : 'JsonReader',
-                                                            xns : Roo.data,
-                                                            fields : [{"name":"id","type":"int"},{"name":"plancode_code","type":"string"}],
-                                                            totalProperty : 'total'
-                                                        },
-                                                        '|xns' : 'Roo.data',
-                                                        xtype : 'Store',
-                                                        remoteSort : true,
-                                                        xns : Roo.data,
-                                                        sortInfo : { direction : 'ASC', field: 'id' },
-                                                        listeners : {
-                                                               beforeload : function (_self, o){
-                                                                      o.params = o.params || {};
-                                                                      // set more here
-                                                                  }
-                                                        },
-                                                        items : [
-
-                                                        ]
-
-                                                    },
-                                                    '|xns' : 'Roo.form',
-                                                    listWidth : 400,
-                                                    triggerAction : 'all',
-                                                    fieldLabel : 'Planner Code',
-                                                    forceSelection : true,
-                                                    selectOnFocus : true,
-                                                    pageSize : 20,
-                                                    displayField : 'plancode_name',
-                                                    emptyText : "Select plancode",
-                                                    hiddenName : 'item_itemsite_id_itemsite_plancode_id',
-                                                    minChars : 2,
-                                                    valueField : 'plancode_id',
-                                                    xtype : 'ComboBox',
-                                                    allowBlank : false,
-                                                    typeAhead : true,
-                                                    editable : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'plancode_name',
-                                                    qtip : "Select plancode",
-                                                    queryParam : '',
-                                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>',
-                                                    loadingText : "Searching...",
-                                                    items : [
-
-                                                    ]
-
-                                                },
-                                               {
-                                                    store : {
-                                                        proxy : {
-                                                            '|xns' : 'Roo.data',
-                                                            url : baseURL + '/Roo/costcat.php',
-                                                            method : 'GET',
-                                                            xtype : 'HttpProxy',
-                                                            xns : Roo.data
-                                                        },
-                                                        reader : {
-                                                            '|xns' : 'Roo.data',
-                                                            id : 'id',
-                                                            root : 'data',
-                                                            xtype : 'JsonReader',
-                                                            xns : Roo.data,
-                                                            fields : [{"name":"id","type":"int"},{"name":"costcat_code","type":"string"}],
-                                                            totalProperty : 'total'
-                                                        },
-                                                        '|xns' : 'Roo.data',
-                                                        xtype : 'Store',
-                                                        remoteSort : true,
-                                                        xns : Roo.data,
-                                                        sortInfo : { direction : 'ASC', field: 'id' },
-                                                        listeners : {
-                                                               beforeload : function (_self, o){
-                                                                      o.params = o.params || {};
-                                                                      // set more here
-                                                                  }
-                                                        },
-                                                        items : [
-
-                                                        ]
-
-                                                    },
-                                                    '|xns' : 'Roo.form',
-                                                    listWidth : 400,
-                                                    triggerAction : 'all',
-                                                    fieldLabel : 'Costcat',
-                                                    forceSelection : true,
-                                                    selectOnFocus : true,
-                                                    pageSize : 20,
-                                                    displayField : 'costcat_code',
-                                                    emptyText : "Select costcat",
-                                                    hiddenName : 'item_itemsite_id_itemsite_costcat_id',
-                                                    minChars : 2,
-                                                    valueField : 'costcat_id',
-                                                    xtype : 'ComboBox',
-                                                    allowBlank : false,
-                                                    typeAhead : true,
-                                                    editable : false,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'costcat_code',
-                                                    qtip : "Select costcat",
-                                                    queryParam : '',
-                                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>',
-                                                    loadingText : "Searching...",
-                                                    items : [
-
-                                                    ]
-
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Active',
-                                                    inputValue : true,
-                                                    xtype : 'Checkbox',
-                                                    valueOff : 0,
-                                                    width : 75,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_active'
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Sold',
-                                                    inputValue : true,
-                                                    xtype : 'Checkbox',
-                                                    valueOff : 0,
-                                                    width : 75,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_sold'
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Stocked',
-                                                    inputValue : true,
-                                                    xtype : 'Checkbox',
-                                                    valueOff : 0,
-                                                    width : 75,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_stocked'
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Perishable',
-                                                    inputValue : true,
-                                                    xtype : 'Checkbox',
-                                                    valueOff : 0,
-                                                    width : 75,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_perishable'
-                                                },
-                                               {
-                                                    '|xns' : 'Roo.form',
-                                                    fieldLabel : 'Multi Location',
-                                                    inputValue : true,
-                                                    xtype : 'Checkbox',
-                                                    valueOff : 0,
-                                                    width : 100,
-                                                    xns : Roo.form,
-                                                    name : 'item_itemsite_id_itemsite_loccntrl'
-                                                },
-                                               {
-                                                    store : {
-                                                        proxy : {
-                                                            '|xns' : 'Roo.data',
-                                                            url : baseURL + '/Roo/location.php',
-                                                            xtype : 'HttpProxy',
-                                                            method : 'GET',
-                                                            xns : Roo.data
-                                                        },
-                                                        reader : {
-                                                            '|xns' : 'Roo.data',
-                                                            id : 'location_id',
-                                                            root : 'data',
-                                                            xtype : 'JsonReader',
-                                                            fields : [{"name":"location_id","type":"int"},"location_name"],
-                                                            xns : Roo.data,
-                                                            totalProperty : 'total'
-                                                        },
-                                                        '|xns' : 'Roo.data',
-                                                        xtype : 'Store',
-                                                        remoteSort : true,
-                                                        sortInfo : { direction : 'ASC', field: 'location_name' },
-                                                        xns : Roo.data,
-                                                        listeners : {
-                                                               beforeload : function (_self, o){
-                                                                      o.params = o.params || {};
-                                                                      // set more here
-                                                                       o.params.location_netable = 1;
-                                                                       o.params._notinternalcompany = 1;
-                                                                       o.params.location_restrict = 0;
-                                                                  }
-                                                        },
-                                                        items : [
-
-                                                        ]
-
-                                                    },
-                                                    '|xns' : 'Roo.form',
-                                                    listWidth : 400,
-                                                    triggerAction : 'all',
-                                                    fieldLabel : 'Default Location',
-                                                    forceSelection : true,
-                                                    selectOnFocus : true,
-                                                    pageSize : 200,
-                                                    displayField : 'location_name',
-                                                    emptyText : "Default Location",
-                                                    hiddenName : 'item_itemsite_id_itemsite_location_id',
-                                                    minChars : 2,
-                                                    valueField : 'location_id',
-                                                    xtype : 'ComboBox',
-                                                    allowBlank : false,
-                                                    typeAhead : false,
-                                                    editable : true,
-                                                    width : 200,
-                                                    xns : Roo.form,
-                                                    name : 'location_name',
-                                                    qtip : "Select terms",
-                                                    queryParam : 'query[location_name]',
-                                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>',
-                                                    loadingText : "Searching...",
-                                                    items : [
-
-                                                    ]
-
-                                                }
-                                            ]
-
-                                        }
-                                    ]
-
-                                },
-                               {
-                                    '|xns' : 'Roo.form',
-                                    xtype : 'Hidden',
-                                    width : 75,
-                                    xns : Roo.form,
-                                    name : 'item_id'
-                                }
-                            ]
-
-                        }
-                    ]
-
-                },
-               {
-                    grid : {
-                        toolbar : {
-                            '|xns' : 'Roo',
-                            xtype : 'Toolbar',
-                            xns : Roo,
-                            items : [
-                               {
-                                    store : {
-                                        proxy : {
-                                            '|xns' : 'Roo.data',
-                                            url : baseURL + '/Roo/item.php',
-                                            xtype : 'HttpProxy',
-                                            method : 'GET',
-                                            xns : Roo.data
-                                        },
-                                        reader : {
-                                            '|xns' : 'Roo.data',
-                                            id : 'id',
-                                            root : 'data',
-                                            xtype : 'JsonReader',
-                                            fields : [
-                                                {"name":"id","type":"int"},
-                                                {"name":"item_number","type":"string"}
-                                            ],
-                                            xns : Roo.data,
-                                            totalProperty : 'total'
-                                        },
-                                        '|xns' : 'Roo.data',
-                                        xtype : 'Store',
-                                        remoteSort : true,
-                                        sortInfo : { direction : 'ASC', field: 'item_number' },
-                                        xns : Roo.data,
-                                        listeners : {
-                                               beforeload : function (_self, o){
-                                                      o.params = o.params || {};
-                                                      
-                                                      o.params.item_active = 1;
-                                                      o.params['!item_type'] = 'K';
-                                                  }
-                                        },
-                                        items : [
-
-                                        ]
-
-                                    },
-                                    '|xns' : 'Roo.bootstrap',
-                                    alwaysQuery : true,
-                                    triggerAction : 'all',
-                                    fieldLabel : 'Item',
-                                    forceSelection : true,
-                                    selectOnFocus : true,
-                                    pageSize : 20,
-                                    displayField : 'item_number',
-                                    emptyText : "Select item",
-                                    minChars : 2,
-                                    valueField : 'id',
-                                    xtype : 'ComboBox',
-                                    allowBlank : true,
-                                    typeAhead : true,
-                                    editable : true,
-                                    width : 200,
-                                    xns : Roo.bootstrap,
-                                    qtip : "Select item",
-                                    queryParam : 'query[number_or_name]',
-                                    tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
-                                    loadingText : "Searching...",
-                                    listeners : {
-                                       render : function (_self)
-                                          {
-                                              _this.partsBox = _self;
-                                          },
-                                       select : function (combo, record, index)
-                                          {
-                                              var item_id = _this.form.findField('item_id').getValue() * 1;
-                                              
-                                              if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
-                                                  return;
-                                              }
-                                              
-                                              var err = false;
-                                          
-                                              _this.partsgrid.ds.each(function(d){
-                                                  if(record.data.item_id == d.data.bomitem_item_id){
-                                                      err = true;
-                                                  }
-                                              });
-                                          
-                                              if(err){
-                                                  Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
-                                                  _this.partsBox.reset();
-                                                  return;
-                                              }
-                                              
-                                              new Pman.Request({
-                                                  url : baseURL + '/Roo/bomitem.php',
-                                                  method : 'POST',
-                                                  params : {
-                                                      bomitem_parent_item_id : item_id,
-                                                      bomitem_item_id : record.data.item_id,
-                                                      bomitem_qtyper : 1
-                                                  }, 
-                                                  success : function(res) {
-                                                      _this.partsBox.reset();
-                                                      _this.partsgrid.footer.onClick('first');
-                                                  }
-                                              }); 
-                                          }
-                                    },
-                                    items : [
-
-                                    ]
-
-                                },
-                               {
-                                    '|xns' : 'Roo.Toolbar',
-                                    xtype : 'Fill',
-                                    xns : Roo.Toolbar
-                                },
-                               {
-                                    '|xns' : 'Roo',
-                                    text : "Remove",
-                                    xtype : 'Button',
-                                    cls : 'x-btn-text-icon',
-                                    icon : rootURL + '/Pman/templates/images/trash.gif',
-                                    xns : Roo,
-                                    listeners : {
-                                       click : function ()
-                                          {
-                                              var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
-                                              
-                                              if(!sel || !sel.length){
-                                                  Roo.MessageBox.alert("Error", "Please select a item from below list");
-                                                  return;
-                                              }
-                                              
-                                              var d = _this.partsgrid.ds.getAt(sel[0]);      
-                                            
-                                              if(d.data.bomitem_id * 1 < 1){
-                                                  Roo.MessageBox.alert("Error", "Invaild selection");
-                                                  return;
-                                              }
-                                              
-                                              new Pman.Request({
-                                                  url : baseURL + '/Roo/bomitem.php',
-                                                  method : 'POST',
-                                                  params : {
-                                                      _delete : d.data.bomitem_id
-                                                  }, 
-                                                  success : function(res) {
-                                                      _this.partsgrid.footer.onClick('first');
-                                                  }
-                                              }); 
-                                             
-                                          }
-                                    }
-                                }
-                            ]
-
-                        },
-                        dataSource : {
-                            proxy : {
-                                '|xns' : 'Roo.data',
-                                url : baseURL + '/Roo/bomitem.php',
-                                method : 'GET',
-                                xtype : 'HttpProxy',
-                                xns : Roo.data
-                            },
-                            reader : {
-                                '|xns' : 'Roo.data',
-                                id : 'bom_id',
-                                root : 'data',
-                                xtype : 'JsonReader',
-                                fields : [
-                                    {
-                                        'name': 'bomitem_id',
-                                        'type': 'int'
-                                    }
-                                ],
-                                xns : Roo.data,
-                                totalProperty : 'total'
-                            },
-                            '|xns' : 'Roo.data',
-                            xtype : 'Store',
-                            remoteSort : true,
-                            sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
-                            xns : Roo.data,
-                            listeners : {
-                               beforeload : function (_self, o)
-                                  {
-                                     o.params = o.params || {};
-                                     
-                                     var id  = _this.form.findField('item_id').getValue() * 1;
-                                     if(id < 1){
-                                          return false;
-                                     }
-                                     
-                                     o.params.bom_parent_item_id = id;
-                                  }
-                            },
-                            items : [
-
-                            ]
-
-                        },
-                        footer : {
-                            '|xns' : 'Roo',
-                            pageSize : 50,
-                            xtype : 'PagingToolbar',
-                            emptyMsg : "Nothing found",
-                            xns : Roo,
-                            displayMsg : "Displaying parts {0} - {1} of {2}",
-                            displayInfo : true
-                        },
-                        '|xns' : 'Roo.grid',
-                        autoExpandColumn : 'bomitem_item_id_item_descrip1',
-                        xtype : 'EditorGrid',
-                        loadMask : true,
-                        clicksToEdit : 1,
-                        xns : Roo.grid,
-                        colModel : [
-                                {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 150,
-                                       header : 'Name',
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'bomitem_item_id_item_number'
-                                   },
+             {
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              fieldLabel : 'Reorder Level',
+              name : 'item_itemsite_id_itemsite_reorderlevel',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'NumberField'
+             },
+             {
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              fieldLabel : 'Stock Safety Level',
+              name : 'item_itemsite_id_itemsite_safetystock',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'NumberField'
+             },
+             {
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              fieldLabel : 'Lead time (Days)',
+              name : 'item_itemsite_id_itemsite_leadtime',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'NumberField'
+             },
+             {
+              store : {
+               '|xns' : 'Roo.data',
+               data : [ 
+                   [ 'N', "None"],
+                   [ 'R' , "Regular"]
+               ],
+               fields : [  'ftype', 'fname'],
+               xns : Roo.data,
+               xtype : 'SimpleStore'
+              },
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              displayField : 'fname',
+              editable : false,
+              fieldLabel : 'Control Method',
+              hiddenName : 'item_itemsite_id_itemsite_controlmethod',
+              listWidth : 200,
+              mode : 'local',
+              name : 'item_itemsite_id_itemsite_controlmethod_name',
+              tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{fname}</b> </div>',
+              triggerAction : 'all',
+              valueField : 'ftype',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'ComboBox',
+              items : [
+
+              ]
+
+             },
+             {
+              store : {
+               proxy : {
+                '|xns' : 'Roo.data',
+                method : 'GET',
+                url : baseURL + '/Roo/plancode.php',
+                xns : Roo.data,
+                xtype : 'HttpProxy'
+               },
+               reader : {
+                '|xns' : 'Roo.data',
+                fields : [{"name":"id","type":"int"},{"name":"plancode_code","type":"string"}],
+                id : 'id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                xtype : 'JsonReader'
+               },
+               '|xns' : 'Roo.data',
+               remoteSort : true,
+               sortInfo : { direction : 'ASC', field: 'id' },
+               xns : Roo.data,
+               xtype : 'Store',
+               listeners : {
+                beforeload : function (_self, o){
+                     o.params = o.params || {};
+                     // set more here
+                 }
+               },
+               items : [
+
+               ]
+
+              },
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              displayField : 'plancode_name',
+              editable : false,
+              emptyText : _this._strings['c19ea8f7a11074ac743c58d34830b233'],
+              fieldLabel : 'Planner Code',
+              forceSelection : true,
+              hiddenName : 'item_itemsite_id_itemsite_plancode_id',
+              listWidth : 400,
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+              minChars : 2,
+              name : 'plancode_name',
+              pageSize : 20,
+              qtip : _this._strings['c19ea8f7a11074ac743c58d34830b233'],
+              queryParam : '',
+              selectOnFocus : true,
+              tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{plancode_name}</b> </div>',
+              triggerAction : 'all',
+              typeAhead : true,
+              valueField : 'plancode_id',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'ComboBox',
+              items : [
+
+              ]
+
+             },
+             {
+              store : {
+               proxy : {
+                '|xns' : 'Roo.data',
+                method : 'GET',
+                url : baseURL + '/Roo/costcat.php',
+                xns : Roo.data,
+                xtype : 'HttpProxy'
+               },
+               reader : {
+                '|xns' : 'Roo.data',
+                fields : [{"name":"id","type":"int"},{"name":"costcat_code","type":"string"}],
+                id : 'id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                xtype : 'JsonReader'
+               },
+               '|xns' : 'Roo.data',
+               remoteSort : true,
+               sortInfo : { direction : 'ASC', field: 'id' },
+               xns : Roo.data,
+               xtype : 'Store',
+               listeners : {
+                beforeload : function (_self, o){
+                     o.params = o.params || {};
+                     // set more here
+                 }
+               },
+               items : [
+
+               ]
+
+              },
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              displayField : 'costcat_code',
+              editable : false,
+              emptyText : _this._strings['045a1ac263ac3a9b7420208bdc2df423'],
+              fieldLabel : 'Costcat',
+              forceSelection : true,
+              hiddenName : 'item_itemsite_id_itemsite_costcat_id',
+              listWidth : 400,
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+              minChars : 2,
+              name : 'costcat_code',
+              pageSize : 20,
+              qtip : _this._strings['045a1ac263ac3a9b7420208bdc2df423'],
+              queryParam : '',
+              selectOnFocus : true,
+              tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{costcat_code}</b> </div>',
+              triggerAction : 'all',
+              typeAhead : true,
+              valueField : 'costcat_id',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'ComboBox',
+              items : [
+
+              ]
+
+             },
+             {
+              '|xns' : 'Roo.form',
+              fieldLabel : 'Active',
+              inputValue : true,
+              name : 'item_itemsite_id_itemsite_active',
+              valueOff : 0,
+              width : 75,
+              xns : Roo.form,
+              xtype : 'Checkbox'
+             },
+             {
+              '|xns' : 'Roo.form',
+              fieldLabel : 'Sold',
+              inputValue : true,
+              name : 'item_itemsite_id_itemsite_sold',
+              valueOff : 0,
+              width : 75,
+              xns : Roo.form,
+              xtype : 'Checkbox'
+             },
+             {
+              '|xns' : 'Roo.form',
+              fieldLabel : 'Stocked',
+              inputValue : true,
+              name : 'item_itemsite_id_itemsite_stocked',
+              valueOff : 0,
+              width : 75,
+              xns : Roo.form,
+              xtype : 'Checkbox'
+             },
+             {
+              '|xns' : 'Roo.form',
+              fieldLabel : 'Perishable',
+              inputValue : true,
+              name : 'item_itemsite_id_itemsite_perishable',
+              valueOff : 0,
+              width : 75,
+              xns : Roo.form,
+              xtype : 'Checkbox'
+             },
+             {
+              '|xns' : 'Roo.form',
+              fieldLabel : 'Multi Location',
+              inputValue : true,
+              name : 'item_itemsite_id_itemsite_loccntrl',
+              valueOff : 0,
+              width : 100,
+              xns : Roo.form,
+              xtype : 'Checkbox'
+             },
+             {
+              store : {
+               proxy : {
+                '|xns' : 'Roo.data',
+                method : 'GET',
+                url : baseURL + '/Roo/location.php',
+                xns : Roo.data,
+                xtype : 'HttpProxy'
+               },
+               reader : {
+                '|xns' : 'Roo.data',
+                fields : [{"name":"location_id","type":"int"},"location_name"],
+                id : 'location_id',
+                root : 'data',
+                totalProperty : 'total',
+                xns : Roo.data,
+                xtype : 'JsonReader'
+               },
+               '|xns' : 'Roo.data',
+               remoteSort : true,
+               sortInfo : { direction : 'ASC', field: 'location_name' },
+               xns : Roo.data,
+               xtype : 'Store',
+               listeners : {
+                beforeload : function (_self, o){
+                     o.params = o.params || {};
+                     // set more here
+                      o.params.location_netable = 1;
+                      o.params._notinternalcompany = 1;
+                      o.params.location_restrict = 0;
+                 }
+               },
+               items : [
+
+               ]
+
+              },
+              '|xns' : 'Roo.form',
+              allowBlank : false,
+              displayField : 'location_name',
+              editable : true,
+              emptyText : _this._strings['82a43f89af6d331d80d441624c5c71fa'],
+              fieldLabel : 'Default Location',
+              forceSelection : true,
+              hiddenName : 'item_itemsite_id_itemsite_location_id',
+              listWidth : 400,
+              loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+              minChars : 2,
+              name : 'location_name',
+              pageSize : 200,
+              qtip : _this._strings['151ccf95db9b81c11bb20fbc302af4b6'],
+              queryParam : 'query[location_name]',
+              selectOnFocus : true,
+              tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{location_name}</b> </div>',
+              triggerAction : 'all',
+              typeAhead : false,
+              valueField : 'location_id',
+              width : 200,
+              xns : Roo.form,
+              xtype : 'ComboBox',
+              items : [
+
+              ]
+
+             }
+            ]
+
+           }
+          ]
+
+         },
+         {
+          '|xns' : 'Roo.form',
+          name : 'item_id',
+          width : 75,
+          xns : Roo.form,
+          xtype : 'Hidden'
+         }
+        ]
+
+       }
+      ]
+
+     },
+     {
+      grid : {
+       toolbar : {
+        '|xns' : 'Roo',
+        xns : Roo,
+        xtype : 'Toolbar',
+        items : [
+         {
+          store : {
+           proxy : {
+            '|xns' : 'Roo.data',
+            method : 'GET',
+            url : baseURL + '/Roo/item.php',
+            xns : Roo.data,
+            xtype : 'HttpProxy'
+           },
+           reader : {
+            '|xns' : 'Roo.data',
+            fields : [
+                {"name":"id","type":"int"},
+                {"name":"item_number","type":"string"}
+            ],
+            id : 'id',
+            root : 'data',
+            totalProperty : 'total',
+            xns : Roo.data,
+            xtype : 'JsonReader'
+           },
+           '|xns' : 'Roo.data',
+           remoteSort : true,
+           sortInfo : { direction : 'ASC', field: 'item_number' },
+           xns : Roo.data,
+           xtype : 'Store',
+           listeners : {
+            beforeload : function (_self, o){
+                 o.params = o.params || {};
+                 
+                 o.params.item_active = 1;
+                 o.params['!item_type'] = 'K';
+             }
+           },
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.bootstrap',
+          allowBlank : true,
+          alwaysQuery : true,
+          displayField : 'item_number',
+          editable : true,
+          emptyText : _this._strings['786410e93beb0193d89f8608c54feb4b'],
+          fieldLabel : 'Item',
+          forceSelection : true,
+          loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+          minChars : 2,
+          pageSize : 20,
+          qtip : _this._strings['786410e93beb0193d89f8608c54feb4b'],
+          queryParam : 'query[number_or_name]',
+          selectOnFocus : true,
+          tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{item_number}</b> </div>',
+          triggerAction : 'all',
+          typeAhead : true,
+          valueField : 'id',
+          width : 200,
+          xns : Roo.bootstrap,
+          xtype : 'ComboBox',
+          listeners : {
+           render : function (_self)
+            {
+                _this.partsBox = _self;
+            },
+           select : function (combo, record, index)
+            {
+                var item_id = _this.form.findField('item_id').getValue() * 1;
+                
+                if(typeof(record) == 'undefined' || !record || record.data.id * 1 < 1 || item_id < 1){
+                    return;
+                }
+                
+                var err = false;
+            
+                _this.partsgrid.ds.each(function(d){
+                    if(record.data.item_id == d.data.bomitem_item_id){
+                        err = true;
+                    }
+                });
+            
+                if(err){
+                    Roo.MessageBox.alert('Error', record.data.item_number + ' already exists!');
+                    _this.partsBox.reset();
+                    return;
+                }
+                
+                new Pman.Request({
+                    url : baseURL + '/Roo/bomitem.php',
+                    method : 'POST',
+                    params : {
+                        bomitem_parent_item_id : item_id,
+                        bomitem_item_id : record.data.item_id,
+                        bomitem_qtyper : 1
+                    }, 
+                    success : function(res) {
+                        _this.partsBox.reset();
+                        _this.partsgrid.footer.onClick('first');
+                    }
+                }); 
+            }
+          },
+          items : [
+
+          ]
+
+         },
+         {
+          '|xns' : 'Roo.Toolbar',
+          xns : Roo.Toolbar,
+          xtype : 'Fill'
+         },
+         {
+          '|xns' : 'Roo',
+          cls : 'x-btn-text-icon',
+          icon : rootURL + '/Pman/templates/images/trash.gif',
+          text : _this._strings['1063e38cb53d94d386f21227fcd84717'],
+          xns : Roo,
+          xtype : 'Button',
+          listeners : {
+           click : function ()
+            {
+                var sel = _this.partsgrid.getSelectionModel().getSelectedCell();
+                
+                if(!sel || !sel.length){
+                    Roo.MessageBox.alert("Error", "Please select a item from below list");
+                    return;
+                }
+                
+                var d = _this.partsgrid.ds.getAt(sel[0]);      
+              
+                if(d.data.bomitem_id * 1 < 1){
+                    Roo.MessageBox.alert("Error", "Invaild selection");
+                    return;
+                }
+                
+                new Pman.Request({
+                    url : baseURL + '/Roo/bomitem.php',
+                    method : 'POST',
+                    params : {
+                        _delete : d.data.bomitem_id
+                    }, 
+                    success : function(res) {
+                        _this.partsgrid.footer.onClick('first');
+                    }
+                }); 
+               
+            }
+          }
+         }
+        ]
+
+       },
+       dataSource : {
+        proxy : {
+         '|xns' : 'Roo.data',
+         method : 'GET',
+         url : baseURL + '/Roo/bomitem.php',
+         xns : Roo.data,
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         '|xns' : 'Roo.data',
+         fields : [
+             {
+                 'name': 'bomitem_id',
+                 'type': 'int'
+             }
+         ],
+         id : 'bom_id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         xtype : 'JsonReader'
+        },
+        '|xns' : 'Roo.data',
+        remoteSort : true,
+        sortInfo : { field : 'bomitem_item_id_item_name', direction: 'ASC' },
+        xns : Roo.data,
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+             o.params = o.params || {};
+             
+             var id  = _this.form.findField('item_id').getValue() * 1;
+             if(id < 1){
+                  return false;
+             }
+             
+             o.params.bom_parent_item_id = id;
+          }
+        },
+        items : [
+
+        ]
+
+       },
+       footer : {
+        '|xns' : 'Roo',
+        displayInfo : true,
+        displayMsg : _this._strings['76d5bf9597c882d6513f71759df298d5'],
+        emptyMsg : _this._strings['9076cbba1d9ef79280b4f39e2aa0d115'],
+        pageSize : 50,
+        xns : Roo,
+        xtype : 'PagingToolbar'
+       },
+       '|xns' : 'Roo.grid',
+       autoExpandColumn : 'bomitem_item_id_item_descrip1',
+       clicksToEdit : 1,
+       loadMask : true,
+       xns : Roo.grid,
+       xtype : 'EditorGrid',
+       colModel : [
+         {
+          '|xns' : 'Roo.grid',
+          dataIndex : 'bomitem_item_id_item_number',
+          header : _this._strings['49ee3087348e8d44e1feda1917443987'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 150,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       width : 150,
-                                       header : 'Description',
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'bomitem_item_id_item_descrip1'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'bomitem_item_id_item_descrip1',
+          header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 150,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       editor : {
-                                           field : {
-                                               '|xns' : 'Roo.form',
-                                               allowBlank : false,
-                                               cls : 'align-right',
-                                               xtype : 'NumberField',
-                                               decimalPrecision : 0,
-                                               xns : Roo.form,
-                                               minValue : 0
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       align : 'right',
-                                       header : 'Qty',
-                                       width : 100,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'bomitem_qtyper',
-                                       items : [
-
-                                       ]
-
-                                   }
-                        ],
-                        listeners : {
-                               beforeedit : function (e)
-                                  {
-                                      if(e.field != 'bomitem_qtyper'){
-                                          return false;
-                                      }
-                                      
-                                  },
-                               render : function() 
-                                  {
-                                      _this.partsgrid = this; 
-                                      //_this.dialog = Pman.Dialog.FILL_IN
-                                      if (_this.partspanel.active) {
-                                         this.footer.onClick('first');
-                                      }
-                                  },
-                               afteredit : function (e)
-                                  {
-                                      if(e.originalValue == e.value){
-                                          return false;
-                                      }
-                                      
-                                      
-                                      new Pman.Request({
-                                          method : 'POST',
-                                          url : baseURL + '/Roo/bomitem.php',
-                                          mask : 'Saving',
-                                          params : {
-                                              bomitem_id : e.record.data.bomitem_id,
-                                              bomitem_qtyper : e.value
-                                          },
-                                          success : function() {
-                                              e.record.set('bomitem_qtyper', e.value);
-                                          }
-                                      
-                                      });
-                                          
-                                           
-                                          
-                                          
-                                  }
-                        },
-                        items : [
-
-                        ]
-
-                    },
-                    '|xns' : 'Roo',
-                    region : 'center',
-                    fitToframe : true,
-                    background : true,
-                    title : "Item Parts",
-                    xtype : 'GridPanel',
-                    fitContainer : true,
-                    xns : Roo,
-                    tableName : 'bomitem',
-                    listeners : {
-                       activate : function() {
-                              _this.partspanel = this;
-                              
-                              try { if (MODULE.isBuilder) {
-                                  return;
-                              } } catch(e) { }
-                              
-                              var id = _this.form.findField('item_id').getValue() * 1;
-                              if (id < 1) {
-                                  Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
-                                  _this.dialog.layout.getRegion('center').showPanel(0);
-                                  return;
-                              }
-                              
-                              var type = _this.form.findField('item_type').getValue();
-                              
-                              if(!type.length || type != 'K'){
-                                  Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
-                                  _this.dialog.layout.getRegion('center').showPanel(0);
-                                  return;
-                              }
-                              
-                              if (_this.partsgrid) {
-                                  _this.partsgrid.footer.onClick('first');
-                              
-                               }
-                          }
-                    },
-                    items : [
-
-                    ]
-
-                },
-               {
-                    grid : {
-                        dataSource : {
-                            reader : {
-                                '|xns' : 'Roo.data',
-                                id : 'id',
-                                root : 'data',
-                                xtype : 'JsonReader',
-                                fields : [
-                                    {
-                                        'name': 'id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'filename',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'ontable',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'onid',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'mimetype',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'width',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'height',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'filesize',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'displayorder',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'language',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'parent_image_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'created',
-                                        'type': 'date',
-                                        'dateFormat' : 'Y-m-d H:i:s'
-                                    },
-                                    {
-                                        'name': 'imgtype',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'linkurl',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'descript',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'title',
-                                        'type': 'string'
-                                    }
-                                ],
-                                xns : Roo.data,
-                                totalProperty : 'total'
-                            },
-                            proxy : {
-                                '|xns' : 'Roo.data',
-                                url : baseURL + '/Roo/Images.php',
-                                method : 'GET',
-                                xtype : 'HttpProxy',
-                                xns : Roo.data
-                            },
-                            '|xns' : 'Roo.data',
-                            xtype : 'Store',
-                            remoteSort : true,
-                            sortInfo : { field: 'created' , direction: 'DESC' },
-                            xns : Roo.data,
-                            listeners : {
-                               beforeload : function (_self, o)
-                                  {
-                                      o.params = o.params || {};
-                                      
-                                      var id = _this.form.findField('item_id').getValue();
-                                      
-                                      if(id * 1 < 1){
-                                          return false;
-                                      }
-                                      
-                                      o.params.onid = id;
-                                      o.params.ontable = 'item';
-                                      
-                                  }
-                            },
-                            items : [
-
-                            ]
-
-                        },
-                        footer : {
-                            '|xns' : 'Roo',
-                            pageSize : 25,
-                            xtype : 'PagingToolbar',
-                            emptyMsg : "No Images found",
-                            xns : Roo,
-                            displayInfo : true,
-                            displayMsg : "Displaying Images  {0} - {1} of {2}"
-                        },
-                        toolbar : {
-                            '|xns' : 'Roo',
-                            xtype : 'Toolbar',
-                            xns : Roo,
-                            items : [
-                               {
-                                    '|xns' : 'Roo.Toolbar',
-                                    text : "Add",
-                                    xtype : 'Button',
-                                    cls : 'x-btn-text-icon',
-                                    icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
-                                    xns : Roo.Toolbar,
-                                    listeners : {
-                                       click : function()
-                                          {
-                                              Pman.Dialog.Image.show({
-                                                  id : 0, 
-                                                  ontable: 'item',
-                                                  onid: _this.form.findField('item_id').getValue() * 1,
-                                                  imgtype : ''
-                                              }, function(data){
-                                                  if (!data) { return; } 
-                                                  _this.grid.footer.onClick('first');
-                                              }); 
-                                          
-                                          }
-                                    }
-                                },
-                               {
-                                    '|xns' : 'Roo.Toolbar',
-                                    text : "Delete",
-                                    xtype : 'Button',
-                                    cls : 'x-btn-text-icon',
-                                    icon : rootURL + '/Pman/templates/images/trash.gif',
-                                    xns : Roo.Toolbar,
-                                    listeners : {
-                                       click : function()
-                                          {
-                                              Pman.genericDelete(_this, 'Images'); 
-                                          }
-                                    }
-                                }
-                            ]
-
-                        },
-                        '|xns' : 'Roo.grid',
-                        autoExpandColumn : 'id',
-                        xtype : 'Grid',
-                        loadMask : true,
-                        xns : Roo.grid,
-                        colModel : [
-                                {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       sortable : true,
-                                       header : 'Created',
-                                       width : 200,
-                                       renderer : function(v,x,r) {
-                                              return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
-                                                   v.format('d/M/Y'), r.data.mimetype, r.data.filename,
-                                           r.data.width, r.data.height
-                                           ); 
-                                       },
-                                       xns : Roo.grid,
-                                       dataIndex : 'created'
-                                   },
+          editor : {
+           field : {
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            cls : 'align-right',
+            decimalPrecision : 0,
+            minValue : 0,
+            xns : Roo.form,
+            xtype : 'NumberField'
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          align : 'right',
+          dataIndex : 'bomitem_qtyper',
+          header : _this._strings['03ab340b3f99e03cff9e84314ead38c0'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 100,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         }
+       ],
+       listeners : {
+        afteredit : function (e)
+         {
+             if(e.originalValue == e.value){
+                 return false;
+             }
+             
+             
+             new Pman.Request({
+                 method : 'POST',
+                 url : baseURL + '/Roo/bomitem.php',
+                 mask : 'Saving',
+                 params : {
+                     bomitem_id : e.record.data.bomitem_id,
+                     bomitem_qtyper : e.value
+                 },
+                 success : function() {
+                     e.record.set('bomitem_qtyper', e.value);
+                 }
+             
+             });
+                 
+                  
+                 
+                 
+         },
+        beforeedit : function (e)
+         {
+             if(e.field != 'bomitem_qtyper'){
+                 return false;
+             }
+             
+         },
+        render : function() 
+         {
+             _this.partsgrid = this; 
+             //_this.dialog = Pman.Dialog.FILL_IN
+             if (_this.partspanel.active) {
+                this.footer.onClick('first');
+             }
+         }
+       },
+       items : [
+
+       ]
+
+      },
+      '|xns' : 'Roo',
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'bomitem',
+      title : _this._strings['538a3c9d82a4ea4250b987a357d41184'],
+      xns : Roo,
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.partspanel = this;
+            
+            try { if (MODULE.isBuilder) {
+                return;
+            } } catch(e) { }
+            
+            var id = _this.form.findField('item_id').getValue() * 1;
+            if (id < 1) {
+                Roo.MessageBox.alert("Save First", "Save the item first, before adding parts");
+                _this.dialog.layout.getRegion('center').showPanel(0);
+                return;
+            }
+            
+            var type = _this.form.findField('item_type').getValue();
+            
+            if(!type.length || type != 'K'){
+                Roo.MessageBox.alert("Error", "Can't add parts to non-kit item");
+                _this.dialog.layout.getRegion('center').showPanel(0);
+                return;
+            }
+            
+            if (_this.partsgrid) {
+                _this.partsgrid.footer.onClick('first');
+            
+             }
+        }
+      },
+      items : [
+
+      ]
+
+     },
+     {
+      grid : {
+       dataSource : {
+        reader : {
+         '|xns' : 'Roo.data',
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'filename',
+                 'type': 'string'
+             },
+             {
+                 'name': 'ontable',
+                 'type': 'string'
+             },
+             {
+                 'name': 'onid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'mimetype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'width',
+                 'type': 'int'
+             },
+             {
+                 'name': 'height',
+                 'type': 'int'
+             },
+             {
+                 'name': 'filesize',
+                 'type': 'int'
+             },
+             {
+                 'name': 'displayorder',
+                 'type': 'int'
+             },
+             {
+                 'name': 'language',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'created',
+                 'type': 'date',
+                 'dateFormat' : 'Y-m-d H:i:s'
+             },
+             {
+                 'name': 'imgtype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'linkurl',
+                 'type': 'string'
+             },
+             {
+                 'name': 'descript',
+                 'type': 'string'
+             },
+             {
+                 'name': 'title',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         xtype : 'JsonReader'
+        },
+        proxy : {
+         '|xns' : 'Roo.data',
+         method : 'GET',
+         url : baseURL + '/Roo/Images.php',
+         xns : Roo.data,
+         xtype : 'HttpProxy'
+        },
+        '|xns' : 'Roo.data',
+        remoteSort : true,
+        sortInfo : { field: 'created' , direction: 'DESC' },
+        xns : Roo.data,
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+              o.params = o.params || {};
+              
+              var id = _this.form.findField('item_id').getValue();
+              
+              if(id * 1 < 1){
+                  return false;
+              }
+              
+              o.params.onid = id;
+              o.params.ontable = 'item';
+              
+          }
+        },
+        items : [
+
+        ]
+
+       },
+       footer : {
+        '|xns' : 'Roo',
+        displayInfo : true,
+        displayMsg : _this._strings['c0ed345ec857c06b31f7e88745c9bc40'],
+        emptyMsg : _this._strings['0c81971f67c0bd4b33799c5365ec2bf5'],
+        pageSize : 25,
+        xns : Roo,
+        xtype : 'PagingToolbar'
+       },
+       toolbar : {
+        '|xns' : 'Roo',
+        xns : Roo,
+        xtype : 'Toolbar',
+        items : [
+         {
+          '|xns' : 'Roo.Toolbar',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'],
+          xns : Roo.Toolbar,
+          xtype : 'Button',
+          listeners : {
+           click : function()
+            {
+                Pman.Dialog.Image.show({
+                    id : 0, 
+                    ontable: 'item',
+                    onid: _this.form.findField('item_id').getValue() * 1,
+                    imgtype : ''
+                }, function(data){
+                    if (!data) { return; } 
+                    _this.grid.footer.onClick('first');
+                }); 
+            
+            }
+          }
+         },
+         {
+          '|xns' : 'Roo.Toolbar',
+          cls : 'x-btn-text-icon',
+          icon : rootURL + '/Pman/templates/images/trash.gif',
+          text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'],
+          xns : Roo.Toolbar,
+          xtype : 'Button',
+          listeners : {
+           click : function()
+            {
+                Pman.genericDelete(_this, 'Images'); 
+            }
+          }
+         }
+        ]
+
+       },
+       '|xns' : 'Roo.grid',
+       autoExpandColumn : 'id',
+       loadMask : true,
+       xns : Roo.grid,
+       xtype : 'Grid',
+       colModel : [
+         {
+          '|xns' : 'Roo.grid',
+          dataIndex : 'created',
+          header : _this._strings['0eceeb45861f9585dd7a97a3e36f85c6'],
+          renderer : function(v,x,r) {
+                 return String.format('{0}<br/><i>{1}</i><br/>{2}<br/><i>{3}x{4}</i>',
+                      v.format('d/M/Y'), r.data.mimetype, r.data.filename,
+              r.data.width, r.data.height
+              ); 
+          },
+          sortable : true,
+          width : 200,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Image',
-                                       width : 100,
-                                       renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'id'
-                                   }
-                        ],
-                        listeners : {
-                               rowdblclick : function (_self, rowIndex, e)
-                                  {
-                                    
-                                     var s =  _self.getDataSource().getAt(rowIndex);
-                                     new Pman.Download({
-                                          url : baseURL + '/Images/Download/' + s.data.id
-                                      });
-                                     
-                                  },
-                               render : function() { 
-                                      _this.grid = this; 
-                                  
-                                      if (_this.panel.active) {
-                                         this.footer.onClick('first');
-                                      }
-                                  }
-                        },
-                        items : [
-
-                        ]
-
-                    },
-                    '|xns' : 'Roo',
-                    fitToframe : true,
-                    background : true,
-                    region : 'center',
-                    title : "Reference Files",
-                    xtype : 'GridPanel',
-                    fitContainer : true,
-                    xns : Roo,
-                    tableName : 'Images',
-                    listeners : {
-                       activate : function() {
-                              _this.panel = this;
-                              
-                              try { if (MODULE.isBuilder) {
-                                  return;
-                              } } catch(e) { }
-                              
-                              var id = _this.form.findField('item_id').getValue() * 1;
-                              if (id < 1) {
-                                  Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
-                                  _this.dialog.layout.getRegion('center').showPanel(0);
-                                  return;
-                              }
-                              
-                              if (_this.grid) {
-                                  _this.grid.footer.onClick('first');
-                              
-                               }
-                          }
-                    },
-                    items : [
-
-                    ]
-
-                },
-               {
-                    grid : {
-                        dataSource : {
-                            proxy : {
-                                '|xns' : 'Roo.data',
-                                url : baseURL + '/Roo/ipshead.php',
-                                xtype : 'HttpProxy',
-                                method : 'GET',
-                                xns : Roo.data
-                            },
-                            reader : {
-                                '|xns' : 'Roo.data',
-                                id : 'ipshead_id',
-                                root : 'data',
-                                xtype : 'JsonReader',
-                                fields : [
-                                    {
-                                        'name': 'ipshead_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'ipshead_name',
-                                        'type': 'string'
-                                    }
-                                ],
-                                xns : Roo.data,
-                                totalProperty : 'total'
-                            },
-                            '|xns' : 'Roo.data',
-                            xtype : 'Store',
-                            remoteSort : true,
-                            sortInfo : { field : 'ipshead_id', direction: 'ASC' },
-                            xns : Roo.data,
-                            listeners : {
-                               beforeload : function (_self, o)
-                                  {
-                                     o.params = o.params || {};
-                                     
-                                     var id  = _this.form.findField('item_id').getValue() * 1;
-                                     if(id < 1){
-                                          return false;
-                                     }
-                                     
-                                     o.params._with_item = id;
-                                  }
-                            },
-                            items : [
-
-                            ]
-
-                        },
-                        footer : {
-                            '|xns' : 'Roo',
-                            pageSize : 50,
-                            xtype : 'PagingToolbar',
-                            emptyMsg : "Nothing found",
-                            xns : Roo,
-                            displayMsg : "Displaying records {0} - {1} of {2}",
-                            displayInfo : true
-                        },
-                        '|xns' : 'Roo.grid',
-                        autoExpandColumn : 'ipshead_descrip',
-                        xtype : 'EditorGrid',
-                        loadMask : true,
-                        clicksToEdit : 1,
-                        xns : Roo.grid,
-                        colModel : [
-                                {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Name',
-                                       width : 150,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'ipshead_name'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'id',
+          header : _this._strings['be53a0541a6d36f6ecb879fa2c584b08'],
+          renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="100">', baseURL, v, r.data.filename); },
+          width : 100,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         }
+       ],
+       listeners : {
+        render : function() { 
+             _this.grid = this; 
+         
+             if (_this.panel.active) {
+                this.footer.onClick('first');
+             }
+         },
+        rowdblclick : function (_self, rowIndex, e)
+         {
+           
+            var s =  _self.getDataSource().getAt(rowIndex);
+            new Pman.Download({
+                 url : baseURL + '/Images/Download/' + s.data.id
+             });
+            
+         }
+       },
+       items : [
+
+       ]
+
+      },
+      '|xns' : 'Roo',
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'Images',
+      title : _this._strings['346577d22bb510368e3eddab5df2ca13'],
+      xns : Roo,
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.panel = this;
+            
+            try { if (MODULE.isBuilder) {
+                return;
+            } } catch(e) { }
+            
+            var id = _this.form.findField('item_id').getValue() * 1;
+            if (id < 1) {
+                Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
+                _this.dialog.layout.getRegion('center').showPanel(0);
+                return;
+            }
+            
+            if (_this.grid) {
+                _this.grid.footer.onClick('first');
+            
+             }
+        }
+      },
+      items : [
+
+      ]
+
+     },
+     {
+      grid : {
+       dataSource : {
+        proxy : {
+         '|xns' : 'Roo.data',
+         method : 'GET',
+         url : baseURL + '/Roo/ipshead.php',
+         xns : Roo.data,
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         '|xns' : 'Roo.data',
+         fields : [
+             {
+                 'name': 'ipshead_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'ipshead_name',
+                 'type': 'string'
+             }
+         ],
+         id : 'ipshead_id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         xtype : 'JsonReader'
+        },
+        '|xns' : 'Roo.data',
+        remoteSort : true,
+        sortInfo : { field : 'ipshead_id', direction: 'ASC' },
+        xns : Roo.data,
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+             o.params = o.params || {};
+             
+             var id  = _this.form.findField('item_id').getValue() * 1;
+             if(id < 1){
+                  return false;
+             }
+             
+             o.params._with_item = id;
+          }
+        },
+        items : [
+
+        ]
+
+       },
+       footer : {
+        '|xns' : 'Roo',
+        displayInfo : true,
+        displayMsg : _this._strings['956e816fa19ca04485c7101adbe07762'],
+        emptyMsg : _this._strings['9076cbba1d9ef79280b4f39e2aa0d115'],
+        pageSize : 50,
+        xns : Roo,
+        xtype : 'PagingToolbar'
+       },
+       '|xns' : 'Roo.grid',
+       autoExpandColumn : 'ipshead_descrip',
+       clicksToEdit : 1,
+       loadMask : true,
+       xns : Roo.grid,
+       xtype : 'EditorGrid',
+       colModel : [
+         {
+          '|xns' : 'Roo.grid',
+          dataIndex : 'ipshead_name',
+          header : _this._strings['49ee3087348e8d44e1feda1917443987'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 150,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Description',
-                                       width : 150,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'ipshead_descrip'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'ipshead_descrip',
+          header : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 150,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Currency',
-                                       width : 100,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'ipshead_curr_id_curr_name'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'ipshead_curr_id_curr_name',
+          header : _this._strings['386c339d37e737a436499d423a77df0c'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 100,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       editor : {
-                                           field : {
-                                               '|xns' : 'Roo.form',
-                                               xtype : 'NumberField',
-                                               cls : 'align-right',
-                                               decimalPrecision : 2,
-                                               xns : Roo.form
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       align : 'right',
-                                       xtype : 'ColumnModel',
-                                       header : 'Price',
-                                       width : 120,
-                                       renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'ipshead_ipsitem_price',
-                                       items : [
-
-                                       ]
-
-                                   }
-                        ],
-                        listeners : {
-                               beforeedit : function (e)
-                                  {
-                                      if(e.field != 'ipshead_ipsitem_price'){
-                                          return false;
-                                      }
-                                      
-                                  },
-                               render : function() 
-                                  {
-                                      _this.lgrid = this; 
-                                      //_this.dialog = Pman.Dialog.FILL_IN
-                                      if (_this.lpanel.active) {
-                                         this.footer.onClick('first');
-                                      }
-                                  },
-                               afteredit : function (e)
-                                  {
-                                      if(e.originalValue == e.value){
-                                          return false;
-                                      }
-                                      
-                                      var id = _this.form.findField('item_id').getValue() * 1;
-                                      if(id < 1){
-                                          return false;
-                                      }
-                                      
-                                      new Pman.Request({
-                                          method : 'POST',
-                                          url : baseURL + '/Roo/ipsiteminfo',
-                                          mask : 'Saving',
-                                          params : {
-                                              ipsitem_ipshead_id : e.record.data.ipshead_id,
-                                              ipsitem_item_id : id,
-                                              ipsitem_price : e.record.data.ipshead_ipsitem_price,
-                                              ipsitem_id : e.record.data.ipshead_ipsitem_id
-                                          }
-                                      
-                                      });
-                                          
-                                           
-                                          
-                                          
-                                  }
-                        },
-                        items : [
-
-                        ]
-
-                    },
-                    '|xns' : 'Roo',
-                    fitToframe : true,
-                    background : true,
-                    region : 'center',
-                    title : "Price List",
-                    xtype : 'GridPanel',
-                    fitContainer : true,
-                    xns : Roo,
-                    tableName : 'ipshead',
-                    listeners : {
-                       activate : function() {
-                              _this.lpanel = this;
-                              
-                              try { if (MODULE.isBuilder) {
-                                  return;
-                              } } catch(e) { }
-                              
-                              var id = _this.form.findField('item_id').getValue() * 1;
-                              if (id < 1) {
-                                  Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
-                                  _this.dialog.layout.getRegion('center').showPanel(0);
-                                  return;
-                              }
-                              
-                              if (_this.lgrid) {
-                                  _this.lgrid.footer.onClick('first');
-                              
-                               }
-                          }
-                    },
-                    items : [
-
-                    ]
-
-                },
-               {
-                    grid : {
-                        dataSource : {
-                            proxy : {
-                                '|xns' : 'Roo.data',
-                                url : baseURL + '/Roo/itemsrc.php',
-                                method : 'GET',
-                                xtype : 'HttpProxy',
-                                xns : Roo.data
-                            },
-                            reader : {
-                                '|xns' : 'Roo.data',
-                                id : 'id',
-                                root : 'data',
-                                xtype : 'JsonReader',
-                                xns : Roo.data,
-                                fields : [
-                                    {
-                                        'name': 'itemsrc_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_item_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_item_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_vend_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_vend_id',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_vend_item_number',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_vend_item_descrip',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_comments',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_vend_uom',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_invvendoruomratio',
-                                        'type': 'float'
-                                    },
-                                    {
-                                        'name': 'itemsrc_minordqty',
-                                        'type': 'float'
-                                    },
-                                    {
-                                        'name': 'itemsrc_multordqty',
-                                        'type': 'float'
-                                    },
-                                    {
-                                        'name': 'itemsrc_leadtime',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_ranking',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_active',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_manuf_name',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_manuf_item_number',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_manuf_item_descrip',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'itemsrc_default',
-                                        'type': 'int'
-                                    },
-                                    {
-                                        'name': 'itemsrc_upccode',
-                                        'type': 'string'
-                                    }
-                                ],
-                                totalProperty : 'total'
-                            },
-                            '|xns' : 'Roo.data',
-                            xtype : 'Store',
-                            remoteSort : true,
-                            sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
-                            xns : Roo.data,
-                            listeners : {
-                               update : function (_self, record, operation)
-                                  {
-                                      Roo.log(operation);
-                                        Roo.log(record);
-                                     
-                                      if (operation != 'commit') {
-                                          return;
-                                      }
-                                      if (record.data.itemsrc_vend_id * 1 < 1) {
-                                          return; // do not save.
-                                      }
-                                      if (record.data.itemsrc_id * 1 < 0) {
-                                          return; // do not save. -- updating at present...
-                                      }
-                                      
-                                      var p = Roo.apply({}, record.data);
-                                      record.set('itemsrc_id', -1);    
-                                      
-                                      new Pman.Request({
-                                          url : baseURL + '/Roo/Itemsrc',
-                                          params : p,
-                                          method : 'POST',
-                                          success: function(res) {
-                                              if (record.data.itemsrc_id *1  < 1) { 
-                                                  record.set('itemsrc_id', res.data.itemsrc_id);
-                                              }
-                                          }
-                                      });
-                                      
-                                      
-                                  },
-                               beforeload : function (_self, o)
-                                  {
-                                      
-                                      var id = 1 * _this.form.findField('item_id').getValue();
-                                      if (!id) {
-                                          this.removeAll();
-                                          return false;
-                                      }
-                                      o.params.itemsrc_item_id = id;
-                                  }
-                            },
-                            items : [
-
-                            ]
-
-                        },
-                        footer : {
-                            '|xns' : 'Roo',
-                            pageSize : 25,
-                            xtype : 'PagingToolbar',
-                            emptyMsg : "No itemsrc found",
-                            xns : Roo,
-                            displayInfo : true,
-                            displayMsg : "Displaying itemsrc{0} - {1} of {2}"
-                        },
-                        toolbar : {
-                            '|xns' : 'Roo',
-                            xtype : 'Toolbar',
-                            xns : Roo,
-                            items : [
-                               {
-                                    '|xns' : 'Roo.Toolbar',
-                                    text : "Add",
-                                    xtype : 'Button',
-                                    cls : 'x-btn-text-icon',
-                                    icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
-                                    xns : Roo.Toolbar,
-                                    listeners : {
-                                       click : function()
-                                          {
-                                               
-                                              Roo.log("add presed");
-                                               
-                                              // work out last 
-                                              var grid = _this.itemsrcgrid;
-                                               
-                                              // uses form defaults or last row value.
-                                              var nr = grid.ds.reader.newRow({
-                                                   itemsrc_id : 0,
-                                                   itemsrc_item_id : _this.form.findField('item_id').getValue(),
-                                                   itemsrc_vend_id : 0,
-                                                   itemsrc_vend_id_vend_name : '',
-                                                   itemsrc_vend_item_number : '',
-                                                   itemsrc_vend_item_descrip : '',
-                                                   itemsrc_comments           : '',
-                                                   itemsrc_vend_uom  :           'EA',
-                                                   itemsrc_invvendoruomratio : 1.0,
-                                                   itemsrc_minordqty        : 0,
-                                                   itemsrc_multordqty        : 0,
-                                                   itemsrc_leadtime         :  30,
-                                                   itemsrc_ranking         :   0,
-                                                   itemsrc_active          :   true,
-                                                   itemsrc_manuf_name       :  '',
-                                                   itemsrc_manuf_item_number : '',
-                                                   itemsrc_manuf_item_descrip: '',
-                                                   itemsrc_default          : true,
-                                                   itemsrc_upccode    : ''
-                                                                  
-                                              });
-                                              grid.stopEditing();
-                                              grid.ds.insert(0, nr); 
-                                              grid.startEditing(0, 0); // type..
-                                          
-                                          }
-                                    }
-                                }
-                            ]
-
-                        },
-                        '|xns' : 'Roo.grid',
-                        autoExpandColumn : 'itemsrc_comments',
-                        xtype : 'EditorGrid',
-                        loadMask : true,
-                        clicksToEdit : 1,
-                        xns : Roo.grid,
-                        colModel : [
-                                {
-                                       editor : {
-                                           field : {
-                                               store : {
-                                                   proxy : {
-                                                       '|xns' : 'Roo.data',
-                                                       url : baseURL + '/Roo/vendinfo.php',
-                                                       method : 'GET',
-                                                       xtype : 'HttpProxy',
-                                                       xns : Roo.data
-                                                   },
-                                                   reader : {
-                                                       '|xns' : 'Roo.data',
-                                                       id : 'id',
-                                                       root : 'data',
-                                                       xtype : 'JsonReader',
-                                                       xns : Roo.data,
-                                                       fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
-                                                       totalProperty : 'total'
-                                                   },
-                                                   '|xns' : 'Roo.data',
-                                                   xtype : 'Store',
-                                                   remoteSort : true,
-                                                   xns : Roo.data,
-                                                   sortInfo : { direction : 'ASC', field: 'id' },
-                                                   listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              // set more here
-                                                          }
-                                                   },
-                                                   items : [
-
-                                                   ]
-
-                                               },
-                                               '|xns' : 'Roo.form',
-                                               listWidth : 400,
-                                               triggerAction : 'all',
-                                               forceSelection : true,
-                                               selectOnFocus : true,
-                                               pageSize : 20,
-                                               displayField : 'vend_name',
-                                               emptyText : "Select Vendor",
-                                               hiddenName : 'itemsrc_vend_id',
-                                               minChars : 2,
-                                               valueField : 'vend_id',
-                                               xtype : 'ComboBox',
-                                               allowBlank : false,
-                                               typeAhead : true,
-                                               editable : true,
-                                               width : 300,
-                                               xns : Roo.form,
-                                               name : 'itemsrc_vend_id_vend_name',
-                                               qtip : "Select vendinfo",
-                                               queryParam : 'q[search]',
-                                               tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
-                                               loadingText : "Searching...",
-                                               items : [
-
-                                               ]
-
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Vendor',
-                                       width : 120,
-                                       renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_vend_id',
-                                       items : [
-
-                                       ]
-
-                                   },
+          editor : {
+           field : {
+            '|xns' : 'Roo.form',
+            cls : 'align-right',
+            decimalPrecision : 2,
+            xns : Roo.form,
+            xtype : 'NumberField'
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          align : 'right',
+          dataIndex : 'ipshead_ipsitem_price',
+          header : _this._strings['3601146c4e948c32b6424d2c0a7f0118'],
+          renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
+          width : 120,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         }
+       ],
+       listeners : {
+        afteredit : function (e)
+         {
+             if(e.originalValue == e.value){
+                 return false;
+             }
+             
+             var id = _this.form.findField('item_id').getValue() * 1;
+             if(id < 1){
+                 return false;
+             }
+             
+             new Pman.Request({
+                 method : 'POST',
+                 url : baseURL + '/Roo/ipsiteminfo',
+                 mask : 'Saving',
+                 params : {
+                     ipsitem_ipshead_id : e.record.data.ipshead_id,
+                     ipsitem_item_id : id,
+                     ipsitem_price : e.record.data.ipshead_ipsitem_price,
+                     ipsitem_id : e.record.data.ipshead_ipsitem_id
+                 }
+             
+             });
+                 
+                  
+                 
+                 
+         },
+        beforeedit : function (e)
+         {
+             if(e.field != 'ipshead_ipsitem_price'){
+                 return false;
+             }
+             
+         },
+        render : function() 
+         {
+             _this.lgrid = this; 
+             //_this.dialog = Pman.Dialog.FILL_IN
+             if (_this.lpanel.active) {
+                this.footer.onClick('first');
+             }
+         }
+       },
+       items : [
+
+       ]
+
+      },
+      '|xns' : 'Roo',
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'ipshead',
+      title : _this._strings['1656a671ba692e15836cd85df374556c'],
+      xns : Roo,
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.lpanel = this;
+            
+            try { if (MODULE.isBuilder) {
+                return;
+            } } catch(e) { }
+            
+            var id = _this.form.findField('item_id').getValue() * 1;
+            if (id < 1) {
+                Roo.MessageBox.alert("Save First", "Save the item first, before adding image");
+                _this.dialog.layout.getRegion('center').showPanel(0);
+                return;
+            }
+            
+            if (_this.lgrid) {
+                _this.lgrid.footer.onClick('first');
+            
+             }
+        }
+      },
+      items : [
+
+      ]
+
+     },
+     {
+      grid : {
+       dataSource : {
+        proxy : {
+         '|xns' : 'Roo.data',
+         method : 'GET',
+         url : baseURL + '/Roo/itemsrc.php',
+         xns : Roo.data,
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         '|xns' : 'Roo.data',
+         fields : [
+             {
+                 'name': 'itemsrc_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_item_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_item_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_vend_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_vend_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_vend_item_number',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_vend_item_descrip',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_comments',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_vend_uom',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_invvendoruomratio',
+                 'type': 'float'
+             },
+             {
+                 'name': 'itemsrc_minordqty',
+                 'type': 'float'
+             },
+             {
+                 'name': 'itemsrc_multordqty',
+                 'type': 'float'
+             },
+             {
+                 'name': 'itemsrc_leadtime',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_ranking',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_active',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_manuf_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_manuf_item_number',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_manuf_item_descrip',
+                 'type': 'string'
+             },
+             {
+                 'name': 'itemsrc_default',
+                 'type': 'int'
+             },
+             {
+                 'name': 'itemsrc_upccode',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         xtype : 'JsonReader'
+        },
+        '|xns' : 'Roo.data',
+        remoteSort : true,
+        sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
+        xns : Roo.data,
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+              
+              var id = 1 * _this.form.findField('item_id').getValue();
+              if (!id) {
+                  this.removeAll();
+                  return false;
+              }
+              o.params.itemsrc_item_id = id;
+          },
+         update : function (_self, record, operation)
+          {
+              Roo.log(operation);
+                Roo.log(record);
+             
+              if (operation != 'commit') {
+                  return;
+              }
+              if (record.data.itemsrc_vend_id * 1 < 1) {
+                  return; // do not save.
+              }
+              if (record.data.itemsrc_id * 1 < 0) {
+                  return; // do not save. -- updating at present...
+              }
+              
+              var p = Roo.apply({}, record.data);
+              record.set('itemsrc_id', -1);    
+              
+              new Pman.Request({
+                  url : baseURL + '/Roo/Itemsrc',
+                  params : p,
+                  method : 'POST',
+                  success: function(res) {
+                      if (record.data.itemsrc_id *1  < 1) { 
+                          record.set('itemsrc_id', res.data.itemsrc_id);
+                      }
+                  }
+              });
+              
+              
+          }
+        },
+        items : [
+
+        ]
+
+       },
+       footer : {
+        '|xns' : 'Roo',
+        displayInfo : true,
+        displayMsg : _this._strings['7f841b4d2f7280eb82318988c6d649d1'],
+        emptyMsg : _this._strings['19df363d15888baa395364fbcd230c05'],
+        pageSize : 25,
+        xns : Roo,
+        xtype : 'PagingToolbar'
+       },
+       toolbar : {
+        '|xns' : 'Roo',
+        xns : Roo,
+        xtype : 'Toolbar',
+        items : [
+         {
+          '|xns' : 'Roo.Toolbar',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'],
+          xns : Roo.Toolbar,
+          xtype : 'Button',
+          listeners : {
+           click : function()
+            {
+                 
+                Roo.log("add presed");
+                 
+                // work out last 
+                var grid = _this.itemsrcgrid;
+                 
+                // uses form defaults or last row value.
+                var nr = grid.ds.reader.newRow({
+                     itemsrc_id : 0,
+                     itemsrc_item_id : _this.form.findField('item_id').getValue(),
+                     itemsrc_vend_id : 0,
+                     itemsrc_vend_id_vend_name : '',
+                     itemsrc_vend_item_number : '',
+                     itemsrc_vend_item_descrip : '',
+                     itemsrc_comments           : '',
+                     itemsrc_vend_uom  :           'EA',
+                     itemsrc_invvendoruomratio : 1.0,
+                     itemsrc_minordqty        : 0,
+                     itemsrc_multordqty        : 0,
+                     itemsrc_leadtime         :  30,
+                     itemsrc_ranking         :   0,
+                     itemsrc_active          :   true,
+                     itemsrc_manuf_name       :  '',
+                     itemsrc_manuf_item_number : '',
+                     itemsrc_manuf_item_descrip: '',
+                     itemsrc_default          : true,
+                     itemsrc_upccode    : ''
+                                    
+                });
+                grid.stopEditing();
+                grid.ds.insert(0, nr); 
+                grid.startEditing(0, 0); // type..
+            
+            }
+          }
+         }
+        ]
+
+       },
+       '|xns' : 'Roo.grid',
+       autoExpandColumn : 'itemsrc_comments',
+       clicksToEdit : 1,
+       loadMask : true,
+       xns : Roo.grid,
+       xtype : 'EditorGrid',
+       colModel : [
+         {
+          editor : {
+           field : {
+            store : {
+             proxy : {
+              '|xns' : 'Roo.data',
+              method : 'GET',
+              url : baseURL + '/Roo/vendinfo.php',
+              xns : Roo.data,
+              xtype : 'HttpProxy'
+             },
+             reader : {
+              '|xns' : 'Roo.data',
+              fields : [{"name":"id","type":"int"},{"name":"vend_name","type":"string"}],
+              id : 'id',
+              root : 'data',
+              totalProperty : 'total',
+              xns : Roo.data,
+              xtype : 'JsonReader'
+             },
+             '|xns' : 'Roo.data',
+             remoteSort : true,
+             sortInfo : { direction : 'ASC', field: 'id' },
+             xns : Roo.data,
+             xtype : 'Store',
+             listeners : {
+              beforeload : function (_self, o){
+                   o.params = o.params || {};
+                   // set more here
+               }
+             },
+             items : [
+
+             ]
+
+            },
+            '|xns' : 'Roo.form',
+            allowBlank : false,
+            displayField : 'vend_name',
+            editable : true,
+            emptyText : _this._strings['7996af9149ed376ce252e35c4da7146b'],
+            forceSelection : true,
+            hiddenName : 'itemsrc_vend_id',
+            listWidth : 400,
+            loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'],
+            minChars : 2,
+            name : 'itemsrc_vend_id_vend_name',
+            pageSize : 20,
+            qtip : _this._strings['dd24f967299e81b9603cb071693d5c32'],
+            queryParam : 'q[search]',
+            selectOnFocus : true,
+            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
+            triggerAction : 'all',
+            typeAhead : true,
+            valueField : 'vend_id',
+            width : 300,
+            xns : Roo.form,
+            xtype : 'ComboBox',
+            items : [
+
+            ]
+
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'itemsrc_vend_id',
+          header : _this._strings['ec9ceefe0c19f4c029008c23e3c947b7'],
+          renderer : function(v,x,r) { return String.format('{0}', r.data.itemsrc_vend_id_vend_name); },
+          width : 120,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         },
 {
-                                       editor : {
-                                           field : {
-                                               '|xns' : 'Roo.form',
-                                               xtype : 'TextField',
-                                               xns : Roo.form
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Vendor Ref#',
-                                       width : 100,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_vend_item_number',
-                                       items : [
-
-                                       ]
-
-                                   },
+          editor : {
+           field : {
+            '|xns' : 'Roo.form',
+            xns : Roo.form,
+            xtype : 'TextField'
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'itemsrc_vend_item_number',
+          header : _this._strings['e5353fc67b122d1b42181073b46cd060'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 100,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         },
 {
-                                       editor : {
-                                           field : {
-                                               '|xns' : 'Roo.form',
-                                               xtype : 'TextField',
-                                               xns : Roo.form
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Comments',
-                                       width : 200,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_comments',
-                                       items : [
-
-                                       ]
-
-                                   },
+          editor : {
+           field : {
+            '|xns' : 'Roo.form',
+            xns : Roo.form,
+            xtype : 'TextField'
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'itemsrc_comments',
+          header : _this._strings['8413c683b4b27cc3f4dbd4c90329d8ba'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 200,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'UOM',
-                                       width : 50,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_vend_uom'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'itemsrc_vend_uom',
+          header : _this._strings['bb8913cd17d59f182acc7be1020007b7'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 50,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       editor : {
-                                           field : {
-                                               '|xns' : 'Roo.form',
-                                               minValue : 0,
-                                               xtype : 'NumberField',
-                                               decimalPrecision : 0,
-                                               xns : Roo.form
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       align : 'right',
-                                       xtype : 'ColumnModel',
-                                       header : 'Min Qty',
-                                       width : 50,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_minordqty',
-                                       items : [
-
-                                       ]
-
-                                   },
+          editor : {
+           field : {
+            '|xns' : 'Roo.form',
+            decimalPrecision : 0,
+            minValue : 0,
+            xns : Roo.form,
+            xtype : 'NumberField'
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          align : 'right',
+          dataIndex : 'itemsrc_minordqty',
+          header : _this._strings['7be1fa478799242847d4ef861ff6f8e1'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 50,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         },
 {
-                                       editor : {
-                                           field : {
-                                               '|xns' : 'Roo.form',
-                                               minValue : 0,
-                                               xtype : 'NumberField',
-                                               decimalPrecision : 0,
-                                               xns : Roo.form
-                                           },
-                                           '|xns' : 'Roo.grid',
-                                           xtype : 'GridEditor',
-                                           xns : Roo.grid,
-                                           items : [
-
-                                           ]
-
-                                       },
-                                       '|xns' : 'Roo.grid',
-                                       align : 'right',
-                                       xtype : 'ColumnModel',
-                                       header : 'Lead time',
-                                       width : 75,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_leadtime',
-                                       items : [
-
-                                       ]
-
-                                   },
+          editor : {
+           field : {
+            '|xns' : 'Roo.form',
+            decimalPrecision : 0,
+            minValue : 0,
+            xns : Roo.form,
+            xtype : 'NumberField'
+           },
+           '|xns' : 'Roo.grid',
+           xns : Roo.grid,
+           xtype : 'GridEditor',
+           items : [
+
+           ]
+
+          },
+          '|xns' : 'Roo.grid',
+          align : 'right',
+          dataIndex : 'itemsrc_leadtime',
+          header : _this._strings['0ac9012a8c03a76ee76f04321b3b7fda'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 75,
+          xns : Roo.grid,
+          xtype : 'ColumnModel',
+          items : [
+
+          ]
+
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Active',
-                                       width : 50,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'itemsrc_active'
-                                   }
-                        ],
-                        listeners : {
-                               rowdblclick : function (_self, rowIndex, e)
-                                  {
-                                      if (!_this.dialog) return;
-                                      _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
-                                          _this.grid.footer.onClick('first');
-                                      }); 
-                                  },
-                               render : function() 
-                                  {
-                                      _this.itemsrcgrid = this; 
-                                      
-                                      if (_this.itemsrcpanel.active) {
-                                         this.footer.onClick('first');
-                                      }
-                                  },
-                               afteredit : function (e)
-                                  {
-                                      e.record.commit();
-                                  }
-                        },
-                        items : [
-
-                        ]
-
-                    },
-                    '|xns' : 'Roo',
-                    fitToframe : true,
-                    background : true,
-                    region : 'center',
-                    title : "Suppliers",
-                    xtype : 'GridPanel',
-                    fitContainer : true,
-                    xns : Roo,
-                    tableName : 'itemsrc',
-                    listeners : {
-                       activate : function() {
-                              _this.itemsrcpanel = this;
-                              
-                              try { if (MODULE.isBuilder) {
-                                  return;
-                              } } catch(e) { }
-                              
-                              var id = _this.form.findField('item_id').getValue() * 1;
-                              if (id < 1) {
-                                  Roo.MessageBox.alert("Save First", "Save the item first, before adding suppliers");
-                                  _this.dialog.layout.getRegion('center').showPanel(0);
-                                  return false;
-                              }
-                              
-                              var type = _this.form.findField('item_type').getValue();
-                              
-                              if(type == 'K'){
-                                  Roo.MessageBox.alert("Error", "Can't add suppliers to kit item");
-                                  _this.dialog.layout.getRegion('center').showPanel(0);
-                                  return false;
-                              }
-                              
-                              if (_this.itemsrcgrid) {
-                                  _this.itemsrcgrid.footer.onClick('first');
-                              }
-                          }
-                    },
-                    items : [
-
-                    ]
-
-                },
-               {
-                    grid : {
-                        dataSource : {
-                            proxy : {
-                                '|xns' : 'Roo.data',
-                                url : baseURL + '/Roo/events.php',
-                                xtype : 'HttpProxy',
-                                method : 'GET',
-                                xns : Roo.data
-                            },
-                            reader : {
-                                '|xns' : 'Roo.data',
-                                id : 'id',
-                                root : 'data',
-                                xtype : 'JsonReader',
-                                fields : [
-                                    {
-                                        'name': 'event_when',
-                                        'type': 'date'
-                                    },
-                                    {
-                                        'name': 'action',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'ipaddr',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'person_id_name',
-                                        'type': 'string'
-                                    },
-                                    {
-                                        'name': 'remarks',
-                                        'type': 'string'
-                                    }
-                                ],
-                                xns : Roo.data,
-                                totalProperty : 'total'
-                            },
-                            '|xns' : 'Roo.data',
-                            xtype : 'Store',
-                            remoteSort : true,
-                            sortInfo : { field : 'event_when', direction: 'DESC' },
-                            xns : Roo.data,
-                            listeners : {
-                               beforeload : function (_self, options)
-                                  {
-                                      options.params = options.params || {};
-                                      
-                                      options.params.on_table = 'item';
-                                      options.params.on_id = _this.form.findField('item_id').getValue();
-                                  }
-                            },
-                            items : [
-
-                            ]
-
-                        },
-                        footer : {
-                            '|xns' : 'Roo',
-                            pageSize : 25,
-                            xtype : 'PagingToolbar',
-                            emptyMsg : "No Events found",
-                            xns : Roo,
-                            displayMsg : "Displaying events{0} - {1} of {2}",
-                            displayInfo : true
-                        },
-                        '|xns' : 'Roo.grid',
-                        autoExpandColumn : 'remarks',
-                        xtype : 'Grid',
-                        loadMask : true,
-                        xns : Roo.grid,
-                        colModel : [
-                                {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Changed',
-                                       width : 120,
-                                       renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'event_when'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'itemsrc_active',
+          header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 50,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         }
+       ],
+       listeners : {
+        afteredit : function (e)
+         {
+             e.record.commit();
+         },
+        render : function() 
+         {
+             _this.itemsrcgrid = this; 
+             
+             if (_this.itemsrcpanel.active) {
+                this.footer.onClick('first');
+             }
+         },
+        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 : 'center',
+      tableName : 'itemsrc',
+      title : _this._strings['1814d65a76028fdfbadab64a5a8076df'],
+      xns : Roo,
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.itemsrcpanel = this;
+            
+            try { if (MODULE.isBuilder) {
+                return;
+            } } catch(e) { }
+            
+            var id = _this.form.findField('item_id').getValue() * 1;
+            if (id < 1) {
+                Roo.MessageBox.alert("Save First", "Save the item first, before adding suppliers");
+                _this.dialog.layout.getRegion('center').showPanel(0);
+                return false;
+            }
+            
+            var type = _this.form.findField('item_type').getValue();
+            
+            if(type == 'K'){
+                Roo.MessageBox.alert("Error", "Can't add suppliers to kit item");
+                _this.dialog.layout.getRegion('center').showPanel(0);
+                return false;
+            }
+            
+            if (_this.itemsrcgrid) {
+                _this.itemsrcgrid.footer.onClick('first');
+            }
+        }
+      },
+      items : [
+
+      ]
+
+     },
+     {
+      grid : {
+       dataSource : {
+        proxy : {
+         '|xns' : 'Roo.data',
+         method : 'GET',
+         url : baseURL + '/Roo/events.php',
+         xns : Roo.data,
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         '|xns' : 'Roo.data',
+         fields : [
+             {
+                 'name': 'event_when',
+                 'type': 'date'
+             },
+             {
+                 'name': 'action',
+                 'type': 'string'
+             },
+             {
+                 'name': 'ipaddr',
+                 'type': 'string'
+             },
+             {
+                 'name': 'person_id_name',
+                 'type': 'string'
+             },
+             {
+                 'name': 'remarks',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         xtype : 'JsonReader'
+        },
+        '|xns' : 'Roo.data',
+        remoteSort : true,
+        sortInfo : { field : 'event_when', direction: 'DESC' },
+        xns : Roo.data,
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, options)
+          {
+              options.params = options.params || {};
+              
+              options.params.on_table = 'item';
+              options.params.on_id = _this.form.findField('item_id').getValue();
+          }
+        },
+        items : [
+
+        ]
+
+       },
+       footer : {
+        '|xns' : 'Roo',
+        displayInfo : true,
+        displayMsg : _this._strings['089ba2b5edc96565fc22c584ecfbb1a6'],
+        emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'],
+        pageSize : 25,
+        xns : Roo,
+        xtype : 'PagingToolbar'
+       },
+       '|xns' : 'Roo.grid',
+       autoExpandColumn : 'remarks',
+       loadMask : true,
+       xns : Roo.grid,
+       xtype : 'Grid',
+       colModel : [
+         {
+          '|xns' : 'Roo.grid',
+          dataIndex : 'event_when',
+          header : _this._strings['820dbd2b8f606aff866c0bbfb6b737c1'],
+          renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
+          width : 120,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Action',
-                                       width : 200,
-                                       renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'action'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'action',
+          header : _this._strings['004bf6c9a40003140292e97330236c53'],
+          renderer : function(v,x,r) { return String.format('{0} - {1}', v, r.data.on_table); },
+          width : 200,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'IP Address',
-                                       width : 200,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'ipaddr'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'ipaddr',
+          header : _this._strings['5b8c99dad1893a85076709b2d3c2d2d0'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 200,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Who',
-                                       width : 75,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'person_id_name'
-                                   },
+          '|xns' : 'Roo.grid',
+          dataIndex : 'person_id_name',
+          header : _this._strings['4ee972120bcda675f75222c87cb9d356'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 75,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         },
 {
-                                       '|xns' : 'Roo.grid',
-                                       xtype : 'ColumnModel',
-                                       header : 'Notes',
-                                       width : 200,
-                                       renderer : function(v) { return String.format('{0}', v); },
-                                       xns : Roo.grid,
-                                       dataIndex : 'remarks'
-                                   }
-                        ],
-                        listeners : {
-                               render : function() 
-                                  {
-                                      _this.hgrid = this; 
-                                      if (_this.hpanel.active) {
-                                         this.footer.onClick('first');
-                                      }
-                                  }
-                        },
-                        items : [
-
-                        ]
-
-                    },
-                    '|xns' : 'Roo',
-                    fitToframe : true,
-                    background : true,
-                    region : 'center',
-                    title : "History",
-                    xtype : 'GridPanel',
-                    fitContainer : true,
-                    xns : Roo,
-                    tableName : 'events',
-                    listeners : {
-                       activate : function() {
-                              _this.hpanel = this;
-                              if (_this.hgrid) {
-                                  _this.hgrid.footer.onClick('first');
-                              }
-                          }
-                    },
-                    items : [
-
-                    ]
+          '|xns' : 'Roo.grid',
+          dataIndex : 'remarks',
+          header : _this._strings['f4c6f851b00d5518bf888815de279aba'],
+          renderer : function(v) { return String.format('{0}', v); },
+          width : 200,
+          xns : Roo.grid,
+          xtype : 'ColumnModel'
+         }
+       ],
+       listeners : {
+        render : function() 
+         {
+             _this.hgrid = this; 
+             if (_this.hpanel.active) {
+                this.footer.onClick('first');
+             }
+         }
+       },
+       items : [
+
+       ]
+
+      },
+      '|xns' : 'Roo',
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'events',
+      title : _this._strings['16d2b386b2034b9488996466aaae0b57'],
+      xns : Roo,
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.hpanel = this;
+            if (_this.hgrid) {
+                _this.hgrid.footer.onClick('first');
+            }
+        }
+      },
+      items : [
 
-                }
-            ]
+      ]
+
+     }
+    ]
 
-        });
   }
+   });
+ }
 };