Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleItem.bjs
index 96c4939..e2c7a89 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/Pman.Xtuple/Pman.Dialog.XtupleItem.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "346577d22bb510368e3eddab5df2ca13" : "Reference Files",
+  "be53a0541a6d36f6ecb879fa2c584b08" : "Image",
+  "92b17d3d0f13232ec1d46844c836d4db" : "Invoice UOM",
+  "390fc24b0feebfff8c3fb8625418c2e9" : "Perishable",
+  "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
+  "956e816fa19ca04485c7101adbe07762" : "Displaying records {0} - {1} of {2}",
+  "69395719de41dd8a31905b1e94c91816" : "Select classcode",
+  "82a43f89af6d331d80d441624c5c71fa" : "Default Location",
+  "538a3c9d82a4ea4250b987a357d41184" : "Item Parts",
+  "03ab340b3f99e03cff9e84314ead38c0" : "Qty",
+  "5b8c99dad1893a85076709b2d3c2d2d0" : "IP Address",
+  "fce71ab09b7795157c6e23370b4afb26" : "Stocked",
+  "045a1ac263ac3a9b7420208bdc2df423" : "Select costcat",
+  "0c81971f67c0bd4b33799c5365ec2bf5" : "No Images found",
+  "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
+  "151ccf95db9b81c11bb20fbc302af4b6" : "Select terms",
+  "786410e93beb0193d89f8608c54feb4b" : "Select item",
+  "0ac9012a8c03a76ee76f04321b3b7fda" : "Lead time",
+  "675c9bd3bbae30af03fe74346dcae9a7" : "Edit / Create item",
+  "dd24f967299e81b9603cb071693d5c32" : "Select vendinfo",
+  "023a5dfa857c4aa0156e6685231a1dbd" : "Select Type",
+  "e8586011952b0d098b0e568f20ca2b1f" : "Select Currency",
+  "9bd81329febf6efe22788e03ddeaf0af" : "Class",
+  "8413c683b4b27cc3f4dbd4c90329d8ba" : "Comments",
+  "820dbd2b8f606aff866c0bbfb6b737c1" : "Changed",
+  "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
+  "0eceeb45861f9585dd7a97a3e36f85c6" : "Created",
+  "386c339d37e737a436499d423a77df0c" : "Currency",
+  "9076cbba1d9ef79280b4f39e2aa0d115" : "Nothing found",
+  "1243daf593fa297e07ab03bf06d925af" : "Searching...",
+  "6df5afb79e960381ed66568c2a644ec6" : "Description (2)",
+  "7be1fa478799242847d4ef861ff6f8e1" : "Min Qty",
+  "6665e3761028c84e1d228de3432229ed" : "SKU",
+  "e54f1b41d200adbd96eb53634388d780" : "Sales Account",
+  "76729937a5eb6b0fd88c42581161facd" : "Select Category",
+  "eccd13e2f1acfd6b8412a2caafa37a80" : "Stock Safety Level",
+  "43b2683180fe5e67a91696c834df0a32" : "Reorder Level",
+  "e1a8f447925ed2867c591aa0865d170e" : "Multi Location",
+  "7d74f3b92b19da5e606d737d339a9679" : "Item",
+  "2ea154449c00001e87af8df7c0728678" : "Control Method",
+  "19df363d15888baa395364fbcd230c05" : "No itemsrc found",
+  "0d122b17933ab4173e9d75d55fc5e764" : "Standard Cost",
+  "df2ad52a14d681b1cd8495f8650fdb56" : "Select prodcat",
+  "49ee3087348e8d44e1feda1917443987" : "Name",
+  "e5353fc67b122d1b42181073b46cd060" : "Vendor Ref#",
+  "c19ea8f7a11074ac743c58d34830b233" : "Select plancode",
+  "ea4788705e6873b424c65e91c2846b19" : "Cancel",
+  "c056b1456660ea65aad6dfc664002b84" : "Item active",
+  "9d98e31f261471f426e906282544c15d" : "Item comments",
+  "20f39d1311ccbd3b7e61cdd4978719f9" : "Itemsite Settings",
+  "1656a671ba692e15836cd85df374556c" : "Price List",
+  "bb8913cd17d59f182acc7be1020007b7" : "UOM",
+  "f9c68217f6ef9a9afe7575e766bd7b9f" : "Planner Code",
+  "76d5bf9597c882d6513f71759df298d5" : "Displaying parts {0} - {1} of {2}",
+  "3601146c4e948c32b6424d2c0a7f0118" : "Price",
+  "1814d65a76028fdfbadab64a5a8076df" : "Suppliers",
+  "90e4ac2e5a22e53df63b6b186d8727ba" : "No Events found",
+  "4ee972120bcda675f75222c87cb9d356" : "Who",
+  "16d2b386b2034b9488996466aaae0b57" : "History",
+  "14fc4f0a5008e1d8d5645071755c596b" : "Price UOM",
+  "089ba2b5edc96565fc22c584ecfbb1a6" : "Displaying events{0} - {1} of {2}",
+  "b5a7adde1af5c87d7fd797b6245c2a39" : "Description",
+  "148cb4c3e6469c6a92d24951485b65ff" : "Item listprice",
+  "c96bc98500430b5eb8e9cfc5959e09b5" : "Item sold",
+  "7f841b4d2f7280eb82318988c6d649d1" : "Displaying itemsrc{0} - {1} of {2}",
+  "a254c25adc7d10d7e9c4889484f875a5" : "Detail",
+  "5aa275a71868f3afcacfd6de452b07eb" : "Costcat",
+  "c0ed345ec857c06b31f7e88745c9bc40" : "Displaying Images  {0} - {1} of {2}",
+  "c9cc8cce247e49bae79f15173ce97354" : "Save",
+  "6abc7326bcd435c1eb22ad3714db48c4" : "Lead time (Days)",
+  "ec9ceefe0c19f4c029008c23e3c947b7" : "Vendor",
+  "4d3d769b812b6faa6b76e1a8abaece2d" : "Active",
+  "004bf6c9a40003140292e97330236c53" : "Action",
+  "689202409e48743b914713f96d93947c" : "Value",
+  "f4c6f851b00d5518bf888815de279aba" : "Notes",
+  "10991ea03e3591bebc4c0827fc369540" : "Product Category",
+  "f9838de820f2a2e16241033270c68e29" : "Select uom",
+  "8c489d0946f66d17d73f26366a4bf620" : "Weight",
+  "d85a8a381c36f6dde21d81542830e2b1" : "Sold",
+  "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}"
+           },
+           "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" : [
                 {
-                    "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",
-                    "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       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" : [
-                                {
-                                    "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    _this.form.findField('_update_related').setValue(1);\n    \n    switch(it) {\n        case 'K':\n            state = false;\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    if(!state){\n        _this.standardCostFieldSet.hide();\n        _this.itemsiteFieldSet.hide();\n        _this.form.findField('_update_related').setValue(0);\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"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "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" : [
-                                                                {
-                                                                    "$ url" : "baseURL + '/Roo/curr_symbol.php'",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "method" : "GET",
-                                                                    "$ 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'",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "method" : "GET",
-                                                                    "$ 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'",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "method" : "GET",
-                                                                    "$ 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'",
-                                                                    "method" : "GET",
-                                                                    "xtype" : "HttpProxy",
-                                                                    "$ 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",
-                                    "$ xns" : "Roo.form",
-                                    "width" : 75,
-                                    "name" : "item_id"
-                                },
-                                {
-                                    "value" : 1,
-                                    "xtype" : "Hidden",
-                                    "width" : 75,
-                                    "$ xns" : "Roo.form",
-                                    "name" : "_update_related"
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "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.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 parts\");\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" : "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.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    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" : "bom_item_id_item_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.bom_parent_item_id = id;\n}"
-                                    },
-                                    "xtype" : "Store",
-                                    "remoteSort" : true,
-                                    "$ sortInfo" : "{ field : 'bom_item_id_item_name', direction: 'ASC' }",
-                                    "$ xns" : "Roo.data",
-                                    "* prop" : "dataSource",
-                                    "items" : [
-                                        {
-                                            "$ url" : "baseURL + '/Roo/ipshead.php'",
-                                            "xtype" : "HttpProxy",
-                                            "method" : "GET",
-                                            "$ xns" : "Roo.data",
-                                            "* prop" : "proxy"
-                                        },
-                                        {
-                                            "id" : "bom_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" : "bom_item_id_item_name"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Description",
-                                    "width" : 150,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "bom_item_id_item_descrip"
-                                },
-                                {
-                                    "xtype" : "ColumnModel",
-                                    "header" : "Qty",
-                                    "width" : 100,
-                                    "$ renderer" : "function(v) { return String.format('{0}', v); }",
-                                    "$ xns" : "Roo.grid",
-                                    "* prop" : "colModel[]",
-                                    "dataIndex" : "bom_qtyper"
-                                }
-                            ]
-                        }
-                    ]
+                 "$ 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}"
-                    },
-                    "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"
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "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}"
-                    },
-                    "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"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
+                 "$ url" : "baseURL + '/Roo/costcat.php'",
+                 "xtype" : "HttpProxy",
+                 "method" : "GET",
+                 "$ xns" : "Roo.data",
+                 "* prop" : "proxy"
                 },
                 {
-                    "listeners" : {
-                        "|activate" : "function() {\n    _this.itemsrcpanel = this;\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    //_this.dialog = Pman.Dialog.FILL_IN\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\n         itemsrc_vend_id : 0,\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"
-                                                                },
-                                                                {
-                                                                    "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"
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "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}"
-                    },
-                    "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"
-                                }
-                            ]
-                        }
-                    ]
+                 "$ 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}"
+     },
+     "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'",
+               "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}"
+     },
+     "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'",
+           "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}"
+     },
+     "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'",
+           "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}"
+     },
+     "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'",
+           "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}"
+     },
+     "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'",
+           "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