Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtuplePriceLists.bjs
index c7013e7..c95a666 100644 (file)
@@ -27,7 +27,7 @@
                         {
                             "*prop": "east",
                             "split": true,
-                            "width": 200,
+                            "width": 350,
                             "xtype": "LayoutRegion",
                             "|xns": "Roo"
                         },
@@ -56,6 +56,9 @@
                                     "|xns": "Roo.grid",
                                     "items": [
                                         {
+                                            "listeners": {
+                                                "afterselectionchange": "function (_self)\n{\n    _this.igrid.footer.onClick('first');\n}"
+                                            },
                                             "*prop": "sm",
                                             "singleSelect": true,
                                             "xtype": "RowSelectionModel",
                                 {
                                     "listeners": {
                                         "|render": "function() \n{\n    _this.igrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.ipanel.active) {\n       //this.footer.onClick('first');\n    }\n}",
-                                        "cellclick": "function (_self, row, col, e)\n{\n     var di = _this.grid.colModel.getDataIndex(col);\n     \n     var rec = _this.grid.ds.getAt(row);\n     \n     if(di == 'item_image_filename'){\n        if(!rec.data.item_image_id){\n            return;\n        }\n        var u = baseURL;\n        if(rec.data.item_image_from_hk){\n            u = u.split('/');\n            u.pop();\n            u = u.join('/') + '/hk.php';\n        }\n        Pman.download( {\n           url: u + '/Images/Download/' + rec.data.item_image_id  + '/' + rec.data.item_image_filename\n       });\n       return;\n     }\n     \n     if (di == 'item_active') {\n     \n        var nv = rec.data.item_active ? 0 : 1;\n        new Pman.Request({\n            mask : 'Saving',\n            url : baseURL + '/Roo/Item',\n            params : {\n                item_id : rec.data.item_id,\n                item_active : nv\n            },\n            success : function() {\n                rec.set('item_active', nv);\n            }\n        });\n        return;\n        \n     \n     }\n     \n     if(di == 'itemsrc_active'){\n        if(!rec.data.itemsrc_active){\n            Roo.MessageBox.alert('Error','Please edit it on Xtuple tool');\n            return;\n        }\n        if(rec.data.itemsrc_active){\n            Roo.MessageBox.confirm(\"Confirm\", \"Are you sure this product is no longer purchased\",\n                function (res) {\n                    if(res!='yes') {\n                        return;\n                    }\n                    rec.commit();\n            });\n        }\n    }\n     \n     _this.locgrid.footer.onClick('first');\n     \n     \n     \n     \n}",
-                                        "afteredit": "function (e)\n{\n    \n    \n    Roo.log(e);\n    new Pman.Request({\n        url : baseURL +'/Roo/Charass',\n        params : {\n             charass_char_id_char_name : e.field.replace(/^item_char_/,'').toUpperCase(),\n             charass_value : e.value,\n             charass_target_type : 'I',\n             charass_default : 1,\n             charass_target_id : e.record.data.item_id\n         },\n         method : 'POST'\n     });\n    \n    \n    e.record.commit();\n    \n    \n    \n}",
-                                        "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"
+                                        "afteredit": "function (e)\n{\n    if(e.value == e.originalValue){\n        return false;       \n    }\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.data.ipshead_id * 1 < 1){\n        Roo.MessageBox.alert('Error','Please select a price list');\n        return false;       \n    }\n    \n    new Pman.Request({\n        url : baseURL +'/Roo/Item',\n        method : 'POST',\n        marks : 'Posting',\n        params : {\n             update_ipshead : 1,\n             ipshead_id : p.data.ipshead_id,\n             item_id : e.record.data.item_id,\n             _price : e.value,\n         },\n         success : function() {\n            _this.igrid.footer.onClick('refresh');\n        }\n         \n     });\n    \n}",
+                                        "beforeedit": "function (e)\n{\n    if(e.field != 'ipshead_price'){\n        return false;\n    }\n\n}"
                                     },
                                     "*prop": "grid",
-                                    "autoExpandColumn": "item_descrip1",
+                                    "autoExpandColumn": "item_number",
                                     "clicksToEdit": 1,
                                     "loadMask": true,
                                     "xtype": "EditorGrid",
                                     "items": [
                                         {
                                             "listeners": {
-                                                "beforeload": "function (_self, o)\n{\n    o.params = o.params || {}\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.ipshead_id * 1 < 1){\n        this.ds.removeAll();\n        return;\n    }\n    \n    o.params.item_active = 1;\n\n}",
-                                                "update": "function (_self, record, operation)\n{\n    if(operation != 'commit'){\n        return;\n    }\n    \n    var nv  = record.data.itemsrc_active ? 0 : 1;\n    new Pman.Request({\n        mask : 'Saving',\n        url : baseURL + '/Roo/Itemsrc',\n        params : {\n            _update_by_item : 1,\n            item_id : record.data.item_id,\n            itemsrc_active : nv\n        },\n        success : function(res) {\n            record.set('itemsrc_active', nv);\n        }\n    });\n}"
+                                                "beforeload": "function (_self, o)\n{\n    o.params = o.params || {}\n    \n    var p = _this.grid.getSelectionModel().getSelected();\n    \n    if(!p || p.data.ipshead_id * 1 < 1){\n        this.removeAll();\n        return false;\n    }\n    \n    //o.params.item_active = 1;\n    o.params._ipshead_price = 1;\n    o.params._ipshead_id = p.data.ipshead_id;\n\n}"
                                             },
                                             "*prop": "dataSource",
                                             "remoteSort": true,
                                                     "|xns": "Roo.data"
                                                 },
                                                 {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
                                                     "*prop": "reader",
                                                     "id": "id",
-                                                    "|fields": "[\n    {\n        'name': 'item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'item_descrip1',\n        'type': 'string'\n    },\n    {\n        'name': 'item_descrip2',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_picklist',\n        'type': 'int'\n    },\n    {\n        'name': 'item_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'item_sold',\n        'type': 'int'\n    },\n    {\n        'name': 'item_fractional',\n        'type': 'int'\n    },\n    {\n        'name': 'item_active',\n        'type': 'int'\n    },\n    {\n        'name': 'item_type',\n        'type': 'string'\n    },\n    {\n        'name': 'item_prodweight',\n        'type': 'float'\n    },\n    {\n        'name': 'item_packweight',\n        'type': 'float'\n    },\n    {\n        'name': 'item_prodcat_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_exclusive',\n        'type': 'int'\n    },\n    {\n        'name': 'item_listprice',\n        'type': 'float'\n    },\n    {\n        'name': 'item_config',\n        'type': 'int'\n    },\n    {\n        'name': 'item_extdescrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_upccode',\n        'type': 'string'\n    },\n    {\n        'name': 'item_maxcost',\n        'type': 'float'\n    },\n    {\n        'name': 'item_inv_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_price_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_warrdays',\n        'type': 'int'\n    },\n    {\n        'name': 'item_freightclass_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_tax_recoverable',\n        'type': 'int'\n    },\n    {\n        'name': 'item_price_uom_id_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_price_uom_id_uom_name',\n        'type': 'string'\n    },\n    {\n        'name': 'item_price_uom_id_uom_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_price_uom_id_uom_item_weight',\n        'type': 'int'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_name',\n        'type': 'string'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_inv_uom_id_uom_item_weight',\n        'type': 'int'\n    },\n    {\n        'name': 'item_freightclass_id_freightclass_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_freightclass_id_freightclass_code',\n        'type': 'string'\n    },\n    {\n        'name': 'item_freightclass_id_freightclass_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_classcode_id_classcode_code',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_mfg',\n        'type': 'int'\n    },\n    {\n        'name': 'item_classcode_id_classcode_creator',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_created',\n        'type': 'date'\n    },\n    {\n        'name': 'item_classcode_id_classcode_modifier',\n        'type': 'string'\n    },\n    {\n        'name': 'item_classcode_id_classcode_modified',\n        'type': 'date'\n    },\n    {\n        'name': 'item_classcode_id_classcode_type',\n        'type': 'string'\n    }\n]"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.brandSel = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "allowBlank": true,
-                                                    "alwaysQuery": true,
-                                                    "displayField": "charass_value",
-                                                    "editable": true,
-                                                    "forceSelection": true,
-                                                    "listWidth": 300,
-                                                    "loadingText": "Searching...",
-                                                    "minChars": 2,
-                                                    "pageSize": 20,
-                                                    "qtip": "Select Brand",
-                                                    "queryParam": "query[charass_value]",
-                                                    "selectOnFocus": true,
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "width": 150,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
-                                                        {
-                                                            "listeners": {
-                                                                "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    // look for all of the charass 's with the same type= eg. brand.\n    \n    o.params.charass_char_id_char_name = 'BRAND';\n    o.params.charass_target_type ='I';\n    o.params._distinct = 'charass_value';\n        o.params._columns = 'charass_value';\n\n}"
-                                                            },
-                                                            "*prop": "store",
-                                                            "remoteSort": true,
-                                                            "xtype": "Store",
-                                                            "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                            "|xns": "Roo.data",
-                                                            "items": [
-                                                                {
-                                                                    "*prop": "proxy",
-                                                                    "method": "GET",
-                                                                    "xtype": "HttpProxy",
-                                                                    "|url": "baseURL + '/Roo/Charass.php'",
-                                                                    "|xns": "Roo.data"
-                                                                },
-                                                                {
-                                                                    "|xns": "Roo.data",
-                                                                    "xtype": "JsonReader",
-                                                                    "totalProperty": "total",
-                                                                    "root": "data",
-                                                                    "*prop": "reader",
-                                                                    "id": "id",
-                                                                    "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.search = _self;\n}",
-                                                        "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "xtype": "TextField",
-                                                    "|xns": "Roo.form"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "|click": "function (_self, e)\n{\n    _this.search.setValue('');\n    \n\n    \n    _this.grid.footer.onClick('first');\n}"
-                                                    },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Separator"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "toggle": "function (_self, pressed)\n{\n\n    this.setText(pressed ? \"Hide Inactive\" : \"Show Inactive\");\n    (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}",
-                                                        "render": "function (_self)\n{\n    _this.active = _self;\n}"
-                                                    },
-                                                    "enableToggle": true,
-                                                    "text": "Show Inactive",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
-                                                },
-                                                {
-                                                    "text": "Report start :",
-                                                    "xtype": "TextItem",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.dateFrom = _self;\n}"
-                                                    },
-                                                    "format": "d/M/Y",
-                                                    "useIso": true,
-                                                    "xtype": "DateField",
-                                                    "|value": "(function() { return (new Date()).format('Y') + '-01-01'; })()",
-                                                    "|xns": "Roo.form"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.datespan  = _self;\n}"
-                                                    },
-                                                    "allowBlank": false,
-                                                    "displayField": "fname",
-                                                    "editable": false,
-                                                    "fieldLabel": "Status",
-                                                    "hiddenName": "cm_status",
-                                                    "listWidth": 200,
-                                                    "mode": "local",
-                                                    "name": "cm_status_name",
-                                                    "triggerAction": "all",
-                                                    "value": 12,
-                                                    "valueField": "ftype",
-                                                    "width": 150,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "store",
-                                                            "xtype": "SimpleStore",
-                                                            "|data": "[ \n    [ '1', \"Single Month Sales\"],\n    [ '3', \"Quarter Sales\"],\n    [ '6', \"Half year Sales\"] ,\n    [ '12', \"Full Year Sales\"] \n]\n",
-                                                            "|fields": "[  'ftype', 'fname']",
-                                                            "|xns": "Roo.data"
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    if (!_this.brandSel.getValue().length) {\n        Roo.MessageBox.alert(\"Error\", \"Select a brand to download\");\n        return;\n    }\n\n    new Pman.Download({\n        url : baseURL + '/Xtuple/Reports/SalesByCountryItemYear',\n        params: { \n            date_from : _this.dateFrom.getValue(),\n            brand : _this.brandSel.getValue(),\n            span : _this.datespan.getValue()\n        }\n    });\n        \n\n}"
-                                                    },
-                                                    "text": "Download Sales Report",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "root": "data",
+                                                    "totalProperty": "total",
+                                                    "xtype": "JsonReader",
+                                                    "|fields": "[\n    {\n        'name': 'item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'item_number',\n        'type': 'string'\n    }\n]",
+                                                    "|xns": "Roo.data"
                                                 }
                                             ]
                                         },
                                         {
                                             "*prop": "footer",
-                                            "xtype": "PagingToolbar",
-                                            "pageSize": 25,
                                             "displayInfo": true,
-                                            "displayMsg": "Displaying item{0} - {1} of {2}",
-                                            "emptyMsg": "No item found",
-                                            "|xns": "Roo",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n   new Pman.Download({\n        method: 'GET',\n        url : baseURL + '/Roo/item',\n        params : {\n            _costgrid : 1\n        }\n   });\n}"
-                                                    },
-                                                    "text": "Download Standard costs",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Products'\n        \n       },\n       function (data) {\n            var msg = [];\n           \n            if (data.updated) {\n                msg.push(\"Updated \" + data.updated + \" Products(s)\");\n            }            \n            if (data.inserted) {\n                msg.push(\"Added \" + data.inserted + \" Products(s)\");\n            }\n            if (data.skipped) {\n                msg.push(\"Skipped \" + data.skipped);\n            }\n            \n            if (!msg.length) {\n                msg.push(\"No data changed\");\n            }\n            Roo.MessageBox.alert(\"Notice\", msg.join(\"\\n\"));\n\n       }\n   );\n}"
-                                                    },
-                                                    "text": "Upload new products and costs",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    \n    var sel = _this.grid.selModel.getSelectedCell();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a row\");\n        return;\n    }\n    \n    var rec = _this.grid.ds.getAt(sel[0]);\n    if(rec.data.item_id * 1 < 1){\n        return;\n    }\n    \n    Pman.Dialog.Image.show({\n            id : rec.data.item_image_id ? rec.data.item_image_id : 0,\n            onid : rec.data.item_id,\n            ontable : 'Item'\n        }, function(data) {\n            if (data) {\n                _this.grid.footer.onClick('first');\n                \n        }\n        \n    });\n}"
-                                                    },
-                                                    "text": "Upload an image",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
-                                                },
-                                                {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n  Roo.MessageBox.progress (\"Syncing Stock\", \"Sending\");\n  \n  var offset = 0;\n  \n   function runSync() {\n       \n       new Pman.Request( {\n            url : baseURL+'/Roo/Item',\n            method : 'GET',\n            params : {\n                _syncFromHK : 1,\n                offset : offset\n            },\n            success : function(res) {\n                Roo.log(res);\n                if (!res.data.total) {\n                    Roo.MessageBox.hide();\n                    return;\n                }\n                offset += res.data.limit;\n                Roo.MessageBox.updateProgress ( offset  / res.data.total, \"Done \" + offset + '/' + res.data.total);\n                runSync();\n            }\n            \n        \n       });\n   }\n   runSync();\n}"
-                                                    },
-                                                    "text": "Sync Product Data from HK",
-                                                    "xtype": "Button",
-                                                    "|hidden": "(function() {\n\n    return baseURL.match(/hk\\.php$/) ? true : false;\n})()",
-                                                    "|xns": "Roo.Toolbar"
-                                                }
-                                            ]
+                                            "displayMsg": "",
+                                            "emptyMsg": "",
+                                            "pageSize": 25,
+                                            "xtype": "PagingToolbar",
+                                            "|xns": "Roo"
                                         },
                                         {
                                             "*prop": "colModel[]",
-                                            "dataIndex": "item_image_filename",
-                                            "header": "Image ( Click to download )",
+                                            "dataIndex": "item_number",
+                                            "header": "Number",
                                             "width": 150,
                                             "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r)\r\n{\n   if(!v){\n    return '';\n   }\n   if(r.data.item_image_from_hk){\n        var url = baseURL.split('/');\n        url.pop();\n        url = url.join('/');\n        return '<img src=\"' + url + '/hk.php/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '\" width=\"150\" height=\"150\" />';     \n   }\r\n   return '<img src=\"' + baseURL + '/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '\" width=\"150\" height=\"150\" />';\r\n}",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_char_brand",
-                                            "header": "Brand",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
                                             "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "field",
-                                                            "allowBlank": true,
-                                                            "alwaysQuery": true,
-                                                            "displayField": "charass_value",
-                                                            "editable": true,
-                                                            "forceSelection": false,
-                                                            "listWidth": 300,
-                                                            "loadingText": "Searching...",
-                                                            "minChars": 2,
-                                                            "pageSize": 20,
-                                                            "qtip": "Select Brand",
-                                                            "queryParam": "query[charass_value]",
-                                                            "selectOnFocus": true,
-                                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                            "triggerAction": "all",
-                                                            "width": 150,
-                                                            "xtype": "ComboBox",
-                                                            "|xns": "Roo.form",
-                                                            "items": [
-                                                                {
-                                                                    "listeners": {
-                                                                        "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    // look for all of the charass 's with the same type= eg. brand.\n    \n    o.params.charass_char_id_char_name = 'BRAND';\n    o.params.charass_target_type ='I';\n    o.params._distinct = 'charass_value';\n        o.params._columns = 'charass_value';\n\n}"
-                                                                    },
-                                                                    "*prop": "store",
-                                                                    "remoteSort": true,
-                                                                    "xtype": "Store",
-                                                                    "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                                    "|xns": "Roo.data",
-                                                                    "items": [
-                                                                        {
-                                                                            "*prop": "proxy",
-                                                                            "method": "GET",
-                                                                            "xtype": "HttpProxy",
-                                                                            "|url": "baseURL + '/Roo/Charass.php'",
-                                                                            "|xns": "Roo.data"
-                                                                        },
-                                                                        {
-                                                                            "|xns": "Roo.data",
-                                                                            "xtype": "JsonReader",
-                                                                            "totalProperty": "total",
-                                                                            "root": "data",
-                                                                            "*prop": "reader",
-                                                                            "id": "id",
-                                                                            "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]"
-                                                                        }
-                                                                    ]
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
+                                            "|xns": "Roo.grid"
                                         },
                                         {
                                             "*prop": "colModel[]",
-                                            "dataIndex": "item_char_productgroup",
-                                            "header": "Product Group",
+                                            "align": "right",
+                                            "dataIndex": "ipshead_price",
+                                            "header": "Price",
                                             "width": 100,
                                             "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
+                                            "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
                                             "|xns": "Roo.grid",
                                             "items": [
                                                 {
                                                     "items": [
                                                         {
                                                             "*prop": "field",
-                                                            "allowBlank": true,
-                                                            "alwaysQuery": true,
-                                                            "displayField": "charass_value",
-                                                            "editable": true,
-                                                            "forceSelection": false,
-                                                            "listWidth": 300,
-                                                            "loadingText": "Searching...",
-                                                            "minChars": 2,
-                                                            "pageSize": 20,
-                                                            "qtip": "Select Brand",
-                                                            "queryParam": "query[charass_value]",
-                                                            "selectOnFocus": true,
-                                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{charass_value}</b> </div>",
-                                                            "triggerAction": "all",
-                                                            "width": 150,
-                                                            "xtype": "ComboBox",
-                                                            "|xns": "Roo.form",
-                                                            "items": [
-                                                                {
-                                                                    "listeners": {
-                                                                        "|beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    // look for all of the charass 's with the same type= eg. brand.\n    \n    o.params.charass_char_id_char_name = 'PRODUCTGROUP';\n    o.params.charass_target_type ='I';\n    o.params._distinct = 'charass_value';\n        o.params._columns = 'charass_value';    \n}"
-                                                                    },
-                                                                    "*prop": "store",
-                                                                    "remoteSort": true,
-                                                                    "xtype": "Store",
-                                                                    "|sortInfo": "{ field : 'charass_value' , direction : 'ASC' }",
-                                                                    "|xns": "Roo.data",
-                                                                    "items": [
-                                                                        {
-                                                                            "*prop": "proxy",
-                                                                            "method": "GET",
-                                                                            "xtype": "HttpProxy",
-                                                                            "|url": "baseURL + '/Roo/Charass.php'",
-                                                                            "|xns": "Roo.data"
-                                                                        },
-                                                                        {
-                                                                            "|xns": "Roo.data",
-                                                                            "xtype": "JsonReader",
-                                                                            "totalProperty": "total",
-                                                                            "root": "data",
-                                                                            "*prop": "reader",
-                                                                            "id": "id",
-                                                                            "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]"
-                                                                        }
-                                                                    ]
-                                                                }
-                                                            ]
+                                                            "decimalPrecision": 2,
+                                                            "minValue": 1,
+                                                            "style": "text-align:right",
+                                                            "xtype": "NumberField",
+                                                            "|xns": "Roo.form"
                                                         }
                                                     ]
                                                 }
                                             ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_number",
-                                            "header": "Number",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_descrip1",
-                                            "header": "Description",
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "itemsrc_active",
-                                            "header": "Purchased",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_sold",
-                                            "header": "is Sold?",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_active",
-                                            "header": "is Active?",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "last_purchase_price",
-                                            "header": "Last purchase price",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) {\n\n     return String.format('{0}{1}', r.data.last_purchase_price_curr_name, Roo.util.Format.number(v,2)) ; \n     \n }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_type",
-                                            "header": "Item type",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "item_prodcat_id_prodcat_code",
-                                            "header": "Item prodcat",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "item_actcost",
-                                            "header": "Cost",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) {\n\n     return String.format('{0}{1}', r.data.item_curr_name, Roo.util.Format.number(v,2)) ; \n     \n }",
-                                            "|xns": "Roo.grid"
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "item_base_cost",
-                                            "header": "Cost (base)",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) {\n\n     return String.format('{0}{1}', r.data.item_base_curr, Roo.util.Format.number(v,2)) ; \n     \n }",
-                                            "|xns": "Roo.grid"
                                         }
                                     ]
                                 }