commit
authorEdward <edward@roojs.com>
Mon, 1 Dec 2014 08:26:57 +0000 (16:26 +0800)
committerEdward <edward@roojs.com>
Mon, 1 Dec 2014 08:26:57 +0000 (16:26 +0800)
15 files changed:
Pman.Tab.XtupleApAging.bjs
Pman.Tab.XtupleApAging.js
Pman.Tab.XtupleArAging.bjs
Pman.Tab.XtupleArAging.js
Pman.Tab.XtupleCurrency.bjs
Pman.Tab.XtupleCurrency.js
Pman.Tab.XtupleGeneralLedger.bjs
Pman.Tab.XtupleGeneralLedger.js
Pman.Tab.XtuplePeriods.bjs
Pman.Tab.XtuplePeriods.js
Pman.Tab.XtupleReconcile.bjs
Pman.Tab.XtupleReconcile.js
Pman.Tab.XtupleTerms.bjs [new file with mode: 0644]
Pman.Tab.XtupleTerms.js [new file with mode: 0644]
metasql/registrar.invoice.sql [deleted file]

index 2965d91..26c1a3f 100644 (file)
 {
-    "id": "roo-file-44",
-    "name": "Pman.Tab.XtupleApAging",
-    "parent": "Pman.Tab.XtupleAccountsTab",
-    "title": "",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleApAging.bjs",
-    "items": [
+    "name" : "Pman.Tab.XtupleApAging",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleApAging.bjs",
+    "permname" : "",
+    "modOrder" : "500",
+    "items" : [
         {
-            "background": true,
-            "fitContainer": true,
-            "fitToFrame": true,
-            "region": "center",
-            "title": "Accounts Payable",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+            "fitToFrame" : true,
+            "background" : true,
+            "region" : "center",
+            "title" : "Accounts Payable",
+            "xtype" : "NestedLayoutPanel",
+            "fitContainer" : true,
+            "$ xns" : "Roo",
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
                         {
-                            "*prop": "center",
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "xtype" : "LayoutRegion",
+                            "$ xns" : "Roo",
+                            "* prop" : "center"
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
                             },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "apopen",
-                            "title": "ApAging",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : true,
+                            "region" : "center",
+                            "title" : "ApAging",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "apopen",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+                                    "listeners" : {
+                                        "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "araging_cust_name",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "araging_cust_name",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "*prop": "sm",
-                                            "singleSelect": true,
-                                            "xtype": "RowSelectionModel",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "RowSelectionModel",
+                                            "singleSelect" : true,
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "sm"
                                         },
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n\n    \n    var dt = _this.relDate.getValue();\n    \n    var params = {\n        _group : 'apAging',\n        _name : 'bydate',\n        'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'useDocDate:text' : false\n    };\n    \n    var vend = _this.vendSel.getValue();\n    if (vend*1) {\n        params['vend_id:number'] = vend;\n    \n    }\n    \n    \n    Roo.apply(o.params,params);\n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n\n    \n    var dt = _this.relDate.getValue();\n    \n    var params = {\n        _group : 'apAging',\n        _name : 'bydate',\n        'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'useDocDate:text' : false\n    };\n    \n    var vend = _this.vendSel.getValue();\n    if (vend*1) {\n        params['vend_id:number'] = vend;\n    \n    }\n    \n    \n    Roo.apply(o.params,params);\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "timeout": 600000,
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Metasql.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/Metasql.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "timeout" : 600000,
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'apaging_doctype',\n        'type': 'string'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'apaging_doctype',\n        'type': 'string'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.vendSel = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n    _this.vendSel = _self;\n}",
+                                                        "select" : "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": true,
-                                                    "displayField": "vend_name",
-                                                    "editable": true,
-                                                    "emptyText": "Select Vendor",
-                                                    "fieldLabel": "cust_name",
-                                                    "forceSelection": true,
-                                                    "hiddenName": "vend_id",
-                                                    "listWidth": 400,
-                                                    "loadingText": "Searching...",
-                                                    "minChars": 2,
-                                                    "name": "vend_name",
-                                                    "pageSize": 20,
-                                                    "qtip": "Select Vendor",
-                                                    "queryParam": "vend_name:text",
-                                                    "selectOnFocus": true,
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "typeAhead": true,
-                                                    "valueField": "vend_id",
-                                                    "width": 300,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
+                                                    "listWidth" : 400,
+                                                    "triggerAction" : "all",
+                                                    "fieldLabel" : "cust_name",
+                                                    "forceSelection" : true,
+                                                    "selectOnFocus" : true,
+                                                    "pageSize" : 20,
+                                                    "displayField" : "vend_name",
+                                                    "emptyText" : "Select Vendor",
+                                                    "hiddenName" : "vend_id",
+                                                    "minChars" : 2,
+                                                    "valueField" : "vend_id",
+                                                    "xtype" : "ComboBox",
+                                                    "allowBlank" : true,
+                                                    "typeAhead" : true,
+                                                    "editable" : true,
+                                                    "width" : 300,
+                                                    "$ xns" : "Roo.form",
+                                                    "name" : "vend_name",
+                                                    "qtip" : "Select Vendor",
+                                                    "queryParam" : "vend_name:text",
+                                                    "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\n    if (!_this.relDate) {\n        return false;\n    }\n    var dt = _this.relDate.getValue();    \n    // set more here\n    o.params['_group'] = 'apAging';\n    o.params['_name'] = 'vendors';\n    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    o.params['useDocDate:text'] = false    \n}\n"
+                                                            "listeners" : {
+                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    if (!_this.relDate) {\n        return false;\n    }\n    var dt = _this.relDate.getValue();    \n    // set more here\n    o.params['_group'] = 'apAging';\n    o.params['_name'] = 'vendors';\n    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    o.params['useDocDate:text'] = false    \n}\n"
                                                             },
-                                                            "*prop": "store",
-                                                            "remoteSort": true,
-                                                            "xtype": "Store",
-                                                            "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
-                                                            "|xns": "Roo.data",
-                                                            "items": [
+                                                            "xtype" : "Store",
+                                                            "remoteSort" : true,
+                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'cust_name' }",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "store",
+                                                            "items" : [
                                                                 {
-                                                                    "*prop": "proxy",
-                                                                    "method": "GET",
-                                                                    "xtype": "HttpProxy",
-                                                                    "|url": "baseURL + '/Roo/metasql.php'",
-                                                                    "|xns": "Roo.data"
+                                                                    "$ url" : "baseURL + '/Roo/metasql.php'",
+                                                                    "xtype" : "HttpProxy",
+                                                                    "method" : "GET",
+                                                                    "$ xns" : "Roo.data",
+                                                                    "* prop" : "proxy"
                                                                 },
                                                                 {
-                                                                    "*prop": "reader",
-                                                                    "id": "cust_id",
-                                                                    "root": "data",
-                                                                    "totalProperty": "total",
-                                                                    "xtype": "JsonReader",
-                                                                    "|fields": "[{\"name\":\"vend_id\",\"type\":\"int\"},\"vend_name\"]",
-                                                                    "|xns": "Roo.data"
+                                                                    "id" : "cust_id",
+                                                                    "root" : "data",
+                                                                    "xtype" : "JsonReader",
+                                                                    "$ fields" : "[{\"name\":\"vend_id\",\"type\":\"int\"},\"vend_name\"]",
+                                                                    "$ xns" : "Roo.data",
+                                                                    "* prop" : "reader",
+                                                                    "totalProperty" : "total"
                                                                 }
                                                             ]
                                                         }
                                                     ]
                                                 },
                                                 {
-                                                    "text": "as Of:",
-                                                    "xtype": "TextItem",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "as Of:",
+                                                    "xtype" : "TextItem",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\r\n{\r\n    _this.relDate = _self;\r\n   _self.setValue(  new Date() );\r\n}",
-                                                        "select": "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\r\n{\r\n    _this.relDate = _self;\r\n   _self.setValue(  new Date() );\r\n}",
+                                                        "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": false,
-                                                    "format": "Y-m-d",
-                                                    "width": 100,
-                                                    "xtype": "DateField",
-                                                    "|xns": "Roo.form"
+                                                    "format" : "Y-m-d",
+                                                    "xtype" : "DateField",
+                                                    "allowBlank" : false,
+                                                    "width" : 100,
+                                                    "$ xns" : "Roo.form"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "|click": "function ()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if(!s || s.data.apopen_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n    }\n    \n    if(s.data.apaging_doctype != 'V'){\n        Roo.MessageBox.alert('Error', 'We just can handle voucher at the time being');\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to VOID that?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Voiding',\n                url : baseURL + '/Roo/Apopen',\n                method : 'POST',\n                params :  {\n                    apopen_id : s.data.apopen_id,\n                    _void : 1\n                },\n                success : function() {\n                    _this.grid.footer.onClick('first');\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
+                                                    "listeners" : {
+                                                        "|click" : "function ()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if(!s || s.data.apopen_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a row');\n        return;\n    }\n    \n    if(s.data.apaging_doctype != 'V'){\n        Roo.MessageBox.alert('Error', 'We just can handle voucher at the time being');\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to VOID that?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Voiding',\n                url : baseURL + '/Roo/Apopen',\n                method : 'POST',\n                params :  {\n                    apopen_id : s.data.apopen_id,\n                    _void : 1\n                },\n                success : function() {\n                    _this.grid.footer.onClick('first');\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
                                                     },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Void",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Void",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying araging{0} - {1} of {2}",
-                                            "emptyMsg": "Nothing found",
-                                            "pageSize": 25,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo"
+                                            "pageSize" : 25,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "Nothing found",
+                                            "$ xns" : "Roo",
+                                            "displayMsg" : "Displaying araging{0} - {1} of {2}",
+                                            "displayInfo" : true,
+                                            "* prop" : "footer"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "apaging_docdate",
-                                            "header": "Date",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n\n    return String.format('{0}', d.format('d/M/Y')); \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Date",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n\n    return String.format('{0}', d.format('d/M/Y')); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_docdate"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "apaging_vend_name",
-                                            "header": "Vendor",
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Vendor",
+                                            "width" : 200,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_vend_name"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "apaging_doctype",
-                                            "header": "Doc Type",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {\n    switch(v) {\n        case 'I':\n            return \"Invoice\";\n        case 'C':\n            return \"Credit Memo\";        \n        case 'D':\n            return \"Debit Memo\";                    \n        case 'R':\n            return \"Cash Receipt\";        \n        case 'V':\n            return \"Voucher\";        \n        default:\n             return String.format('{0}', v); \n     }\n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Doc Type",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) {\n    switch(v) {\n        case 'I':\n            return \"Invoice\";\n        case 'C':\n            return \"Credit Memo\";        \n        case 'D':\n            return \"Debit Memo\";                    \n        case 'R':\n            return \"Cash Receipt\";        \n        case 'V':\n            return \"Voucher\";        \n        default:\n             return String.format('{0}', v); \n     }\n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_doctype"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "apaging_docnumber",
-                                            "header": "Docnumber",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Docnumber",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_docnumber"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "apaging_curr_symbol",
-                                            "header": "Currency",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Currency",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_curr_symbol"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_apopen_amount",
-                                            "header": "Value",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Value",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_apopen_amount"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_cur_val",
-                                            "header": "30 Days",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "30 Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_cur_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_sixty_val",
-                                            "header": "60 Days",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "60 Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_sixty_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_ninety_val",
-                                            "header": "90 Days",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "90 Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_ninety_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_plus_val",
-                                            "header": "Over 90 days",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Over 90 days",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_plus_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_total_val",
-                                            "header": "Total",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Total",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_total_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "apaging_base_total",
-                                            "header": "Total (BASE)",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Total (BASE)",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "apaging_base_total"
                                         }
                                     ]
                                 }
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "400"
+    ]
 }
\ No newline at end of file
index 3d33132..68e9574 100644 (file)
@@ -2,9 +2,11 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleApAging = new Roo.XComponent({
-    part     :  ["Xtuple","ApAging"],
-    order    : '400-Pman.Tab.XtupleApAging',
+    part     :  ["Xtuple", "ApAging" ],
+    order    : '500-Pman.Tab.XtupleApAging',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
     name     : "unnamed module",
@@ -15,430 +17,486 @@ Pman.Tab.XtupleApAging = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            fitContainer : true,
-            fitToFrame : true,
-            region : 'center',
-            title : "Accounts Payable",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    xns : Roo
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                                if (_this.grid) {
-                                    _this.grid.footer.onClick('first');
-                                }
-                            }
-                        },
-                        background : true,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'apopen',
-                        title : "ApAging",
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.panel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                }
-                            },
-                            autoExpandColumn : 'araging_cust_name',
-                            loadMask : true,
                             sm : {
-                                xtype: 'RowSelectionModel',
-                                xns: Roo.grid,
-                                singleSelect : true
+                                '|xns' : 'Roo.grid',
+                                xtype : 'RowSelectionModel',
+                                singleSelect : true,
+                                xns : Roo.grid
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o)
-                                    {
-                                        o.params = o.params || {};
-                                        
-                                    
-                                        
-                                        var dt = _this.relDate.getValue();
-                                        
-                                        var params = {
-                                            _group : 'apAging',
-                                            _name : 'bydate',
-                                            'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                            'useDocDate:text' : false
-                                        };
-                                        
-                                        var vend = _this.vendSel.getValue();
-                                        if (vend*1) {
-                                            params['vend_id:number'] = vend;
-                                        
-                                        }
-                                        
-                                        
-                                        Roo.apply(o.params,params);
-                                    }
-                                },
-                                remoteSort : true,
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Metasql.php',
                                     method : 'GET',
+                                    xtype : 'HttpProxy',
                                     timeout : 600000,
-                                    url : baseURL + '/Roo/Metasql.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'apaging_doctype',
                                             'type': 'string'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o)
+                                          {
+                                              o.params = o.params || {};
+                                              
+                                          
+                                              
+                                              var dt = _this.relDate.getValue();
+                                              
+                                              var params = {
+                                                  _group : 'apAging',
+                                                  _name : 'bydate',
+                                                  'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                  'useDocDate:text' : false
+                                              };
+                                              
+                                              var vend = _this.vendSel.getValue();
+                                              if (vend*1) {
+                                                  params['vend_id:number'] = vend;
+                                              
+                                              }
+                                              
+                                              
+                                              Roo.apply(o.params,params);
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                                _this.vendSel = _self;
+                                       {
+                                        store : {
+                                            proxy : {
+                                                '|xns' : 'Roo.data',
+                                                url : baseURL + '/Roo/metasql.php',
+                                                xtype : 'HttpProxy',
+                                                method : 'GET',
+                                                xns : Roo.data
                                             },
-                                            select : function (combo, record, index)
-                                            {
-                                                _this.grid.footer.onClick('first');
-                                            }
+                                            reader : {
+                                                '|xns' : 'Roo.data',
+                                                id : 'cust_id',
+                                                root : 'data',
+                                                xtype : 'JsonReader',
+                                                fields : [{"name":"vend_id","type":"int"},"vend_name"],
+                                                xns : Roo.data,
+                                                totalProperty : 'total'
+                                            },
+                                            '|xns' : 'Roo.data',
+                                            xtype : 'Store',
+                                            remoteSort : true,
+                                            sortInfo : { direction : 'ASC', field: 'cust_name' },
+                                            xns : Roo.data,
+                                            listeners : {
+                                               beforeload : function (_self, o){
+                                                      o.params = o.params || {};
+                                                  
+                                                      if (!_this.relDate) {
+                                                          return false;
+                                                      }
+                                                      var dt = _this.relDate.getValue();    
+                                                      // set more here
+                                                      o.params['_group'] = 'apAging';
+                                                      o.params['_name'] = 'vendors';
+                                                      o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
+                                                      o.params['useDocDate:text'] = false    
+                                                  }
+                                            },
+                                            items : [
+
+                                            ]
+
                                         },
-                                        allowBlank : true,
-                                        displayField : 'vend_name',
-                                        editable : true,
-                                        emptyText : "Select Vendor",
+                                        '|xns' : 'Roo.form',
+                                        listWidth : 400,
+                                        triggerAction : 'all',
                                         fieldLabel : 'cust_name',
                                         forceSelection : true,
+                                        selectOnFocus : true,
+                                        pageSize : 20,
+                                        displayField : 'vend_name',
+                                        emptyText : "Select Vendor",
                                         hiddenName : 'vend_id',
-                                        listWidth : 400,
-                                        loadingText : "Searching...",
                                         minChars : 2,
+                                        valueField : 'vend_id',
+                                        xtype : 'ComboBox',
+                                        allowBlank : true,
+                                        typeAhead : true,
+                                        editable : true,
+                                        width : 300,
+                                        xns : Roo.form,
                                         name : 'vend_name',
-                                        pageSize : 20,
                                         qtip : "Select Vendor",
                                         queryParam : 'vend_name:text',
-                                        selectOnFocus : true,
-                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{vend_name}</b> </div>',
-                                        triggerAction : 'all',
-                                        typeAhead : true,
-                                        valueField : 'vend_id',
-                                        width : 300,
-                                        store : {
-                                            xtype: 'Store',
-                                            xns: Roo.data,
-                                            listeners : {
-                                                beforeload : function (_self, o){
-                                                    o.params = o.params || {};
-                                                
-                                                    if (!_this.relDate) {
-                                                        return false;
-                                                    }
-                                                    var dt = _this.relDate.getValue();    
-                                                    // set more here
-                                                    o.params['_group'] = 'apAging';
-                                                    o.params['_name'] = 'vendors';
-                                                    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
-                                                    o.params['useDocDate:text'] = false    
-                                                }
-                                            },
-                                            remoteSort : true,
-                                            sortInfo : { direction : 'ASC', field: 'cust_name' },
-                                            proxy : {
-                                                xtype: 'HttpProxy',
-                                                xns: Roo.data,
-                                                method : 'GET',
-                                                url : baseURL + '/Roo/metasql.php'
-                                            },
-                                            reader : {
-                                                xtype: 'JsonReader',
-                                                xns: Roo.data,
-                                                id : 'cust_id',
-                                                root : 'data',
-                                                totalProperty : 'total',
-                                                fields : [{"name":"vend_id","type":"int"},"vend_name"]
-                                            }
-                                        }
-                                    },
-                                    {
-                                        xtype: 'TextItem',
-                                        xns: Roo.Toolbar,
-                                        text : "as Of:"
-                                    },
-                                    {
-                                        xtype: 'DateField',
-                                        xns: Roo.form,
+                                        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
+                                        loadingText : "Searching...",
                                         listeners : {
-                                            render : function (_self)\r
-                                            {\r
-                                                _this.relDate = _self;\r
-                                               _self.setValue(  new Date() );\r
-                                            },
-                                            select : function (combo, date)
-                                            {
-                                                _this.grid.footer.onClick('first');
-                                            }
+                                               render : function (_self)
+                                                  {
+                                                      _this.vendSel = _self;
+                                                  },
+                                               select : function (combo, record, index)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
                                         },
-                                        allowBlank : false,
-                                        format : 'Y-m-d',
-                                        width : 100
+                                        items : [
+
+                                        ]
+
                                     },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "as Of:",
+                                        xtype : 'TextItem',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                       {
+                                        '|xns' : 'Roo.form',
+                                        format : 'Y-m-d',
+                                        xtype : 'DateField',
+                                        allowBlank : false,
+                                        width : 100,
+                                        xns : Roo.form,
                                         listeners : {
-                                            click : function ()
-                                            {
-                                                var s = _this.grid.getSelectionModel().getSelected();
-                                                
-                                                if(!s || s.data.apopen_id * 1 < 1){
-                                                    Roo.MessageBox.alert('Error', 'Please select a row');
-                                                    return;
-                                                }
-                                                
-                                                if(s.data.apaging_doctype != 'V'){
-                                                    Roo.MessageBox.alert('Error', 'We just can handle voucher at the time being');
-                                                    return;
-                                                }
-                                                
-                                                Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that?",
-                                                    function(r) {
-                                                        if (r != 'yes') {
-                                                            return;
-                                                        }
-                                                        new Pman.Request({
-                                                            mask : 'Voiding',
-                                                            url : baseURL + '/Roo/Apopen',
-                                                            method : 'POST',
-                                                            params :  {
-                                                                apopen_id : s.data.apopen_id,
-                                                                _void : 1
-                                                            },
-                                                            success : function() {
-                                                                _this.grid.footer.onClick('first');
-                                                            }
-                                                        })
-                                                        
-                                                    }
-                                                );
-                                                        
-                                                        
-                                               
-                                            }
-                                        },
-                                        cls : 'x-btn-text-icon',
+                                               render : function (_self)\r
+                                                  {\r
+                                                      _this.relDate = _self;\r
+                                                     _self.setValue(  new Date() );\r
+                                                  },
+                                               select : function (combo, date)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
                                         text : "Void",
-                                        icon : rootURL + '/Pman/templates/images/trash.gif'
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : rootURL + '/Pman/templates/images/trash.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function ()
+                                                  {
+                                                      var s = _this.grid.getSelectionModel().getSelected();
+                                                      
+                                                      if(!s || s.data.apopen_id * 1 < 1){
+                                                          Roo.MessageBox.alert('Error', 'Please select a row');
+                                                          return;
+                                                      }
+                                                      
+                                                      if(s.data.apaging_doctype != 'V'){
+                                                          Roo.MessageBox.alert('Error', 'We just can handle voucher at the time being');
+                                                          return;
+                                                      }
+                                                      
+                                                      Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that?",
+                                                          function(r) {
+                                                              if (r != 'yes') {
+                                                                  return;
+                                                              }
+                                                              new Pman.Request({
+                                                                  mask : 'Voiding',
+                                                                  url : baseURL + '/Roo/Apopen',
+                                                                  method : 'POST',
+                                                                  params :  {
+                                                                      apopen_id : s.data.apopen_id,
+                                                                      _void : 1
+                                                                  },
+                                                                  success : function() {
+                                                                      _this.grid.footer.onClick('first');
+                                                                  }
+                                                              })
+                                                              
+                                                          }
+                                                      );
+                                                              
+                                                              
+                                                     
+                                                  }
+                                        }
                                     }
                                 ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "Displaying araging{0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "Nothing found",
-                                pageSize : 25
+                                xns : Roo,
+                                displayMsg : "Displaying araging{0} - {1} of {2}",
+                                displayInfo : true
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'araging_cust_name',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'apaging_docdate',
-                                    header : 'Date',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                        var d = Date.parseDate(v, 'Y-m-d');
-                                    
-                                        return String.format('{0}', d.format('d/M/Y')); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'apaging_vend_name',
-                                    header : 'Vendor',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'apaging_doctype',
-                                    header : 'Doc Type',
-                                    width : 120,
-                                    renderer : function(v) {
-                                        switch(v) {
-                                            case 'I':
-                                                return "Invoice";
-                                            case 'C':
-                                                return "Credit Memo";        
-                                            case 'D':
-                                                return "Debit Memo";                    
-                                            case 'R':
-                                                return "Cash Receipt";        
-                                            case 'V':
-                                                return "Voucher";        
-                                            default:
-                                                 return String.format('{0}', v); 
-                                         }
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'apaging_docnumber',
-                                    header : 'Docnumber',
-                                    width : 120,
-                                    renderer : function(v) {
-                                        
-                                                 return String.format('{0}', v); 
-                                         
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'apaging_curr_symbol',
-                                    header : 'Currency',
-                                    width : 120,
-                                    renderer : function(v) {
-                                        
-                                                 return String.format('{0}', v); 
-                                         
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_apopen_amount',
-                                    header : 'Value',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_cur_val',
-                                    header : '30 Days',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_sixty_val',
-                                    header : '60 Days',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_ninety_val',
-                                    header : '90 Days',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_plus_val',
-                                    header : 'Over 90 days',
-                                    width : 150,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_total_val',
-                                    header : 'Total',
-                                    width : 150,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'apaging_base_total',
-                                    header : 'Total (BASE)',
-                                    width : 150,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Date',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                           var d = Date.parseDate(v, 'Y-m-d');
+                                       
+                                           return String.format('{0}', d.format('d/M/Y')); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_docdate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Vendor',
+                                       width : 200,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_vend_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Doc Type',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           switch(v) {
+                                               case 'I':
+                                                   return "Invoice";
+                                               case 'C':
+                                                   return "Credit Memo";        
+                                               case 'D':
+                                                   return "Debit Memo";                    
+                                               case 'R':
+                                                   return "Cash Receipt";        
+                                               case 'V':
+                                                   return "Voucher";        
+                                               default:
+                                                    return String.format('{0}', v); 
+                                            }
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_doctype'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Docnumber',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           
+                                                    return String.format('{0}', v); 
+                                            
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_docnumber'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Currency',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           
+                                                    return String.format('{0}', v); 
+                                            
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_curr_symbol'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Value',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_apopen_amount'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '30 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_cur_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '60 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_sixty_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '90 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_ninety_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Over 90 days',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_plus_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Total',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_total_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Total (BASE)',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'apaging_base_total'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.panel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : true,
+                        region : 'center',
+                        title : "ApAging",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'apopen',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                      if (_this.grid) {
+                                          _this.grid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            fitToFrame : true,
+            background : true,
+            region : 'center',
+            title : "Accounts Payable",
+            xtype : 'NestedLayoutPanel',
+            fitContainer : true,
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });
index 030dc9f..16f65f5 100644 (file)
 {
-    "id": "roo-file-41",
-    "name": "Pman.Tab.XtupleArAging",
-    "parent": "Pman.Tab.XtupleAccountsTab",
-    "title": "",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleArAging.bjs",
-    "items": [
+    "name" : "Pman.Tab.XtupleArAging",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleArAging.bjs",
+    "permname" : "",
+    "modOrder" : "400",
+    "items" : [
         {
-            "background": true,
-            "fitContainer": true,
-            "fitToFrame": true,
-            "region": "center",
-            "title": "Accounts Recievable",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+            "fitToFrame" : true,
+            "background" : true,
+            "region" : "center",
+            "title" : "Accounts Recievable",
+            "xtype" : "NestedLayoutPanel",
+            "fitContainer" : true,
+            "$ xns" : "Roo",
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
                         {
-                            "*prop": "center",
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "xtype" : "LayoutRegion",
+                            "$ xns" : "Roo",
+                            "* prop" : "center"
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
                             },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "aropen",
-                            "title": "ArAging",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : true,
+                            "region" : "center",
+                            "title" : "ArAging",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "aropen",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+                                    "listeners" : {
+                                        "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "araging_cust_name",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "araging_cust_name",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n\n    \n    var dt = _this.relDate.getValue();\n    \n    var params = {\n        _group : 'arAging',\n        _name : 'bydate',\n        'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'useDocDate:text' : false\n    };\n    \n    var cs = _this.customerSel.getValue();\n    if (cs*1) {\n        params['cust_id:number'] = cs;\n    \n    }\n    \n    \n    Roo.apply(o.params,params);\n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n\n    \n    var dt = _this.relDate.getValue();\n    \n    var params = {\n        _group : 'arAging',\n        _name : 'bydate',\n        'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'useDocDate:text' : false\n    };\n    \n    var cs = _this.customerSel.getValue();\n    if (cs*1) {\n        params['cust_id:number'] = cs;\n    \n    }\n    \n    \n    Roo.apply(o.params,params);\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "timeout": 600000,
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Metasql.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/Metasql.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "timeout" : 600000,
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'araging_apopen_id',\n        'type': 'int'\n    },\n    {\n        'name': 'araging_cust_id',\n        'type': 'int'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'araging_apopen_id',\n        'type': 'int'\n    },\n    {\n        'name': 'araging_cust_id',\n        'type': 'int'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.customerSel = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n    _this.customerSel = _self;\n}",
+                                                        "select" : "function (combo, record, index)\n{\n    _this.grid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": true,
-                                                    "displayField": "cust_name",
-                                                    "editable": true,
-                                                    "emptyText": "Select customer",
-                                                    "fieldLabel": "cust_name",
-                                                    "forceSelection": true,
-                                                    "hiddenName": "cust_id",
-                                                    "listWidth": 400,
-                                                    "loadingText": "Searching...",
-                                                    "minChars": 2,
-                                                    "name": "cust_name",
-                                                    "pageSize": 20,
-                                                    "qtip": "Select Customer",
-                                                    "queryParam": "cust_name:text",
-                                                    "selectOnFocus": true,
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "typeAhead": true,
-                                                    "valueField": "cust_id",
-                                                    "width": 300,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
+                                                    "listWidth" : 400,
+                                                    "triggerAction" : "all",
+                                                    "fieldLabel" : "cust_name",
+                                                    "forceSelection" : true,
+                                                    "selectOnFocus" : true,
+                                                    "pageSize" : 20,
+                                                    "displayField" : "cust_name",
+                                                    "emptyText" : "Select customer",
+                                                    "hiddenName" : "cust_id",
+                                                    "minChars" : 2,
+                                                    "valueField" : "cust_id",
+                                                    "xtype" : "ComboBox",
+                                                    "allowBlank" : true,
+                                                    "typeAhead" : true,
+                                                    "editable" : true,
+                                                    "width" : 300,
+                                                    "$ xns" : "Roo.form",
+                                                    "name" : "cust_name",
+                                                    "qtip" : "Select Customer",
+                                                    "queryParam" : "cust_name:text",
+                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>",
+                                                    "loadingText" : "Searching...",
+                                                    "items" : [
                                                         {
-                                                            "listeners": {
-                                                                "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n\n    if (!_this.relDate) {\n        return false;\n    }\n    var dt = _this.relDate.getValue();    \n    // set more here\n    o.params['_group'] = 'arAging';\n    o.params['_name'] = 'customers';\n    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    o.params['useDocDate:text'] = false    \n}\n"
+                                                            "listeners" : {
+                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n\n    if (!_this.relDate) {\n        return false;\n    }\n    var dt = _this.relDate.getValue();    \n    // set more here\n    o.params['_group'] = 'arAging';\n    o.params['_name'] = 'customers';\n    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    o.params['useDocDate:text'] = false    \n}\n"
                                                             },
-                                                            "*prop": "store",
-                                                            "remoteSort": true,
-                                                            "xtype": "Store",
-                                                            "|sortInfo": "{ direction : 'ASC', field: 'cust_name' }",
-                                                            "|xns": "Roo.data",
-                                                            "items": [
+                                                            "xtype" : "Store",
+                                                            "remoteSort" : true,
+                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'cust_name' }",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "store",
+                                                            "items" : [
                                                                 {
-                                                                    "*prop": "proxy",
-                                                                    "method": "GET",
-                                                                    "xtype": "HttpProxy",
-                                                                    "|url": "baseURL + '/Roo/metasql.php'",
-                                                                    "|xns": "Roo.data"
+                                                                    "$ url" : "baseURL + '/Roo/metasql.php'",
+                                                                    "xtype" : "HttpProxy",
+                                                                    "method" : "GET",
+                                                                    "$ xns" : "Roo.data",
+                                                                    "* prop" : "proxy"
                                                                 },
                                                                 {
-                                                                    "*prop": "reader",
-                                                                    "xtype": "JsonReader",
-                                                                    "|xns": "Roo.data",
-                                                                    "id": "cust_id",
-                                                                    "root": "data",
-                                                                    "totalProperty": "total",
-                                                                    "|fields": "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]"
+                                                                    "id" : "cust_id",
+                                                                    "root" : "data",
+                                                                    "xtype" : "JsonReader",
+                                                                    "$ xns" : "Roo.data",
+                                                                    "$ fields" : "[{\"name\":\"cust_id\",\"type\":\"int\"},\"cust_name\"]",
+                                                                    "* prop" : "reader",
+                                                                    "totalProperty" : "total"
                                                                 }
                                                             ]
                                                         }
                                                     ]
                                                 },
                                                 {
-                                                    "text": "as Of:",
-                                                    "xtype": "TextItem",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "as Of:",
+                                                    "xtype" : "TextItem",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\r\n{\r\n    _this.relDate = _self;\r\n   _self.setValue(  new Date() );\r\n}",
-                                                        "select": "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\r\n{\r\n    _this.relDate = _self;\r\n   _self.setValue(  new Date() );\r\n}",
+                                                        "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": false,
-                                                    "format": "Y-m-d",
-                                                    "width": 100,
-                                                    "xtype": "DateField",
-                                                    "|xns": "Roo.form"
+                                                    "format" : "Y-m-d",
+                                                    "xtype" : "DateField",
+                                                    "allowBlank" : false,
+                                                    "width" : 100,
+                                                    "$ xns" : "Roo.form"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying araging{0} - {1} of {2}",
-                                            "emptyMsg": "Nothing found",
-                                            "pageSize": 25,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo"
+                                            "pageSize" : 25,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "Nothing found",
+                                            "$ xns" : "Roo",
+                                            "displayMsg" : "Displaying araging{0} - {1} of {2}",
+                                            "displayInfo" : true,
+                                            "* prop" : "footer"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "araging_docdate",
-                                            "header": "Date",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n\n    return String.format('{0}', d.format('d/M/Y')); \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Date",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n    var d = Date.parseDate(v, 'Y-m-d');\n\n    return String.format('{0}', d.format('d/M/Y')); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_docdate"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "araging_cust_name",
-                                            "header": "Customer",
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Customer",
+                                            "width" : 200,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_cust_name"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "araging_doctype",
-                                            "header": "Doc Type",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {\n    switch(v) {\n        case 'I':\n            return \"Invoice\";\n        case 'C':\n            return \"Credit Memo\";        \n        case 'D':\n            return \"Debit Memo\";                    \n        case 'R':\n            return \"Cash Receipt\";        \n        case 'V':\n            return \"Voucher\";     \n        default:\n             return String.format('{0}', v); \n     }\n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Doc Type",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) {\n    switch(v) {\n        case 'I':\n            return \"Invoice\";\n        case 'C':\n            return \"Credit Memo\";        \n        case 'D':\n            return \"Debit Memo\";                    \n        case 'R':\n            return \"Cash Receipt\";        \n        case 'V':\n            return \"Voucher\";     \n        default:\n             return String.format('{0}', v); \n     }\n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_doctype"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "araging_docnumber",
-                                            "header": "Docnumber",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Docnumber",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_docnumber"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "araging_ponumber_pretty",
-                                            "header": "Order",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Order",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_ponumber_pretty"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "araging_curr_symbol",
-                                            "header": "Currency",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Currency",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) {\n    \n             return String.format('{0}', v); \n     \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_curr_symbol"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_aropen_amount",
-                                            "header": "Value",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Value",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_aropen_amount"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_cur_val",
-                                            "header": "30 Days",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "30 Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_cur_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_sixty_val",
-                                            "header": "60 Days",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "60 Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_sixty_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_ninety_val",
-                                            "header": "90 Days",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "90 Days",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_ninety_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_plus_val",
-                                            "header": "Over 90 days",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Over 90 days",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_plus_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_total_val",
-                                            "header": "Total",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Total",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_total_val"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "araging_base_total",
-                                            "header": "Total (BASE)",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Total (BASE)",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { \n\n        return String.format(v*1 < 0 ? '<span style=\"color:red\">{0}</span>' : '{0}', \n            Roo.util.Format.usMoney(v)); \n    }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "araging_base_total"
                                         }
                                     ]
                                 }
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "300"
+    ]
 }
\ No newline at end of file
index ae2ef40..022f7d7 100644 (file)
@@ -2,9 +2,11 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleArAging = new Roo.XComponent({
-    part     :  ["Xtuple","ArAging"],
-    order    : '300-Pman.Tab.XtupleArAging',
+    part     :  ["Xtuple", "ArAging" ],
+    order    : '400-Pman.Tab.XtupleArAging',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
     name     : "unnamed module",
@@ -15,92 +17,32 @@ Pman.Tab.XtupleArAging = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            fitContainer : true,
-            fitToFrame : true,
-            region : 'center',
-            title : "Accounts Recievable",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    xns : Roo
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                                if (_this.grid) {
-                                    _this.grid.footer.onClick('first');
-                                }
-                            }
-                        },
-                        background : true,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'aropen',
-                        title : "ArAging",
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.panel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                }
-                            },
-                            autoExpandColumn : 'araging_cust_name',
-                            loadMask : true,
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o)
-                                    {
-                                        o.params = o.params || {};
-                                        
-                                    
-                                        
-                                        var dt = _this.relDate.getValue();
-                                        
-                                        var params = {
-                                            _group : 'arAging',
-                                            _name : 'bydate',
-                                            'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                            'useDocDate:text' : false
-                                        };
-                                        
-                                        var cs = _this.customerSel.getValue();
-                                        if (cs*1) {
-                                            params['cust_id:number'] = cs;
-                                        
-                                        }
-                                        
-                                        
-                                        Roo.apply(o.params,params);
-                                    }
-                                },
-                                remoteSort : true,
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Metasql.php',
                                     method : 'GET',
+                                    xtype : 'HttpProxy',
                                     timeout : 600000,
-                                    url : baseURL + '/Roo/Metasql.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'araging_apopen_id',
@@ -110,291 +52,405 @@ Pman.Tab.XtupleArAging = new Roo.XComponent({
                                             'name': 'araging_cust_id',
                                             'type': 'int'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o)
+                                          {
+                                              o.params = o.params || {};
+                                              
+                                          
+                                              
+                                              var dt = _this.relDate.getValue();
+                                              
+                                              var params = {
+                                                  _group : 'arAging',
+                                                  _name : 'bydate',
+                                                  'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                  'useDocDate:text' : false
+                                              };
+                                              
+                                              var cs = _this.customerSel.getValue();
+                                              if (cs*1) {
+                                                  params['cust_id:number'] = cs;
+                                              
+                                              }
+                                              
+                                              
+                                              Roo.apply(o.params,params);
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                                _this.customerSel = _self;
+                                       {
+                                        store : {
+                                            proxy : {
+                                                '|xns' : 'Roo.data',
+                                                url : baseURL + '/Roo/metasql.php',
+                                                xtype : 'HttpProxy',
+                                                method : 'GET',
+                                                xns : Roo.data
+                                            },
+                                            reader : {
+                                                '|xns' : 'Roo.data',
+                                                id : 'cust_id',
+                                                root : 'data',
+                                                xtype : 'JsonReader',
+                                                xns : Roo.data,
+                                                fields : [{"name":"cust_id","type":"int"},"cust_name"],
+                                                totalProperty : 'total'
+                                            },
+                                            '|xns' : 'Roo.data',
+                                            xtype : 'Store',
+                                            remoteSort : true,
+                                            sortInfo : { direction : 'ASC', field: 'cust_name' },
+                                            xns : Roo.data,
+                                            listeners : {
+                                               beforeload : function (_self, o){
+                                                      o.params = o.params || {};
+                                                  
+                                                      if (!_this.relDate) {
+                                                          return false;
+                                                      }
+                                                      var dt = _this.relDate.getValue();    
+                                                      // set more here
+                                                      o.params['_group'] = 'arAging';
+                                                      o.params['_name'] = 'customers';
+                                                      o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
+                                                      o.params['useDocDate:text'] = false    
+                                                  }
                                             },
-                                            select : function (combo, record, index)
-                                            {
-                                                _this.grid.footer.onClick('first');
-                                            }
+                                            items : [
+
+                                            ]
+
                                         },
-                                        allowBlank : true,
-                                        displayField : 'cust_name',
-                                        editable : true,
-                                        emptyText : "Select customer",
+                                        '|xns' : 'Roo.form',
+                                        listWidth : 400,
+                                        triggerAction : 'all',
                                         fieldLabel : 'cust_name',
                                         forceSelection : true,
+                                        selectOnFocus : true,
+                                        pageSize : 20,
+                                        displayField : 'cust_name',
+                                        emptyText : "Select customer",
                                         hiddenName : 'cust_id',
-                                        listWidth : 400,
-                                        loadingText : "Searching...",
                                         minChars : 2,
+                                        valueField : 'cust_id',
+                                        xtype : 'ComboBox',
+                                        allowBlank : true,
+                                        typeAhead : true,
+                                        editable : true,
+                                        width : 300,
+                                        xns : Roo.form,
                                         name : 'cust_name',
-                                        pageSize : 20,
                                         qtip : "Select Customer",
                                         queryParam : 'cust_name:text',
-                                        selectOnFocus : true,
-                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{cust_name}</b> </div>',
-                                        triggerAction : 'all',
-                                        typeAhead : true,
-                                        valueField : 'cust_id',
-                                        width : 300,
-                                        store : {
-                                            xtype: 'Store',
-                                            xns: Roo.data,
-                                            listeners : {
-                                                beforeload : function (_self, o){
-                                                    o.params = o.params || {};
-                                                
-                                                    if (!_this.relDate) {
-                                                        return false;
-                                                    }
-                                                    var dt = _this.relDate.getValue();    
-                                                    // set more here
-                                                    o.params['_group'] = 'arAging';
-                                                    o.params['_name'] = 'customers';
-                                                    o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
-                                                    o.params['useDocDate:text'] = false    
-                                                }
-                                            },
-                                            remoteSort : true,
-                                            sortInfo : { direction : 'ASC', field: 'cust_name' },
-                                            proxy : {
-                                                xtype: 'HttpProxy',
-                                                xns: Roo.data,
-                                                method : 'GET',
-                                                url : baseURL + '/Roo/metasql.php'
-                                            },
-                                            reader : {
-                                                xtype: 'JsonReader',
-                                                xns: Roo.data,
-                                                id : 'cust_id',
-                                                root : 'data',
-                                                totalProperty : 'total',
-                                                fields : [{"name":"cust_id","type":"int"},"cust_name"]
-                                            }
-                                        }
-                                    },
-                                    {
-                                        xtype: 'TextItem',
-                                        xns: Roo.Toolbar,
-                                        text : "as Of:"
-                                    },
-                                    {
-                                        xtype: 'DateField',
-                                        xns: Roo.form,
+                                        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>',
+                                        loadingText : "Searching...",
                                         listeners : {
-                                            render : function (_self)\r
-                                            {\r
-                                                _this.relDate = _self;\r
-                                               _self.setValue(  new Date() );\r
-                                            },
-                                            select : function (combo, date)
-                                            {
-                                                _this.grid.footer.onClick('first');
-                                            }
+                                               render : function (_self)
+                                                  {
+                                                      _this.customerSel = _self;
+                                                  },
+                                               select : function (combo, record, index)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
                                         },
-                                        allowBlank : false,
+                                        items : [
+
+                                        ]
+
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "as Of:",
+                                        xtype : 'TextItem',
+                                        xns : Roo.Toolbar
+                                    },
+                                       {
+                                        '|xns' : 'Roo.form',
                                         format : 'Y-m-d',
-                                        width : 100
+                                        xtype : 'DateField',
+                                        allowBlank : false,
+                                        width : 100,
+                                        xns : Roo.form,
+                                        listeners : {
+                                               render : function (_self)\r
+                                                  {\r
+                                                      _this.relDate = _self;\r
+                                                     _self.setValue(  new Date() );\r
+                                                  },
+                                               select : function (combo, date)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
+                                        }
                                     }
                                 ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "Displaying araging{0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "Nothing found",
-                                pageSize : 25
+                                xns : Roo,
+                                displayMsg : "Displaying araging{0} - {1} of {2}",
+                                displayInfo : true
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'araging_cust_name',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'araging_docdate',
-                                    header : 'Date',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                        var d = Date.parseDate(v, 'Y-m-d');
-                                    
-                                        return String.format('{0}', d.format('d/M/Y')); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'araging_cust_name',
-                                    header : 'Customer',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'araging_doctype',
-                                    header : 'Doc Type',
-                                    width : 120,
-                                    renderer : function(v) {
-                                        switch(v) {
-                                            case 'I':
-                                                return "Invoice";
-                                            case 'C':
-                                                return "Credit Memo";        
-                                            case 'D':
-                                                return "Debit Memo";                    
-                                            case 'R':
-                                                return "Cash Receipt";        
-                                            case 'V':
-                                                return "Voucher";     
-                                            default:
-                                                 return String.format('{0}', v); 
-                                         }
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'araging_docnumber',
-                                    header : 'Docnumber',
-                                    width : 120,
-                                    renderer : function(v) {
-                                        
-                                                 return String.format('{0}', v); 
-                                         
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'araging_ponumber_pretty',
-                                    header : 'Order',
-                                    width : 150,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'araging_curr_symbol',
-                                    header : 'Currency',
-                                    width : 120,
-                                    renderer : function(v) {
-                                        
-                                                 return String.format('{0}', v); 
-                                         
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_aropen_amount',
-                                    header : 'Value',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_cur_val',
-                                    header : '30 Days',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_sixty_val',
-                                    header : '60 Days',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_ninety_val',
-                                    header : '90 Days',
-                                    width : 100,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_plus_val',
-                                    header : 'Over 90 days',
-                                    width : 150,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_total_val',
-                                    header : 'Total',
-                                    width : 150,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'araging_base_total',
-                                    header : 'Total (BASE)',
-                                    width : 150,
-                                    renderer : function(v) { 
-                                    
-                                            return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
-                                                Roo.util.Format.usMoney(v)); 
-                                        }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Date',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                           var d = Date.parseDate(v, 'Y-m-d');
+                                       
+                                           return String.format('{0}', d.format('d/M/Y')); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_docdate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Customer',
+                                       width : 200,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_cust_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Doc Type',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           switch(v) {
+                                               case 'I':
+                                                   return "Invoice";
+                                               case 'C':
+                                                   return "Credit Memo";        
+                                               case 'D':
+                                                   return "Debit Memo";                    
+                                               case 'R':
+                                                   return "Cash Receipt";        
+                                               case 'V':
+                                                   return "Voucher";     
+                                               default:
+                                                    return String.format('{0}', v); 
+                                            }
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_doctype'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Docnumber',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           
+                                                    return String.format('{0}', v); 
+                                            
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_docnumber'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Order',
+                                       width : 150,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_ponumber_pretty'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Currency',
+                                       width : 120,
+                                       renderer : function(v) {
+                                           
+                                                    return String.format('{0}', v); 
+                                            
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_curr_symbol'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Value',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_aropen_amount'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '30 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_cur_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '60 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_sixty_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : '90 Days',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_ninety_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Over 90 days',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_plus_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Total',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_total_val'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Total (BASE)',
+                                       width : 150,
+                                       renderer : function(v) { 
+                                       
+                                               return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
+                                                   Roo.util.Format.usMoney(v)); 
+                                           },
+                                       xns : Roo.grid,
+                                       dataIndex : 'araging_base_total'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.panel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : true,
+                        region : 'center',
+                        title : "ArAging",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'aropen',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                      if (_this.grid) {
+                                          _this.grid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            fitToFrame : true,
+            background : true,
+            region : 'center',
+            title : "Accounts Recievable",
+            xtype : 'NestedLayoutPanel',
+            fitContainer : true,
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });
index 343017e..b66ae78 100644 (file)
 {
-    "id": "roo-file-46",
-    "name": "Pman.Tab.XtupleCurrency",
-    "parent": "Pman.Tab.XtupleAccountsTab",
-    "title": "Pman.Tab.XtupleCurrency",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCurrency.bjs",
-    "items": [
+    "name" : "Pman.Tab.XtupleCurrency",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "Pman.Tab.XtupleCurrency",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleCurrency.bjs",
+    "permname" : "",
+    "modOrder" : "600",
+    "items" : [
         {
-            "background": true,
-            "region": "center",
-            "title": "Currency / Rates",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+            "background" : true,
+            "region" : "center",
+            "title" : "Currency / Rates",
+            "xtype" : "NestedLayoutPanel",
+            "$ xns" : "Roo",
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
                         {
-                            "*prop": "west",
-                            "split": true,
-                            "width": 300,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "xtype" : "LayoutRegion",
+                            "width" : 300,
+                            "$ xns" : "Roo",
+                            "split" : true,
+                            "* prop" : "west"
                         },
                         {
-                            "|xns": "Roo",
-                            "xtype": "LayoutRegion",
-                            "*prop": "center"
+                            "xtype" : "LayoutRegion",
+                            "$ xns" : "Roo",
+                            "* prop" : "center"
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
                             },
-                            "background": false,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "west",
-                            "tableName": "curr_symbol",
-                            "title": "curr_symbol",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : false,
+                            "region" : "west",
+                            "title" : "curr_symbol",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "curr_symbol",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    Pman.Dialog.XtupleCurrency.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                                    "listeners" : {
+                                        "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    Pman.Dialog.XtupleCurrency.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
+                                        "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "curr_name",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "curr_name",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "listeners": {
-                                                "afterselectionchange": "function (_self)\n{\n    _this.rgrid.footer.onClick('first');\n}"
+                                            "listeners" : {
+                                                "afterselectionchange" : "function (_self)\n{\n    _this.rgrid.footer.onClick('first');\n}"
                                             },
-                                            "*prop": "sm",
-                                            "singleSelect": true,
-                                            "xtype": "RowSelectionModel",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "RowSelectionModel",
+                                            "singleSelect" : true,
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "sm"
                                         },
                                         {
-                                            "*prop": "dataSource",
-                                            "xtype": "Store",
-                                            "remoteSort": true,
-                                            "|sortInfo": "{ field : 'curr_name', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "remoteSort" : true,
+                                            "xtype" : "Store",
+                                            "$ sortInfo" : "{ field : 'curr_name', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "xtype": "HttpProxy",
-                                                    "method": "GET",
-                                                    "|url": "baseURL + '/Roo/curr_symbol.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/curr_symbol.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_base',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'curr_symbol',\n        'type': 'string'\n    },\n    {\n        'name': 'curr_abbr',\n        'type': 'string'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_base',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'curr_symbol',\n        'type': 'string'\n    },\n    {\n        'name': 'curr_abbr',\n        'type': 'string'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "displayInfo": true,
-                                            "displayMsg": "{0} - {1} of {2}",
-                                            "emptyMsg": "Nothing found",
-                                            "pageSize": 25,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo"
+                                            "pageSize" : 25,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "Nothing found",
+                                            "$ xns" : "Roo",
+                                            "displayMsg" : "{0} - {1} of {2}",
+                                            "displayInfo" : true,
+                                            "* prop" : "footer"
                                         },
                                         {
-                                            "*prop": "toolbar",
-                                            "xtype": "Toolbar",
-                                            "|xns": "Roo",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "|click": "function()\n{\n    Pman.Dialog.XtupleCurrency.show( { curr_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                                    "listeners" : {
+                                                        "|click" : "function()\n{\n    Pman.Dialog.XtupleCurrency.show( { curr_id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
                                                     },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Add",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Add",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a currency!\");\n        return;\n    }\n        \n    new Pman.Request({\n        method: 'POST',\n        url: baseURL+ '/Roo/curr_symbol',\n        params : {\n            curr_id : s.data.curr_id,\n            _load_rates : 1\n        },\n        success : function() {\n            _this.rgrid.footer.onClick('first');\n        }\n    });\n}\n"
+                                                    "listeners" : {
+                                                        "|click" : "function()\n{\n    var s = _this.grid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a currency!\");\n        return;\n    }\n        \n    new Pman.Request({\n        method: 'POST',\n        url: baseURL+ '/Roo/curr_symbol',\n        params : {\n            curr_id : s.data.curr_id,\n            _load_rates : 1\n        },\n        success : function() {\n            _this.rgrid.footer.onClick('first');\n        }\n    });\n}\n"
                                                     },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Get this months rates",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Get this months rates",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "curr_name",
-                                            "header": "Name",
-                                            "width": 80,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Name",
+                                            "width" : 80,
+                                            "$ renderer" : "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_name"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "curr_symbol",
-                                            "header": "Symbol",
-                                            "width": 80,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Symbol",
+                                            "width" : 80,
+                                            "$ renderer" : "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_symbol"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "curr_abbr",
-                                            "header": "Abbr.",
-                                            "width": 80,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Abbr.",
+                                            "width" : 80,
+                                            "$ renderer" : "function(v,x,r) { \n\n    return String.format(r.data.curr_base*1 ? '<span style=\"color:red\">{0}</span>' : '{0}', v); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_abbr"
                                         }
                                     ]
                                 }
                             ]
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.rpanel = this;\n    if (_this.rgrid) {\n        _this.rgrid.footer.onClick('first');\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.rpanel = this;\n    if (_this.rgrid) {\n        _this.rgrid.footer.onClick('first');\n    }\n}"
                             },
-                            "background": false,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "curr_rate",
-                            "title": "curr_rate",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : false,
+                            "region" : "center",
+                            "title" : "curr_rate",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "curr_rate",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.rgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.rpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
+                                    "listeners" : {
+                                        "|render" : "function() \n{\n    _this.rgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.rpanel.active) {\n       this.footer.onClick('first');\n    }\n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "curr_rate",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "curr_rate",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "*prop": "sm",
-                                            "singleSelect": true,
-                                            "xtype": "RowSelectionModel",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "RowSelectionModel",
+                                            "singleSelect" : true,
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "sm"
                                         },
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "|click": "function ()\n{\n\n     var sel  = _this.rgrid.getSelectionModel().getSelected();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a rate\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to delete this rate?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Deleting',\n                url : baseURL + '/Roo/curr_rate',\n                method : 'POST',\n                params :  {\n                    _delete : sel.data.curr_rate_id\n                },\n                success : function() {\n                    _this.rgrid.footer.onClick('first');\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
+                                                    "listeners" : {
+                                                        "|click" : "function ()\n{\n\n     var sel  = _this.rgrid.getSelectionModel().getSelected();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a rate\");\n        return;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to delete this rate?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Deleting',\n                url : baseURL + '/Roo/curr_rate',\n                method : 'POST',\n                params :  {\n                    _delete : sel.data.curr_rate_id\n                },\n                success : function() {\n                    _this.rgrid.footer.onClick('first');\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
                                                     },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Delete",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Delete",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, options)\n{\n    var s = _this.grid.selModel.getSelected();\n    if (!s) { \n        this.removeAll();\n        return false;\n    }\n    options.params.curr_id = s.data.curr_id;\n    options.params._with_base_symbol  = 1;\n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, options)\n{\n    var s = _this.grid.selModel.getSelected();\n    if (!s) { \n        this.removeAll();\n        return false;\n    }\n    options.params.curr_id = s.data.curr_id;\n    options.params._with_base_symbol  = 1;\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'curr_effective', direction: 'DESC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'curr_effective', direction: 'DESC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "xtype": "HttpProxy",
-                                                    "method": "GET",
-                                                    "|url": "baseURL + '/Roo/curr_rate.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/curr_rate.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "|fields": "[\n    {\n        'name': 'curr_rate_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_rate',\n        'type': 'float'\n    },\n    {\n        'name': 'curr_effective',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'curr_expires',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    }\n]"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ xns" : "Roo.data",
+                                                    "$ fields" : "[\n    {\n        'name': 'curr_rate_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_id',\n        'type': 'int'\n    },\n    {\n        'name': 'curr_rate',\n        'type': 'float'\n    },\n    {\n        'name': 'curr_effective',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'curr_expires',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    }\n]",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying curr_rate {0} - {1} of {2}",
-                                            "emptyMsg": "No curr_rate found",
-                                            "pageSize": 25,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo"
+                                            "pageSize" : 25,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "No curr_rate found",
+                                            "$ xns" : "Roo",
+                                            "displayMsg" : "Displaying curr_rate {0} - {1} of {2}",
+                                            "displayInfo" : true,
+                                            "* prop" : "footer"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "curr_effective",
-                                            "header": "From",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "From",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_effective"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "curr_expires",
-                                            "header": "To",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "To",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_expires"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "curr_rate",
-                                            "header": "Rate",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Rate",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_rate"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "curr_rate1",
-                                            "header": "Rate",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) {\n\n     return String.format('{1}1 = {2}{0}', \n        Roo.util.Format.number(r.data.curr_rate,2),\n        r.data.base_curr_symbol,\n        r.data.curr_id_curr_symbol\n    ); \n    \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Rate",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v,x,r) {\n\n     return String.format('{1}1 = {2}{0}', \n        Roo.util.Format.number(r.data.curr_rate,2),\n        r.data.base_curr_symbol,\n        r.data.curr_id_curr_symbol\n    ); \n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_rate1"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "curr_rate2",
-                                            "header": "Rate",
-                                            "width": 150,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) {    \n     return String.format('{2}1 = {1}{0}', \n        Roo.util.Format.number(1.0/r.data.curr_rate,2),\n        r.data.base_curr_symbol,\n        r.data.curr_id_curr_symbol\n    ); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Rate",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v,x,r) {    \n     return String.format('{2}1 = {1}{0}', \n        Roo.util.Format.number(1.0/r.data.curr_rate,2),\n        r.data.base_curr_symbol,\n        r.data.curr_id_curr_symbol\n    ); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "curr_rate2"
                                         }
                                     ]
                                 }
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "901"
+    ]
 }
\ No newline at end of file
index 857f817..8ce2e6c 100644 (file)
@@ -2,9 +2,11 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleCurrency = new Roo.XComponent({
-    part     :  ["Xtuple","Currency"],
-    order    : '901-Pman.Tab.XtupleCurrency',
+    part     :  ["Xtuple", "Currency" ],
+    order    : '600-Pman.Tab.XtupleCurrency',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
     name     : "Pman.Tab.XtupleCurrency",
@@ -15,81 +17,50 @@ Pman.Tab.XtupleCurrency = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            region : 'center',
-            title : "Currency / Rates",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                west : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    width : 300,
+                    xns : Roo,
+                    split : true
+                },
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    xns : Roo
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                                if (_this.grid) {
-                                    _this.grid.footer.onClick('first');
-                                }
-                            }
-                        },
-                        background : false,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'west',
-                        tableName : 'curr_symbol',
-                        title : "curr_symbol",
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.panel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                },
-                                rowdblclick : function (_self, rowIndex, e)
-                                {
-                                    Pman.Dialog.XtupleCurrency.show( this.getDataSource().getAt(rowIndex).data, function() {
-                                        _this.grid.footer.onClick('first');
-                                    }); 
-                                }
-                            },
-                            autoExpandColumn : 'curr_name',
-                            loadMask : true,
                             sm : {
-                                xtype: 'RowSelectionModel',
-                                xns: Roo.grid,
+                                '|xns' : 'Roo.grid',
+                                xtype : 'RowSelectionModel',
+                                singleSelect : true,
+                                xns : Roo.grid,
                                 listeners : {
-                                    afterselectionchange : function (_self)
-                                    {
-                                        _this.rgrid.footer.onClick('first');
-                                    }
-                                },
-                                singleSelect : true
+                                       afterselectionchange : function (_self)
+                                          {
+                                              _this.rgrid.footer.onClick('first');
+                                          }
+                                }
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                remoteSort : true,
-                                sortInfo : { field : 'curr_name', direction: 'ASC' },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/curr_symbol.php',
                                     method : 'GET',
-                                    url : baseURL + '/Roo/curr_symbol.php'
+                                    xtype : 'HttpProxy',
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'curr_id',
@@ -111,229 +82,255 @@ Pman.Tab.XtupleCurrency = new Roo.XComponent({
                                             'name': 'curr_abbr',
                                             'type': 'string'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                remoteSort : true,
+                                xtype : 'Store',
+                                sortInfo : { field : 'curr_name', direction: 'ASC' },
+                                xns : Roo.data,
+                                items : [
+
+                                ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "{0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "Nothing found",
-                                pageSize : 25
+                                xns : Roo,
+                                displayMsg : "{0} - {1} of {2}",
+                                displayInfo : true
                             },
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function()
-                                            {
-                                                Pman.Dialog.XtupleCurrency.show( { curr_id : 0 } , function() {
-                                                    _this.grid.footer.onClick('first');
-                                               }); 
-                                            }
-                                        },
-                                        cls : 'x-btn-text-icon',
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
                                         text : "Add",
-                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function()
+                                                  {
+                                                      Pman.Dialog.XtupleCurrency.show( { curr_id : 0 } , function() {
+                                                          _this.grid.footer.onClick('first');
+                                                     }); 
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function()
-                                            {
-                                                var s = _this.grid.getSelectionModel().getSelected();
-                                                
-                                                if(!s){
-                                                    Roo.MessageBox.alert("Error", "Please select a currency!");
-                                                    return;
-                                                }
-                                                    
-                                                new Pman.Request({
-                                                    method: 'POST',
-                                                    url: baseURL+ '/Roo/curr_symbol',
-                                                    params : {
-                                                        curr_id : s.data.curr_id,
-                                                        _load_rates : 1
-                                                    },
-                                                    success : function() {
-                                                        _this.rgrid.footer.onClick('first');
-                                                    }
-                                                });
-                                            }
-                                        },
-                                        cls : 'x-btn-text-icon',
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
                                         text : "Get this months rates",
-                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function()
+                                                  {
+                                                      var s = _this.grid.getSelectionModel().getSelected();
+                                                      
+                                                      if(!s){
+                                                          Roo.MessageBox.alert("Error", "Please select a currency!");
+                                                          return;
+                                                      }
+                                                          
+                                                      new Pman.Request({
+                                                          method: 'POST',
+                                                          url: baseURL+ '/Roo/curr_symbol',
+                                                          params : {
+                                                              curr_id : s.data.curr_id,
+                                                              _load_rates : 1
+                                                          },
+                                                          success : function() {
+                                                              _this.rgrid.footer.onClick('first');
+                                                          }
+                                                      });
+                                                  }
+                                        }
                                     }
                                 ]
+
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'curr_name',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'curr_name',
-                                    header : 'Name',
-                                    width : 80,
-                                    renderer : function(v,x,r) { 
-                                    
-                                        return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
-                                        
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'curr_symbol',
-                                    header : 'Symbol',
-                                    width : 80,
-                                    renderer : function(v,x,r) { 
-                                    
-                                        return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
-                                        
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'curr_abbr',
-                                    header : 'Abbr.',
-                                    width : 80,
-                                    renderer : function(v,x,r) { 
-                                    
-                                        return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
-                                        
-                                    }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Name',
+                                       width : 80,
+                                       renderer : function(v,x,r) { 
+                                       
+                                           return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
+                                           
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Symbol',
+                                       width : 80,
+                                       renderer : function(v,x,r) { 
+                                       
+                                           return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
+                                           
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_symbol'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Abbr.',
+                                       width : 80,
+                                       renderer : function(v,x,r) { 
+                                       
+                                           return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
+                                           
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_abbr'
+                                   }
+                            ],
+                            listeners : {
+                               rowdblclick : function (_self, rowIndex, e)
+                                  {
+                                      Pman.Dialog.XtupleCurrency.show( this.getDataSource().getAt(rowIndex).data, function() {
+                                          _this.grid.footer.onClick('first');
+                                      }); 
+                                  },
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.panel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
-                    },
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.rpanel = this;
-                                if (_this.rgrid) {
-                                    _this.rgrid.footer.onClick('first');
-                                }
-                            }
+
                         },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
                         background : false,
+                        region : 'west',
+                        title : "curr_symbol",
+                        xtype : 'GridPanel',
                         fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'curr_rate',
-                        title : "curr_rate",
+                        xns : Roo,
+                        tableName : 'curr_symbol',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                      if (_this.grid) {
+                                          _this.grid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
+                    },
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.rgrid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.rpanel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                }
-                            },
-                            autoExpandColumn : 'curr_rate',
-                            loadMask : true,
                             sm : {
-                                xtype: 'RowSelectionModel',
-                                xns: Roo.grid,
-                                singleSelect : true
+                                '|xns' : 'Roo.grid',
+                                xtype : 'RowSelectionModel',
+                                singleSelect : true,
+                                xns : Roo.grid
                             },
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function ()
-                                            {
-                                            
-                                                 var sel  = _this.rgrid.getSelectionModel().getSelected();
-                                                if (!sel) {
-                                                    Roo.MessageBox.alert("Error", "Select a rate");
-                                                    return;
-                                                }
-                                                
-                                                Roo.MessageBox.confirm("Are you sure", "Are you sure you want to delete this rate?",
-                                                    function(r) {
-                                                        if (r != 'yes') {
-                                                            return;
-                                                        }
-                                                        new Pman.Request({
-                                                            mask : 'Deleting',
-                                                            url : baseURL + '/Roo/curr_rate',
-                                                            method : 'POST',
-                                                            params :  {
-                                                                _delete : sel.data.curr_rate_id
-                                                            },
-                                                            success : function() {
-                                                                _this.rgrid.footer.onClick('first');
-                                                            }
-                                                        })
-                                                        
-                                                    }
-                                                );
-                                                        
-                                                        
-                                               
-                                            }
-                                        },
-                                        cls : 'x-btn-text-icon',
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
                                         text : "Delete",
-                                        icon : rootURL + '/Pman/templates/images/trash.gif'
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : rootURL + '/Pman/templates/images/trash.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function ()
+                                                  {
+                                                  
+                                                       var sel  = _this.rgrid.getSelectionModel().getSelected();
+                                                      if (!sel) {
+                                                          Roo.MessageBox.alert("Error", "Select a rate");
+                                                          return;
+                                                      }
+                                                      
+                                                      Roo.MessageBox.confirm("Are you sure", "Are you sure you want to delete this rate?",
+                                                          function(r) {
+                                                              if (r != 'yes') {
+                                                                  return;
+                                                              }
+                                                              new Pman.Request({
+                                                                  mask : 'Deleting',
+                                                                  url : baseURL + '/Roo/curr_rate',
+                                                                  method : 'POST',
+                                                                  params :  {
+                                                                      _delete : sel.data.curr_rate_id
+                                                                  },
+                                                                  success : function() {
+                                                                      _this.rgrid.footer.onClick('first');
+                                                                  }
+                                                              })
+                                                              
+                                                          }
+                                                      );
+                                                              
+                                                              
+                                                     
+                                                  }
+                                        }
                                     }
                                 ]
+
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, options)
-                                    {
-                                        var s = _this.grid.selModel.getSelected();
-                                        if (!s) { 
-                                            this.removeAll();
-                                            return false;
-                                        }
-                                        options.params.curr_id = s.data.curr_id;
-                                        options.params._with_base_symbol  = 1;
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'curr_effective', direction: 'DESC' },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/curr_rate.php',
                                     method : 'GET',
-                                    url : baseURL + '/Roo/curr_rate.php'
+                                    xtype : 'HttpProxy',
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    totalProperty : 'total',
-                                    root : 'data',
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
+                                    root : 'data',
+                                    xtype : 'JsonReader',
+                                    xns : Roo.data,
                                     fields : [
                                         {
                                             'name': 'curr_rate_id',
@@ -361,90 +358,158 @@ Pman.Tab.XtupleCurrency = new Roo.XComponent({
                                             'type': 'date',
                                             'dateFormat': 'Y-m-d'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'curr_effective', direction: 'DESC' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, options)
+                                          {
+                                              var s = _this.grid.selModel.getSelected();
+                                              if (!s) { 
+                                                  this.removeAll();
+                                                  return false;
+                                              }
+                                              options.params.curr_id = s.data.curr_id;
+                                              options.params._with_base_symbol  = 1;
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "Displaying curr_rate {0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "No curr_rate found",
-                                pageSize : 25
+                                xns : Roo,
+                                displayMsg : "Displaying curr_rate {0} - {1} of {2}",
+                                displayInfo : true
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'curr_rate',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'curr_effective',
-                                    header : 'From',
-                                    width : 150,
-                                    renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'curr_expires',
-                                    header : 'To',
-                                    width : 150,
-                                    renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'curr_rate',
-                                    header : 'Rate',
-                                    width : 75,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'curr_rate1',
-                                    header : 'Rate',
-                                    width : 150,
-                                    renderer : function(v,x,r) {
-                                    
-                                         return String.format('{1}1 = {2}{0}', 
-                                            Roo.util.Format.number(r.data.curr_rate,2),
-                                            r.data.base_curr_symbol,
-                                            r.data.curr_id_curr_symbol
-                                        ); 
-                                        
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'curr_rate2',
-                                    header : 'Rate',
-                                    width : 150,
-                                    renderer : function(v,x,r) {    
-                                         return String.format('{2}1 = {1}{0}', 
-                                            Roo.util.Format.number(1.0/r.data.curr_rate,2),
-                                            r.data.base_curr_symbol,
-                                            r.data.curr_id_curr_symbol
-                                        ); 
-                                    }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'From',
+                                       width : 150,
+                                       renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_effective'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'To',
+                                       width : 150,
+                                       renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_expires'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Rate',
+                                       width : 75,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_rate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Rate',
+                                       width : 150,
+                                       renderer : function(v,x,r) {
+                                       
+                                            return String.format('{1}1 = {2}{0}', 
+                                               Roo.util.Format.number(r.data.curr_rate,2),
+                                               r.data.base_curr_symbol,
+                                               r.data.curr_id_curr_symbol
+                                           ); 
+                                           
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_rate1'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Rate',
+                                       width : 150,
+                                       renderer : function(v,x,r) {    
+                                            return String.format('{2}1 = {1}{0}', 
+                                               Roo.util.Format.number(1.0/r.data.curr_rate,2),
+                                               r.data.base_curr_symbol,
+                                               r.data.curr_id_curr_symbol
+                                           ); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'curr_rate2'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.rgrid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.rpanel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : false,
+                        region : 'center',
+                        title : "curr_rate",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'curr_rate',
+                        listeners : {
+                               activate : function() {
+                                      _this.rpanel = this;
+                                      if (_this.rgrid) {
+                                          _this.rgrid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                west : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    split : true,
-                    width : 300
-                },
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            background : true,
+            region : 'center',
+            title : "Currency / Rates",
+            xtype : 'NestedLayoutPanel',
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });
index ab01ed5..c61b3a1 100644 (file)
 {
-    "id": "roo-file-52",
-    "name": "Pman.Tab.XtupleGeneralLedger",
-    "parent": "Pman.Tab.XtupleAccountsTab",
-    "title": "",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleGeneralLedger.bjs",
-    "items": [
+    "name" : "Pman.Tab.XtupleGeneralLedger",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleGeneralLedger.bjs",
+    "permname" : "",
+    "modOrder" : "100",
+    "items" : [
         {
-            "background": true,
-            "fitContainer": true,
-            "fitToFrame": true,
-            "region": "center",
-            "title": "General Ledger",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+            "fitToFrame" : true,
+            "background" : true,
+            "region" : "center",
+            "title" : "General Ledger",
+            "xtype" : "NestedLayoutPanel",
+            "fitContainer" : true,
+            "$ xns" : "Roo",
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
                         {
-                            "*prop": "center",
-                            "tabPosition": "top",
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "xtype" : "LayoutRegion",
+                            "tabPosition" : "top",
+                            "$ xns" : "Roo",
+                            "* prop" : "center"
                         },
                         {
-                            "*prop": "west",
-                            "split": true,
-                            "tabPosition": "top",
-                            "width": 600,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "xtype" : "LayoutRegion",
+                            "tabPosition" : "top",
+                            "width" : 600,
+                            "$ xns" : "Roo",
+                            "split" : true,
+                            "* prop" : "west"
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.wpanel = this;\n    if (_this.wgrid) {\n        _this.wgrid.ds.load({});\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.wpanel = this;\n    if (_this.wgrid) {\n        _this.wgrid.ds.load({});\n    }\n}"
                             },
-                            "background": false,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "west",
-                            "tableName": "accnt",
-                            "title": "Account",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : false,
+                            "region" : "west",
+                            "title" : "Account",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "accnt",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.wgrid = this; \n    _this.active = 1;\n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.wpanel.active) {\n       this.ds.load({});\n    }\n}",
-                                        "rowclick": "function (_self, rowIndex, e)\n{\n    var s = _this.wgrid.ds.getAt(rowIndex);\n    \n    if(s.data.accnt_id * 1 < 1){\n        return;\n    }\n    \n    _this.grid.footer.onClick('first');\n    \n    \n}",
-                                        "rowdblclick": "function (_self, rowIndex, e)\n{\n    var ret = _this.wgrid.ds.getAt(rowIndex).data;\n    if(ret.accnt_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Error occur on getting the account id!\");\n        return;\n    }\n    Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {\n        _this.wgrid.ds.load({});\n    }); \n}"
+                                    "listeners" : {
+                                        "rowdblclick" : "function (_self, rowIndex, e)\n{\n    var ret = _this.wgrid.ds.getAt(rowIndex).data;\n    if(ret.accnt_id * 1 < 1){\n        Roo.MessageBox.alert(\"Error\", \"Error occur on getting the account id!\");\n        return;\n    }\n    Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {\n        _this.wgrid.ds.load({});\n    }); \n}",
+                                        "|render" : "function() \n{\n    _this.wgrid = this; \n    _this.active = 1;\n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.wpanel.active) {\n       this.ds.load({});\n    }\n}",
+                                        "rowclick" : "function (_self, rowIndex, e)\n{\n    var s = _this.wgrid.ds.getAt(rowIndex);\n    \n    if(s.data.accnt_id * 1 < 1){\n        return;\n    }\n    \n    _this.grid.footer.onClick('first');\n    \n    \n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "accnt_descrip",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "accnt_descrip",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "specialkey": "function (_self, e)\n{\n  _this.wgrid.ds.load({});\n}",
-                                                        "render": "function (_self)\n{\n    _this.searchBox = _self;\n}"
+                                                    "listeners" : {
+                                                        "specialkey" : "function (_self, e)\n{\n  _this.wgrid.ds.load({});\n}",
+                                                        "render" : "function (_self)\n{\n    _this.searchBox = _self;\n}"
                                                     },
-                                                    "width": 100,
-                                                    "xtype": "TextField",
-                                                    "|xns": "Roo.form"
+                                                    "xtype" : "TextField",
+                                                    "$ xns" : "Roo.form",
+                                                    "width" : 100
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    _this.wgrid.ds.load({});\n}"
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    _this.wgrid.ds.load({});\n}"
                                                     },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\r\n    _this.wgrid.ds.load({});\r\n}"
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\r\n    _this.wgrid.ds.load({});\r\n}"
                                                     },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\r\n{\r\n    _this.dateSel = _self;\r\n   _self.setValue(  new Date() );\r\n}",
-                                                        "select": "function (combo, date)\n{\n    _this.wgrid.ds.load({});\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\r\n{\r\n    _this.dateSel = _self;\r\n   _self.setValue(  new Date() );\r\n}",
+                                                        "select" : "function (combo, date)\n{\n    _this.wgrid.ds.load({});\n}"
                                                     },
-                                                    "allowBlank": false,
-                                                    "format": "d/M/Y",
-                                                    "width": 100,
-                                                    "xtype": "DateField",
-                                                    "|xns": "Roo.form"
+                                                    "format" : "d/M/Y",
+                                                    "xtype" : "DateField",
+                                                    "allowBlank" : false,
+                                                    "width" : 100,
+                                                    "$ xns" : "Roo.form"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.orderBox = _self;\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n    _this.orderBox = _self;\n}"
                                                     },
-                                                    "width": 80,
-                                                    "xtype": "TextField",
-                                                    "|xns": "Roo.form"
+                                                    "xtype" : "TextField",
+                                                    "$ xns" : "Roo.form",
+                                                    "width" : 80
                                                 },
                                                 {
-                                                    "text": "Download / Upload",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar",
-                                                    "items": [
+                                                    "text" : "Download / Upload",
+                                                    "xtype" : "Button",
+                                                    "$ xns" : "Roo.Toolbar",
+                                                    "items" : [
                                                         {
-                                                            "|xns": "Roo.menu",
-                                                            "xtype": "Menu",
-                                                            "*prop": "menu",
-                                                            "items": [
+                                                            "xtype" : "Menu",
+                                                            "$ xns" : "Roo.menu",
+                                                            "* prop" : "menu",
+                                                            "items" : [
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    _this.active = (_this.active) ? 0 : 1;\n    this.setText(_this.active ? \"Show Inactive\" : \"Hide Inactive\");\n    _this.wgrid.ds.load({});\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    _this.active = (_this.active) ? 0 : 1;\n    this.setText(_this.active ? \"Show Inactive\" : \"Hide Inactive\");\n    _this.wgrid.ds.load({});\n}"
                                                                     },
-                                                                    "text": "Show Inactive",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Show Inactive",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 60000,\n        newWindow : true,\n        params : {\n            _group : 'accnt',\n            _name : 'export',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"Downloading\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 60000,\n        newWindow : true,\n        params : {\n            _group : 'accnt',\n            _name : 'export',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"Downloading\");\n}"
                                                                     },
-                                                                    "text": "Export Account Details",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Export Account Details",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n    new Pman.download({\n        url : baseURL + '/Roo/accnt.php',\n        method : 'GET',\n        params : {\n            'start' : 0,\n            'limit' : 9999,\n            _with_xt_balances : 1,\n            'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',\n            'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',\n            'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',\n            'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',\n            'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'\n        }\n        \n    });\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n    new Pman.download({\n        url : baseURL + '/Roo/accnt.php',\n        method : 'GET',\n        params : {\n            'start' : 0,\n            'limit' : 9999,\n            _with_xt_balances : 1,\n            'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',\n            'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',\n            'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',\n            'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',\n            'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'\n        }\n        \n    });\n}"
                                                                     },
-                                                                    "text": "Download Balances",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download Balances",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n   Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {\n        Pman.Dialog.Image.show({\n            _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)\n        }, function(data) {\n             _this.wgrid.ds.load({});\n        });\n   }); \n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n   Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {\n        Pman.Dialog.Image.show({\n            _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)\n        }, function(data) {\n             _this.wgrid.ds.load({});\n        });\n   }); \n}"
                                                                     },
-                                                                    "text": "Upload JE adjustment",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Upload JE adjustment",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Accounts',\n            timeout : 90000\n        \n       },\n       function (data) {\n            Roo.MessageBox.alert(\"Notice\", data); \n            _this.grid.footer.onClick('first');\n\n       }\n   );\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n   Pman.Dialog.Image.show(\n       {\n            _url : baseURL+'/Xtuple/Import/Accounts',\n            timeout : 90000\n        \n       },\n       function (data) {\n            Roo.MessageBox.alert(\"Notice\", data); \n            _this.grid.footer.onClick('first');\n\n       }\n   );\n}"
                                                                     },
-                                                                    "text": "Upload Account Details",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Upload Account Details",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 60000,\n        newWindow : true,\n        params : {\n            _group : 'apopen',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 60000,\n        newWindow : true,\n        params : {\n            _group : 'apopen',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}"
                                                                     },
-                                                                    "text": "Download AP - Day by Day Comparison",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AP - Day by Day Comparison",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        params : {\n            _group : 'apopen',\n            _name : 'bydatesummary',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        params : {\n            _group : 'apopen',\n            _name : 'bydatesummary',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}"
                                                                     },
-                                                                    "text": "Download AP open vs GL - summary of bad days",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AP open vs GL - summary of bad days",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        params : {\n             'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),\n        \n            _group : 'apopen',\n            _name : 'all',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        params : {\n             'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),\n        \n            _group : 'apopen',\n            _name : 'all',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}"
                                                                     },
-                                                                    "text": "Download AP - Transactions on a single day",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AP - Transactions on a single day",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        newWindow : 1,\n        params : {\n             'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            'useDocDate:text' :  'FALSE',\n            \n            _group : 'apAging',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}\n "
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        newWindow : 1,\n        params : {\n             'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            'useDocDate:text' :  'FALSE',\n            \n            _group : 'apAging',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}\n "
                                                                     },
-                                                                    "text": "Download AP Aging at this date",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AP Aging at this date",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        params : {\n              'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            \n            _group : 'apopen',\n            _name : 'history',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}\n "
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n  new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 90000,\n        params : {\n              'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            \n            _group : 'apopen',\n            _name : 'history',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });\n    Roo.MessageBox.alert(\"Notice\", \"This may take some time to calculate\");\n}\n "
                                                                     },
-                                                                    "text": "Download AP Aging Comparison back from this date",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AP Aging Comparison back from this date",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'aropen',\n            _name : 'all',\n            'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999        \n            \n        }\n    });;\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'aropen',\n            _name : 'all',\n            'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),\n            'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999        \n            \n        }\n    });;\n}"
                                                                     },
-                                                                    "text": "Download AR - Transactions on a day",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AR - Transactions on a day",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'aropen',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'aropen',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999         \n            \n        }\n    });;\n}"
                                                                     },
-                                                                    "text": "Download AR - Day by Day Comparison",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Download AR - Day by Day Comparison",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "text": "Gltrans vs Stock (COHEAD)",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu",
-                                                                    "items": [
+                                                                    "text" : "Gltrans vs Stock (COHEAD)",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu",
+                                                                    "items" : [
                                                                         {
-                                                                            "|xns": "Roo.menu",
-                                                                            "xtype": "Menu",
-                                                                            "*prop": "menu",
-                                                                            "items": [
+                                                                            "xtype" : "Menu",
+                                                                            "$ xns" : "Roo.menu",
+                                                                            "* prop" : "menu",
+                                                                            "items" : [
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'bydate',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Gltrans vs Stock By Date",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Gltrans vs Stock By Date",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'bycohead',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'bycohead',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Gltrans vs Sales Order",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Gltrans vs Sales Order",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    var dt = _this.dateSel.getValue();\n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'gltrans',\n            '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    var dt = _this.dateSel.getValue();\n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'gltrans',\n            '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Gltrans",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Gltrans",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    var dt = _this.dateSel.getValue();\n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'stock',\n            '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    var dt = _this.dateSel.getValue();\n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'stock',\n            '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Stock",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Stock",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 }
                                                                             ]
                                                                         }
                                                                     ]
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "text": "Gltrans vs Stock (PO)",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu",
-                                                                    "items": [
+                                                                    "text" : "Gltrans vs Stock (PO)",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu",
+                                                                    "items" : [
                                                                         {
-                                                                            "|xns": "Roo.menu",
-                                                                            "xtype": "Menu",
-                                                                            "*prop": "menu",
-                                                                            "items": [
+                                                                            "xtype" : "Menu",
+                                                                            "$ xns" : "Roo.menu",
+                                                                            "* prop" : "menu",
+                                                                            "items" : [
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'byorder',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'byorder',\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Gltrans vs Stock By PO",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Gltrans vs Stock By PO",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    var ord = _this.orderBox.getValue();\n    \n    if(!ord.length){\n        Roo.MessageBox.alert('Error','Please enter a PO number');\n        return;\n    }\n    \n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'byordergltrans',\n            'docnumber:text' : ord,\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    var ord = _this.orderBox.getValue();\n    \n    if(!ord.length){\n        Roo.MessageBox.alert('Error','Please enter a PO number');\n        return;\n    }\n    \n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'byordergltrans',\n            'docnumber:text' : ord,\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999       \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Gltrans",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Gltrans",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    var ord = _this.orderBox.getValue();\n    \n    if(!ord.length){\n        Roo.MessageBox.alert('Error','Please enter a PO number');\n        return;\n    }\n    \n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'byorderstock',\n            'docnumber:text' : ord,\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999      \n        }\n    });\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    var ord = _this.orderBox.getValue();\n    \n    if(!ord.length){\n        Roo.MessageBox.alert('Error','Please enter a PO number');\n        return;\n    }\n    \n    \n     new Pman.Download({\n        url : baseURL + '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans_stock',\n            _name : 'byorderstock',\n            'docnumber:text' : ord,\n            csvCols : '*',\n            csvTitles : '*', \n            limit : 9999      \n        }\n    });\n}"
                                                                                     },
-                                                                                    "text": "Download Stock",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Download Stock",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 }
                                                                             ]
                                                                         }
                                                                     ]
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "text": "Kingdee",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu",
-                                                                    "items": [
+                                                                    "text" : "Kingdee",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu",
+                                                                    "items" : [
                                                                         {
-                                                                            "|xns": "Roo.menu",
-                                                                            "xtype": "Menu",
-                                                                            "*prop": "menu",
-                                                                            "items": [
+                                                                            "xtype" : "Menu",
+                                                                            "$ xns" : "Roo.menu",
+                                                                            "* prop" : "menu",
+                                                                            "items" : [
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Currency',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Currency',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
                                                                                     },
-                                                                                    "text": "Currency",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Currency",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Rate',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Rate',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
                                                                                     },
-                                                                                    "text": "Exchange Rate",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Exchange Rate",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Account',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    \n     new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Account',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
                                                                                     },
-                                                                                    "text": "Accounts",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Accounts",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/VoucherGroup',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/VoucherGroup',\n        method : 'GET',\n        timeout: 600000\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly\");\n}"
                                                                                     },
-                                                                                    "text": "Voucher Category",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Voucher Category",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 },
                                                                                 {
-                                                                                    "listeners": {
-                                                                                        "click": "function (_self, e)\n{\n    var dt = _this.dateSel.getValue();\n    new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Voucher',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')\n        }\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly - If you wanna import again, please delete all the exist!\");\n}"
+                                                                                    "listeners" : {
+                                                                                        "click" : "function (_self, e)\n{\n    var dt = _this.dateSel.getValue();\n    new Pman.Download({\n        url : baseURL+'/Xtuple/Kingdee/Voucher',\n        method : 'GET',\n        timeout: 600000,\n        params : {\n            _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')\n        }\n    });\n    Roo.MessageBox.alert(\"Notice\", \"Report will download shortly - If you wanna import again, please delete all the exist!\");\n}"
                                                                                     },
-                                                                                    "text": "Transactions",
-                                                                                    "xtype": "Item",
-                                                                                    "|xns": "Roo.menu"
+                                                                                    "text" : "Transactions",
+                                                                                    "xtype" : "Item",
+                                                                                    "$ xns" : "Roo.menu"
                                                                                 }
                                                                             ]
                                                                         }
                                             ]
                                         },
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params.limit = 9999;\n    \n    options.params._general_ledger = 1;\n    \n    options.params['search[name]'] = _this.searchBox.getValue();\n    \n    if (_this.active) {\r\n        options.params.accnt_active = 1;\n        options.params._with_balances = 1;\r\n    }\n    \n   \n    \r    var dt = _this.dateSel.getValue();\r\n    options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    \n\n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params.limit = 9999;\n    \n    options.params._general_ledger = 1;\n    \n    options.params['search[name]'] = _this.searchBox.getValue();\n    \n    if (_this.active) {\r\n        options.params.accnt_active = 1;\n        options.params._with_balances = 1;\r\n    }\n    \n   \n    \r    var dt = _this.dateSel.getValue();\r\n    options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    \n\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'accnt_name', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'accnt_name', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "loadexception": "function (This, o, arg, e)\n{\n\n}"
+                                                    "listeners" : {
+                                                        "loadexception" : "function (This, o, arg, e)\n{\n\n}"
                                                     },
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/accnt.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/accnt.php'",
+                                                    "xtype" : "HttpProxy",
+                                                    "method" : "GET",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "accnt_id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'accnt_id',\n        'type': 'int'\n    },\n    {\n        'name': 'accnt_name',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_type',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_subaccnttype_code',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_curr_id_curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_curr_id_curr_id',\n        'type': 'int'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "accnt_id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'accnt_id',\n        'type': 'int'\n    },\n    {\n        'name': 'accnt_name',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_type',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_subaccnttype_code',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_curr_id_curr_name',\n        'type': 'string'\n    },\n    {\n        'name': 'accnt_curr_id_curr_id',\n        'type': 'int'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "accnt_name",
-                                            "header": "Name",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Name",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "accnt_name"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "accnt_code_alt",
-                                            "header": "Alternative Code",
-                                            "hidden": true,
-                                            "sortable": true,
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "hidden" : true,
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Alternative Code",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "accnt_code_alt"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "accnt_descrip_alt",
-                                            "header": "Alternative Description",
-                                            "hidden": true,
-                                            "sortable": true,
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "hidden" : true,
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Alternative Description",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "accnt_descrip_alt"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "accnt_type",
-                                            "header": "Type",
-                                            "sortable": true,
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) {\n     return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code); \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Type",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v,x,r) {\n     return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code); \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "accnt_type"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "accnt_descrip",
-                                            "header": "Description",
-                                            "sortable": true,
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) \n{ \n    if(r.data.accnt_descrip_alt){\n        return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);     \n    }\n    \n    return String.format('{0}', v); \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Description",
+                                            "width" : 200,
+                                            "$ renderer" : "function(v,x,r) \n{ \n    if(r.data.accnt_descrip_alt){\n        return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);     \n    }\n    \n    return String.format('{0}', v); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "accnt_descrip"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "accnt_curr_id_curr_name",
-                                            "header": "Currency",
-                                            "sortable": true,
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n    var base = baseURL.match(/sg\\.php$/) ? 'SGD' : 'HKD';\n    if (v != base) {\n        return String.format('<span style=\"color:green\">{0}</span>', v);     \n    }\n\n    return String.format('{0}', v); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Currency",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v) { \n    var base = baseURL.match(/sg\\.php$/) ? 'SGD' : 'HKD';\n    if (v != base) {\n        return String.format('<span style=\"color:green\">{0}</span>', v);     \n    }\n\n    return String.format('{0}', v); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "accnt_curr_id_curr_name"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "balance",
-                                            "header": "Balance",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \r\n   return String.format('<span style=\"color:blue;text-decoration:underline;\">{0}</span>',\r\n            Roo.util.Format.usMoney(v) ); \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Balance",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \r\n   return String.format('<span style=\"color:blue;text-decoration:underline;\">{0}</span>',\r\n            Roo.util.Format.usMoney(v) ); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "balance"
                                         }
                                     ]
                                 }
                             ]
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n /*   if (_this.grid) {\n        _this.grid.ds.load({});\n    } */\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n /*   if (_this.grid) {\n        _this.grid.ds.load({});\n    } */\n}"
                             },
-                            "background": false,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "gltrans",
-                            "title": "Transactions",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : false,
+                            "region" : "center",
+                            "title" : "Transactions",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "gltrans",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n   /* if (_this.panel.active) {\n       this.ds.load({});\n    } */\n}",
-                                        "afteredit": "function (e)\n{   \n    var r = _this.grid.ds.getAt(e.row);\n    \n    if(e.value == e.originalValue || !r){\n        return;\n    }\n\n    new Pman.Request({\n        url : baseURL + '/Roo/Gltrans.php',\n        method :'POST',\n        params : {\n            gltrans_id : r.data.gltrans_id,\n            gltrans_notes : e.value,\n            _update_notes : 1\n            \n        },\n        success : function() {\n           \n            _this.grid.footer.onClick('refresh');\n            \n        }\n    });\n    \n}",
-                                        "rowclass": "function (gridview, rowcfg)\n{\n  rowcfg.rowClass = 'dragon-gl-fixedheight';\n}",
-                                        "celldblclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var cm = this.colModel.config[columnIndex].dataIndex;\n    var r = this.ds.getAt(rowIndex);\n    if (cm != 'gltrans_date') {\n        return;\n    }\n    new Pman.Download({\n        url : baseURL+ '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans',\n            _name : 'sequence',\n            'gltrans_sequence:number' : r.data.gltrans_sequence,\n            limit : 9999\n        }\n    });\n    \n}",
-                                        "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n    if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {\n        return;\n    }\n    var r = this.ds.getAt(rowIndex);\n    Pman.Dialog.XtupleJournalEntry.show({\n        gltrans_id : r.data.gltrans_id\n    }, function()\n    {\n        // no need to refresh as it's viewed only?\n    });\n    \n    \n}"
+                                    "listeners" : {
+                                        "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n   /* if (_this.panel.active) {\n       this.ds.load({});\n    } */\n}",
+                                        "celldblclick" : "function (_self, rowIndex, columnIndex, e)\n{\n    var cm = this.colModel.config[columnIndex].dataIndex;\n    var r = this.ds.getAt(rowIndex);\n    if (cm != 'gltrans_date') {\n        return;\n    }\n    new Pman.Download({\n        url : baseURL+ '/Roo/Metasql',\n        method : 'GET',\n        params : {\n            _group : 'gltrans',\n            _name : 'sequence',\n            'gltrans_sequence:number' : r.data.gltrans_sequence,\n            limit : 9999\n        }\n    });\n    \n}",
+                                        "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n    if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {\n        return;\n    }\n    var r = this.ds.getAt(rowIndex);\n    Pman.Dialog.XtupleJournalEntry.show({\n        gltrans_id : r.data.gltrans_id\n    }, function()\n    {\n        // no need to refresh as it's viewed only?\n    });\n    \n    \n}",
+                                        "rowclass" : "function (gridview, rowcfg)\n{\n  rowcfg.rowClass = 'dragon-gl-fixedheight';\n}",
+                                        "afteredit" : "function (e)\n{   \n    var r = _this.grid.ds.getAt(e.row);\n    \n    if(e.value == e.originalValue || !r){\n        return;\n    }\n\n    new Pman.Request({\n        url : baseURL + '/Roo/Gltrans.php',\n        method :'POST',\n        params : {\n            gltrans_id : r.data.gltrans_id,\n            gltrans_notes : e.value,\n            _update_notes : 1\n            \n        },\n        success : function() {\n           \n            _this.grid.footer.onClick('refresh');\n            \n        }\n    });\n    \n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "gltrans_notes",
-                                    "clicksToEdit": 2,
-                                    "loadMask": true,
-                                    "xtype": "EditorGrid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "gltrans_notes",
+                                    "xtype" : "EditorGrid",
+                                    "loadMask" : true,
+                                    "clicksToEdit" : 2,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "specialkey": "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}",
-                                                        "render": "function (_self)\n{\n    _this.gltransBox = _self;\n}"
+                                                    "listeners" : {
+                                                        "specialkey" : "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}",
+                                                        "render" : "function (_self)\n{\n    _this.gltransBox = _self;\n}"
                                                     },
-                                                    "xtype": "TextField",
-                                                    "|xns": "Roo.form"
+                                                    "xtype" : "TextField",
+                                                    "$ xns" : "Roo.form"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.sourceCombo = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n  _this.sourceCombo = _self;\n}",
+                                                        "select" : "function (combo, record, index)\n{\n    Roo.log('select');\n    _this.grid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": false,
-                                                    "displayField": "gltrans_source_name",
-                                                    "editable": false,
-                                                    "hiddenName": "gltrans_source",
-                                                    "listWidth": 200,
-                                                    "mode": "local",
-                                                    "name": "gltrans_source_name",
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{gltrans_source_name}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "value": "ALL",
-                                                    "valueField": "gltrans_source",
-                                                    "width": 150,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
+                                                    "listWidth" : 200,
+                                                    "triggerAction" : "all",
+                                                    "displayField" : "gltrans_source_name",
+                                                    "hiddenName" : "gltrans_source",
+                                                    "value" : "ALL",
+                                                    "valueField" : "gltrans_source",
+                                                    "xtype" : "ComboBox",
+                                                    "allowBlank" : false,
+                                                    "editable" : false,
+                                                    "width" : 150,
+                                                    "$ xns" : "Roo.form",
+                                                    "mode" : "local",
+                                                    "name" : "gltrans_source_name",
+                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{gltrans_source_name}</b> </div>",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "store",
-                                                            "xtype": "SimpleStore",
-                                                            "|data": "[ \n    [ 'ALL', \"All Transactions\"],\n    [ 'S/R' , \"Sales Return\"],\n    [ 'S/O', \"Sales Orders\"] ,\n    [ 'A/P', \"Accounts Payable\"] ,\n    [ 'A/R', \"Accounts Recievable\"] ,\n    [ 'I/M', \"Inventory \"] ,\n    [ 'G/L', \"General Ledger \"] \n    \n    \n]\n",
-                                                            "|fields": "[  'gltrans_source', 'gltrans_source_name']",
-                                                            "|xns": "Roo.data"
+                                                            "xtype" : "SimpleStore",
+                                                            "$ data" : "[ \n    [ 'ALL', \"All Transactions\"],\n    [ 'S/R' , \"Sales Return\"],\n    [ 'S/O', \"Sales Orders\"] ,\n    [ 'A/P', \"Accounts Payable\"] ,\n    [ 'A/R', \"Accounts Recievable\"] ,\n    [ 'I/M', \"Inventory \"] ,\n    [ 'G/L', \"General Ledger \"] \n    \n    \n]\n",
+                                                            "$ fields" : "[  'gltrans_source', 'gltrans_source_name']",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "store"
                                                         }
                                                     ]
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    "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"
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    _this.gltransBox.setValue('');\r\n    _this.grid.footer.onClick('first');\r\n}"
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    _this.gltransBox.setValue('');\r\n    _this.grid.footer.onClick('first');\r\n}"
                                                     },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Download",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/spreadsheet.gif'",
-                                                    "|xns": "Roo.Toolbar",
-                                                    "items": [
+                                                    "text" : "Download",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/spreadsheet.gif'",
+                                                    "$ xns" : "Roo.Toolbar",
+                                                    "items" : [
                                                         {
-                                                            "|xns": "Roo.menu",
-                                                            "xtype": "Menu",
-                                                            "*prop": "menu",
-                                                            "items": [
+                                                            "xtype" : "Menu",
+                                                            "$ xns" : "Roo.menu",
+                                                            "* prop" : "menu",
+                                                            "items" : [
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    \n    new Pman.Download({\n        grid : _this.grid,\n        csvCols : '*',\n        csvTitles : '*',\n        method : 'GET'\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Search Transactions Report for \" + s.data.accnt_descrip + \" will download shortly\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    \n    new Pman.Download({\n        grid : _this.grid,\n        csvCols : '*',\n        csvTitles : '*',\n        method : 'GET'\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Search Transactions Report for \" + s.data.accnt_descrip + \" will download shortly\");\n}"
                                                                     },
-                                                                    "text": "Transactions from search result",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Transactions from search result",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "|xns": "Roo.menu",
-                                                                    "xtype": "Separator"
+                                                                    "xtype" : "Separator",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a account\"); \n        return false;\n    }\n    \n    var dt = _this.dateSel.getValue();\n    \n    if(!dt){\n        Roo.MessageBox.alert(\"Error\", \"Please select a date on the right\"); \n        return false;\n    }  \n    \n    var g = _this.gltransBox.getValue();\n    \n    var params = {\n        '_group' : 'account',\n        '_name' : 'summary',\n        'limit' : 99999,\n        'accnt_id:number' : s.data.accnt_id,\n        'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n    \n    if(g.length){\n        params['search:text'] = g;\n    }\n    \n    new Pman.Download({\n      url : baseURL + '/Roo/Metasql',\n      params :   params,\n      method : 'GET'\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"All Transactions Report for \" + s.data.accnt_descrip + \" will download shortly\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a account\"); \n        return false;\n    }\n    \n    var dt = _this.dateSel.getValue();\n    \n    if(!dt){\n        Roo.MessageBox.alert(\"Error\", \"Please select a date on the right\"); \n        return false;\n    }  \n    \n    var g = _this.gltransBox.getValue();\n    \n    var params = {\n        '_group' : 'account',\n        '_name' : 'summary',\n        'limit' : 99999,\n        'accnt_id:number' : s.data.accnt_id,\n        'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n        'csvTitles' : '*',\n        'csvCols' : '*'\n    };\n    \n    if(g.length){\n        params['search:text'] = g;\n    }\n    \n    new Pman.Download({\n      url : baseURL + '/Roo/Metasql',\n      params :   params,\n      method : 'GET'\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"All Transactions Report for \" + s.data.accnt_descrip + \" will download shortly\");\n}"
                                                                     },
-                                                                    "text": "All Transactions",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "All Transactions",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a account\"); \n        return false;\n    }\n    \n    var dt = _this.dateSel.getValue();\n    \n    if(!dt){\n        Roo.MessageBox.alert(\"Error\", \"Please select a date on the right\"); \n        return false;\n    }  \n    \n    new Pman.Download({\n        url : baseURL + '/Roo/Gltrans.php',\n        method :'GET',\n        params : {\n            gltrans_accnt_id : s.data.accnt_id,\n            _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            _download : 1\n        }\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Financial Year Report for \" + s.data.accnt_descrip + \" will download shortly\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s){\n        Roo.MessageBox.alert(\"Error\", \"Please select a account\"); \n        return false;\n    }\n    \n    var dt = _this.dateSel.getValue();\n    \n    if(!dt){\n        Roo.MessageBox.alert(\"Error\", \"Please select a date on the right\"); \n        return false;\n    }  \n    \n    new Pman.Download({\n        url : baseURL + '/Roo/Gltrans.php',\n        method :'GET',\n        params : {\n            gltrans_accnt_id : s.data.accnt_id,\n            _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            _download : 1\n        }\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Financial Year Report for \" + s.data.accnt_descrip + \" will download shortly\");\n}"
                                                                     },
-                                                                    "text": "All Transactions (Selected Financial Year)",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "All Transactions (Selected Financial Year)",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{   \n    var dt = _this.dateSel.getValue();\n    \n    if(!dt){\n        Roo.MessageBox.alert(\"Error\", \"Please select a date on the right\"); \n        return false;\n    }   \n       \n    new Pman.Download({\n        url : baseURL + '/Roo/Gltrans.php',\n        method :'GET',\n        timeout : 900000,\n        params : {\n            _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            _download : 1\n        }\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Financial Year Report for all accounts will download shortly! it might take several minutes\");\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{   \n    var dt = _this.dateSel.getValue();\n    \n    if(!dt){\n        Roo.MessageBox.alert(\"Error\", \"Please select a date on the right\"); \n        return false;\n    }   \n       \n    new Pman.Download({\n        url : baseURL + '/Roo/Gltrans.php',\n        method :'GET',\n        timeout : 900000,\n        params : {\n            _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),\n            _download : 1\n        }\n    });\n    \n    Roo.MessageBox.alert(\"Notice\", \"Financial Year Report for all accounts will download shortly! it might take several minutes\");\n}"
                                                                     },
-                                                                    "text": "All Transactions  / All Accounts (Selected Financial Year)",
-                                                                    "xtype": "Item",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "All Transactions  / All Accounts (Selected Financial Year)",
+                                                                    "xtype" : "Item",
+                                                                    "$ xns" : "Roo.menu"
                                                                 }
                                                             ]
                                                         }
                                             ]
                                         },
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s){\n        return;\n    }\n    \n    var dt = _this.dateSel.getValue();\n    var g = _this.gltransBox.getValue();\n    \n    var params = {\n        _group : 'account',\n        _name : 'summary',\n        'accnt_id:number' : s.data.accnt_id,\n        'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')\n    };\n    \n    // can not do source + search..\n    var source = _this.sourceCombo.getValue();\n    if (source != 'ALL') {\n        params['search:text']  = source;\n    }\n    \n    if(g.length){\n        params['search:text'] = g;\n    }\n    \n    Roo.apply(options.params,params);\n    \n    var cm = _this.grid.getColumnModel();\n    var hide = (g.length) ? true : false;\n    \n    cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);\n    \n    \n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s){\n        return;\n    }\n    \n    var dt = _this.dateSel.getValue();\n    var g = _this.gltransBox.getValue();\n    \n    var params = {\n        _group : 'account',\n        _name : 'summary',\n        'accnt_id:number' : s.data.accnt_id,\n        'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')\n    };\n    \n    // can not do source + search..\n    var source = _this.sourceCombo.getValue();\n    if (source != 'ALL') {\n        params['search:text']  = source;\n    }\n    \n    if(g.length){\n        params['search:text'] = g;\n    }\n    \n    Roo.apply(options.params,params);\n    \n    var cm = _this.grid.getColumnModel();\n    var hide = (g.length) ? true : false;\n    \n    cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);\n    \n    \n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "timeout": 600000,
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Metasql.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/Metasql.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "timeout" : 600000,
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "gltrans_id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'gltrans_id',\n        'type': 'int'\n    },\n    {\n        'name': 'gltrans_accnt_id',\n        'type': 'int'\n    },\n    {\n        'name': 'gltrans_source',\n        'type': 'string'\n    },\n    {\n        'name': 'gltrans_amount',\n        'type': 'int'\n    },\n    {\n        'name': 'gltrans_notes',\n        'type': 'string'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "gltrans_id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'gltrans_id',\n        'type': 'int'\n    },\n    {\n        'name': 'gltrans_accnt_id',\n        'type': 'int'\n    },\n    {\n        'name': 'gltrans_source',\n        'type': 'string'\n    },\n    {\n        'name': 'gltrans_amount',\n        'type': 'int'\n    },\n    {\n        'name': 'gltrans_notes',\n        'type': 'string'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "pageSize": 100,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo",
-                                            "items": [
+                                            "pageSize" : 100,
+                                            "xtype" : "PagingToolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "footer",
+                                            "items" : [
                                                 {
-                                                    "text": "Double Click To Edit",
-                                                    "xtype": "TextItem",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Double Click To Edit",
+                                                    "xtype" : "TextItem",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "gltrans_date",
-                                            "header": "Date",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    return String.format('{0}<br/><i style=\"color:#ccc;\">{1}</i>',\n         v ? v : '', r.data.gltrans_sequence\n     ); \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Date",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}<br/><i style=\"color:#ccc;\">{1}</i>',\n         v ? v : '', r.data.gltrans_sequence\n     ); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_date"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "gltrans_created",
-                                            "header": "Date",
-                                            "hidden": true,
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    return String.format('{0}', v); \n}",
-                                            "|xns": "Roo.grid"
+                                            "hidden" : true,
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Date",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_created"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "gltrans_source",
-                                            "header": "Source / Who",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    return String.format('{0} - {1}<br/>{2} <i style=\"color:#ccc;\">{3}</i>',\n    \n             v,r.data.gltrans_doctype, \n             r.data.gltrans_username,\n             r.data.gltrans_created);\n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Source / Who",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) { \n    return String.format('{0} - {1}<br/>{2} <i style=\"color:#ccc;\">{3}</i>',\n    \n             v,r.data.gltrans_doctype, \n             r.data.gltrans_username,\n             r.data.gltrans_created);\n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_source"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "gltrans_docnumber",
-                                            "header": "Doc Number",
-                                            "hidden": true,
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|xns": "Roo.grid"
+                                            "hidden" : true,
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Doc Number",
+                                            "width" : 100,
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_docnumber"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "gltrans_notes",
-                                            "header": "Account / Notes",
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) \n{ \n    return String.format(\n            '<u class=\"dragon-ref-accounts\">{3}</u> - <span qtip=\"{2}\"><b>{0}</b>' + \"\\n\" + '{1}', \n            r.data.gltrans_docnumber,\n             v, \n            v.split('\\n').join('<br/>'),\n            r.data.related_accounts\n            \n        ).split('\\n').join('<br/>');\n    \n}",
-                                            "|xns": "Roo.grid",
-                                            "items": [
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Account / Notes",
+                                            "width" : 200,
+                                            "$ renderer" : "function(v,x,r) \n{ \n    return String.format(\n            '<u class=\"dragon-ref-accounts\">{3}</u> - <span qtip=\"{2}\"><b>{0}</b>' + \"\\n\" + '{1}', \n            r.data.gltrans_docnumber,\n             v, \n            v.split('\\n').join('<br/>'),\n            r.data.related_accounts\n            \n        ).split('\\n').join('<br/>');\n    \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_notes",
+                                            "items" : [
                                                 {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
+                                                    "xtype" : "GridEditor",
+                                                    "$ xns" : "Roo.grid",
+                                                    "* prop" : "editor",
+                                                    "items" : [
                                                         {
-                                                            "|xns": "Roo.form",
-                                                            "xtype": "TextArea",
-                                                            "*prop": "field"
+                                                            "xtype" : "TextArea",
+                                                            "$ xns" : "Roo.form",
+                                                            "* prop" : "field"
                                                         }
                                                     ]
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "gltrans_base_curr",
-                                            "header": "Currency",
-                                            "sortable": true,
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n    return String.format('{0}', v); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Currency",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) { \n    return String.format('{0}', v); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_base_curr"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "gltrans_credit_amount",
-                                            "header": "Credit",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );\n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Credit",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );\n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_credit_amount"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "gltrans_debit_amount",
-                                            "header": "Debit",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );\n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Debit",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) { \n    return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );\n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_debit_amount"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "gltrans_balance",
-                                            "header": "Amount",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { \n    var c =v >= 0.0 ? 'black' :  'red';\n\r\n   return String.format('<span style=\"color:' + c + ';\">{0}</span>',\r\n            Roo.util.Format.number(v,2) ); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Amount",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { \n    var c =v >= 0.0 ? 'black' :  'red';\n\r\n   return String.format('<span style=\"color:' + c + ';\">{0}</span>',\r\n            Roo.util.Format.number(v,2) ); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "gltrans_balance"
                                         }
                                     ]
                                 }
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "100"
+    ]
 }
\ No newline at end of file
index d14a276..afebcc7 100644 (file)
@@ -2,8 +2,10 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
-    part     :  ["Xtuple","GeneralLedger"],
+    part     :  ["Xtuple", "GeneralLedger" ],
     order    : '100-Pman.Tab.XtupleGeneralLedger',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
@@ -15,819 +17,813 @@ Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            fitContainer : true,
-            fitToFrame : true,
-            region : 'center',
-            title : "General Ledger",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    tabPosition : 'top',
+                    xns : Roo
+                },
+                west : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    tabPosition : 'top',
+                    width : 600,
+                    xns : Roo,
+                    split : true
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.wpanel = this;
-                                if (_this.wgrid) {
-                                    _this.wgrid.ds.load({});
-                                }
-                            }
-                        },
-                        background : false,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'west',
-                        tableName : 'accnt',
-                        title : "Account",
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.wgrid = this; 
-                                    _this.active = 1;
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.wpanel.active) {
-                                       this.ds.load({});
-                                    }
-                                },
-                                rowclick : function (_self, rowIndex, e)
-                                {
-                                    var s = _this.wgrid.ds.getAt(rowIndex);
-                                    
-                                    if(s.data.accnt_id * 1 < 1){
-                                        return;
-                                    }
-                                    
-                                    _this.grid.footer.onClick('first');
-                                    
-                                    
-                                },
-                                rowdblclick : function (_self, rowIndex, e)
-                                {
-                                    var ret = _this.wgrid.ds.getAt(rowIndex).data;
-                                    if(ret.accnt_id * 1 < 1){
-                                        Roo.MessageBox.alert("Error", "Error occur on getting the account id!");
-                                        return;
-                                    }
-                                    Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {
-                                        _this.wgrid.ds.load({});
-                                    }); 
-                                }
-                            },
-                            autoExpandColumn : 'accnt_descrip',
-                            loadMask : true,
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'TextField',
-                                        xns: Roo.form,
+                                       {
+                                        '|xns' : 'Roo.form',
+                                        xtype : 'TextField',
+                                        xns : Roo.form,
+                                        width : 100,
                                         listeners : {
-                                            specialkey : function (_self, e)
-                                            {
-                                              _this.wgrid.ds.load({});
-                                            },
-                                            render : function (_self)
-                                            {
-                                                _this.searchBox = _self;
-                                            }
-                                        },
-                                        width : 100
+                                               specialkey : function (_self, e)
+                                                  {
+                                                    _this.wgrid.ds.load({});
+                                                  },
+                                               render : function (_self)
+                                                  {
+                                                      _this.searchBox = _self;
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.wgrid.ds.load({});
-                                            }
-                                        },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
                                         cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/search.gif'
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                        icon : rootURL + '/Pman/templates/images/search.gif',
+                                        xns : Roo.Toolbar,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.searchBox.setValue('');\r
-                                                _this.wgrid.ds.load({});\r
-                                            }
-                                        },
-                                        cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.wgrid.ds.load({});
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'DateField',
-                                        xns: Roo.form,
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
+                                        cls : 'x-btn-icon',
+                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+                                        xns : Roo.Toolbar,
                                         listeners : {
-                                            render : function (_self)\r
-                                            {\r
-                                                _this.dateSel = _self;\r
-                                               _self.setValue(  new Date() );\r
-                                            },
-                                            select : function (combo, date)
-                                            {
-                                                _this.wgrid.ds.load({});
-                                            }
-                                        },
-                                        allowBlank : false,
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.searchBox.setValue('');\r
+                                                      _this.wgrid.ds.load({});\r
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.form',
                                         format : 'd/M/Y',
-                                        width : 100
+                                        xtype : 'DateField',
+                                        allowBlank : false,
+                                        width : 100,
+                                        xns : Roo.form,
+                                        listeners : {
+                                               render : function (_self)\r
+                                                  {\r
+                                                      _this.dateSel = _self;\r
+                                                     _self.setValue(  new Date() );\r
+                                                  },
+                                               select : function (combo, date)
+                                                  {
+                                                      _this.wgrid.ds.load({});
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'TextField',
-                                        xns: Roo.form,
+                                       {
+                                        '|xns' : 'Roo.form',
+                                        xtype : 'TextField',
+                                        xns : Roo.form,
+                                        width : 80,
                                         listeners : {
-                                            render : function (_self)
-                                            {
-                                                _this.orderBox = _self;
-                                            }
-                                        },
-                                        width : 80
+                                               render : function (_self)
+                                                  {
+                                                      _this.orderBox = _self;
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        text : "Download / Upload",
+                                       {
                                         menu : {
-                                            xtype: 'Menu',
-                                            xns: Roo.menu,
+                                            '|xns' : 'Roo.menu',
+                                            xtype : 'Menu',
+                                            xns : Roo.menu,
                                             items : [
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Show Inactive",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            _this.active = (_this.active) ? 0 : 1;
-                                                            this.setText(_this.active ? "Show Inactive" : "Hide Inactive");
-                                                            _this.wgrid.ds.load({});
-                                                        }
-                                                    },
-                                                    text : "Show Inactive"
+                                                       click : function (_self, e)
+                                                          {
+                                                              _this.active = (_this.active) ? 0 : 1;
+                                                              this.setText(_this.active ? "Show Inactive" : "Hide Inactive");
+                                                              _this.wgrid.ds.load({});
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Export Account Details",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                          new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                timeout: 60000,
-                                                                newWindow : true,
-                                                                params : {
-                                                                    _group : 'accnt',
-                                                                    _name : 'export',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });;
-                                                            Roo.MessageBox.alert("Notice", "Downloading");
-                                                        }
-                                                    },
-                                                    text : "Export Account Details"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                            new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  timeout: 60000,
+                                                                  newWindow : true,
+                                                                  params : {
+                                                                      _group : 'accnt',
+                                                                      _name : 'export',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });;
+                                                              Roo.MessageBox.alert("Notice", "Downloading");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download Balances",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                            new Pman.download({
-                                                                url : baseURL + '/Roo/accnt.php',
-                                                                method : 'GET',
-                                                                params : {
-                                                                    'start' : 0,
-                                                                    'limit' : 9999,
-                                                                    _with_xt_balances : 1,
-                                                                    'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',
-                                                                    'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',
-                                                                    'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',
-                                                                    'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',
-                                                                    'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'
-                                                                }
-                                                                
-                                                            });
-                                                        }
-                                                    },
-                                                    text : "Download Balances"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                              new Pman.download({
+                                                                  url : baseURL + '/Roo/accnt.php',
+                                                                  method : 'GET',
+                                                                  params : {
+                                                                      'start' : 0,
+                                                                      'limit' : 9999,
+                                                                      _with_xt_balances : 1,
+                                                                      'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',
+                                                                      'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',
+                                                                      'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',
+                                                                      'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',
+                                                                      'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'
+                                                                  }
+                                                                  
+                                                              });
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Upload JE adjustment",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                           Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {
-                                                                Pman.Dialog.Image.show({
-                                                                    _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)
-                                                                }, function(data) {
-                                                                     _this.wgrid.ds.load({});
-                                                                });
-                                                           }); 
-                                                        }
-                                                    },
-                                                    text : "Upload JE adjustment"
+                                                       click : function (_self, e)
+                                                          {
+                                                             Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {
+                                                                  Pman.Dialog.Image.show({
+                                                                      _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)
+                                                                  }, function(data) {
+                                                                       _this.wgrid.ds.load({});
+                                                                  });
+                                                             }); 
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Upload Account Details",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                           Pman.Dialog.Image.show(
-                                                               {
-                                                                    _url : baseURL+'/Xtuple/Import/Accounts',
-                                                                    timeout : 90000
-                                                                
-                                                               },
-                                                               function (data) {
-                                                                    Roo.MessageBox.alert("Notice", data); 
-                                                                    _this.grid.footer.onClick('first');
-                                                        
-                                                               }
-                                                           );
-                                                        }
-                                                    },
-                                                    text : "Upload Account Details"
+                                                       click : function (_self, e)
+                                                          {
+                                                             Pman.Dialog.Image.show(
+                                                                 {
+                                                                      _url : baseURL+'/Xtuple/Import/Accounts',
+                                                                      timeout : 90000
+                                                                  
+                                                                 },
+                                                                 function (data) {
+                                                                      Roo.MessageBox.alert("Notice", data); 
+                                                                      _this.grid.footer.onClick('first');
+                                                          
+                                                                 }
+                                                             );
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AP - Day by Day Comparison",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                          new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                timeout: 60000,
-                                                                newWindow : true,
-                                                                params : {
-                                                                    _group : 'apopen',
-                                                                    _name : 'bydate',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });;
-                                                            Roo.MessageBox.alert("Notice", "This may take some time to calculate");
-                                                        }
-                                                    },
-                                                    text : "Download AP - Day by Day Comparison"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                            new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  timeout: 60000,
+                                                                  newWindow : true,
+                                                                  params : {
+                                                                      _group : 'apopen',
+                                                                      _name : 'bydate',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });;
+                                                              Roo.MessageBox.alert("Notice", "This may take some time to calculate");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AP open vs GL - summary of bad days",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                          new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                timeout: 90000,
-                                                                params : {
-                                                                    _group : 'apopen',
-                                                                    _name : 'bydatesummary',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });;
-                                                            Roo.MessageBox.alert("Notice", "This may take some time to calculate");
-                                                        }
-                                                    },
-                                                    text : "Download AP open vs GL - summary of bad days"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                            new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  timeout: 90000,
+                                                                  params : {
+                                                                      _group : 'apopen',
+                                                                      _name : 'bydatesummary',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });;
+                                                              Roo.MessageBox.alert("Notice", "This may take some time to calculate");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AP - Transactions on a single day",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                          new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                timeout: 90000,
-                                                                params : {
-                                                                     'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
-                                                                    'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
-                                                                
-                                                                    _group : 'apopen',
-                                                                    _name : 'all',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });;
-                                                            Roo.MessageBox.alert("Notice", "This may take some time to calculate");
-                                                        }
-                                                    },
-                                                    text : "Download AP - Transactions on a single day"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                            new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  timeout: 90000,
+                                                                  params : {
+                                                                       'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
+                                                                      'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
+                                                                  
+                                                                      _group : 'apopen',
+                                                                      _name : 'all',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });;
+                                                              Roo.MessageBox.alert("Notice", "This may take some time to calculate");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AP Aging at this date",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                          new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                timeout: 90000,
-                                                                newWindow : 1,
-                                                                params : {
-                                                                     'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
-                                                                    'useDocDate:text' :  'FALSE',
-                                                                    
-                                                                    _group : 'apAging',
-                                                                    _name : 'bydate',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });;
-                                                            Roo.MessageBox.alert("Notice", "This may take some time to calculate");
-                                                        }
-                                                    },
-                                                    text : "Download AP Aging at this date"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                            new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  timeout: 90000,
+                                                                  newWindow : 1,
+                                                                  params : {
+                                                                       'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
+                                                                      'useDocDate:text' :  'FALSE',
+                                                                      
+                                                                      _group : 'apAging',
+                                                                      _name : 'bydate',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });;
+                                                              Roo.MessageBox.alert("Notice", "This may take some time to calculate");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AP Aging Comparison back from this date",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                          new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                timeout: 90000,
-                                                                params : {
-                                                                      'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
-                                                                    
-                                                                    _group : 'apopen',
-                                                                    _name : 'history',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });
-                                                            Roo.MessageBox.alert("Notice", "This may take some time to calculate");
-                                                        }
-                                                    },
-                                                    text : "Download AP Aging Comparison back from this date"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                            new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  timeout: 90000,
+                                                                  params : {
+                                                                        'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
+                                                                      
+                                                                      _group : 'apopen',
+                                                                      _name : 'history',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });
+                                                              Roo.MessageBox.alert("Notice", "This may take some time to calculate");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AR - Transactions on a day",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                             new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                params : {
-                                                                    _group : 'aropen',
-                                                                    _name : 'all',
-                                                                    'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
-                                                                    'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999        
-                                                                    
-                                                                }
-                                                            });;
-                                                        }
-                                                    },
-                                                    text : "Download AR - Transactions on a day"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                               new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  params : {
+                                                                      _group : 'aropen',
+                                                                      _name : 'all',
+                                                                      'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
+                                                                      'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999        
+                                                                      
+                                                                  }
+                                                              });;
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Download AR - Day by Day Comparison",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                             new Pman.Download({
-                                                                url : baseURL + '/Roo/Metasql',
-                                                                method : 'GET',
-                                                                params : {
-                                                                    _group : 'aropen',
-                                                                    _name : 'bydate',
-                                                                    csvCols : '*',
-                                                                    csvTitles : '*', 
-                                                                    limit : 9999         
-                                                                    
-                                                                }
-                                                            });;
-                                                        }
-                                                    },
-                                                    text : "Download AR - Day by Day Comparison"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                               new Pman.Download({
+                                                                  url : baseURL + '/Roo/Metasql',
+                                                                  method : 'GET',
+                                                                  params : {
+                                                                      _group : 'aropen',
+                                                                      _name : 'bydate',
+                                                                      csvCols : '*',
+                                                                      csvTitles : '*', 
+                                                                      limit : 9999         
+                                                                      
+                                                                  }
+                                                              });;
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
-                                                    text : "Gltrans vs Stock (COHEAD)",
+                                               {
                                                     menu : {
-                                                        xtype: 'Menu',
-                                                        xns: Roo.menu,
+                                                        '|xns' : 'Roo.menu',
+                                                        xtype : 'Menu',
+                                                        xns : Roo.menu,
                                                         items : [
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Gltrans vs Stock By Date",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            timeout: 600000,
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'bydate',
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999       
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Gltrans vs Stock By Date"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000,
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'bydate',
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999       
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Gltrans vs Sales Order",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            timeout: 600000,
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'bycohead',
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999       
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Gltrans vs Sales Order"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000,
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'bycohead',
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999       
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Gltrans",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        var dt = _this.dateSel.getValue();
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'gltrans',
-                                                                                '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999       
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Gltrans"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              var dt = _this.dateSel.getValue();
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'gltrans',
+                                                                                      '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999       
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Stock",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        var dt = _this.dateSel.getValue();
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'stock',
-                                                                                '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999       
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Stock"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              var dt = _this.dateSel.getValue();
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'stock',
+                                                                                      '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999       
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             }
                                                         ]
-                                                    }
+
+                                                    },
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Gltrans vs Stock (COHEAD)",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
+                                                    items : [
+
+                                                    ]
+
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
-                                                    text : "Gltrans vs Stock (PO)",
+                                               {
                                                     menu : {
-                                                        xtype: 'Menu',
-                                                        xns: Roo.menu,
+                                                        '|xns' : 'Roo.menu',
+                                                        xtype : 'Menu',
+                                                        xns : Roo.menu,
                                                         items : [
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Gltrans vs Stock By PO",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            timeout: 600000,
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'byorder',
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999       
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Gltrans vs Stock By PO"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000,
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'byorder',
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999       
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Gltrans",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        var ord = _this.orderBox.getValue();
-                                                                        
-                                                                        if(!ord.length){
-                                                                            Roo.MessageBox.alert('Error','Please enter a PO number');
-                                                                            return;
-                                                                        }
-                                                                        
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'byordergltrans',
-                                                                                'docnumber:text' : ord,
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999       
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Gltrans"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              var ord = _this.orderBox.getValue();
+                                                                              
+                                                                              if(!ord.length){
+                                                                                  Roo.MessageBox.alert('Error','Please enter a PO number');
+                                                                                  return;
+                                                                              }
+                                                                              
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'byordergltrans',
+                                                                                      'docnumber:text' : ord,
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999       
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Download Stock",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        var ord = _this.orderBox.getValue();
-                                                                        
-                                                                        if(!ord.length){
-                                                                            Roo.MessageBox.alert('Error','Please enter a PO number');
-                                                                            return;
-                                                                        }
-                                                                        
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL + '/Roo/Metasql',
-                                                                            method : 'GET',
-                                                                            params : {
-                                                                                _group : 'gltrans_stock',
-                                                                                _name : 'byorderstock',
-                                                                                'docnumber:text' : ord,
-                                                                                csvCols : '*',
-                                                                                csvTitles : '*', 
-                                                                                limit : 9999      
-                                                                            }
-                                                                        });
-                                                                    }
-                                                                },
-                                                                text : "Download Stock"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              var ord = _this.orderBox.getValue();
+                                                                              
+                                                                              if(!ord.length){
+                                                                                  Roo.MessageBox.alert('Error','Please enter a PO number');
+                                                                                  return;
+                                                                              }
+                                                                              
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL + '/Roo/Metasql',
+                                                                                  method : 'GET',
+                                                                                  params : {
+                                                                                      _group : 'gltrans_stock',
+                                                                                      _name : 'byorderstock',
+                                                                                      'docnumber:text' : ord,
+                                                                                      csvCols : '*',
+                                                                                      csvTitles : '*', 
+                                                                                      limit : 9999      
+                                                                                  }
+                                                                              });
+                                                                          }
+                                                                }
                                                             }
                                                         ]
-                                                    }
+
+                                                    },
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Gltrans vs Stock (PO)",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
+                                                    items : [
+
+                                                    ]
+
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
-                                                    text : "Kingdee",
+                                               {
                                                     menu : {
-                                                        xtype: 'Menu',
-                                                        xns: Roo.menu,
+                                                        '|xns' : 'Roo.menu',
+                                                        xtype : 'Menu',
+                                                        xns : Roo.menu,
                                                         items : [
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Currency",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL+'/Xtuple/Kingdee/Currency',
-                                                                            method : 'GET',
-                                                                            timeout: 600000
-                                                                        });
-                                                                        Roo.MessageBox.alert("Notice", "Report will download shortly");
-                                                                    }
-                                                                },
-                                                                text : "Currency"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL+'/Xtuple/Kingdee/Currency',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000
+                                                                              });
+                                                                              Roo.MessageBox.alert("Notice", "Report will download shortly");
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Exchange Rate",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL+'/Xtuple/Kingdee/Rate',
-                                                                            method : 'GET',
-                                                                            timeout: 600000
-                                                                        });
-                                                                        Roo.MessageBox.alert("Notice", "Report will download shortly");
-                                                                    }
-                                                                },
-                                                                text : "Exchange Rate"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL+'/Xtuple/Kingdee/Rate',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000
+                                                                              });
+                                                                              Roo.MessageBox.alert("Notice", "Report will download shortly");
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Accounts",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        
-                                                                         new Pman.Download({
-                                                                            url : baseURL+'/Xtuple/Kingdee/Account',
-                                                                            method : 'GET',
-                                                                            timeout: 600000
-                                                                        });
-                                                                        Roo.MessageBox.alert("Notice", "Report will download shortly");
-                                                                    }
-                                                                },
-                                                                text : "Accounts"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              
+                                                                               new Pman.Download({
+                                                                                  url : baseURL+'/Xtuple/Kingdee/Account',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000
+                                                                              });
+                                                                              Roo.MessageBox.alert("Notice", "Report will download shortly");
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Voucher Category",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        new Pman.Download({
-                                                                            url : baseURL+'/Xtuple/Kingdee/VoucherGroup',
-                                                                            method : 'GET',
-                                                                            timeout: 600000
-                                                                        });
-                                                                        Roo.MessageBox.alert("Notice", "Report will download shortly");
-                                                                    }
-                                                                },
-                                                                text : "Voucher Category"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              new Pman.Download({
+                                                                                  url : baseURL+'/Xtuple/Kingdee/VoucherGroup',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000
+                                                                              });
+                                                                              Roo.MessageBox.alert("Notice", "Report will download shortly");
+                                                                          }
+                                                                }
                                                             },
-                                                            {
-                                                                xtype: 'Item',
-                                                                xns: Roo.menu,
+                                                               {
+                                                                '|xns' : 'Roo.menu',
+                                                                text : "Transactions",
+                                                                xtype : 'Item',
+                                                                xns : Roo.menu,
                                                                 listeners : {
-                                                                    click : function (_self, e)
-                                                                    {
-                                                                        var dt = _this.dateSel.getValue();
-                                                                        new Pman.Download({
-                                                                            url : baseURL+'/Xtuple/Kingdee/Voucher',
-                                                                            method : 'GET',
-                                                                            timeout: 600000,
-                                                                            params : {
-                                                                                _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')
-                                                                            }
-                                                                        });
-                                                                        Roo.MessageBox.alert("Notice", "Report will download shortly - If you wanna import again, please delete all the exist!");
-                                                                    }
-                                                                },
-                                                                text : "Transactions"
+                                                                       click : function (_self, e)
+                                                                          {
+                                                                              var dt = _this.dateSel.getValue();
+                                                                              new Pman.Download({
+                                                                                  url : baseURL+'/Xtuple/Kingdee/Voucher',
+                                                                                  method : 'GET',
+                                                                                  timeout: 600000,
+                                                                                  params : {
+                                                                                      _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')
+                                                                                  }
+                                                                              });
+                                                                              Roo.MessageBox.alert("Notice", "Report will download shortly - If you wanna import again, please delete all the exist!");
+                                                                          }
+                                                                }
                                                             }
                                                         ]
-                                                    }
+
+                                                    },
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Kingdee",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
+                                                    items : [
+
+                                                    ]
+
                                                 }
                                             ]
-                                        }
+
+                                        },
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "Download / Upload",
+                                        xtype : 'Button',
+                                        xns : Roo.Toolbar,
+                                        items : [
+
+                                        ]
+
                                     }
                                 ]
+
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, options)
-                                    {
-                                        options.params = options.params || {};
-                                        
-                                        options.params.limit = 9999;
-                                        
-                                        options.params._general_ledger = 1;
-                                        
-                                        options.params['search[name]'] = _this.searchBox.getValue();
-                                        
-                                        if (_this.active) {\r
-                                            options.params.accnt_active = 1;
-                                            options.params._with_balances = 1;\r
-                                        }
-                                        
-                                       
-                                        \r    var dt = _this.dateSel.getValue();\r
-                                        options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
-                                        
-                                    
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'accnt_name', direction: 'ASC' },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    listeners : {
-                                        loadexception : function (This, o, arg, e)
-                                        {
-                                        
-                                        }
-                                    },
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/accnt.php',
+                                    xtype : 'HttpProxy',
                                     method : 'GET',
-                                    url : baseURL + '/Roo/accnt.php'
+                                    xns : Roo.data,
+                                    listeners : {
+                                       loadexception : function (This, o, arg, e)
+                                          {
+                                          
+                                          }
+                                    }
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'accnt_id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'accnt_id',
@@ -857,241 +853,229 @@ Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
                                             'name': 'accnt_curr_id_curr_id',
                                             'type': 'int'
                                         }
-                                    ]
-                                }
-                            },
-                            colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'accnt_name',
-                                    header : 'Name',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v) { return String.format('{0}', v); }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
                                 },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'accnt_code_alt',
-                                    header : 'Alternative Code',
-                                    hidden : true,
-                                    sortable : true,
-                                    width : 50,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'accnt_descrip_alt',
-                                    header : 'Alternative Description',
-                                    hidden : true,
-                                    sortable : true,
-                                    width : 50,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'accnt_type',
-                                    header : 'Type',
-                                    sortable : true,
-                                    width : 50,
-                                    renderer : function(v,x,r) {
-                                         return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code); 
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'accnt_descrip',
-                                    header : 'Description',
-                                    sortable : true,
-                                    width : 200,
-                                    renderer : function(v,x,r) 
-                                    { 
-                                        if(r.data.accnt_descrip_alt){
-                                            return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);     
-                                        }
-                                        
-                                        return String.format('{0}', v); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'accnt_curr_id_curr_name',
-                                    header : 'Currency',
-                                    sortable : true,
-                                    width : 50,
-                                    renderer : function(v) { 
-                                        var base = baseURL.match(/sg\.php$/) ? 'SGD' : 'HKD';
-                                        if (v != base) {
-                                            return String.format('<span style="color:green">{0}</span>', v);     
-                                        }
-                                    
-                                        return String.format('{0}', v); 
-                                    }
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'accnt_name', direction: 'ASC' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, options)
+                                          {
+                                              options.params = options.params || {};
+                                              
+                                              options.params.limit = 9999;
+                                              
+                                              options.params._general_ledger = 1;
+                                              
+                                              options.params['search[name]'] = _this.searchBox.getValue();
+                                              
+                                              if (_this.active) {\r
+                                                  options.params.accnt_active = 1;
+                                                  options.params._with_balances = 1;\r
+                                              }
+                                              
+                                             
+                                              \r    var dt = _this.dateSel.getValue();\r
+                                              options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
+                                              
+                                          
+                                          }
                                 },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'balance',
-                                    header : 'Balance',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v) { \r
-                                       return String.format('<span style="color:blue;text-decoration:underline;">{0}</span>',\r
-                                                Roo.util.Format.usMoney(v) ); 
-                                    }
-                                }
+                                items : [
+
+                                ]
+
+                            },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'accnt_descrip',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
+                            colModel : [
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Name',
+                                       width : 100,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'accnt_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       hidden : true,
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Alternative Code',
+                                       width : 50,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'accnt_code_alt'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       hidden : true,
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Alternative Description',
+                                       width : 50,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'accnt_descrip_alt'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Type',
+                                       width : 50,
+                                       renderer : function(v,x,r) {
+                                            return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code); 
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'accnt_type'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Description',
+                                       width : 200,
+                                       renderer : function(v,x,r) 
+                                       { 
+                                           if(r.data.accnt_descrip_alt){
+                                               return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);     
+                                           }
+                                           
+                                           return String.format('{0}', v); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'accnt_descrip'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Currency',
+                                       width : 50,
+                                       renderer : function(v) { 
+                                           var base = baseURL.match(/sg\.php$/) ? 'SGD' : 'HKD';
+                                           if (v != base) {
+                                               return String.format('<span style="color:green">{0}</span>', v);     
+                                           }
+                                       
+                                           return String.format('{0}', v); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'accnt_curr_id_curr_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Balance',
+                                       width : 100,
+                                       renderer : function(v) { \r
+                                          return String.format('<span style="color:blue;text-decoration:underline;">{0}</span>',\r
+                                                   Roo.util.Format.usMoney(v) ); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'balance'
+                                   }
+                            ],
+                            listeners : {
+                               rowdblclick : function (_self, rowIndex, e)
+                                  {
+                                      var ret = _this.wgrid.ds.getAt(rowIndex).data;
+                                      if(ret.accnt_id * 1 < 1){
+                                          Roo.MessageBox.alert("Error", "Error occur on getting the account id!");
+                                          return;
+                                      }
+                                      Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {
+                                          _this.wgrid.ds.load({});
+                                      }); 
+                                  },
+                               render : function() 
+                                  {
+                                      _this.wgrid = this; 
+                                      _this.active = 1;
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.wpanel.active) {
+                                         this.ds.load({});
+                                      }
+                                  },
+                               rowclick : function (_self, rowIndex, e)
+                                  {
+                                      var s = _this.wgrid.ds.getAt(rowIndex);
+                                      
+                                      if(s.data.accnt_id * 1 < 1){
+                                          return;
+                                      }
+                                      
+                                      _this.grid.footer.onClick('first');
+                                      
+                                      
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
-                    },
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                             /*   if (_this.grid) {
-                                    _this.grid.ds.load({});
-                                } */
-                            }
+
                         },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
                         background : false,
+                        region : 'west',
+                        title : "Account",
+                        xtype : 'GridPanel',
                         fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'gltrans',
-                        title : "Transactions",
+                        xns : Roo,
+                        tableName : 'accnt',
+                        listeners : {
+                               activate : function() {
+                                      _this.wpanel = this;
+                                      if (_this.wgrid) {
+                                          _this.wgrid.ds.load({});
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
+                    },
+                       {
                         grid : {
-                            xtype: 'EditorGrid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                   /* if (_this.panel.active) {
-                                       this.ds.load({});
-                                    } */
-                                },
-                                afteredit : function (e)
-                                {   
-                                    var r = _this.grid.ds.getAt(e.row);
-                                    
-                                    if(e.value == e.originalValue || !r){
-                                        return;
-                                    }
-                                
-                                    new Pman.Request({
-                                        url : baseURL + '/Roo/Gltrans.php',
-                                        method :'POST',
-                                        params : {
-                                            gltrans_id : r.data.gltrans_id,
-                                            gltrans_notes : e.value,
-                                            _update_notes : 1
-                                            
-                                        },
-                                        success : function() {
-                                           
-                                            _this.grid.footer.onClick('refresh');
-                                            
-                                        }
-                                    });
-                                    
-                                },
-                                rowclass : function (gridview, rowcfg)
-                                {
-                                  rowcfg.rowClass = 'dragon-gl-fixedheight';
-                                },
-                                celldblclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                    var cm = this.colModel.config[columnIndex].dataIndex;
-                                    var r = this.ds.getAt(rowIndex);
-                                    if (cm != 'gltrans_date') {
-                                        return;
-                                    }
-                                    new Pman.Download({
-                                        url : baseURL+ '/Roo/Metasql',
-                                        method : 'GET',
-                                        params : {
-                                            _group : 'gltrans',
-                                            _name : 'sequence',
-                                            'gltrans_sequence:number' : r.data.gltrans_sequence,
-                                            limit : 9999
-                                        }
-                                    });
-                                    
-                                },
-                                cellclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                    if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {
-                                        return;
-                                    }
-                                    var r = this.ds.getAt(rowIndex);
-                                    Pman.Dialog.XtupleJournalEntry.show({
-                                        gltrans_id : r.data.gltrans_id
-                                    }, function()
-                                    {
-                                        // no need to refresh as it's viewed only?
-                                    });
-                                    
-                                    
-                                }
-                            },
-                            autoExpandColumn : 'gltrans_notes',
-                            clicksToEdit : 2,
-                            loadMask : true,
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'TextField',
-                                        xns: Roo.form,
+                                       {
+                                        '|xns' : 'Roo.form',
+                                        xtype : 'TextField',
+                                        xns : Roo.form,
                                         listeners : {
-                                            specialkey : function (_self, e)
-                                            {
-                                              _this.grid.footer.onClick('first');
-                                            },
-                                            render : function (_self)
-                                            {
-                                                _this.gltransBox = _self;
-                                            }
+                                               specialkey : function (_self, e)
+                                                  {
+                                                    _this.grid.footer.onClick('first');
+                                                  },
+                                               render : function (_self)
+                                                  {
+                                                      _this.gltransBox = _self;
+                                                  }
                                         }
                                     },
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                              _this.sourceCombo = _self;
-                                            },
-                                            select : function (combo, record, index)
-                                            {
-                                                Roo.log('select');
-                                                _this.grid.footer.onClick('first');
-                                            }
-                                        },
-                                        allowBlank : false,
-                                        displayField : 'gltrans_source_name',
-                                        editable : false,
-                                        hiddenName : 'gltrans_source',
-                                        listWidth : 200,
-                                        mode : 'local',
-                                        name : 'gltrans_source_name',
-                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{gltrans_source_name}</b> </div>',
-                                        triggerAction : 'all',
-                                        value : "ALL",
-                                        valueField : 'gltrans_source',
-                                        width : 150,
+                                       {
                                         store : {
-                                            xtype: 'SimpleStore',
-                                            xns: Roo.data,
+                                            '|xns' : 'Roo.data',
+                                            xtype : 'SimpleStore',
                                             data : [ 
                                                 [ 'ALL', "All Transactions"],
                                                 [ 'S/R' , "Sales Return"],
@@ -1103,244 +1087,247 @@ Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
                                                 
                                                 
                                             ],
-                                            fields : [  'gltrans_source', 'gltrans_source_name']
-                                        }
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                            fields : [  'gltrans_source', 'gltrans_source_name'],
+                                            xns : Roo.data
+                                        },
+                                        '|xns' : 'Roo.form',
+                                        listWidth : 200,
+                                        triggerAction : 'all',
+                                        displayField : 'gltrans_source_name',
+                                        hiddenName : 'gltrans_source',
+                                        value : "ALL",
+                                        valueField : 'gltrans_source',
+                                        xtype : 'ComboBox',
+                                        allowBlank : false,
+                                        editable : false,
+                                        width : 150,
+                                        xns : Roo.form,
+                                        mode : 'local',
+                                        name : 'gltrans_source_name',
+                                        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{gltrans_source_name}</b> </div>',
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.grid.footer.onClick('first');
-                                            }
+                                               render : function (_self)
+                                                  {
+                                                    _this.sourceCombo = _self;
+                                                  },
+                                               select : function (combo, record, index)
+                                                  {
+                                                      Roo.log('select');
+                                                      _this.grid.footer.onClick('first');
+                                                  }
                                         },
-                                        cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/search.gif'
+                                        items : [
+
+                                        ]
+
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
+                                        cls : 'x-btn-icon',
+                                        icon : rootURL + '/Pman/templates/images/search.gif',
+                                        xns : Roo.Toolbar,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.gltransBox.setValue('');\r
-                                                _this.grid.footer.onClick('first');\r
-                                            }
-                                        },
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
                                         cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.gltransBox.setValue('');\r
+                                                      _this.grid.footer.onClick('first');\r
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        cls : 'x-btn-text-icon',
-                                        text : "Download",
-                                        icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
+                                       {
                                         menu : {
-                                            xtype: 'Menu',
-                                            xns: Roo.menu,
+                                            '|xns' : 'Roo.menu',
+                                            xtype : 'Menu',
+                                            xns : Roo.menu,
                                             items : [
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "Transactions from search result",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            
-                                                            new Pman.Download({
-                                                                grid : _this.grid,
-                                                                csvCols : '*',
-                                                                csvTitles : '*',
-                                                                method : 'GET'
-                                                            });
-                                                            
-                                                            Roo.MessageBox.alert("Notice", "Search Transactions Report for " + s.data.accnt_descrip + " will download shortly");
-                                                        }
-                                                    },
-                                                    text : "Transactions from search result"
+                                                       click : function (_self, e)
+                                                          {
+                                                              
+                                                              new Pman.Download({
+                                                                  grid : _this.grid,
+                                                                  csvCols : '*',
+                                                                  csvTitles : '*',
+                                                                  method : 'GET'
+                                                              });
+                                                              
+                                                              Roo.MessageBox.alert("Notice", "Search Transactions Report for " + s.data.accnt_descrip + " will download shortly");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Separator',
-                                                    xns: Roo.menu
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    xtype : 'Separator',
+                                                    xns : Roo.menu
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "All Transactions",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            var s = _this.wgrid.getSelectionModel().getSelected();
-                                                            
-                                                            if(!s){
-                                                                Roo.MessageBox.alert("Error", "Please select a account"); 
-                                                                return false;
-                                                            }
-                                                            
-                                                            var dt = _this.dateSel.getValue();
-                                                            
-                                                            if(!dt){
-                                                                Roo.MessageBox.alert("Error", "Please select a date on the right"); 
-                                                                return false;
-                                                            }  
-                                                            
-                                                            var g = _this.gltransBox.getValue();
-                                                            
-                                                            var params = {
-                                                                '_group' : 'account',
-                                                                '_name' : 'summary',
-                                                                'limit' : 99999,
-                                                                'accnt_id:number' : s.data.accnt_id,
-                                                                'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                                                'csvTitles' : '*',
-                                                                'csvCols' : '*'
-                                                            };
-                                                            
-                                                            if(g.length){
-                                                                params['search:text'] = g;
-                                                            }
-                                                            
-                                                            new Pman.Download({
-                                                              url : baseURL + '/Roo/Metasql',
-                                                              params :   params,
-                                                              method : 'GET'
-                                                            });
-                                                            
-                                                            Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
-                                                        }
-                                                    },
-                                                    text : "All Transactions"
+                                                       click : function (_self, e)
+                                                          {
+                                                              var s = _this.wgrid.getSelectionModel().getSelected();
+                                                              
+                                                              if(!s){
+                                                                  Roo.MessageBox.alert("Error", "Please select a account"); 
+                                                                  return false;
+                                                              }
+                                                              
+                                                              var dt = _this.dateSel.getValue();
+                                                              
+                                                              if(!dt){
+                                                                  Roo.MessageBox.alert("Error", "Please select a date on the right"); 
+                                                                  return false;
+                                                              }  
+                                                              
+                                                              var g = _this.gltransBox.getValue();
+                                                              
+                                                              var params = {
+                                                                  '_group' : 'account',
+                                                                  '_name' : 'summary',
+                                                                  'limit' : 99999,
+                                                                  'accnt_id:number' : s.data.accnt_id,
+                                                                  'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                                  'csvTitles' : '*',
+                                                                  'csvCols' : '*'
+                                                              };
+                                                              
+                                                              if(g.length){
+                                                                  params['search:text'] = g;
+                                                              }
+                                                              
+                                                              new Pman.Download({
+                                                                url : baseURL + '/Roo/Metasql',
+                                                                params :   params,
+                                                                method : 'GET'
+                                                              });
+                                                              
+                                                              Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "All Transactions (Selected Financial Year)",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                            var s = _this.wgrid.getSelectionModel().getSelected();
-                                                            
-                                                            if(!s){
-                                                                Roo.MessageBox.alert("Error", "Please select a account"); 
-                                                                return false;
-                                                            }
-                                                            
-                                                            var dt = _this.dateSel.getValue();
-                                                            
-                                                            if(!dt){
-                                                                Roo.MessageBox.alert("Error", "Please select a date on the right"); 
-                                                                return false;
-                                                            }  
-                                                            
-                                                            new Pman.Download({
-                                                                url : baseURL + '/Roo/Gltrans.php',
-                                                                method :'GET',
-                                                                params : {
-                                                                    gltrans_accnt_id : s.data.accnt_id,
-                                                                    _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                                                    _download : 1
-                                                                }
-                                                            });
-                                                            
-                                                            Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
-                                                        }
-                                                    },
-                                                    text : "All Transactions (Selected Financial Year)"
+                                                       click : function (_self, e)
+                                                          {
+                                                              var s = _this.wgrid.getSelectionModel().getSelected();
+                                                              
+                                                              if(!s){
+                                                                  Roo.MessageBox.alert("Error", "Please select a account"); 
+                                                                  return false;
+                                                              }
+                                                              
+                                                              var dt = _this.dateSel.getValue();
+                                                              
+                                                              if(!dt){
+                                                                  Roo.MessageBox.alert("Error", "Please select a date on the right"); 
+                                                                  return false;
+                                                              }  
+                                                              
+                                                              new Pman.Download({
+                                                                  url : baseURL + '/Roo/Gltrans.php',
+                                                                  method :'GET',
+                                                                  params : {
+                                                                      gltrans_accnt_id : s.data.accnt_id,
+                                                                      _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                                      _download : 1
+                                                                  }
+                                                              });
+                                                              
+                                                              Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
+                                                          }
+                                                    }
                                                 },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
+                                               {
+                                                    '|xns' : 'Roo.menu',
+                                                    text : "All Transactions  / All Accounts (Selected Financial Year)",
+                                                    xtype : 'Item',
+                                                    xns : Roo.menu,
                                                     listeners : {
-                                                        click : function (_self, e)
-                                                        {   
-                                                            var dt = _this.dateSel.getValue();
-                                                            
-                                                            if(!dt){
-                                                                Roo.MessageBox.alert("Error", "Please select a date on the right"); 
-                                                                return false;
-                                                            }   
-                                                               
-                                                            new Pman.Download({
-                                                                url : baseURL + '/Roo/Gltrans.php',
-                                                                method :'GET',
-                                                                timeout : 900000,
-                                                                params : {
-                                                                    _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
-                                                                    _download : 1
-                                                                }
-                                                            });
-                                                            
-                                                            Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
-                                                        }
-                                                    },
-                                                    text : "All Transactions  / All Accounts (Selected Financial Year)"
+                                                       click : function (_self, e)
+                                                          {   
+                                                              var dt = _this.dateSel.getValue();
+                                                              
+                                                              if(!dt){
+                                                                  Roo.MessageBox.alert("Error", "Please select a date on the right"); 
+                                                                  return false;
+                                                              }   
+                                                                 
+                                                              new Pman.Download({
+                                                                  url : baseURL + '/Roo/Gltrans.php',
+                                                                  method :'GET',
+                                                                  timeout : 900000,
+                                                                  params : {
+                                                                      _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
+                                                                      _download : 1
+                                                                  }
+                                                              });
+                                                              
+                                                              Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
+                                                          }
+                                                    }
                                                 }
                                             ]
-                                        }
+
+                                        },
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "Download",
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
+                                        xns : Roo.Toolbar,
+                                        items : [
+
+                                        ]
+
                                     }
                                 ]
+
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, options)
-                                    {
-                                        options.params = options.params || {};
-                                        
-                                        var s = _this.wgrid.getSelectionModel().getSelected();
-                                        
-                                        if(!s){
-                                            return;
-                                        }
-                                        
-                                        var dt = _this.dateSel.getValue();
-                                        var g = _this.gltransBox.getValue();
-                                        
-                                        var params = {
-                                            _group : 'account',
-                                            _name : 'summary',
-                                            'accnt_id:number' : s.data.accnt_id,
-                                            'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
-                                        };
-                                        
-                                        // can not do source + search..
-                                        var source = _this.sourceCombo.getValue();
-                                        if (source != 'ALL') {
-                                            params['search:text']  = source;
-                                        }
-                                        
-                                        if(g.length){
-                                            params['search:text'] = g;
-                                        }
-                                        
-                                        Roo.apply(options.params,params);
-                                        
-                                        var cm = _this.grid.getColumnModel();
-                                        var hide = (g.length) ? true : false;
-                                        
-                                        cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
-                                        
-                                        
-                                    }
-                                },
-                                remoteSort : true,
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Metasql.php',
                                     method : 'GET',
+                                    xtype : 'HttpProxy',
                                     timeout : 600000,
-                                    url : baseURL + '/Roo/Metasql.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'gltrans_id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'gltrans_id',
@@ -1362,166 +1349,343 @@ Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
                                             'name': 'gltrans_notes',
                                             'type': 'string'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, options)
+                                          {
+                                              options.params = options.params || {};
+                                              
+                                              var s = _this.wgrid.getSelectionModel().getSelected();
+                                              
+                                              if(!s){
+                                                  return;
+                                              }
+                                              
+                                              var dt = _this.dateSel.getValue();
+                                              var g = _this.gltransBox.getValue();
+                                              
+                                              var params = {
+                                                  _group : 'account',
+                                                  _name : 'summary',
+                                                  'accnt_id:number' : s.data.accnt_id,
+                                                  'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
+                                              };
+                                              
+                                              // can not do source + search..
+                                              var source = _this.sourceCombo.getValue();
+                                              if (source != 'ALL') {
+                                                  params['search:text']  = source;
+                                              }
+                                              
+                                              if(g.length){
+                                                  params['search:text'] = g;
+                                              }
+                                              
+                                              Roo.apply(options.params,params);
+                                              
+                                              var cm = _this.grid.getColumnModel();
+                                              var hide = (g.length) ? true : false;
+                                              
+                                              cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
+                                              
+                                              
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
                                 pageSize : 100,
+                                xtype : 'PagingToolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'TextItem',
-                                        xns: Roo.Toolbar,
-                                        text : "Double Click To Edit"
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "Double Click To Edit",
+                                        xtype : 'TextItem',
+                                        xns : Roo.Toolbar
                                     }
                                 ]
+
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'gltrans_notes',
+                            xtype : 'EditorGrid',
+                            loadMask : true,
+                            clicksToEdit : 2,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'gltrans_date',
-                                    header : 'Date',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
-                                             v ? v : '', r.data.gltrans_sequence
-                                         ); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'gltrans_created',
-                                    header : 'Date',
-                                    hidden : true,
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0}', v); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'gltrans_source',
-                                    header : 'Source / Who',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0} - {1}<br/>{2} <i style="color:#ccc;">{3}</i>',
-                                        
-                                                 v,r.data.gltrans_doctype, 
-                                                 r.data.gltrans_username,
-                                                 r.data.gltrans_created);
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'gltrans_docnumber',
-                                    header : 'Doc Number',
-                                    hidden : true,
-                                    sortable : true,
-                                    width : 100
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'gltrans_notes',
-                                    header : 'Account / Notes',
-                                    width : 200,
-                                    renderer : function(v,x,r) 
-                                    { 
-                                        return String.format(
-                                                '<u class="dragon-ref-accounts">{3}</u> - <span qtip="{2}"><b>{0}</b>' + "\n" + '{1}', 
-                                                r.data.gltrans_docnumber,
-                                                 v, 
-                                                v.split('\n').join('<br/>'),
-                                                r.data.related_accounts
-                                                
-                                            ).split('\n').join('<br/>');
-                                        
-                                    },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'TextArea',
-                                            xns: Roo.form
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'gltrans_base_curr',
-                                    header : 'Currency',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v) { 
-                                        return String.format('{0}', v); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'gltrans_credit_amount',
-                                    header : 'Credit',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'gltrans_debit_amount',
-                                    header : 'Debit',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v,x,r) { 
-                                        return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'gltrans_balance',
-                                    header : 'Amount',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v) { 
-                                        var c =v >= 0.0 ? 'black' :  'red';
-                                    \r
-                                       return String.format('<span style="color:' + c + ';">{0}</span>',\r
-                                                Roo.util.Format.number(v,2) ); 
-                                    }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Date',
+                                       width : 100,
+                                       renderer : function(v,x,r) { 
+                                           return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
+                                                v ? v : '', r.data.gltrans_sequence
+                                            ); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_date'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       hidden : true,
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Date',
+                                       width : 100,
+                                       renderer : function(v,x,r) { 
+                                           return String.format('{0}', v); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_created'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Source / Who',
+                                       width : 100,
+                                       renderer : function(v,x,r) { 
+                                           return String.format('{0} - {1}<br/>{2} <i style="color:#ccc;">{3}</i>',
+                                           
+                                                    v,r.data.gltrans_doctype, 
+                                                    r.data.gltrans_username,
+                                                    r.data.gltrans_created);
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_source'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       hidden : true,
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Doc Number',
+                                       width : 100,
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_docnumber'
+                                   },
+{
+                                       editor : {
+                                           field : {
+                                               '|xns' : 'Roo.form',
+                                               xtype : 'TextArea',
+                                               xns : Roo.form
+                                           },
+                                           '|xns' : 'Roo.grid',
+                                           xtype : 'GridEditor',
+                                           xns : Roo.grid,
+                                           items : [
+
+                                           ]
+
+                                       },
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Account / Notes',
+                                       width : 200,
+                                       renderer : function(v,x,r) 
+                                       { 
+                                           return String.format(
+                                                   '<u class="dragon-ref-accounts">{3}</u> - <span qtip="{2}"><b>{0}</b>' + "\n" + '{1}', 
+                                                   r.data.gltrans_docnumber,
+                                                    v, 
+                                                   v.split('\n').join('<br/>'),
+                                                   r.data.related_accounts
+                                                   
+                                               ).split('\n').join('<br/>');
+                                           
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_notes',
+                                       items : [
+
+                                       ]
+
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Currency',
+                                       width : 75,
+                                       renderer : function(v) { 
+                                           return String.format('{0}', v); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_base_curr'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Credit',
+                                       width : 100,
+                                       renderer : function(v,x,r) { 
+                                           return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_credit_amount'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Debit',
+                                       width : 100,
+                                       renderer : function(v,x,r) { 
+                                           return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_debit_amount'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Amount',
+                                       width : 100,
+                                       renderer : function(v) { 
+                                           var c =v >= 0.0 ? 'black' :  'red';
+                                       \r
+                                          return String.format('<span style="color:' + c + ';">{0}</span>',\r
+                                                   Roo.util.Format.number(v,2) ); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'gltrans_balance'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                     /* if (_this.panel.active) {
+                                         this.ds.load({});
+                                      } */
+                                  },
+                               celldblclick : function (_self, rowIndex, columnIndex, e)
+                                  {
+                                      var cm = this.colModel.config[columnIndex].dataIndex;
+                                      var r = this.ds.getAt(rowIndex);
+                                      if (cm != 'gltrans_date') {
+                                          return;
+                                      }
+                                      new Pman.Download({
+                                          url : baseURL+ '/Roo/Metasql',
+                                          method : 'GET',
+                                          params : {
+                                              _group : 'gltrans',
+                                              _name : 'sequence',
+                                              'gltrans_sequence:number' : r.data.gltrans_sequence,
+                                              limit : 9999
+                                          }
+                                      });
+                                      
+                                  },
+                               cellclick : function (_self, rowIndex, columnIndex, e)
+                                  {
+                                      if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {
+                                          return;
+                                      }
+                                      var r = this.ds.getAt(rowIndex);
+                                      Pman.Dialog.XtupleJournalEntry.show({
+                                          gltrans_id : r.data.gltrans_id
+                                      }, function()
+                                      {
+                                          // no need to refresh as it's viewed only?
+                                      });
+                                      
+                                      
+                                  },
+                               rowclass : function (gridview, rowcfg)
+                                  {
+                                    rowcfg.rowClass = 'dragon-gl-fixedheight';
+                                  },
+                               afteredit : function (e)
+                                  {   
+                                      var r = _this.grid.ds.getAt(e.row);
+                                      
+                                      if(e.value == e.originalValue || !r){
+                                          return;
+                                      }
+                                  
+                                      new Pman.Request({
+                                          url : baseURL + '/Roo/Gltrans.php',
+                                          method :'POST',
+                                          params : {
+                                              gltrans_id : r.data.gltrans_id,
+                                              gltrans_notes : e.value,
+                                              _update_notes : 1
+                                              
+                                          },
+                                          success : function() {
+                                             
+                                              _this.grid.footer.onClick('refresh');
+                                              
+                                          }
+                                      });
+                                      
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : false,
+                        region : 'center',
+                        title : "Transactions",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'gltrans',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                   /*   if (_this.grid) {
+                                          _this.grid.ds.load({});
+                                      } */
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    tabPosition : 'top'
-                },
-                west : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    split : true,
-                    tabPosition : 'top',
-                    width : 600
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            fitToFrame : true,
+            background : true,
+            region : 'center',
+            title : "General Ledger",
+            xtype : 'NestedLayoutPanel',
+            fitContainer : true,
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });
index 45469f3..b0c39db 100644 (file)
 {
-    "id": "roo-file-51",
-    "name": "Pman.Tab.XtuplePeriods",
-    "parent": "Pman.Tab.XtupleAccountsTab",
-    "title": "",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtuplePeriods.bjs",
-    "items": [
+    "name" : "Pman.Tab.XtuplePeriods",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtuplePeriods.bjs",
+    "permname" : "",
+    "modOrder" : "300",
+    "items" : [
         {
-            "background": true,
-            "fitContainer": true,
-            "fitToFrame": true,
-            "region": "center",
-            "title": "Periods",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+            "fitToFrame" : true,
+            "background" : true,
+            "region" : "center",
+            "title" : "Periods",
+            "xtype" : "NestedLayoutPanel",
+            "fitContainer" : true,
+            "$ xns" : "Roo",
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
                         {
-                            "*prop": "center",
-                            "tabPosition": "top",
-                            "title": "Periods",
-                            "titlebar": false,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "title" : "Periods",
+                            "xtype" : "LayoutRegion",
+                            "tabPosition" : "top",
+                            "$ xns" : "Roo",
+                            "* prop" : "center",
+                            "titlebar" : false
                         },
                         {
-                            "*prop": "west",
-                            "split": true,
-                            "tabPosition": "top",
-                            "title": "Year Periods",
-                            "titlebar": false,
-                            "width": 400,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "title" : "Year Periods",
+                            "xtype" : "LayoutRegion",
+                            "tabPosition" : "top",
+                            "width" : 400,
+                            "$ xns" : "Roo",
+                            "split" : true,
+                            "* prop" : "west",
+                            "titlebar" : false
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.wpanel = this;\n    if (_this.wgrid) {\n        _this.wgrid.ds.load({});\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.wpanel = this;\n    if (_this.wgrid) {\n        _this.wgrid.ds.load({});\n    }\n}"
                             },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "west",
-                            "tableName": "yearperiod",
-                            "title": "Year Periods",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : true,
+                            "region" : "west",
+                            "title" : "Year Periods",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "yearperiod",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.wgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.wpanel.active) {\n       this.ds.load({});\n    }\n}",
-                                        "rowclick": "function (_self, rowIndex, e)\n{\n    _this.grid.ds.load({});\n}",
-                                        "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n\n    var di = this.colModel.getDataIndex(columnIndex);\n\n    if (di != 'yearperiod_closed') {\n        return;\n    }\n\n    var rec = this.ds.getAt(rowIndex);\n\n\n  var open = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Yearperiod.php',\n            timeout: 600000,\n            mask : 'Processing',\n            method : 'POST',\n            params : {\n                yearperiod_id : rec.data.yearperiod_id,\n                _open : 1\n                \n            }, \n            success : function() {\n                _this.wgrid.ds.load({});\n            }\n        });    \n    };\n    \n    var close = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Yearperiod.php',\n            timeout: 600000,\n            mask : 'Processing',\n            method : 'POST',\n            params : {\n                yearperiod_id : rec.data.yearperiod_id,\n                _close : 1\n                \n            }, \n            success : function() {\n                _this.wgrid.ds.load({});\n            }\n        });    \n    };\n    \n    if(rec.data.yearperiod_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a period?');\n        return;\n    }\n\n    //Roo.log(rec.data);\n    if(rec.data.yearperiod_closed *1){\n         Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to open this year period?\" , function(r) {\n            if (r !='yes') {\n                return;\n            }\n            open();\n         \n          });\n         return;\n   }\n        \n    \n\n  \n     Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to close this year period?\" , function(r) {\n        if (r !='yes') {\n            return;\n        }\n        close();\n        \n   })\n   \n    \n    \n    \n}"
+                                    "listeners" : {
+                                        "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n    var di = this.colModel.getDataIndex(columnIndex);\n\n    if (di != 'yearperiod_closed') {\n        return;\n    }\n\n    var rec = this.ds.getAt(rowIndex);\n\n\n  var open = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Yearperiod.php',\n            timeout: 600000,\n            mask : 'Processing',\n            method : 'POST',\n            params : {\n                yearperiod_id : rec.data.yearperiod_id,\n                _open : 1\n                \n            }, \n            success : function() {\n                _this.wgrid.ds.load({});\n            }\n        });    \n    };\n    \n    var close = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Yearperiod.php',\n            timeout: 600000,\n            mask : 'Processing',\n            method : 'POST',\n            params : {\n                yearperiod_id : rec.data.yearperiod_id,\n                _close : 1\n                \n            }, \n            success : function() {\n                _this.wgrid.ds.load({});\n            }\n        });    \n    };\n    \n    if(rec.data.yearperiod_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Please select a period?');\n        return;\n    }\n\n    //Roo.log(rec.data);\n    if(rec.data.yearperiod_closed *1){\n         Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to open this year period?\" , function(r) {\n            if (r !='yes') {\n                return;\n            }\n            open();\n         \n          });\n         return;\n   }\n        \n    \n\n  \n     Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to close this year period?\" , function(r) {\n        if (r !='yes') {\n            return;\n        }\n        close();\n        \n   })\n   \n    \n    \n    \n}",
+                                        "|render" : "function() \n{\n    _this.wgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.wpanel.active) {\n       this.ds.load({});\n    }\n}",
+                                        "rowclick" : "function (_self, rowIndex, e)\n{\n    _this.grid.ds.load({});\n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "yearperiod_start",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "yearperiod_start",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "*prop": "sm",
-                                            "singleSelect": true,
-                                            "xtype": "RowSelectionModel",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "RowSelectionModel",
+                                            "singleSelect" : true,
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "sm"
                                         },
                                         {
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'yearperiod_start', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'yearperiod_start', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Yearperiod.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/Yearperiod.php'",
+                                                    "xtype" : "HttpProxy",
+                                                    "method" : "GET",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'yearperiod_id',\n        'type': 'int'\n    },\n    {\n        'name': 'yearperiod_name',\n        'type': 'string'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'yearperiod_id',\n        'type': 'int'\n    },\n    {\n        'name': 'yearperiod_name',\n        'type': 'string'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "yearperiod_name",
-                                            "header": "Name",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) \n{ \n    v = r.data.yearperiod_start.getFullYear() + '-' + r.data.yearperiod_end.getFullYear();\n    \n    return String.format('{0}', v ? v : ''); \n}",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Name",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) \n{ \n    v = r.data.yearperiod_start.getFullYear() + '-' + r.data.yearperiod_end.getFullYear();\n    \n    return String.format('{0}', v ? v : ''); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "yearperiod_name"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "yearperiod_start",
-                                            "header": "Start",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Start",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "yearperiod_start"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "yearperiod_end",
-                                            "header": "End",
-                                            "sortable": true,
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "End",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "yearperiod_end"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "yearperiod_closed",
-                                            "header": "Closed",
-                                            "sortable": true,
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "sortable" : true,
+                                            "header" : "Closed",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "yearperiod_closed"
                                         }
                                     ]
                                 }
                             ]
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n}"
                             },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "period",
-                            "title": "Periods",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : true,
+                            "region" : "center",
+                            "title" : "Periods",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "period",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n}",
-                                        "beforeedit": "function (e)\n{\n    if(e.field != 'period_name'){\n        return false;\n    }\n}",
-                                        "afteredit": "function (e)\n{\n    if(e.field != 'period_name' || e.originalValue == e.value){\n        return;\n    }\n    \n    if(e.record.data.period_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Error occur on getting the period id');\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Period.php',\n        method : 'POST',\n        params : {\n            period_id : e.record.data.period_id,\n            period_name : e.record.data.period_name\n            \n        }, \n        success : function() {\n            _this.grid.ds.load({});\n        }\n    });\n}",
-                                        "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n\n    var di = this.colModel.getDataIndex(columnIndex);\n\n    if (di != 'period_closed' && di != 'period_freeze') {\n        return;\n    }\n\n    var rec = _this.grid.ds.getAt(rowIndex);\n    \n    if(rec.data.period_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Error occur on getting the period id');\n        return;\n    }\n    \n    var action = rec.data[di] ? 'thaw' : 'freeze';\n    \n    if(di == 'period_closed'){\n        action = rec.data[di] ? 'open' : 'close';\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Period.php',\n        timeout: 600000,\n        mask : 'Processing',\n        method : 'POST',\n        params : {\n            period_id : rec.data.period_id,\n            _action : action\n            \n        }, \n        success : function() {\n            _this.grid.ds.load({});\n        }\n    });    \n    \n}"
+                                    "listeners" : {
+                                        "beforeedit" : "function (e)\n{\n    if(e.field != 'period_name'){\n        return false;\n    }\n}",
+                                        "|render" : "function() \n{\n    _this.grid = this; \n}",
+                                        "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n    var di = this.colModel.getDataIndex(columnIndex);\n\n    if (di != 'period_closed' && di != 'period_freeze') {\n        return;\n    }\n\n    var rec = _this.grid.ds.getAt(rowIndex);\n    \n    if(rec.data.period_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Error occur on getting the period id');\n        return;\n    }\n    \n    var action = rec.data[di] ? 'thaw' : 'freeze';\n    \n    if(di == 'period_closed'){\n        action = rec.data[di] ? 'open' : 'close';\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Period.php',\n        timeout: 600000,\n        mask : 'Processing',\n        method : 'POST',\n        params : {\n            period_id : rec.data.period_id,\n            _action : action\n            \n        }, \n        success : function() {\n            _this.grid.ds.load({});\n        }\n    });    \n    \n}",
+                                        "afteredit" : "function (e)\n{\n    if(e.field != 'period_name' || e.originalValue == e.value){\n        return;\n    }\n    \n    if(e.record.data.period_id * 1 < 1){\n        Roo.MessageBox.alert('Error', 'Error occur on getting the period id');\n        return;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Period.php',\n        method : 'POST',\n        params : {\n            period_id : e.record.data.period_id,\n            period_name : e.record.data.period_name\n            \n        }, \n        success : function() {\n            _this.grid.ds.load({});\n        }\n    });\n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "period_name",
-                                    "clicksToEdit": 2,
-                                    "loadMask": true,
-                                    "xtype": "EditorGrid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "period_name",
+                                    "xtype" : "EditorGrid",
+                                    "loadMask" : true,
+                                    "clicksToEdit" : 2,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n  _this.status = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{\n    _this.grid.ds.load({});\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n  _this.status = _self;\n}",
+                                                        "select" : "function (combo, record, index)\n{\n    _this.grid.ds.load({});\n}"
                                                     },
-                                                    "allowBlank": false,
-                                                    "displayField": "fname",
-                                                    "editable": false,
-                                                    "fieldLabel": "Status",
-                                                    "hiddenName": "status",
-                                                    "listWidth": 200,
-                                                    "mode": "local",
-                                                    "name": "status",
-                                                    "triggerAction": "all",
-                                                    "value": "A",
-                                                    "valueField": "ftype",
-                                                    "width": 150,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
+                                                    "listWidth" : 200,
+                                                    "triggerAction" : "all",
+                                                    "fieldLabel" : "Status",
+                                                    "displayField" : "fname",
+                                                    "hiddenName" : "status",
+                                                    "value" : "A",
+                                                    "valueField" : "ftype",
+                                                    "xtype" : "ComboBox",
+                                                    "allowBlank" : false,
+                                                    "editable" : false,
+                                                    "width" : 150,
+                                                    "$ xns" : "Roo.form",
+                                                    "mode" : "local",
+                                                    "name" : "status",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "store",
-                                                            "xtype": "SimpleStore",
-                                                            "|data": "[ \n    [ 'O', \"Open\"],\n    [ 'C' , \"Closed\"],\n    [ 'A', \"All\"] \n]\n",
-                                                            "|fields": "[  'ftype', 'fname']",
-                                                            "|xns": "Roo.data"
+                                                            "xtype" : "SimpleStore",
+                                                            "$ data" : "[ \n    [ 'O', \"Open\"],\n    [ 'C' , \"Closed\"],\n    [ 'A', \"All\"] \n]\n",
+                                                            "$ fields" : "[  'ftype', 'fname']",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "store"
                                                         }
                                                     ]
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "|click": "function()\n{\n    var addPeriod = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Period.php',\n            timeout: 600000,\n            mask : 'Processing',\n            method : 'POST',\n            params : {\n                _addExtraYear : 1\n            }, \n            success : function() {\n                _this.wgrid.ds.load({});\n            }\n        });\n    }\n     \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to add extra year\" , function(r) {\n        if (r !='yes') {\n            return;\n        }\n        addPeriod();\n   })\n   \n}\n"
+                                                    "listeners" : {
+                                                        "|click" : "function()\n{\n    var addPeriod = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Period.php',\n            timeout: 600000,\n            mask : 'Processing',\n            method : 'POST',\n            params : {\n                _addExtraYear : 1\n            }, \n            success : function() {\n                _this.wgrid.ds.load({});\n            }\n        });\n    }\n     \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to add extra year\" , function(r) {\n        if (r !='yes') {\n            return;\n        }\n        addPeriod();\n   })\n   \n}\n"
                                                     },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Add Extra Year",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Add Extra Year",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Separator"
+                                                    "xtype" : "Separator",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "|click": "function()\n{\n    var list = []; \n    \n    \n    \n    _this.grid.ds.each(function (r) {\n        if (r.data.period_closed) {\n            return;\n        }\n    \n        if(r.data.transactions > 0 ){\n            return false;\n        }\n        list.push(r.data);\n\n    });\n    \n    if (!list.length) {\n       Roo.MessageBox.alert(\"Notice\", \"Nothing to close\");\n       return;\n    }\n    \n    var tl = list.length;\n    \n    var closeNext = function(){\n    \n        if (!list.length) {\n            Roo.MessageBox.hide();\n             _this.grid.ds.load({});\n             return;\n        }\n    \n        var item = list.shift();\n        \n        Roo.MessageBox.updateProgress(\n            (tl-list.length) / tl,\n            \"Closing \" + item.period_name\n              \n        );\n    \n        new Pman.Request({\n            url : baseURL + '/Roo/Period.php',\n            timeout: 900000,\n            //mask : 'Processing',\n            method : 'POST',\n            params : {\n                period_id : item.period_id,\n                _action:  'close' ,\n                _second_action : 'freeze'\n            }, \n            success : function() {\n                closeNext();\n//                _this.grid.ds.load({});\n            }\n        });\n    };\n     \n    \n     \n  \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to close the period where there are no transactions?\" , function(r) {\n        if (r !='yes') {\n            return;\n        }\n        Roo.MessageBox.progress( \"Closing periods\", \"Closing periods\");\n        closeNext();\n        \n   })\n   \n    \n     \n     \n    \n}\n"
+                                                    "listeners" : {
+                                                        "|click" : "function()\n{\n    var list = []; \n    \n    \n    \n    _this.grid.ds.each(function (r) {\n        if (r.data.period_closed) {\n            return;\n        }\n    \n        if(r.data.transactions > 0 ){\n            return false;\n        }\n        list.push(r.data);\n\n    });\n    \n    if (!list.length) {\n       Roo.MessageBox.alert(\"Notice\", \"Nothing to close\");\n       return;\n    }\n    \n    var tl = list.length;\n    \n    var closeNext = function(){\n    \n        if (!list.length) {\n            Roo.MessageBox.hide();\n             _this.grid.ds.load({});\n             return;\n        }\n    \n        var item = list.shift();\n        \n        Roo.MessageBox.updateProgress(\n            (tl-list.length) / tl,\n            \"Closing \" + item.period_name\n              \n        );\n    \n        new Pman.Request({\n            url : baseURL + '/Roo/Period.php',\n            timeout: 900000,\n            //mask : 'Processing',\n            method : 'POST',\n            params : {\n                period_id : item.period_id,\n                _action:  'close' ,\n                _second_action : 'freeze'\n            }, \n            success : function() {\n                closeNext();\n//                _this.grid.ds.load({});\n            }\n        });\n    };\n     \n    \n     \n  \n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure want to close the period where there are no transactions?\" , function(r) {\n        if (r !='yes') {\n            return;\n        }\n        Roo.MessageBox.progress( \"Closing periods\", \"Closing periods\");\n        closeNext();\n        \n   })\n   \n    \n     \n     \n    \n}\n"
                                                     },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Close all empty months",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Close all empty months",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s || !s.data.yearperiod_id * 1 > 0){\n        Roo.MessageBox.alert('Error','Please select a year period');\n        this.removeAll();\n        return false;\n    }\n    \n    options.params._status = _this.status.getValue();\n    options.params.period_yearperiod_id = s.data.yearperiod_id;\n    options.params._with_transactions = 1;\n    \n\n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if(!s || !s.data.yearperiod_id * 1 > 0){\n        Roo.MessageBox.alert('Error','Please select a year period');\n        this.removeAll();\n        return false;\n    }\n    \n    options.params._status = _this.status.getValue();\n    options.params.period_yearperiod_id = s.data.yearperiod_id;\n    options.params._with_transactions = 1;\n    \n\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'period_start', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'period_start', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/Period.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/Period.php'",
+                                                    "xtype" : "HttpProxy",
+                                                    "method" : "GET",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'period_id',\n        'type': 'int'\n    },\n    {\n        'name': 'period_name',\n        'type': 'string'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'period_id',\n        'type': 'int'\n    },\n    {\n        'name': 'period_name',\n        'type': 'string'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "period_name",
-                                            "header": "Name",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
-                                            "|xns": "Roo.grid",
-                                            "items": [
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Name",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "period_name",
+                                            "items" : [
                                                 {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
+                                                    "xtype" : "GridEditor",
+                                                    "$ xns" : "Roo.grid",
+                                                    "* prop" : "editor",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "field",
-                                                            "allowBlank": false,
-                                                            "xtype": "TextField",
-                                                            "|xns": "Roo.form"
+                                                            "xtype" : "TextField",
+                                                            "allowBlank" : false,
+                                                            "$ xns" : "Roo.form",
+                                                            "* prop" : "field"
                                                         }
                                                     ]
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "period_start",
-                                            "header": "Start",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Start",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "period_start"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "period_end",
-                                            "header": "End",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "End",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "period_end"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "period_closed",
-                                            "header": "Closed",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Closed",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "period_closed"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "period_freeze",
-                                            "header": "Frozen",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Frozen",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) {  \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "period_freeze"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "transactions",
-                                            "header": "Transactions",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Transactions",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) \n{ \n    return String.format('{0}', v ? v : ''); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "transactions"
                                         }
                                     ]
                                 }
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "200"
+    ]
 }
\ No newline at end of file
index 19c49a1..35d5f49 100644 (file)
@@ -2,9 +2,11 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtuplePeriods = new Roo.XComponent({
-    part     :  ["Xtuple","Periods"],
-    order    : '200-Pman.Tab.XtuplePeriods',
+    part     :  ["Xtuple", "Periods" ],
+    order    : '300-Pman.Tab.XtuplePeriods',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
     name     : "unnamed module",
@@ -15,153 +17,50 @@ Pman.Tab.XtuplePeriods = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            fitContainer : true,
-            fitToFrame : true,
-            region : 'center',
-            title : "Periods",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                center : {
+                    '|xns' : 'Roo',
+                    title : "Periods",
+                    xtype : 'LayoutRegion',
+                    tabPosition : 'top',
+                    xns : Roo,
+                    titlebar : false
+                },
+                west : {
+                    '|xns' : 'Roo',
+                    title : "Year Periods",
+                    xtype : 'LayoutRegion',
+                    tabPosition : 'top',
+                    width : 400,
+                    xns : Roo,
+                    split : true,
+                    titlebar : false
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.wpanel = this;
-                                if (_this.wgrid) {
-                                    _this.wgrid.ds.load({});
-                                }
-                            }
-                        },
-                        background : true,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'west',
-                        tableName : 'yearperiod',
-                        title : "Year Periods",
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.wgrid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.wpanel.active) {
-                                       this.ds.load({});
-                                    }
-                                },
-                                rowclick : function (_self, rowIndex, e)
-                                {
-                                    _this.grid.ds.load({});
-                                },
-                                cellclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                
-                                    var di = this.colModel.getDataIndex(columnIndex);
-                                
-                                    if (di != 'yearperiod_closed') {
-                                        return;
-                                    }
-                                
-                                    var rec = this.ds.getAt(rowIndex);
-                                
-                                
-                                  var open = function(){
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/Yearperiod.php',
-                                            timeout: 600000,
-                                            mask : 'Processing',
-                                            method : 'POST',
-                                            params : {
-                                                yearperiod_id : rec.data.yearperiod_id,
-                                                _open : 1
-                                                
-                                            }, 
-                                            success : function() {
-                                                _this.wgrid.ds.load({});
-                                            }
-                                        });    
-                                    };
-                                    
-                                    var close = function(){
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/Yearperiod.php',
-                                            timeout: 600000,
-                                            mask : 'Processing',
-                                            method : 'POST',
-                                            params : {
-                                                yearperiod_id : rec.data.yearperiod_id,
-                                                _close : 1
-                                                
-                                            }, 
-                                            success : function() {
-                                                _this.wgrid.ds.load({});
-                                            }
-                                        });    
-                                    };
-                                    
-                                    if(rec.data.yearperiod_id * 1 < 1){
-                                        Roo.MessageBox.alert('Error', 'Please select a period?');
-                                        return;
-                                    }
-                                
-                                    //Roo.log(rec.data);
-                                    if(rec.data.yearperiod_closed *1){
-                                         Roo.MessageBox.confirm("Confirm", "Are you sure want to open this year period?" , function(r) {
-                                            if (r !='yes') {
-                                                return;
-                                            }
-                                            open();
-                                         
-                                          });
-                                         return;
-                                   }
-                                        
-                                    
-                                
-                                  
-                                     Roo.MessageBox.confirm("Confirm", "Are you sure want to close this year period?" , function(r) {
-                                        if (r !='yes') {
-                                            return;
-                                        }
-                                        close();
-                                        
-                                   })
-                                   
-                                    
-                                    
-                                    
-                                }
-                            },
-                            autoExpandColumn : 'yearperiod_start',
-                            loadMask : true,
                             sm : {
-                                xtype: 'RowSelectionModel',
-                                xns: Roo.grid,
-                                singleSelect : true
+                                '|xns' : 'Roo.grid',
+                                xtype : 'RowSelectionModel',
+                                singleSelect : true,
+                                xns : Roo.grid
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                remoteSort : true,
-                                sortInfo : { field : 'yearperiod_start', direction: 'ASC' },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Yearperiod.php',
+                                    xtype : 'HttpProxy',
                                     method : 'GET',
-                                    url : baseURL + '/Roo/Yearperiod.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'yearperiod_id',
@@ -171,357 +70,390 @@ Pman.Tab.XtuplePeriods = new Roo.XComponent({
                                             'name': 'yearperiod_name',
                                             'type': 'string'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'yearperiod_start', direction: 'ASC' },
+                                xns : Roo.data,
+                                items : [
+
+                                ]
+
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'yearperiod_start',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'yearperiod_name',
-                                    header : 'Name',
-                                    width : 100,
-                                    renderer : function(v,x,r) 
-                                    { 
-                                        v = r.data.yearperiod_start.getFullYear() + '-' + r.data.yearperiod_end.getFullYear();
-                                        
-                                        return String.format('{0}', v ? v : ''); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'yearperiod_start',
-                                    header : 'Start',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'yearperiod_end',
-                                    header : 'End',
-                                    sortable : true,
-                                    width : 100,
-                                    renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'yearperiod_closed',
-                                    header : 'Closed',
-                                    sortable : true,
-                                    width : 75,
-                                    renderer : function(v) {  
-                                        var state = v  ?  '-checked' : '';
-                                    
-                                        return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                                                    
-                                     }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Name',
+                                       width : 100,
+                                       renderer : function(v,x,r) 
+                                       { 
+                                           v = r.data.yearperiod_start.getFullYear() + '-' + r.data.yearperiod_end.getFullYear();
+                                           
+                                           return String.format('{0}', v ? v : ''); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'yearperiod_name'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Start',
+                                       width : 100,
+                                       renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'yearperiod_start'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'End',
+                                       width : 100,
+                                       renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'yearperiod_end'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       sortable : true,
+                                       header : 'Closed',
+                                       width : 75,
+                                       renderer : function(v) {  
+                                           var state = v  ?  '-checked' : '';
+                                       
+                                           return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                                       
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'yearperiod_closed'
+                                   }
+                            ],
+                            listeners : {
+                               cellclick : function (_self, rowIndex, columnIndex, e)
+                                  {
+                                  
+                                      var di = this.colModel.getDataIndex(columnIndex);
+                                  
+                                      if (di != 'yearperiod_closed') {
+                                          return;
+                                      }
+                                  
+                                      var rec = this.ds.getAt(rowIndex);
+                                  
+                                  
+                                    var open = function(){
+                                          new Pman.Request({
+                                              url : baseURL + '/Roo/Yearperiod.php',
+                                              timeout: 600000,
+                                              mask : 'Processing',
+                                              method : 'POST',
+                                              params : {
+                                                  yearperiod_id : rec.data.yearperiod_id,
+                                                  _open : 1
+                                                  
+                                              }, 
+                                              success : function() {
+                                                  _this.wgrid.ds.load({});
+                                              }
+                                          });    
+                                      };
+                                      
+                                      var close = function(){
+                                          new Pman.Request({
+                                              url : baseURL + '/Roo/Yearperiod.php',
+                                              timeout: 600000,
+                                              mask : 'Processing',
+                                              method : 'POST',
+                                              params : {
+                                                  yearperiod_id : rec.data.yearperiod_id,
+                                                  _close : 1
+                                                  
+                                              }, 
+                                              success : function() {
+                                                  _this.wgrid.ds.load({});
+                                              }
+                                          });    
+                                      };
+                                      
+                                      if(rec.data.yearperiod_id * 1 < 1){
+                                          Roo.MessageBox.alert('Error', 'Please select a period?');
+                                          return;
+                                      }
+                                  
+                                      //Roo.log(rec.data);
+                                      if(rec.data.yearperiod_closed *1){
+                                           Roo.MessageBox.confirm("Confirm", "Are you sure want to open this year period?" , function(r) {
+                                              if (r !='yes') {
+                                                  return;
+                                              }
+                                              open();
+                                           
+                                            });
+                                           return;
+                                     }
+                                          
+                                      
+                                  
+                                    
+                                       Roo.MessageBox.confirm("Confirm", "Are you sure want to close this year period?" , function(r) {
+                                          if (r !='yes') {
+                                              return;
+                                          }
+                                          close();
+                                          
+                                     })
+                                     
+                                      
+                                      
+                                      
+                                  },
+                               render : function() 
+                                  {
+                                      _this.wgrid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.wpanel.active) {
+                                         this.ds.load({});
+                                      }
+                                  },
+                               rowclick : function (_self, rowIndex, e)
+                                  {
+                                      _this.grid.ds.load({});
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
-                    },
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                            }
+
                         },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
                         background : true,
+                        region : 'west',
+                        title : "Year Periods",
+                        xtype : 'GridPanel',
                         fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'period',
-                        title : "Periods",
+                        xns : Roo,
+                        tableName : 'yearperiod',
+                        listeners : {
+                               activate : function() {
+                                      _this.wpanel = this;
+                                      if (_this.wgrid) {
+                                          _this.wgrid.ds.load({});
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
+                    },
+                       {
                         grid : {
-                            xtype: 'EditorGrid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                },
-                                beforeedit : function (e)
-                                {
-                                    if(e.field != 'period_name'){
-                                        return false;
-                                    }
-                                },
-                                afteredit : function (e)
-                                {
-                                    if(e.field != 'period_name' || e.originalValue == e.value){
-                                        return;
-                                    }
-                                    
-                                    if(e.record.data.period_id * 1 < 1){
-                                        Roo.MessageBox.alert('Error', 'Error occur on getting the period id');
-                                        return;
-                                    }
-                                    
-                                    new Pman.Request({
-                                        url : baseURL + '/Roo/Period.php',
-                                        method : 'POST',
-                                        params : {
-                                            period_id : e.record.data.period_id,
-                                            period_name : e.record.data.period_name
-                                            
-                                        }, 
-                                        success : function() {
-                                            _this.grid.ds.load({});
-                                        }
-                                    });
-                                },
-                                cellclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                
-                                    var di = this.colModel.getDataIndex(columnIndex);
-                                
-                                    if (di != 'period_closed' && di != 'period_freeze') {
-                                        return;
-                                    }
-                                
-                                    var rec = _this.grid.ds.getAt(rowIndex);
-                                    
-                                    if(rec.data.period_id * 1 < 1){
-                                        Roo.MessageBox.alert('Error', 'Error occur on getting the period id');
-                                        return;
-                                    }
-                                    
-                                    var action = rec.data[di] ? 'thaw' : 'freeze';
-                                    
-                                    if(di == 'period_closed'){
-                                        action = rec.data[di] ? 'open' : 'close';
-                                    }
-                                    
-                                    new Pman.Request({
-                                        url : baseURL + '/Roo/Period.php',
-                                        timeout: 600000,
-                                        mask : 'Processing',
-                                        method : 'POST',
-                                        params : {
-                                            period_id : rec.data.period_id,
-                                            _action : action
-                                            
-                                        }, 
-                                        success : function() {
-                                            _this.grid.ds.load({});
-                                        }
-                                    });    
-                                    
-                                }
-                            },
-                            autoExpandColumn : 'period_name',
-                            clicksToEdit : 2,
-                            loadMask : true,
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                              _this.status = _self;
-                                            },
-                                            select : function (combo, record, index)
-                                            {
-                                                _this.grid.ds.load({});
-                                            }
-                                        },
-                                        allowBlank : false,
-                                        displayField : 'fname',
-                                        editable : false,
-                                        fieldLabel : 'Status',
-                                        hiddenName : 'status',
-                                        listWidth : 200,
-                                        mode : 'local',
-                                        name : 'status',
-                                        triggerAction : 'all',
-                                        value : "A",
-                                        valueField : 'ftype',
-                                        width : 150,
+                                       {
                                         store : {
-                                            xtype: 'SimpleStore',
-                                            xns: Roo.data,
+                                            '|xns' : 'Roo.data',
+                                            xtype : 'SimpleStore',
                                             data : [ 
                                                 [ 'O', "Open"],
                                                 [ 'C' , "Closed"],
                                                 [ 'A', "All"] 
                                             ],
-                                            fields : [  'ftype', 'fname']
-                                        }
-                                    },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                            fields : [  'ftype', 'fname'],
+                                            xns : Roo.data
+                                        },
+                                        '|xns' : 'Roo.form',
+                                        listWidth : 200,
+                                        triggerAction : 'all',
+                                        fieldLabel : 'Status',
+                                        displayField : 'fname',
+                                        hiddenName : 'status',
+                                        value : "A",
+                                        valueField : 'ftype',
+                                        xtype : 'ComboBox',
+                                        allowBlank : false,
+                                        editable : false,
+                                        width : 150,
+                                        xns : Roo.form,
+                                        mode : 'local',
+                                        name : 'status',
                                         listeners : {
-                                            click : function()
-                                            {
-                                                var addPeriod = function(){
-                                                    new Pman.Request({
-                                                        url : baseURL + '/Roo/Period.php',
-                                                        timeout: 600000,
-                                                        mask : 'Processing',
-                                                        method : 'POST',
-                                                        params : {
-                                                            _addExtraYear : 1
-                                                        }, 
-                                                        success : function() {
-                                                            _this.wgrid.ds.load({});
-                                                        }
-                                                    });
-                                                }
-                                                 
-                                                Roo.MessageBox.confirm("Confirm", "Are you sure want to add extra year" , function(r) {
-                                                    if (r !='yes') {
-                                                        return;
-                                                    }
-                                                    addPeriod();
-                                               })
-                                               
-                                            }
+                                               render : function (_self)
+                                                  {
+                                                    _this.status = _self;
+                                                  },
+                                               select : function (combo, record, index)
+                                                  {
+                                                      _this.grid.ds.load({});
+                                                  }
                                         },
-                                        cls : 'x-btn-text-icon',
-                                        text : "Add Extra Year",
-                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                        items : [
+
+                                        ]
+
                                     },
-                                    {
-                                        xtype: 'Separator',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function()
-                                            {
-                                                var list = []; 
-                                                
-                                                
-                                                
-                                                _this.grid.ds.each(function (r) {
-                                                    if (r.data.period_closed) {
-                                                        return;
-                                                    }
-                                                
-                                                    if(r.data.transactions > 0 ){
-                                                        return false;
-                                                    }
-                                                    list.push(r.data);
-                                            
-                                                });
-                                                
-                                                if (!list.length) {
-                                                   Roo.MessageBox.alert("Notice", "Nothing to close");
-                                                   return;
-                                                }
-                                                
-                                                var tl = list.length;
-                                                
-                                                var closeNext = function(){
-                                                
-                                                    if (!list.length) {
-                                                        Roo.MessageBox.hide();
-                                                         _this.grid.ds.load({});
-                                                         return;
-                                                    }
-                                                
-                                                    var item = list.shift();
-                                                    
-                                                    Roo.MessageBox.updateProgress(
-                                                        (tl-list.length) / tl,
-                                                        "Closing " + item.period_name
-                                                          
-                                                    );
-                                                
-                                                    new Pman.Request({
-                                                        url : baseURL + '/Roo/Period.php',
-                                                        timeout: 900000,
-                                                        //mask : 'Processing',
-                                                        method : 'POST',
-                                                        params : {
-                                                            period_id : item.period_id,
-                                                            _action:  'close' ,
-                                                            _second_action : 'freeze'
-                                                        }, 
-                                                        success : function() {
-                                                            closeNext();
-                                            //                _this.grid.ds.load({});
-                                                        }
-                                                    });
-                                                };
-                                                 
-                                                
-                                                 
-                                              
-                                                Roo.MessageBox.confirm("Confirm", "Are you sure want to close the period where there are no transactions?" , function(r) {
-                                                    if (r !='yes') {
-                                                        return;
-                                                    }
-                                                    Roo.MessageBox.progress( "Closing periods", "Closing periods");
-                                                    closeNext();
-                                                    
-                                               })
-                                               
-                                                
-                                                 
-                                                 
-                                                
-                                            }
-                                        },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "Add Extra Year",
+                                        xtype : 'Button',
                                         cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function()
+                                                  {
+                                                      var addPeriod = function(){
+                                                          new Pman.Request({
+                                                              url : baseURL + '/Roo/Period.php',
+                                                              timeout: 600000,
+                                                              mask : 'Processing',
+                                                              method : 'POST',
+                                                              params : {
+                                                                  _addExtraYear : 1
+                                                              }, 
+                                                              success : function() {
+                                                                  _this.wgrid.ds.load({});
+                                                              }
+                                                          });
+                                                      }
+                                                       
+                                                      Roo.MessageBox.confirm("Confirm", "Are you sure want to add extra year" , function(r) {
+                                                          if (r !='yes') {
+                                                              return;
+                                                          }
+                                                          addPeriod();
+                                                     })
+                                                     
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Separator',
+                                        xns : Roo.Toolbar
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
                                         text : "Close all empty months",
-                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function()
+                                                  {
+                                                      var list = []; 
+                                                      
+                                                      
+                                                      
+                                                      _this.grid.ds.each(function (r) {
+                                                          if (r.data.period_closed) {
+                                                              return;
+                                                          }
+                                                      
+                                                          if(r.data.transactions > 0 ){
+                                                              return false;
+                                                          }
+                                                          list.push(r.data);
+                                                  
+                                                      });
+                                                      
+                                                      if (!list.length) {
+                                                         Roo.MessageBox.alert("Notice", "Nothing to close");
+                                                         return;
+                                                      }
+                                                      
+                                                      var tl = list.length;
+                                                      
+                                                      var closeNext = function(){
+                                                      
+                                                          if (!list.length) {
+                                                              Roo.MessageBox.hide();
+                                                               _this.grid.ds.load({});
+                                                               return;
+                                                          }
+                                                      
+                                                          var item = list.shift();
+                                                          
+                                                          Roo.MessageBox.updateProgress(
+                                                              (tl-list.length) / tl,
+                                                              "Closing " + item.period_name
+                                                                
+                                                          );
+                                                      
+                                                          new Pman.Request({
+                                                              url : baseURL + '/Roo/Period.php',
+                                                              timeout: 900000,
+                                                              //mask : 'Processing',
+                                                              method : 'POST',
+                                                              params : {
+                                                                  period_id : item.period_id,
+                                                                  _action:  'close' ,
+                                                                  _second_action : 'freeze'
+                                                              }, 
+                                                              success : function() {
+                                                                  closeNext();
+                                                  //                _this.grid.ds.load({});
+                                                              }
+                                                          });
+                                                      };
+                                                       
+                                                      
+                                                       
+                                                    
+                                                      Roo.MessageBox.confirm("Confirm", "Are you sure want to close the period where there are no transactions?" , function(r) {
+                                                          if (r !='yes') {
+                                                              return;
+                                                          }
+                                                          Roo.MessageBox.progress( "Closing periods", "Closing periods");
+                                                          closeNext();
+                                                          
+                                                     })
+                                                     
+                                                      
+                                                       
+                                                       
+                                                      
+                                                  }
+                                        }
                                     }
                                 ]
+
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, options)
-                                    {
-                                        options.params = options.params || {};
-                                        
-                                        var s = _this.wgrid.getSelectionModel().getSelected();
-                                        
-                                        if(!s || !s.data.yearperiod_id * 1 > 0){
-                                            Roo.MessageBox.alert('Error','Please select a year period');
-                                            this.removeAll();
-                                            return false;
-                                        }
-                                        
-                                        options.params._status = _this.status.getValue();
-                                        options.params.period_yearperiod_id = s.data.yearperiod_id;
-                                        options.params._with_transactions = 1;
-                                        
-                                    
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'period_start', direction: 'ASC' },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/Period.php',
+                                    xtype : 'HttpProxy',
                                     method : 'GET',
-                                    url : baseURL + '/Roo/Period.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'period_id',
@@ -531,105 +463,250 @@ Pman.Tab.XtuplePeriods = new Roo.XComponent({
                                             'name': 'period_name',
                                             'type': 'string'
                                         }
-                                    ]
-                                }
-                            },
-                            colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'period_name',
-                                    header : 'Name',
-                                    width : 100,
-                                    renderer : function(v) 
-                                    { 
-                                        return String.format('{0}', v ? v : ''); 
-                                    },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            allowBlank : false
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'period_start',
-                                    header : 'Start',
-                                    width : 100,
-                                    renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
                                 },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'period_end',
-                                    header : 'End',
-                                    width : 100,
-                                    renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'period_closed',
-                                    header : 'Closed',
-                                    width : 75,
-                                    renderer : function(v) {  
-                                        var state = v  ?  '-checked' : '';
-                                    
-                                        return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                                                    
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'period_freeze',
-                                    header : 'Frozen',
-                                    width : 75,
-                                    renderer : function(v) {  
-                                        var state = v  ?  '-checked' : '';
-                                    
-                                        return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                                                    
-                                     }
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'period_start', direction: 'ASC' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, options)
+                                          {
+                                              options.params = options.params || {};
+                                              
+                                              var s = _this.wgrid.getSelectionModel().getSelected();
+                                              
+                                              if(!s || !s.data.yearperiod_id * 1 > 0){
+                                                  Roo.MessageBox.alert('Error','Please select a year period');
+                                                  this.removeAll();
+                                                  return false;
+                                              }
+                                              
+                                              options.params._status = _this.status.getValue();
+                                              options.params.period_yearperiod_id = s.data.yearperiod_id;
+                                              options.params._with_transactions = 1;
+                                              
+                                          
+                                          }
                                 },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'transactions',
-                                    header : 'Transactions',
-                                    width : 100,
-                                    renderer : function(v) 
-                                    { 
-                                        return String.format('{0}', v ? v : ''); 
-                                    }
-                                }
+                                items : [
+
+                                ]
+
+                            },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'period_name',
+                            xtype : 'EditorGrid',
+                            loadMask : true,
+                            clicksToEdit : 2,
+                            xns : Roo.grid,
+                            colModel : [
+                                {
+                                       editor : {
+                                           field : {
+                                               '|xns' : 'Roo.form',
+                                               xtype : 'TextField',
+                                               allowBlank : false,
+                                               xns : Roo.form
+                                           },
+                                           '|xns' : 'Roo.grid',
+                                           xtype : 'GridEditor',
+                                           xns : Roo.grid,
+                                           items : [
+
+                                           ]
+
+                                       },
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Name',
+                                       width : 100,
+                                       renderer : function(v) 
+                                       { 
+                                           return String.format('{0}', v ? v : ''); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'period_name',
+                                       items : [
+
+                                       ]
+
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Start',
+                                       width : 100,
+                                       renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'period_start'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'End',
+                                       width : 100,
+                                       renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d') : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'period_end'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Closed',
+                                       width : 75,
+                                       renderer : function(v) {  
+                                           var state = v  ?  '-checked' : '';
+                                       
+                                           return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                                       
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'period_closed'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Frozen',
+                                       width : 75,
+                                       renderer : function(v) {  
+                                           var state = v  ?  '-checked' : '';
+                                       
+                                           return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                                       
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'period_freeze'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Transactions',
+                                       width : 100,
+                                       renderer : function(v) 
+                                       { 
+                                           return String.format('{0}', v ? v : ''); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'transactions'
+                                   }
+                            ],
+                            listeners : {
+                               beforeedit : function (e)
+                                  {
+                                      if(e.field != 'period_name'){
+                                          return false;
+                                      }
+                                  },
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                  },
+                               cellclick : function (_self, rowIndex, columnIndex, e)
+                                  {
+                                  
+                                      var di = this.colModel.getDataIndex(columnIndex);
+                                  
+                                      if (di != 'period_closed' && di != 'period_freeze') {
+                                          return;
+                                      }
+                                  
+                                      var rec = _this.grid.ds.getAt(rowIndex);
+                                      
+                                      if(rec.data.period_id * 1 < 1){
+                                          Roo.MessageBox.alert('Error', 'Error occur on getting the period id');
+                                          return;
+                                      }
+                                      
+                                      var action = rec.data[di] ? 'thaw' : 'freeze';
+                                      
+                                      if(di == 'period_closed'){
+                                          action = rec.data[di] ? 'open' : 'close';
+                                      }
+                                      
+                                      new Pman.Request({
+                                          url : baseURL + '/Roo/Period.php',
+                                          timeout: 600000,
+                                          mask : 'Processing',
+                                          method : 'POST',
+                                          params : {
+                                              period_id : rec.data.period_id,
+                                              _action : action
+                                              
+                                          }, 
+                                          success : function() {
+                                              _this.grid.ds.load({});
+                                          }
+                                      });    
+                                      
+                                  },
+                               afteredit : function (e)
+                                  {
+                                      if(e.field != 'period_name' || e.originalValue == e.value){
+                                          return;
+                                      }
+                                      
+                                      if(e.record.data.period_id * 1 < 1){
+                                          Roo.MessageBox.alert('Error', 'Error occur on getting the period id');
+                                          return;
+                                      }
+                                      
+                                      new Pman.Request({
+                                          url : baseURL + '/Roo/Period.php',
+                                          method : 'POST',
+                                          params : {
+                                              period_id : e.record.data.period_id,
+                                              period_name : e.record.data.period_name
+                                              
+                                          }, 
+                                          success : function() {
+                                              _this.grid.ds.load({});
+                                          }
+                                      });
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : true,
+                        region : 'center',
+                        title : "Periods",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'period',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    tabPosition : 'top',
-                    title : "Periods",
-                    titlebar : false
-                },
-                west : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    split : true,
-                    tabPosition : 'top',
-                    title : "Year Periods",
-                    titlebar : false,
-                    width : 400
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            fitToFrame : true,
+            background : true,
+            region : 'center',
+            title : "Periods",
+            xtype : 'NestedLayoutPanel',
+            fitContainer : true,
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });
index ded8be1..e628f52 100644 (file)
 {
-    "id": "roo-file-62",
-    "name": "Pman.Tab.XtupleReconcile",
-    "parent": "Pman.Tab.XtupleAccountsTab",
-    "title": "Pman.Tab.XtupleReconcile",
-    "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleReconcile.bjs",
-    "items": [
+    "name" : "Pman.Tab.XtupleReconcile",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "Pman.Tab.XtupleReconcile",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleReconcile.bjs",
+    "permname" : "",
+    "modOrder" : "200",
+    "items" : [
         {
-            "background": true,
-            "title": "Bank Reconcile",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
+            "background" : true,
+            "xtype" : "NestedLayoutPanel",
+            "title" : "Bank Reconcile",
+            "$ xns" : "Roo",
+            "items" : [
                 {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
                         {
-                            "|xns": "Roo",
-                            "xtype": "LayoutRegion",
-                            "*prop": "center"
+                            "xtype" : "LayoutRegion",
+                            "$ xns" : "Roo",
+                            "* prop" : "center"
                         },
                         {
-                            "*prop": "west",
-                            "split": true,
-                            "width": 400,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
+                            "xtype" : "LayoutRegion",
+                            "width" : 400,
+                            "$ xns" : "Roo",
+                            "split" : true,
+                            "* prop" : "west"
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
                             },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "metasql",
-                            "title": "Bank Reconcile",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : true,
+                            "region" : "center",
+                            "title" : "Bank Reconcile",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "metasql",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                        "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var clear = function(ar) \n    {\n        var ar_in = ar;\n        if (ar === true) {\n            ar = [];\n            \n            _this.grid.ds.each(function(rec) {\n                if (rec.data.doc_type == 'BF') {\n                    return;\n                }\n                ar.push(rec);\n            });\n        }\n        var sortdate = false;\n        var data = [];\n        Roo.each(ar, function(rec) {\n            if (rec.data.cleared || rec.data.bankrec_posted) {\n                return;\n            }\n            if(!sortdate){\n                sortdate = rec.data.sortdate;\n            }\n            data.push({\n                 id : rec.data.id,\n                altid : rec.data.altid,\n                curr_rate : rec.data.doc_exchrate,\n                amount : rec.data.amount\n                \n            });\n        });\n       new Pman.Request({\n        url : baseURL + '/Roo/bankrecitem',\n            method : 'POST',\n            mask : 'Clearing',\n            params : {\n                bankaccnt_id : _this.bankacct.getValue(),\n                sortdate : sortdate,\n                set_clear : Roo.encode(data)\n            },\n            success : function() {\n                Roo.each(ar, function(rec) {\n                    rec.set('cleared', true);\n                });\n                if (ar_in === true) {\n                    _this.grid.ds.getAt(0).set('cleared', true);\n                }\n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n    }\n    \n    \n    var unclear = function(ar)\n    {\n        var ar_in = ar;\n        if (ar === true) {\n            ar = [];\n            \n            _this.grid.ds.each(function(rec) {\n                if (rec.data.doc_type == 'BF') {\n                    return;\n                }\n                ar.push(rec);\n            });\n        }\n        var sortdate = false;\n        var data = [];\n        Roo.each(ar, function(rec) {\n            if (!rec.data.cleared  || rec.data.bankrec_posted) {\n                return;\n            }\n            if(!sortdate){\n                sortdate = rec.data.sortdate;\n            }\n            data.push({\n                id : rec.data.id,\n                altid : rec.data.altid                \n            });\n        });\n\n        new Pman.Request({\n            url : baseURL + '/Roo/bankrecitem',\n            method : 'POST',\n            mask : 'Clearing',\n            params : {\n                bankaccnt_id : _this.bankacct.getValue(),\n                sortdate : sortdate,\n                remove_clear :Roo.encode(data)\n                \n            },\n            success : function() {\n                Roo.each(ar, function(rec) {\n                    rec.set('cleared', false);\n                });\n               if (ar_in === true) {\n                    _this.grid.ds.getAt(0).set('cleared', false);\n                }  \n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n     \n      \n    };\n    \n    \n    \n    var di = this.colModel.config[columnIndex].dataIndex;\n    if (di != 'cleared') {\n        return;\n    }\n    var  rec = this.ds.getAt(rowIndex);\n    if (rec.data.doc_type == 'BF') {\n    \n        if (rec.data.cleared) {\n            unclear(true);\n        \n        } else {\n            clear(true);\n        }\n    \n        return;\n    }\n    \n        \n        \n    if (rec.data.cleared) {\n    \n        unclear([rec]);\n        return;\n        \n    }\n    \n    clear([rec]);\n    \n    \n     \n         \n  \n}",
-                                        "beforeedit": "function (e)\n{\n    //    Roo.log(e);\n       var ch =  _this.grid.colModel.config[e.column].header;\n       var val = e.value *1;\n  // Roo.log(ch);\n  // Roo.log(val);\n\n       if (val > 0.0 && ch == 'Debit') {\n            e.cancel = true;\n            return;\n        }\n       if (val < 0.0 && ch == 'Credit') {\n            e.cancel = true;\n            return;\n        }\n        if (e.record.data.cleared || e.record.data.bankrec_posted) {\n            e.cancel = true;\n            return;\n        }\n        \n        // allow start editing..\n}",
-                                        "afteredit": "function (e)\n{\n\n    if (e.cancel) {\n        return;\n    }\n       var ch =  _this.grid.colModel.config[e.column].header;\n           var val = e.originalValue *1;\n      // Roo.log(ch);\n      // Roo.log(val);\n\n       if (val > 0.0 && ch == 'Debit') {\n            e.cancel = true;\n            return;\n        }\n       if (val < 0.0 && ch == 'Credit') {\n            e.cancel = true;\n            return;\n        }\n        if (e.record.data.cleared || e.record.data.bankrec_posted) {\n            e.cancel = true;\n            return;\n        }\n        if (val > 0.0 && e.value < 0.0) {\n        Roo.log(\"CANCEL\");  \n            e.record.set('amount', e.originalValue);\n            e.cancel = true;\n            return;\n        }\n        if (val < 0.0 && e.value > 0.0) {\n        Roo.log(\"CANCEL\");\n            e.record.set('amount', e.originalValue);\n            e.cancel = true;\n            return;\n        } \n        if (e.originalValue*1 == e.value*1) {\n            return;\n        }\n          \n        e.record.set('doc_exchrate', Math.abs(e.value  * 1)  / Math.abs(e.record.data.base_amount * 1));\n        Roo.log(e.record);\n        \n        _this.grid.ds.updateBalance();\n        // send it down the line...\n        new Pman.Request({\n            method : 'POST',\n            url : baseURL + '/Roo/bankrecitem',\n            mask : 'Saving',\n            params : {\n                bankaccnt_id : _this.bankacct.getValue(),\n                set_amount : Math.abs(e.value),\n                sortdate : e.record.data.sortdate,\n                source_id : e.record.data.id,\n                altid : e.record.data.altid\n            }\n        \n        });\n        \n         \n        \n        \n}"
+                                    "listeners" : {
+                                        "beforeedit" : "function (e)\n{\n    //    Roo.log(e);\n       var ch =  _this.grid.colModel.config[e.column].header;\n       var val = e.value *1;\n  // Roo.log(ch);\n  // Roo.log(val);\n\n       if (val > 0.0 && ch == 'Debit') {\n            e.cancel = true;\n            return;\n        }\n       if (val < 0.0 && ch == 'Credit') {\n            e.cancel = true;\n            return;\n        }\n        if (e.record.data.cleared || e.record.data.bankrec_posted) {\n            e.cancel = true;\n            return;\n        }\n        \n        // allow start editing..\n}",
+                                        "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                                        "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n    var clear = function(ar) \n    {\n        var ar_in = ar;\n        if (ar === true) {\n            ar = [];\n            \n            _this.grid.ds.each(function(rec) {\n                if (rec.data.doc_type == 'BF') {\n                    return;\n                }\n                ar.push(rec);\n            });\n        }\n        var sortdate = false;\n        var data = [];\n        Roo.each(ar, function(rec) {\n            if (rec.data.cleared || rec.data.bankrec_posted) {\n                return;\n            }\n            if(!sortdate){\n                sortdate = rec.data.sortdate;\n            }\n            data.push({\n                 id : rec.data.id,\n                altid : rec.data.altid,\n                curr_rate : rec.data.doc_exchrate,\n                amount : rec.data.amount\n                \n            });\n        });\n       new Pman.Request({\n        url : baseURL + '/Roo/bankrecitem',\n            method : 'POST',\n            mask : 'Clearing',\n            params : {\n                bankaccnt_id : _this.bankacct.getValue(),\n                sortdate : sortdate,\n                set_clear : Roo.encode(data)\n            },\n            success : function() {\n                Roo.each(ar, function(rec) {\n                    rec.set('cleared', true);\n                });\n                if (ar_in === true) {\n                    _this.grid.ds.getAt(0).set('cleared', true);\n                }\n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n    }\n    \n    \n    var unclear = function(ar)\n    {\n        var ar_in = ar;\n        if (ar === true) {\n            ar = [];\n            \n            _this.grid.ds.each(function(rec) {\n                if (rec.data.doc_type == 'BF') {\n                    return;\n                }\n                ar.push(rec);\n            });\n        }\n        var sortdate = false;\n        var data = [];\n        Roo.each(ar, function(rec) {\n            if (!rec.data.cleared  || rec.data.bankrec_posted) {\n                return;\n            }\n            if(!sortdate){\n                sortdate = rec.data.sortdate;\n            }\n            data.push({\n                id : rec.data.id,\n                altid : rec.data.altid                \n            });\n        });\n\n        new Pman.Request({\n            url : baseURL + '/Roo/bankrecitem',\n            method : 'POST',\n            mask : 'Clearing',\n            params : {\n                bankaccnt_id : _this.bankacct.getValue(),\n                sortdate : sortdate,\n                remove_clear :Roo.encode(data)\n                \n            },\n            success : function() {\n                Roo.each(ar, function(rec) {\n                    rec.set('cleared', false);\n                });\n               if (ar_in === true) {\n                    _this.grid.ds.getAt(0).set('cleared', false);\n                }  \n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n     \n      \n    };\n    \n    \n    \n    var di = this.colModel.config[columnIndex].dataIndex;\n    if (di != 'cleared') {\n        return;\n    }\n    var  rec = this.ds.getAt(rowIndex);\n    if (rec.data.doc_type == 'BF') {\n    \n        if (rec.data.cleared) {\n            unclear(true);\n        \n        } else {\n            clear(true);\n        }\n    \n        return;\n    }\n    \n        \n        \n    if (rec.data.cleared) {\n    \n        unclear([rec]);\n        return;\n        \n    }\n    \n    clear([rec]);\n    \n    \n     \n         \n  \n}",
+                                        "afteredit" : "function (e)\n{\n\n    if (e.cancel) {\n        return;\n    }\n       var ch =  _this.grid.colModel.config[e.column].header;\n           var val = e.originalValue *1;\n      // Roo.log(ch);\n      // Roo.log(val);\n\n       if (val > 0.0 && ch == 'Debit') {\n            e.cancel = true;\n            return;\n        }\n       if (val < 0.0 && ch == 'Credit') {\n            e.cancel = true;\n            return;\n        }\n        if (e.record.data.cleared || e.record.data.bankrec_posted) {\n            e.cancel = true;\n            return;\n        }\n        if (val > 0.0 && e.value < 0.0) {\n        Roo.log(\"CANCEL\");  \n            e.record.set('amount', e.originalValue);\n            e.cancel = true;\n            return;\n        }\n        if (val < 0.0 && e.value > 0.0) {\n        Roo.log(\"CANCEL\");\n            e.record.set('amount', e.originalValue);\n            e.cancel = true;\n            return;\n        } \n        if (e.originalValue*1 == e.value*1) {\n            return;\n        }\n          \n        e.record.set('doc_exchrate', Math.abs(e.value  * 1)  / Math.abs(e.record.data.base_amount * 1));\n        Roo.log(e.record);\n        \n        _this.grid.ds.updateBalance();\n        // send it down the line...\n        new Pman.Request({\n            method : 'POST',\n            url : baseURL + '/Roo/bankrecitem',\n            mask : 'Saving',\n            params : {\n                bankaccnt_id : _this.bankacct.getValue(),\n                set_amount : Math.abs(e.value),\n                sortdate : e.record.data.sortdate,\n                source_id : e.record.data.id,\n                altid : e.record.data.altid\n            }\n        \n        });\n        \n         \n        \n        \n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "notes",
-                                    "clicksToEdit": 1,
-                                    "loadMask": true,
-                                    "xtype": "EditorGrid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "notes",
+                                    "xtype" : "EditorGrid",
+                                    "loadMask" : true,
+                                    "clicksToEdit" : 1,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "listeners": {
-                                                "beforeloadadd": "function (_self, records, options, res)\n{\n //  _this.total = 0.0;\n\n  \n\n\n      _this.total = 1 * res.raw.amount;\n        _this.bf = 1 * res.raw.amount;\n    Roo.log(\"TOTAL:\" + _this.total);\n}\n",
-                                                "load": "function (_self, records, options)\n{\n    \n    var bal = _this.bf;\n      var cleared = true;\n      var posted = true;\n    Roo.each(records, function(rec) {\n        if (!rec.data.cleared) {\n            cleared = false;\n\n        }\n        if (!rec.data.bankrec_posted) {\n            posted = false;\n        }\n        if (rec.data.doc_type != 'BF') {\n            bal += rec.data.amount *1;\n            rec.set('balance', bal);   \n        } else {\n            rec.set('balance', _this.bf);\n        }\n        \n        \n    });\n    \n    var rec = this.reader.newRow({\n        notes : 'Brought Forward',\n        balance : _this.bf,\n        doc_type : 'BF',\n        cleared : cleared,\n        bankrec_posted : posted\n    });\n    this.insert(0, [rec]);\n}",
-                                                "beforeload": "function (_self, o)\n{\n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if (!s) {\n        return false;\n    }\n    o.params._group = 'bankrec';\n    o.params._name = 'all';\n    o.params['sortdate:text'] = s.data.sortdate;\n    o.params['bankaccntid:number'] =     _this.bankacct.getValue();\n\n    o.params['_cals'] = 'amount'\n}"
+                                            "listeners" : {
+                                                "beforeloadadd" : "function (_self, records, options, res)\n{\n //  _this.total = 0.0;\n\n  \n\n\n      _this.total = 1 * res.raw.amount;\n        _this.bf = 1 * res.raw.amount;\n    Roo.log(\"TOTAL:\" + _this.total);\n}\n",
+                                                "beforeload" : "function (_self, o)\n{\n    var s = _this.wgrid.getSelectionModel().getSelected();\n    \n    if (!s) {\n        return false;\n    }\n    o.params._group = 'bankrec';\n    o.params._name = 'all';\n    o.params['sortdate:text'] = s.data.sortdate;\n    o.params['bankaccntid:number'] =     _this.bankacct.getValue();\n\n    o.params['_cals'] = 'amount'\n}",
+                                                "load" : "function (_self, records, options)\n{\n    \n    var bal = _this.bf;\n      var cleared = true;\n      var posted = true;\n    Roo.each(records, function(rec) {\n        if (!rec.data.cleared) {\n            cleared = false;\n\n        }\n        if (!rec.data.bankrec_posted) {\n            posted = false;\n        }\n        if (rec.data.doc_type != 'BF') {\n            bal += rec.data.amount *1;\n            rec.set('balance', bal);   \n        } else {\n            rec.set('balance', _this.bf);\n        }\n        \n        \n    });\n    \n    var rec = this.reader.newRow({\n        notes : 'Brought Forward',\n        balance : _this.bf,\n        doc_type : 'BF',\n        cleared : cleared,\n        bankrec_posted : posted\n    });\n    this.insert(0, [rec]);\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'metasql_group', direction: 'ASC' }",
-                                            "|updateBalance": "function() {\n     var bal = _this.bf;\n    this.each( function(rec) {\n        if (rec.data.doc_type != 'BF') {\n            bal += rec.data.amount *1;\n            rec.set('balance', bal);   \n        } else {\n            rec.set('balance', _this.bf);\n        }\n        \n        \n    });\n}\n",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'metasql_group', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "$ updateBalance" : "function() {\n     var bal = _this.bf;\n    this.each( function(rec) {\n        if (rec.data.doc_type != 'BF') {\n            bal += rec.data.amount *1;\n            rec.set('balance', bal);   \n        } else {\n            rec.set('balance', _this.bf);\n        }\n        \n        \n    });\n}\n",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/metasql.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/metasql.php'",
+                                                    "xtype" : "HttpProxy",
+                                                    "method" : "GET",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "idx",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'metasql_id',\n        'type': 'int'\n    },\n    {\n        'name': 'metasql_group',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_name',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_notes',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_query',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_lastuser',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_lastupdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'metasql_grade',\n        'type': 'int'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "idx",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'metasql_id',\n        'type': 'int'\n    },\n    {\n        'name': 'metasql_group',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_name',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_notes',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_query',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_lastuser',\n        'type': 'string'\n    },\n    {\n        'name': 'metasql_lastupdate',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'metasql_grade',\n        'type': 'int'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying records {0} - {1} of {2}",
-                                            "emptyMsg": "Nothing found",
-                                            "pageSize": 50,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo"
+                                            "pageSize" : 50,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "Nothing found",
+                                            "$ xns" : "Roo",
+                                            "displayMsg" : "Displaying records {0} - {1} of {2}",
+                                            "displayInfo" : true,
+                                            "* prop" : "footer"
                                         },
                                         {
-                                            "*prop": "toolbar",
-                                            "xtype": "Toolbar",
-                                            "|xns": "Roo",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.bankacct = _self;\n}",
-                                                        "select": "function (combo, record, index)\n{ \n    var curr = record.data.bankaccnt_curr_id_curr_abbr;\n    var col = _this.grid.colModel.config.length -1;\n    \n    _this.grid.colModel.setColumnHeader(col, 'Balance (' + curr +')');\n    \n    _this.grid.ds.removeAll();\n    \n    _this.wgrid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n    _this.bankacct = _self;\n}",
+                                                        "select" : "function (combo, record, index)\n{ \n    var curr = record.data.bankaccnt_curr_id_curr_abbr;\n    var col = _this.grid.colModel.config.length -1;\n    \n    _this.grid.colModel.setColumnHeader(col, 'Balance (' + curr +')');\n    \n    _this.grid.ds.removeAll();\n    \n    _this.wgrid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": false,
-                                                    "displayField": "bankaccnt_bankname",
-                                                    "editable": false,
-                                                    "emptyText": "Select bankaccnt",
-                                                    "fieldLabel": "bankaccnt",
-                                                    "forceSelection": true,
-                                                    "hiddenName": "bankaccnt_id",
-                                                    "listWidth": 400,
-                                                    "loadingText": "Searching...",
-                                                    "minChars": 2,
-                                                    "name": "bankaccnt_bankname",
-                                                    "pageSize": 50,
-                                                    "qtip": "Select bankaccnt",
-                                                    "queryParam": "",
-                                                    "selectOnFocus": true,
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{bankaccnt_bankname}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "typeAhead": true,
-                                                    "valueField": "bankaccnt_id",
-                                                    "width": 300,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
+                                                    "listWidth" : 400,
+                                                    "triggerAction" : "all",
+                                                    "fieldLabel" : "bankaccnt",
+                                                    "forceSelection" : true,
+                                                    "selectOnFocus" : true,
+                                                    "pageSize" : 50,
+                                                    "displayField" : "bankaccnt_bankname",
+                                                    "emptyText" : "Select bankaccnt",
+                                                    "hiddenName" : "bankaccnt_id",
+                                                    "minChars" : 2,
+                                                    "valueField" : "bankaccnt_id",
+                                                    "xtype" : "ComboBox",
+                                                    "allowBlank" : false,
+                                                    "typeAhead" : true,
+                                                    "editable" : false,
+                                                    "width" : 300,
+                                                    "$ xns" : "Roo.form",
+                                                    "name" : "bankaccnt_bankname",
+                                                    "qtip" : "Select bankaccnt",
+                                                    "queryParam" : "",
+                                                    "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{bankaccnt_bankname}</b> </div>",
+                                                    "loadingText" : "Searching...",
+                                                    "items" : [
                                                         {
-                                                            "listeners": {
-                                                                "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
+                                                            "listeners" : {
+                                                                "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
                                                             },
-                                                            "*prop": "store",
-                                                            "remoteSort": true,
-                                                            "xtype": "Store",
-                                                            "|sortInfo": "{ direction : 'ASC', field: 'bankaccnt_bankname' }",
-                                                            "|xns": "Roo.data",
-                                                            "items": [
+                                                            "xtype" : "Store",
+                                                            "remoteSort" : true,
+                                                            "$ sortInfo" : "{ direction : 'ASC', field: 'bankaccnt_bankname' }",
+                                                            "$ xns" : "Roo.data",
+                                                            "* prop" : "store",
+                                                            "items" : [
                                                                 {
-                                                                    "*prop": "proxy",
-                                                                    "xtype": "HttpProxy",
-                                                                    "method": "GET",
-                                                                    "|xns": "Roo.data",
-                                                                    "|url": "baseURL + '/Roo/bankaccnt.php'"
+                                                                    "$ url" : "baseURL + '/Roo/bankaccnt.php'",
+                                                                    "method" : "GET",
+                                                                    "xtype" : "HttpProxy",
+                                                                    "$ xns" : "Roo.data",
+                                                                    "* prop" : "proxy"
                                                                 },
                                                                 {
-                                                                    "*prop": "reader",
-                                                                    "xtype": "JsonReader",
-                                                                    "|xns": "Roo.data",
-                                                                    "id": "id",
-                                                                    "root": "data",
-                                                                    "totalProperty": "total",
-                                                                    "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"bankaccnt_name\",\"type\":\"string\"}]"
+                                                                    "id" : "id",
+                                                                    "root" : "data",
+                                                                    "xtype" : "JsonReader",
+                                                                    "$ xns" : "Roo.data",
+                                                                    "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"bankaccnt_name\",\"type\":\"string\"}]",
+                                                                    "* prop" : "reader",
+                                                                    "totalProperty" : "total"
                                                                 }
                                                             ]
                                                         }
                                                     ]
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    var o = {params : {}}; \n    if (!_this.bankacct.getValue()) {\n        return false;\n    }\n    o.params._group = 'bankrec';\n    o.params._name = 'all';\n    o.params['bankaccntid:number'] =     _this.bankacct.getValue();\n    o.params['_sum_prev'] = 'amount';\n     o.url = baseURL + '/Roo/Metasql';\n     o.method = 'GET';\n     \n     var cols = {\n        'cleared' : 'Cleared',\n        'sortdate' : 'Date',\n        'doc_type' : 'Doctype',\n        'doc_number' : 'Doc number',\n        'notes' : 'Notes',\n        'doc_curr' : 'Currency',\n        'base_amount' : 'Base Amount',\n        'doc_exchrate' : 'Exchange Rate',\n        'amount' : 'Amount (Bank Currency)'\n    };\n     var n =0;\n     for (var i in cols) {\n        \n     \n        o.params['csvCols['+n+']'] =  i\n        o.params['csvTitles['+n+']'] =  cols[i];\n        n++;\n    }\n\n     \n     new Pman.Download(o);\n    Roo.MessageBox.alert(\"Notice\", \"Should be downloading now\");\n}"
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    var o = {params : {}}; \n    if (!_this.bankacct.getValue()) {\n        return false;\n    }\n    o.params._group = 'bankrec';\n    o.params._name = 'all';\n    o.params['bankaccntid:number'] =     _this.bankacct.getValue();\n    o.params['_sum_prev'] = 'amount';\n     o.url = baseURL + '/Roo/Metasql';\n     o.method = 'GET';\n     \n     var cols = {\n        'cleared' : 'Cleared',\n        'sortdate' : 'Date',\n        'doc_type' : 'Doctype',\n        'doc_number' : 'Doc number',\n        'notes' : 'Notes',\n        'doc_curr' : 'Currency',\n        'base_amount' : 'Base Amount',\n        'doc_exchrate' : 'Exchange Rate',\n        'amount' : 'Amount (Bank Currency)'\n    };\n     var n =0;\n     for (var i in cols) {\n        \n     \n        o.params['csvCols['+n+']'] =  i\n        o.params['csvTitles['+n+']'] =  cols[i];\n        n++;\n    }\n\n     \n     new Pman.Download(o);\n    Roo.MessageBox.alert(\"Notice\", \"Should be downloading now\");\n}"
                                                     },
-                                                    "text": "Download",
-                                                    "xtype": "Button",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "text" : "Download",
+                                                    "xtype" : "Button",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "cleared",
-                                            "header": "Cleared",
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    if (r.data.bankrec_posted) {\n        return 'POSTED';\n    }\n\n    var state = v   ?  '-checked' : '';\n                                    \n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Cleared",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v,x,r) { \n    if (r.data.bankrec_posted) {\n        return 'POSTED';\n    }\n\n    var state = v   ?  '-checked' : '';\n                                    \n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "cleared"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "sortdate",
-                                            "header": "Date",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {   \n\n    return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';\n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Date",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) {   \n\n    return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';\n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "sortdate"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "doc_type",
-                                            "header": "Doctype",
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Doctype",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "doc_type"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "doc_number",
-                                            "header": "Doc Number",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Doc Number",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "doc_number"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "notes",
-                                            "header": "Notes",
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Notes",
+                                            "width" : 200,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "notes"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "doc_curr",
-                                            "header": "Currency",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Currency",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "doc_curr"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "doc_exchrate",
-                                            "header": "Exchange Rate",
-                                            "width": 75,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v ? (v*1).toFixed(3) : ''); }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Exchange Rate",
+                                            "width" : 75,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? (v*1).toFixed(3) : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "doc_exchrate"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "base_amount",
-                                            "header": "Base Amount",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Base Amount",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "base_amount"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "amount",
-                                            "header": "Credit",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    if (r.data.doc_type == 'BF') {\n        return '';\n    }\n    return String.format('{0}', v > 0 ? Roo.util.Format.number(v*1,2)   : ''); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Credit",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v,x,r) { \n    if (r.data.doc_type == 'BF') {\n        return '';\n    }\n    return String.format('{0}', v > 0 ? Roo.util.Format.number(v*1,2)   : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "amount",
+                                            "items" : [
                                                 {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
+                                                    "xtype" : "GridEditor",
+                                                    "$ xns" : "Roo.grid",
+                                                    "* prop" : "editor",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "field",
-                                                            "cls": "align-right",
-                                                            "decimalPrecision": 2,
-                                                            "xtype": "NumberField",
-                                                            "|xns": "Roo.form"
+                                                            "xtype" : "NumberField",
+                                                            "cls" : "align-right",
+                                                            "decimalPrecision" : 2,
+                                                            "$ xns" : "Roo.form",
+                                                            "* prop" : "field"
                                                         }
                                                     ]
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "amount",
-                                            "header": "Debit",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    if (r.data.doc_type == 'BF') {\n        return '';\n    }\n    return String.format('{0}', v < 0 ? Roo.util.Format.number(v*1,2): ''); }",
-                                            "|xns": "Roo.grid",
-                                            "items": [
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Debit",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v,x,r) { \n    if (r.data.doc_type == 'BF') {\n        return '';\n    }\n    return String.format('{0}', v < 0 ? Roo.util.Format.number(v*1,2): ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "amount",
+                                            "items" : [
                                                 {
-                                                    "|xns": "Roo.grid",
-                                                    "xtype": "GridEditor",
-                                                    "*prop": "editor",
-                                                    "items": [
+                                                    "xtype" : "GridEditor",
+                                                    "$ xns" : "Roo.grid",
+                                                    "* prop" : "editor",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "field",
-                                                            "cls": "align-right",
-                                                            "decimalPrecision": 2,
-                                                            "xtype": "NumberField",
-                                                            "|xns": "Roo.form"
+                                                            "xtype" : "NumberField",
+                                                            "cls" : "align-right",
+                                                            "decimalPrecision" : 2,
+                                                            "$ xns" : "Roo.form",
+                                                            "* prop" : "field"
                                                         }
                                                     ]
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "balance",
-                                            "header": "Balance",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "\nfunction(v,x,r) { \n    if (r.data.doc_type == 'BF') {\n        return String.format('{0}', Roo.util.Format.number(v*1,2)); \n    }\n\n\n    //_this.total += (v*1)\n     return String.format('{0}', Roo.util.Format.number(v*1,2)); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Balance",
+                                            "width" : 120,
+                                            "$ renderer" : "\nfunction(v,x,r) { \n    if (r.data.doc_type == 'BF') {\n        return String.format('{0}', Roo.util.Format.number(v*1,2)); \n    }\n\n\n    //_this.total += (v*1)\n     return String.format('{0}', Roo.util.Format.number(v*1,2)); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "balance"
                                         }
                                     ]
                                 }
                             ]
                         },
                         {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.wpanel = this;\n    //if (_this.wgrid) {\n    //    _this.wgrid.footer.onClick('first');\n    //}\n}"
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.wpanel = this;\n    //if (_this.wgrid) {\n    //    _this.wgrid.footer.onClick('first');\n    //}\n}"
                             },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "west",
-                            "tableName": "Groups",
-                            "title": "Pick a Date",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
+                            "fitToframe" : true,
+                            "background" : true,
+                            "region" : "west",
+                            "title" : "Pick a Date",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "Groups",
+                            "items" : [
                                 {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.wgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    //if (_this.wpanel.active) {\n    //   this.footer.onClick('first');\n    //}\n}",
-                                        "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var di = this.colModel.getDataIndex(columnIndex);\n\n    if (di != 'is_reconciled') {\n        return;\n    }\n     \n    var rec = this.ds.getAt(rowIndex);\n    \n    var voidit = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Bankrec.php',\n            method :'POST',\n            params : {\n                _void : 1,\n                bankaccnt_id : _this.bankacct.getValue(),\n                sotrdate : rec.data.sortdate\n                \n            },\n            success : function() {\n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n    }\n    \n    var postit = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Bankrec.php',\n            method :'POST',\n            params : {\n                _post : 1,\n                bankaccnt_id : _this.bankacct.getValue(),\n                sotrdate : rec.data.sortdate\n                \n            },\n            success : function() {\n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n    \n    }\n    \n    if(rec.data.is_reconciled == 1){\n        voidit();\n        return;\n    }\n    \n    postit();\n    return;\n    \n    \n    \n}",
-                                        "rowclick": "function (_self, rowIndex, e)\n{\n    \n     _this.wgrid.lastSelectedRow = rowIndex;\n    \n}"
+                                    "listeners" : {
+                                        "|render" : "function() \n{\n    _this.wgrid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    //if (_this.wpanel.active) {\n    //   this.footer.onClick('first');\n    //}\n}",
+                                        "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n    var di = this.colModel.getDataIndex(columnIndex);\n\n    if (di != 'is_reconciled') {\n        return;\n    }\n     \n    var rec = this.ds.getAt(rowIndex);\n    \n    var voidit = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Bankrec.php',\n            method :'POST',\n            params : {\n                _void : 1,\n                bankaccnt_id : _this.bankacct.getValue(),\n                sotrdate : rec.data.sortdate\n                \n            },\n            success : function() {\n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n    }\n    \n    var postit = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/Bankrec.php',\n            method :'POST',\n            params : {\n                _post : 1,\n                bankaccnt_id : _this.bankacct.getValue(),\n                sotrdate : rec.data.sortdate\n                \n            },\n            success : function() {\n                _this.wgrid.footer.onClick('refresh');\n            }\n        });\n    \n    }\n    \n    if(rec.data.is_reconciled == 1){\n        voidit();\n        return;\n    }\n    \n    postit();\n    return;\n    \n    \n    \n}",
+                                        "rowclick" : "function (_self, rowIndex, e)\n{\n    \n     _this.wgrid.lastSelectedRow = rowIndex;\n    \n}"
                                     },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "sortdate",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
+                                    "autoExpandColumn" : "sortdate",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
                                         {
-                                            "|xns": "Roo",
-                                            "xtype": "Toolbar",
-                                            "*prop": "toolbar",
-                                            "items": [
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
                                                 {
-                                                    "listeners": {
-                                                        "render": "function (_self)\n{\n    _this.monthSel = _self;\n}",
-                                                        "select": "function (combo, date)\n{\n    _this.grid.ds.removeAll();\n    _this.wgrid.footer.onClick('first');\n}"
+                                                    "listeners" : {
+                                                        "render" : "function (_self)\n{\n    _this.monthSel = _self;\n}",
+                                                        "select" : "function (combo, date)\n{\n    _this.grid.ds.removeAll();\n    _this.wgrid.footer.onClick('first');\n}"
                                                     },
-                                                    "allowBlank": true,
-                                                    "format": "M Y",
-                                                    "useIso": true,
-                                                    "width": 150,
-                                                    "xtype": "MonthField",
-                                                    "|xns": "Roo.form"
+                                                    "format" : "M Y",
+                                                    "useIso" : true,
+                                                    "xtype" : "MonthField",
+                                                    "allowBlank" : true,
+                                                    "width" : 150,
+                                                    "$ xns" : "Roo.form"
                                                 },
                                                 {
-                                                    "listeners": {
-                                                        "click": "function (_self, e)\n{\n    _this.monthSel.setValue('');\n    _this.grid.ds.removeAll();\r\n    _this.wgrid.footer.onClick('first');\r\n}"
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    _this.monthSel.setValue('');\n    _this.grid.ds.removeAll();\r\n    _this.wgrid.footer.onClick('first');\r\n}"
                                                     },
-                                                    "cls": "x-btn-icon",
-                                                    "xtype": "Button",
-                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
-                                                    "|xns": "Roo.Toolbar"
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "|xns": "Roo.Toolbar",
-                                                    "xtype": "Fill"
+                                                    "xtype" : "Fill",
+                                                    "$ xns" : "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Fix Data",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
-                                                    "|xns": "Roo.Toolbar",
-                                                    "items": [
+                                                    "text" : "Fix Data",
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-text-icon",
+                                                    "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                    "$ xns" : "Roo.Toolbar",
+                                                    "items" : [
                                                         {
-                                                            "*prop": "menu",
-                                                            "xtype": "Menu",
-                                                            "|xns": "Roo.menu",
-                                                            "items": [
+                                                            "xtype" : "Menu",
+                                                            "$ xns" : "Roo.menu",
+                                                            "* prop" : "menu",
+                                                            "items" : [
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n\n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to fix all the historical data? It will recreate all the posted bankrec and delect all the unpost\",\n        function (res) {\n            if(res!='yes') {\n                return;\n            \n            }\n            new Pman.Request({\n                url : baseURL + '/Roo/Bankrec.php',\n                method :'POST',\n                params : {\n                    _fix : 1\n                },\n                success : function() {\n                    if(_this.wgrid){\n                        _this.wgrid.footer.onClick('refresh');\n                    }\n                    Roo.MessageBox.alert('Notice', 'FIXED');\n                }\n            });\n    });\n\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n\n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to fix all the historical data? It will recreate all the posted bankrec and delect all the unpost\",\n        function (res) {\n            if(res!='yes') {\n                return;\n            \n            }\n            new Pman.Request({\n                url : baseURL + '/Roo/Bankrec.php',\n                method :'POST',\n                params : {\n                    _fix : 1\n                },\n                success : function() {\n                    if(_this.wgrid){\n                        _this.wgrid.footer.onClick('refresh');\n                    }\n                    Roo.MessageBox.alert('Notice', 'FIXED');\n                }\n            });\n    });\n\n}"
                                                                     },
-                                                                    "cls": "x-btn-text-icon",
-                                                                    "text": "Fix historical data",
-                                                                    "xtype": "Item",
-                                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Fix historical data",
+                                                                    "xtype" : "Item",
+                                                                    "cls" : "x-btn-text-icon",
+                                                                    "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                                    "$ xns" : "Roo.menu"
                                                                 },
                                                                 {
-                                                                    "listeners": {
-                                                                        "click": "function (_self, e)\n{\n\n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want?\",\n        function (res) {\n            if(res!='yes') {\n                return;\n            \n            }\n            new Pman.Request({\n                url : baseURL + '/Roo/Bankrec.php',\n                method :'POST',\n                params : {\n                    _closedPeriod : 1\n                },\n                success : function() {\n                    if(_this.wgrid){\n                        _this.wgrid.footer.onClick('refresh');\n                    }\n                    Roo.MessageBox.alert('Notice', 'DONE');\n                }\n            });\n    });\n\n}"
+                                                                    "listeners" : {
+                                                                        "click" : "function (_self, e)\n{\n\n    Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want?\",\n        function (res) {\n            if(res!='yes') {\n                return;\n            \n            }\n            new Pman.Request({\n                url : baseURL + '/Roo/Bankrec.php',\n                method :'POST',\n                params : {\n                    _closedPeriod : 1\n                },\n                success : function() {\n                    if(_this.wgrid){\n                        _this.wgrid.footer.onClick('refresh');\n                    }\n                    Roo.MessageBox.alert('Notice', 'DONE');\n                }\n            });\n    });\n\n}"
                                                                     },
-                                                                    "cls": "x-btn-text-icon",
-                                                                    "text": "Fix Closed Periods",
-                                                                    "xtype": "Item",
-                                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
-                                                                    "|xns": "Roo.menu"
+                                                                    "text" : "Fix Closed Periods",
+                                                                    "xtype" : "Item",
+                                                                    "cls" : "x-btn-text-icon",
+                                                                    "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
+                                                                    "$ xns" : "Roo.menu"
                                                                 }
                                                             ]
                                                         }
                                             ]
                                         },
                                         {
-                                            "listeners": {
-                                                "selectionchange": "function (_self)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                            "listeners" : {
+                                                "selectionchange" : "function (_self)\n{\n    _this.grid.footer.onClick('first');\n}"
                                             },
-                                            "*prop": "sm",
-                                            "singleSelect": true,
-                                            "xtype": "RowSelectionModel",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "RowSelectionModel",
+                                            "singleSelect" : true,
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "sm"
                                         },
                                         {
-                                            "listeners": {
-                                                "beforeload": "function (_self, o)\n{\n\n    if (!_this.bankacct.getValue()) {\n        return false;\n    }\n    var dt = _this.monthSel.getValue();\n    \n    if(dt.length){\n        o.params['sortdate:text'] = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    }\n    o.params._group = 'bankrec';\n    o.params._name = 'bydate';\n    o.params['bankaccntid:number'] =  _this.bankacct.getValue();\n    \n\n    \n}",
-                                                "load": "function (_self, records, options, res)\n{   \n    var sm = _this.wgrid.getSelectionModel();\n    \n    if(_this.wgrid.lastSelectedRow * 1 >0){\n        sm.selectRow(_this.wgrid.lastSelectedRow);\n        return;\n    }\n    \n    if (!sm.getSelections().length) {\n        sm.selectFirstRow();\n    }\n\n}"
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, o)\n{\n\n    if (!_this.bankacct.getValue()) {\n        return false;\n    }\n    var dt = _this.monthSel.getValue();\n    \n    if(dt.length){\n        o.params['sortdate:text'] = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');\n    }\n    o.params._group = 'bankrec';\n    o.params._name = 'bydate';\n    o.params['bankaccntid:number'] =  _this.bankacct.getValue();\n    \n\n    \n}",
+                                                "load" : "function (_self, records, options, res)\n{   \n    var sm = _this.wgrid.getSelectionModel();\n    \n    if(_this.wgrid.lastSelectedRow * 1 >0){\n        sm.selectRow(_this.wgrid.lastSelectedRow);\n        return;\n    }\n    \n    if (!sm.getSelections().length) {\n        sm.selectFirstRow();\n    }\n\n}"
                                             },
-                                            "*prop": "dataSource",
-                                            "remoteSort": true,
-                                            "xtype": "Store",
-                                            "|sortInfo": "{ field : 'sotrdate', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'sotrdate', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
                                                 {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "timeout": 900000,
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Roo/metasql.php'",
-                                                    "|xns": "Roo.data"
+                                                    "$ url" : "baseURL + '/Roo/metasql.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "timeout" : 900000,
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
                                                 },
                                                 {
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "root": "data",
-                                                    "totalProperty": "total",
-                                                    "xtype": "JsonReader",
-                                                    "|fields": "[\n    {\n        'name': 'sortdate',\n        'type': 'string'\n    }\n]",
-                                                    "|xns": "Roo.data"
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ fields" : "[\n    {\n        'name': 'sortdate',\n        'type': 'string'\n    }\n]",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
                                                 }
                                             ]
                                         },
                                         {
-                                            "*prop": "footer",
-                                            "displayInfo": false,
-                                            "displayMsg": "Displaying Date{0} - {1} of {2}",
-                                            "emptyMsg": "No Date found",
-                                            "pageSize": 25,
-                                            "xtype": "PagingToolbar",
-                                            "|xns": "Roo"
+                                            "pageSize" : 25,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "No Date found",
+                                            "$ xns" : "Roo",
+                                            "displayMsg" : "Displaying Date{0} - {1} of {2}",
+                                            "displayInfo" : false,
+                                            "* prop" : "footer"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "sortdate",
-                                            "header": "Date",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) {   \n\n    return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';\n }",
-                                            "|xns": "Roo.grid"
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Date",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v) {   \n\n    return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';\n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "sortdate"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "balance",
-                                            "header": "Closing Balance",
-                                            "width": 120,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    \n    var color = 'red'; // has some not 'ticked'\n    \n    if(r.data.no_records - r.data.no_posted == 0){ // all posted on that date\n        color = 'black';\n    }\n    if(r.data.no_records - r.data.no_cleared == 0 && r.data.no_posted != r.data.no_cleared){ // has 'ticked' or posted\n        color = 'blue';\n    }\n    \n    return String.format('<span style=\"color:{0}\">{1}</span>', color, Roo.util.Format.number(v*1,2)); \n}",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Closing Balance",
+                                            "width" : 120,
+                                            "$ renderer" : "function(v,x,r) { \n    \n    var color = 'red'; // has some not 'ticked'\n    \n    if(r.data.no_records - r.data.no_posted == 0){ // all posted on that date\n        color = 'black';\n    }\n    if(r.data.no_records - r.data.no_cleared == 0 && r.data.no_posted != r.data.no_cleared){ // has 'ticked' or posted\n        color = 'blue';\n    }\n    \n    return String.format('<span style=\"color:{0}\">{1}</span>', color, Roo.util.Format.number(v*1,2)); \n}",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "balance"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "reconciled",
-                                            "header": "Reconciled",
-                                            "width": 100,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    \n    if(!v){\n        return '';\n    }\n    \n    if((r.data.no_records * 1 != r.data.no_posted * 1) || r.data.balance * 1 != v * 1){ // not match\n        \n        return '<span style=\"color:red;font-weight:bold\">' + Roo.util.Format.number(v*1,2); \n    }\n    \n    return String.format('<span style=\"color:black\">{0}</span>', Roo.util.Format.number(v*1,2)); \n        \n }",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Reconciled",
+                                            "width" : 100,
+                                            "$ renderer" : "function(v,x,r) { \n    \n    if(!v){\n        return '';\n    }\n    \n    if((r.data.no_records * 1 != r.data.no_posted * 1) || r.data.balance * 1 != v * 1){ // not match\n        \n        return '<span style=\"color:red;font-weight:bold\">' + Roo.util.Format.number(v*1,2); \n    }\n    \n    return String.format('<span style=\"color:black\">{0}</span>', Roo.util.Format.number(v*1,2)); \n        \n }",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "reconciled"
                                         },
                                         {
-                                            "*prop": "colModel[]",
-                                            "align": "right",
-                                            "dataIndex": "is_reconciled",
-                                            "header": "Post?",
-                                            "width": 50,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v,x,r) { \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }\n \n",
-                                            "|xns": "Roo.grid"
+                                            "align" : "right",
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Post?",
+                                            "width" : 50,
+                                            "$ renderer" : "function(v,x,r) { \n    var state = v  ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n }\n \n",
+                                            "$ xns" : "Roo.grid",
+                                            "* prop" : "colModel[]",
+                                            "dataIndex" : "is_reconciled"
                                         }
                                     ]
                                 }
                 }
             ]
         }
-    ],
-    "permname": "",
-    "modOrder": "105"
+    ]
 }
\ No newline at end of file
index eadc596..c5e9122 100644 (file)
@@ -2,9 +2,11 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.XtupleReconcile = new Roo.XComponent({
-    part     :  ["Xtuple","Reconcile"],
-    order    : '105-Pman.Tab.XtupleReconcile',
+    part     :  ["Xtuple", "Reconcile" ],
+    order    : '200-Pman.Tab.XtupleReconcile',
     region   : 'center',
     parent   : 'Pman.Tab.XtupleAccountsTab',
     name     : "Pman.Tab.XtupleReconcile",
@@ -15,363 +17,38 @@ Pman.Tab.XtupleReconcile = new Roo.XComponent({
         var _this = this;
         var MODULE = this;
         return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            background : true,
-            title : "Bank Reconcile",
             layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    xns : Roo
+                },
+                west : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    width : 400,
+                    xns : Roo,
+                    split : true
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
                 items : [
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                                if (_this.grid) {
-                                    _this.grid.footer.onClick('first');
-                                }
-                            }
-                        },
-                        background : true,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'metasql',
-                        title : "Bank Reconcile",
+                       {
                         grid : {
-                            xtype: 'EditorGrid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.panel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                },
-                                cellclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                    var clear = function(ar) 
-                                    {
-                                        var ar_in = ar;
-                                        if (ar === true) {
-                                            ar = [];
-                                            
-                                            _this.grid.ds.each(function(rec) {
-                                                if (rec.data.doc_type == 'BF') {
-                                                    return;
-                                                }
-                                                ar.push(rec);
-                                            });
-                                        }
-                                        var sortdate = false;
-                                        var data = [];
-                                        Roo.each(ar, function(rec) {
-                                            if (rec.data.cleared || rec.data.bankrec_posted) {
-                                                return;
-                                            }
-                                            if(!sortdate){
-                                                sortdate = rec.data.sortdate;
-                                            }
-                                            data.push({
-                                                 id : rec.data.id,
-                                                altid : rec.data.altid,
-                                                curr_rate : rec.data.doc_exchrate,
-                                                amount : rec.data.amount
-                                                
-                                            });
-                                        });
-                                       new Pman.Request({
-                                        url : baseURL + '/Roo/bankrecitem',
-                                            method : 'POST',
-                                            mask : 'Clearing',
-                                            params : {
-                                                bankaccnt_id : _this.bankacct.getValue(),
-                                                sortdate : sortdate,
-                                                set_clear : Roo.encode(data)
-                                            },
-                                            success : function() {
-                                                Roo.each(ar, function(rec) {
-                                                    rec.set('cleared', true);
-                                                });
-                                                if (ar_in === true) {
-                                                    _this.grid.ds.getAt(0).set('cleared', true);
-                                                }
-                                                _this.wgrid.footer.onClick('refresh');
-                                            }
-                                        });
-                                    }
-                                    
-                                    
-                                    var unclear = function(ar)
-                                    {
-                                        var ar_in = ar;
-                                        if (ar === true) {
-                                            ar = [];
-                                            
-                                            _this.grid.ds.each(function(rec) {
-                                                if (rec.data.doc_type == 'BF') {
-                                                    return;
-                                                }
-                                                ar.push(rec);
-                                            });
-                                        }
-                                        var sortdate = false;
-                                        var data = [];
-                                        Roo.each(ar, function(rec) {
-                                            if (!rec.data.cleared  || rec.data.bankrec_posted) {
-                                                return;
-                                            }
-                                            if(!sortdate){
-                                                sortdate = rec.data.sortdate;
-                                            }
-                                            data.push({
-                                                id : rec.data.id,
-                                                altid : rec.data.altid                
-                                            });
-                                        });
-                                
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/bankrecitem',
-                                            method : 'POST',
-                                            mask : 'Clearing',
-                                            params : {
-                                                bankaccnt_id : _this.bankacct.getValue(),
-                                                sortdate : sortdate,
-                                                remove_clear :Roo.encode(data)
-                                                
-                                            },
-                                            success : function() {
-                                                Roo.each(ar, function(rec) {
-                                                    rec.set('cleared', false);
-                                                });
-                                               if (ar_in === true) {
-                                                    _this.grid.ds.getAt(0).set('cleared', false);
-                                                }  
-                                                _this.wgrid.footer.onClick('refresh');
-                                            }
-                                        });
-                                     
-                                      
-                                    };
-                                    
-                                    
-                                    
-                                    var di = this.colModel.config[columnIndex].dataIndex;
-                                    if (di != 'cleared') {
-                                        return;
-                                    }
-                                    var  rec = this.ds.getAt(rowIndex);
-                                    if (rec.data.doc_type == 'BF') {
-                                    
-                                        if (rec.data.cleared) {
-                                            unclear(true);
-                                        
-                                        } else {
-                                            clear(true);
-                                        }
-                                    
-                                        return;
-                                    }
-                                    
-                                        
-                                        
-                                    if (rec.data.cleared) {
-                                    
-                                        unclear([rec]);
-                                        return;
-                                        
-                                    }
-                                    
-                                    clear([rec]);
-                                    
-                                    
-                                     
-                                         
-                                  
-                                },
-                                beforeedit : function (e)
-                                {
-                                    //    Roo.log(e);
-                                       var ch =  _this.grid.colModel.config[e.column].header;
-                                       var val = e.value *1;
-                                  // Roo.log(ch);
-                                  // Roo.log(val);
-                                
-                                       if (val > 0.0 && ch == 'Debit') {
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                       if (val < 0.0 && ch == 'Credit') {
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                        if (e.record.data.cleared || e.record.data.bankrec_posted) {
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                        
-                                        // allow start editing..
-                                },
-                                afteredit : function (e)
-                                {
-                                
-                                    if (e.cancel) {
-                                        return;
-                                    }
-                                       var ch =  _this.grid.colModel.config[e.column].header;
-                                           var val = e.originalValue *1;
-                                      // Roo.log(ch);
-                                      // Roo.log(val);
-                                
-                                       if (val > 0.0 && ch == 'Debit') {
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                       if (val < 0.0 && ch == 'Credit') {
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                        if (e.record.data.cleared || e.record.data.bankrec_posted) {
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                        if (val > 0.0 && e.value < 0.0) {
-                                        Roo.log("CANCEL");  
-                                            e.record.set('amount', e.originalValue);
-                                            e.cancel = true;
-                                            return;
-                                        }
-                                        if (val < 0.0 && e.value > 0.0) {
-                                        Roo.log("CANCEL");
-                                            e.record.set('amount', e.originalValue);
-                                            e.cancel = true;
-                                            return;
-                                        } 
-                                        if (e.originalValue*1 == e.value*1) {
-                                            return;
-                                        }
-                                          
-                                        e.record.set('doc_exchrate', Math.abs(e.value  * 1)  / Math.abs(e.record.data.base_amount * 1));
-                                        Roo.log(e.record);
-                                        
-                                        _this.grid.ds.updateBalance();
-                                        // send it down the line...
-                                        new Pman.Request({
-                                            method : 'POST',
-                                            url : baseURL + '/Roo/bankrecitem',
-                                            mask : 'Saving',
-                                            params : {
-                                                bankaccnt_id : _this.bankacct.getValue(),
-                                                set_amount : Math.abs(e.value),
-                                                sortdate : e.record.data.sortdate,
-                                                source_id : e.record.data.id,
-                                                altid : e.record.data.altid
-                                            }
-                                        
-                                        });
-                                        
-                                         
-                                        
-                                        
-                                }
-                            },
-                            autoExpandColumn : 'notes',
-                            clicksToEdit : 1,
-                            loadMask : true,
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeloadadd : function (_self, records, options, res)
-                                    {
-                                     //  _this.total = 0.0;
-                                    
-                                      
-                                    
-                                    
-                                          _this.total = 1 * res.raw.amount;
-                                            _this.bf = 1 * res.raw.amount;
-                                        Roo.log("TOTAL:" + _this.total);
-                                    },
-                                    load : function (_self, records, options)
-                                    {
-                                        
-                                        var bal = _this.bf;
-                                          var cleared = true;
-                                          var posted = true;
-                                        Roo.each(records, function(rec) {
-                                            if (!rec.data.cleared) {
-                                                cleared = false;
-                                    
-                                            }
-                                            if (!rec.data.bankrec_posted) {
-                                                posted = false;
-                                            }
-                                            if (rec.data.doc_type != 'BF') {
-                                                bal += rec.data.amount *1;
-                                                rec.set('balance', bal);   
-                                            } else {
-                                                rec.set('balance', _this.bf);
-                                            }
-                                            
-                                            
-                                        });
-                                        
-                                        var rec = this.reader.newRow({
-                                            notes : 'Brought Forward',
-                                            balance : _this.bf,
-                                            doc_type : 'BF',
-                                            cleared : cleared,
-                                            bankrec_posted : posted
-                                        });
-                                        this.insert(0, [rec]);
-                                    },
-                                    beforeload : function (_self, o)
-                                    {
-                                        var s = _this.wgrid.getSelectionModel().getSelected();
-                                        
-                                        if (!s) {
-                                            return false;
-                                        }
-                                        o.params._group = 'bankrec';
-                                        o.params._name = 'all';
-                                        o.params['sortdate:text'] = s.data.sortdate;
-                                        o.params['bankaccntid:number'] =     _this.bankacct.getValue();
-                                    
-                                        o.params['_cals'] = 'amount'
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'metasql_group', direction: 'ASC' },
-                                updateBalance : function() {
-                                     var bal = _this.bf;
-                                    this.each( function(rec) {
-                                        if (rec.data.doc_type != 'BF') {
-                                            bal += rec.data.amount *1;
-                                            rec.set('balance', bal);   
-                                        } else {
-                                            rec.set('balance', _this.bf);
-                                        }
-                                        
-                                        
-                                    });
-                                },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/metasql.php',
+                                    xtype : 'HttpProxy',
                                     method : 'GET',
-                                    url : baseURL + '/Roo/metasql.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'idx',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'metasql_id',
@@ -406,660 +83,1095 @@ Pman.Tab.XtupleReconcile = new Roo.XComponent({
                                             'name': 'metasql_grade',
                                             'type': 'int'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'metasql_group', direction: 'ASC' },
+                                xns : Roo.data,
+                                updateBalance : function() {
+                                     var bal = _this.bf;
+                                    this.each( function(rec) {
+                                        if (rec.data.doc_type != 'BF') {
+                                            bal += rec.data.amount *1;
+                                            rec.set('balance', bal);   
+                                        } else {
+                                            rec.set('balance', _this.bf);
+                                        }
+                                        
+                                        
+                                    });
+                                },
+                                listeners : {
+                                       beforeloadadd : function (_self, records, options, res)
+                                          {
+                                           //  _this.total = 0.0;
+                                          
+                                            
+                                          
+                                          
+                                                _this.total = 1 * res.raw.amount;
+                                                  _this.bf = 1 * res.raw.amount;
+                                              Roo.log("TOTAL:" + _this.total);
+                                          },
+                                       beforeload : function (_self, o)
+                                          {
+                                              var s = _this.wgrid.getSelectionModel().getSelected();
+                                              
+                                              if (!s) {
+                                                  return false;
+                                              }
+                                              o.params._group = 'bankrec';
+                                              o.params._name = 'all';
+                                              o.params['sortdate:text'] = s.data.sortdate;
+                                              o.params['bankaccntid:number'] =     _this.bankacct.getValue();
+                                          
+                                              o.params['_cals'] = 'amount'
+                                          },
+                                       load : function (_self, records, options)
+                                          {
+                                              
+                                              var bal = _this.bf;
+                                                var cleared = true;
+                                                var posted = true;
+                                              Roo.each(records, function(rec) {
+                                                  if (!rec.data.cleared) {
+                                                      cleared = false;
+                                          
+                                                  }
+                                                  if (!rec.data.bankrec_posted) {
+                                                      posted = false;
+                                                  }
+                                                  if (rec.data.doc_type != 'BF') {
+                                                      bal += rec.data.amount *1;
+                                                      rec.set('balance', bal);   
+                                                  } else {
+                                                      rec.set('balance', _this.bf);
+                                                  }
+                                                  
+                                                  
+                                              });
+                                              
+                                              var rec = this.reader.newRow({
+                                                  notes : 'Brought Forward',
+                                                  balance : _this.bf,
+                                                  doc_type : 'BF',
+                                                  cleared : cleared,
+                                                  bankrec_posted : posted
+                                              });
+                                              this.insert(0, [rec]);
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "Displaying records {0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 50,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "Nothing found",
-                                pageSize : 50
+                                xns : Roo,
+                                displayMsg : "Displaying records {0} - {1} of {2}",
+                                displayInfo : true
                             },
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'ComboBox',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                                _this.bankacct = _self;
+                                       {
+                                        store : {
+                                            proxy : {
+                                                '|xns' : 'Roo.data',
+                                                url : baseURL + '/Roo/bankaccnt.php',
+                                                method : 'GET',
+                                                xtype : 'HttpProxy',
+                                                xns : Roo.data
                                             },
-                                            select : function (combo, record, index)
-                                            { 
-                                                var curr = record.data.bankaccnt_curr_id_curr_abbr;
-                                                var col = _this.grid.colModel.config.length -1;
-                                                
-                                                _this.grid.colModel.setColumnHeader(col, 'Balance (' + curr +')');
-                                                
-                                                _this.grid.ds.removeAll();
-                                                
-                                                _this.wgrid.footer.onClick('first');
-                                            }
+                                            reader : {
+                                                '|xns' : 'Roo.data',
+                                                id : 'id',
+                                                root : 'data',
+                                                xtype : 'JsonReader',
+                                                xns : Roo.data,
+                                                fields : [{"name":"id","type":"int"},{"name":"bankaccnt_name","type":"string"}],
+                                                totalProperty : 'total'
+                                            },
+                                            '|xns' : 'Roo.data',
+                                            xtype : 'Store',
+                                            remoteSort : true,
+                                            sortInfo : { direction : 'ASC', field: 'bankaccnt_bankname' },
+                                            xns : Roo.data,
+                                            listeners : {
+                                               beforeload : function (_self, o){
+                                                      o.params = o.params || {};
+                                                      // set more here
+                                                  }
+                                            },
+                                            items : [
+
+                                            ]
+
                                         },
-                                        allowBlank : false,
-                                        displayField : 'bankaccnt_bankname',
-                                        editable : false,
-                                        emptyText : "Select bankaccnt",
+                                        '|xns' : 'Roo.form',
+                                        listWidth : 400,
+                                        triggerAction : 'all',
                                         fieldLabel : 'bankaccnt',
                                         forceSelection : true,
+                                        selectOnFocus : true,
+                                        pageSize : 50,
+                                        displayField : 'bankaccnt_bankname',
+                                        emptyText : "Select bankaccnt",
                                         hiddenName : 'bankaccnt_id',
-                                        listWidth : 400,
-                                        loadingText : "Searching...",
                                         minChars : 2,
+                                        valueField : 'bankaccnt_id',
+                                        xtype : 'ComboBox',
+                                        allowBlank : false,
+                                        typeAhead : true,
+                                        editable : false,
+                                        width : 300,
+                                        xns : Roo.form,
                                         name : 'bankaccnt_bankname',
-                                        pageSize : 50,
                                         qtip : "Select bankaccnt",
                                         queryParam : '',
-                                        selectOnFocus : true,
-                                        tpl : '<div class="x-grid-cell-text x-btn button"><b>{bankaccnt_bankname}</b> </div>',
-                                        triggerAction : 'all',
-                                        typeAhead : true,
-                                        valueField : 'bankaccnt_id',
-                                        width : 300,
-                                        store : {
-                                            xtype: 'Store',
-                                            xns: Roo.data,
-                                            listeners : {
-                                                beforeload : function (_self, o){
-                                                    o.params = o.params || {};
-                                                    // set more here
-                                                }
-                                            },
-                                            remoteSort : true,
-                                            sortInfo : { direction : 'ASC', field: 'bankaccnt_bankname' },
-                                            proxy : {
-                                                xtype: 'HttpProxy',
-                                                xns: Roo.data,
-                                                method : 'GET',
-                                                url : baseURL + '/Roo/bankaccnt.php'
-                                            },
-                                            reader : {
-                                                xtype: 'JsonReader',
-                                                xns: Roo.data,
-                                                id : 'id',
-                                                root : 'data',
-                                                totalProperty : 'total',
-                                                fields : [{"name":"id","type":"int"},{"name":"bankaccnt_name","type":"string"}]
-                                            }
-                                        }
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{bankaccnt_bankname}</b> </div>',
+                                        loadingText : "Searching...",
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                var o = {params : {}}; 
-                                                if (!_this.bankacct.getValue()) {
-                                                    return false;
-                                                }
-                                                o.params._group = 'bankrec';
-                                                o.params._name = 'all';
-                                                o.params['bankaccntid:number'] =     _this.bankacct.getValue();
-                                                o.params['_sum_prev'] = 'amount';
-                                                 o.url = baseURL + '/Roo/Metasql';
-                                                 o.method = 'GET';
-                                                 
-                                                 var cols = {
-                                                    'cleared' : 'Cleared',
-                                                    'sortdate' : 'Date',
-                                                    'doc_type' : 'Doctype',
-                                                    'doc_number' : 'Doc number',
-                                                    'notes' : 'Notes',
-                                                    'doc_curr' : 'Currency',
-                                                    'base_amount' : 'Base Amount',
-                                                    'doc_exchrate' : 'Exchange Rate',
-                                                    'amount' : 'Amount (Bank Currency)'
-                                                };
-                                                 var n =0;
-                                                 for (var i in cols) {
-                                                    
-                                                 
-                                                    o.params['csvCols['+n+']'] =  i
-                                                    o.params['csvTitles['+n+']'] =  cols[i];
-                                                    n++;
-                                                }
-                                            
-                                                 
-                                                 new Pman.Download(o);
-                                                Roo.MessageBox.alert("Notice", "Should be downloading now");
-                                            }
+                                               render : function (_self)
+                                                  {
+                                                      _this.bankacct = _self;
+                                                  },
+                                               select : function (combo, record, index)
+                                                  { 
+                                                      var curr = record.data.bankaccnt_curr_id_curr_abbr;
+                                                      var col = _this.grid.colModel.config.length -1;
+                                                      
+                                                      _this.grid.colModel.setColumnHeader(col, 'Balance (' + curr +')');
+                                                      
+                                                      _this.grid.ds.removeAll();
+                                                      
+                                                      _this.wgrid.footer.onClick('first');
+                                                  }
                                         },
-                                        text : "Download"
+                                        items : [
+
+                                        ]
+
                                     },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "Download",
+                                        xtype : 'Button',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function (_self, e)
+                                                  {
+                                                      var o = {params : {}}; 
+                                                      if (!_this.bankacct.getValue()) {
+                                                          return false;
+                                                      }
+                                                      o.params._group = 'bankrec';
+                                                      o.params._name = 'all';
+                                                      o.params['bankaccntid:number'] =     _this.bankacct.getValue();
+                                                      o.params['_sum_prev'] = 'amount';
+                                                       o.url = baseURL + '/Roo/Metasql';
+                                                       o.method = 'GET';
+                                                       
+                                                       var cols = {
+                                                          'cleared' : 'Cleared',
+                                                          'sortdate' : 'Date',
+                                                          'doc_type' : 'Doctype',
+                                                          'doc_number' : 'Doc number',
+                                                          'notes' : 'Notes',
+                                                          'doc_curr' : 'Currency',
+                                                          'base_amount' : 'Base Amount',
+                                                          'doc_exchrate' : 'Exchange Rate',
+                                                          'amount' : 'Amount (Bank Currency)'
+                                                      };
+                                                       var n =0;
+                                                       for (var i in cols) {
+                                                          
+                                                       
+                                                          o.params['csvCols['+n+']'] =  i
+                                                          o.params['csvTitles['+n+']'] =  cols[i];
+                                                          n++;
+                                                      }
+                                                  
+                                                       
+                                                       new Pman.Download(o);
+                                                      Roo.MessageBox.alert("Notice", "Should be downloading now");
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     }
                                 ]
+
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'notes',
+                            xtype : 'EditorGrid',
+                            loadMask : true,
+                            clicksToEdit : 1,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'cleared',
-                                    header : 'Cleared',
-                                    width : 50,
-                                    renderer : function(v,x,r) { 
-                                        if (r.data.bankrec_posted) {
-                                            return 'POSTED';
-                                        }
-                                    
-                                        var state = v   ?  '-checked' : '';
-                                                                        
-                                        return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'sortdate',
-                                    header : 'Date',
-                                    width : 75,
-                                    renderer : function(v) {   
-                                    
-                                        return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'doc_type',
-                                    header : 'Doctype',
-                                    width : 50,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'doc_number',
-                                    header : 'Doc Number',
-                                    width : 120,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'notes',
-                                    header : 'Notes',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'doc_curr',
-                                    header : 'Currency',
-                                    width : 75,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'doc_exchrate',
-                                    header : 'Exchange Rate',
-                                    width : 75,
-                                    renderer : function(v) { return String.format('{0}', v ? (v*1).toFixed(3) : ''); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'base_amount',
-                                    header : 'Base Amount',
-                                    width : 120,
-                                    renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'amount',
-                                    header : 'Credit',
-                                    width : 120,
-                                    renderer : function(v,x,r) { 
-                                        if (r.data.doc_type == 'BF') {
-                                            return '';
-                                        }
-                                        return String.format('{0}', v > 0 ? Roo.util.Format.number(v*1,2)   : ''); },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'NumberField',
-                                            xns: Roo.form,
-                                            cls : 'align-right',
-                                            decimalPrecision : 2
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'amount',
-                                    header : 'Debit',
-                                    width : 120,
-                                    renderer : function(v,x,r) { 
-                                        if (r.data.doc_type == 'BF') {
-                                            return '';
-                                        }
-                                        return String.format('{0}', v < 0 ? Roo.util.Format.number(v*1,2): ''); },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'NumberField',
-                                            xns: Roo.form,
-                                            cls : 'align-right',
-                                            decimalPrecision : 2
-                                        }
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'balance',
-                                    header : 'Balance',
-                                    width : 120,
-                                    renderer : function(v,x,r) { 
-                                        if (r.data.doc_type == 'BF') {
-                                            return String.format('{0}', Roo.util.Format.number(v*1,2)); 
-                                        }
-                                    
-                                    
-                                        //_this.total += (v*1)
-                                         return String.format('{0}', Roo.util.Format.number(v*1,2)); 
-                                    }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Cleared',
+                                       width : 50,
+                                       renderer : function(v,x,r) { 
+                                           if (r.data.bankrec_posted) {
+                                               return 'POSTED';
+                                           }
+                                       
+                                           var state = v   ?  '-checked' : '';
+                                                                           
+                                           return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'cleared'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Date',
+                                       width : 75,
+                                       renderer : function(v) {   
+                                       
+                                           return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'sortdate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Doctype',
+                                       width : 50,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'doc_type'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Doc Number',
+                                       width : 120,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'doc_number'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Notes',
+                                       width : 200,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'notes'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Currency',
+                                       width : 75,
+                                       renderer : function(v) { return String.format('{0}', v); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'doc_curr'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Exchange Rate',
+                                       width : 75,
+                                       renderer : function(v) { return String.format('{0}', v ? (v*1).toFixed(3) : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'doc_exchrate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Base Amount',
+                                       width : 120,
+                                       renderer : function(v) { return String.format('{0}', Roo.util.Format.number(v*1,2)); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'base_amount'
+                                   },
+{
+                                       editor : {
+                                           field : {
+                                               '|xns' : 'Roo.form',
+                                               xtype : 'NumberField',
+                                               cls : 'align-right',
+                                               decimalPrecision : 2,
+                                               xns : Roo.form
+                                           },
+                                           '|xns' : 'Roo.grid',
+                                           xtype : 'GridEditor',
+                                           xns : Roo.grid,
+                                           items : [
+
+                                           ]
+
+                                       },
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Credit',
+                                       width : 120,
+                                       renderer : function(v,x,r) { 
+                                           if (r.data.doc_type == 'BF') {
+                                               return '';
+                                           }
+                                           return String.format('{0}', v > 0 ? Roo.util.Format.number(v*1,2)   : ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'amount',
+                                       items : [
+
+                                       ]
+
+                                   },
+{
+                                       editor : {
+                                           field : {
+                                               '|xns' : 'Roo.form',
+                                               xtype : 'NumberField',
+                                               cls : 'align-right',
+                                               decimalPrecision : 2,
+                                               xns : Roo.form
+                                           },
+                                           '|xns' : 'Roo.grid',
+                                           xtype : 'GridEditor',
+                                           xns : Roo.grid,
+                                           items : [
+
+                                           ]
+
+                                       },
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Debit',
+                                       width : 120,
+                                       renderer : function(v,x,r) { 
+                                           if (r.data.doc_type == 'BF') {
+                                               return '';
+                                           }
+                                           return String.format('{0}', v < 0 ? Roo.util.Format.number(v*1,2): ''); },
+                                       xns : Roo.grid,
+                                       dataIndex : 'amount',
+                                       items : [
+
+                                       ]
+
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Balance',
+                                       width : 120,
+                                       renderer : function(v,x,r) { 
+                                           if (r.data.doc_type == 'BF') {
+                                               return String.format('{0}', Roo.util.Format.number(v*1,2)); 
+                                           }
+                                       
+                                       
+                                           //_this.total += (v*1)
+                                            return String.format('{0}', Roo.util.Format.number(v*1,2)); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'balance'
+                                   }
+                            ],
+                            listeners : {
+                               beforeedit : function (e)
+                                  {
+                                      //    Roo.log(e);
+                                         var ch =  _this.grid.colModel.config[e.column].header;
+                                         var val = e.value *1;
+                                    // Roo.log(ch);
+                                    // Roo.log(val);
+                                  
+                                         if (val > 0.0 && ch == 'Debit') {
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                         if (val < 0.0 && ch == 'Credit') {
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                          if (e.record.data.cleared || e.record.data.bankrec_posted) {
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                          
+                                          // allow start editing..
+                                  },
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      if (_this.panel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  },
+                               cellclick : function (_self, rowIndex, columnIndex, e)
+                                  {
+                                      var clear = function(ar) 
+                                      {
+                                          var ar_in = ar;
+                                          if (ar === true) {
+                                              ar = [];
+                                              
+                                              _this.grid.ds.each(function(rec) {
+                                                  if (rec.data.doc_type == 'BF') {
+                                                      return;
+                                                  }
+                                                  ar.push(rec);
+                                              });
+                                          }
+                                          var sortdate = false;
+                                          var data = [];
+                                          Roo.each(ar, function(rec) {
+                                              if (rec.data.cleared || rec.data.bankrec_posted) {
+                                                  return;
+                                              }
+                                              if(!sortdate){
+                                                  sortdate = rec.data.sortdate;
+                                              }
+                                              data.push({
+                                                   id : rec.data.id,
+                                                  altid : rec.data.altid,
+                                                  curr_rate : rec.data.doc_exchrate,
+                                                  amount : rec.data.amount
+                                                  
+                                              });
+                                          });
+                                         new Pman.Request({
+                                          url : baseURL + '/Roo/bankrecitem',
+                                              method : 'POST',
+                                              mask : 'Clearing',
+                                              params : {
+                                                  bankaccnt_id : _this.bankacct.getValue(),
+                                                  sortdate : sortdate,
+                                                  set_clear : Roo.encode(data)
+                                              },
+                                              success : function() {
+                                                  Roo.each(ar, function(rec) {
+                                                      rec.set('cleared', true);
+                                                  });
+                                                  if (ar_in === true) {
+                                                      _this.grid.ds.getAt(0).set('cleared', true);
+                                                  }
+                                                  _this.wgrid.footer.onClick('refresh');
+                                              }
+                                          });
+                                      }
+                                      
+                                      
+                                      var unclear = function(ar)
+                                      {
+                                          var ar_in = ar;
+                                          if (ar === true) {
+                                              ar = [];
+                                              
+                                              _this.grid.ds.each(function(rec) {
+                                                  if (rec.data.doc_type == 'BF') {
+                                                      return;
+                                                  }
+                                                  ar.push(rec);
+                                              });
+                                          }
+                                          var sortdate = false;
+                                          var data = [];
+                                          Roo.each(ar, function(rec) {
+                                              if (!rec.data.cleared  || rec.data.bankrec_posted) {
+                                                  return;
+                                              }
+                                              if(!sortdate){
+                                                  sortdate = rec.data.sortdate;
+                                              }
+                                              data.push({
+                                                  id : rec.data.id,
+                                                  altid : rec.data.altid                
+                                              });
+                                          });
+                                  
+                                          new Pman.Request({
+                                              url : baseURL + '/Roo/bankrecitem',
+                                              method : 'POST',
+                                              mask : 'Clearing',
+                                              params : {
+                                                  bankaccnt_id : _this.bankacct.getValue(),
+                                                  sortdate : sortdate,
+                                                  remove_clear :Roo.encode(data)
+                                                  
+                                              },
+                                              success : function() {
+                                                  Roo.each(ar, function(rec) {
+                                                      rec.set('cleared', false);
+                                                  });
+                                                 if (ar_in === true) {
+                                                      _this.grid.ds.getAt(0).set('cleared', false);
+                                                  }  
+                                                  _this.wgrid.footer.onClick('refresh');
+                                              }
+                                          });
+                                       
+                                        
+                                      };
+                                      
+                                      
+                                      
+                                      var di = this.colModel.config[columnIndex].dataIndex;
+                                      if (di != 'cleared') {
+                                          return;
+                                      }
+                                      var  rec = this.ds.getAt(rowIndex);
+                                      if (rec.data.doc_type == 'BF') {
+                                      
+                                          if (rec.data.cleared) {
+                                              unclear(true);
+                                          
+                                          } else {
+                                              clear(true);
+                                          }
+                                      
+                                          return;
+                                      }
+                                      
+                                          
+                                          
+                                      if (rec.data.cleared) {
+                                      
+                                          unclear([rec]);
+                                          return;
+                                          
+                                      }
+                                      
+                                      clear([rec]);
+                                      
+                                      
+                                       
+                                           
+                                    
+                                  },
+                               afteredit : function (e)
+                                  {
+                                  
+                                      if (e.cancel) {
+                                          return;
+                                      }
+                                         var ch =  _this.grid.colModel.config[e.column].header;
+                                             var val = e.originalValue *1;
+                                        // Roo.log(ch);
+                                        // Roo.log(val);
+                                  
+                                         if (val > 0.0 && ch == 'Debit') {
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                         if (val < 0.0 && ch == 'Credit') {
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                          if (e.record.data.cleared || e.record.data.bankrec_posted) {
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                          if (val > 0.0 && e.value < 0.0) {
+                                          Roo.log("CANCEL");  
+                                              e.record.set('amount', e.originalValue);
+                                              e.cancel = true;
+                                              return;
+                                          }
+                                          if (val < 0.0 && e.value > 0.0) {
+                                          Roo.log("CANCEL");
+                                              e.record.set('amount', e.originalValue);
+                                              e.cancel = true;
+                                              return;
+                                          } 
+                                          if (e.originalValue*1 == e.value*1) {
+                                              return;
+                                          }
+                                            
+                                          e.record.set('doc_exchrate', Math.abs(e.value  * 1)  / Math.abs(e.record.data.base_amount * 1));
+                                          Roo.log(e.record);
+                                          
+                                          _this.grid.ds.updateBalance();
+                                          // send it down the line...
+                                          new Pman.Request({
+                                              method : 'POST',
+                                              url : baseURL + '/Roo/bankrecitem',
+                                              mask : 'Saving',
+                                              params : {
+                                                  bankaccnt_id : _this.bankacct.getValue(),
+                                                  set_amount : Math.abs(e.value),
+                                                  sortdate : e.record.data.sortdate,
+                                                  source_id : e.record.data.id,
+                                                  altid : e.record.data.altid
+                                              }
+                                          
+                                          });
+                                          
+                                           
+                                          
+                                          
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
-                    },
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.wpanel = this;
-                                //if (_this.wgrid) {
-                                //    _this.wgrid.footer.onClick('first');
-                                //}
-                            }
+
                         },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
                         background : true,
+                        region : 'center',
+                        title : "Bank Reconcile",
+                        xtype : 'GridPanel',
                         fitContainer : true,
-                        fitToframe : true,
-                        region : 'west',
-                        tableName : 'Groups',
-                        title : "Pick a Date",
+                        xns : Roo,
+                        tableName : 'metasql',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                      if (_this.grid) {
+                                          _this.grid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
+                    },
+                       {
                         grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.wgrid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    //if (_this.wpanel.active) {
-                                    //   this.footer.onClick('first');
-                                    //}
-                                },
-                                cellclick : function (_self, rowIndex, columnIndex, e)
-                                {
-                                    var di = this.colModel.getDataIndex(columnIndex);
-                                
-                                    if (di != 'is_reconciled') {
-                                        return;
-                                    }
-                                     
-                                    var rec = this.ds.getAt(rowIndex);
-                                    
-                                    var voidit = function(){
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/Bankrec.php',
-                                            method :'POST',
-                                            params : {
-                                                _void : 1,
-                                                bankaccnt_id : _this.bankacct.getValue(),
-                                                sotrdate : rec.data.sortdate
-                                                
-                                            },
-                                            success : function() {
-                                                _this.wgrid.footer.onClick('refresh');
-                                            }
-                                        });
-                                    }
-                                    
-                                    var postit = function(){
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/Bankrec.php',
-                                            method :'POST',
-                                            params : {
-                                                _post : 1,
-                                                bankaccnt_id : _this.bankacct.getValue(),
-                                                sotrdate : rec.data.sortdate
-                                                
-                                            },
-                                            success : function() {
-                                                _this.wgrid.footer.onClick('refresh');
-                                            }
-                                        });
-                                    
-                                    }
-                                    
-                                    if(rec.data.is_reconciled == 1){
-                                        voidit();
-                                        return;
-                                    }
-                                    
-                                    postit();
-                                    return;
-                                    
-                                    
-                                    
-                                },
-                                rowclick : function (_self, rowIndex, e)
-                                {
-                                    
-                                     _this.wgrid.lastSelectedRow = rowIndex;
-                                    
-                                }
-                            },
-                            autoExpandColumn : 'sortdate',
-                            loadMask : true,
                             toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
                                 items : [
-                                    {
-                                        xtype: 'MonthField',
-                                        xns: Roo.form,
-                                        listeners : {
-                                            render : function (_self)
-                                            {
-                                                _this.monthSel = _self;
-                                            },
-                                            select : function (combo, date)
-                                            {
-                                                _this.grid.ds.removeAll();
-                                                _this.wgrid.footer.onClick('first');
-                                            }
-                                        },
-                                        allowBlank : true,
+                                       {
+                                        '|xns' : 'Roo.form',
                                         format : 'M Y',
                                         useIso : true,
-                                        width : 150
-                                    },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
+                                        xtype : 'MonthField',
+                                        allowBlank : true,
+                                        width : 150,
+                                        xns : Roo.form,
                                         listeners : {
-                                            click : function (_self, e)
-                                            {
-                                                _this.monthSel.setValue('');
-                                                _this.grid.ds.removeAll();\r
-                                                _this.wgrid.footer.onClick('first');\r
-                                            }
-                                        },
+                                               render : function (_self)
+                                                  {
+                                                      _this.monthSel = _self;
+                                                  },
+                                               select : function (combo, date)
+                                                  {
+                                                      _this.grid.ds.removeAll();
+                                                      _this.wgrid.footer.onClick('first');
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
                                         cls : 'x-btn-icon',
-                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.monthSel.setValue('');
+                                                      _this.grid.ds.removeAll();\r
+                                                      _this.wgrid.footer.onClick('first');\r
+                                                  }
+                                        }
                                     },
-                                    {
-                                        xtype: 'Fill',
-                                        xns: Roo.Toolbar
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Fill',
+                                        xns : Roo.Toolbar
                                     },
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        cls : 'x-btn-text-icon',
-                                        text : "Fix Data",
-                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                       {
                                         menu : {
-                                            xtype: 'Menu',
-                                            xns: Roo.menu,
+                                            '|xns' : 'Roo.menu',
+                                            xtype : 'Menu',
+                                            xns : Roo.menu,
                                             items : [
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
-                                                    listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                        
-                                                            Roo.MessageBox.confirm("Confirm", "Are you sure you want to fix all the historical data? It will recreate all the posted bankrec and delect all the unpost",
-                                                                function (res) {
-                                                                    if(res!='yes') {
-                                                                        return;
-                                                                    
-                                                                    }
-                                                                    new Pman.Request({
-                                                                        url : baseURL + '/Roo/Bankrec.php',
-                                                                        method :'POST',
-                                                                        params : {
-                                                                            _fix : 1
-                                                                        },
-                                                                        success : function() {
-                                                                            if(_this.wgrid){
-                                                                                _this.wgrid.footer.onClick('refresh');
-                                                                            }
-                                                                            Roo.MessageBox.alert('Notice', 'FIXED');
-                                                                        }
-                                                                    });
-                                                            });
-                                                        
-                                                        }
-                                                    },
-                                                    cls : 'x-btn-text-icon',
+                                               {
+                                                    '|xns' : 'Roo.menu',
                                                     text : "Fix historical data",
-                                                    icon : Roo.rootURL + 'images/default/tree/leaf.gif'
-                                                },
-                                                {
-                                                    xtype: 'Item',
-                                                    xns: Roo.menu,
-                                                    listeners : {
-                                                        click : function (_self, e)
-                                                        {
-                                                        
-                                                            Roo.MessageBox.confirm("Confirm", "Are you sure you want?",
-                                                                function (res) {
-                                                                    if(res!='yes') {
-                                                                        return;
-                                                                    
-                                                                    }
-                                                                    new Pman.Request({
-                                                                        url : baseURL + '/Roo/Bankrec.php',
-                                                                        method :'POST',
-                                                                        params : {
-                                                                            _closedPeriod : 1
-                                                                        },
-                                                                        success : function() {
-                                                                            if(_this.wgrid){
-                                                                                _this.wgrid.footer.onClick('refresh');
-                                                                            }
-                                                                            Roo.MessageBox.alert('Notice', 'DONE');
-                                                                        }
-                                                                    });
-                                                            });
-                                                        
-                                                        }
-                                                    },
+                                                    xtype : 'Item',
                                                     cls : 'x-btn-text-icon',
+                                                    icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                                    xns : Roo.menu,
+                                                    listeners : {
+                                                       click : function (_self, e)
+                                                          {
+                                                          
+                                                              Roo.MessageBox.confirm("Confirm", "Are you sure you want to fix all the historical data? It will recreate all the posted bankrec and delect all the unpost",
+                                                                  function (res) {
+                                                                      if(res!='yes') {
+                                                                          return;
+                                                                      
+                                                                      }
+                                                                      new Pman.Request({
+                                                                          url : baseURL + '/Roo/Bankrec.php',
+                                                                          method :'POST',
+                                                                          params : {
+                                                                              _fix : 1
+                                                                          },
+                                                                          success : function() {
+                                                                              if(_this.wgrid){
+                                                                                  _this.wgrid.footer.onClick('refresh');
+                                                                              }
+                                                                              Roo.MessageBox.alert('Notice', 'FIXED');
+                                                                          }
+                                                                      });
+                                                              });
+                                                          
+                                                          }
+                                                    }
+                                                },
+                                               {
+                                                    '|xns' : 'Roo.menu',
                                                     text : "Fix Closed Periods",
-                                                    icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+                                                    xtype : 'Item',
+                                                    cls : 'x-btn-text-icon',
+                                                    icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                                    xns : Roo.menu,
+                                                    listeners : {
+                                                       click : function (_self, e)
+                                                          {
+                                                          
+                                                              Roo.MessageBox.confirm("Confirm", "Are you sure you want?",
+                                                                  function (res) {
+                                                                      if(res!='yes') {
+                                                                          return;
+                                                                      
+                                                                      }
+                                                                      new Pman.Request({
+                                                                          url : baseURL + '/Roo/Bankrec.php',
+                                                                          method :'POST',
+                                                                          params : {
+                                                                              _closedPeriod : 1
+                                                                          },
+                                                                          success : function() {
+                                                                              if(_this.wgrid){
+                                                                                  _this.wgrid.footer.onClick('refresh');
+                                                                              }
+                                                                              Roo.MessageBox.alert('Notice', 'DONE');
+                                                                          }
+                                                                      });
+                                                              });
+                                                          
+                                                          }
+                                                    }
                                                 }
                                             ]
-                                        }
+
+                                        },
+                                        '|xns' : 'Roo.Toolbar',
+                                        text : "Fix Data",
+                                        xtype : 'Button',
+                                        cls : 'x-btn-text-icon',
+                                        icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                                        xns : Roo.Toolbar,
+                                        items : [
+
+                                        ]
+
                                     }
                                 ]
+
                             },
                             sm : {
-                                xtype: 'RowSelectionModel',
-                                xns: Roo.grid,
+                                '|xns' : 'Roo.grid',
+                                xtype : 'RowSelectionModel',
+                                singleSelect : true,
+                                xns : Roo.grid,
                                 listeners : {
-                                    selectionchange : function (_self)
-                                    {
-                                        _this.grid.footer.onClick('first');
-                                    }
-                                },
-                                singleSelect : true
+                                       selectionchange : function (_self)
+                                          {
+                                              _this.grid.footer.onClick('first');
+                                          }
+                                }
                             },
                             dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    beforeload : function (_self, o)
-                                    {
-                                    
-                                        if (!_this.bankacct.getValue()) {
-                                            return false;
-                                        }
-                                        var dt = _this.monthSel.getValue();
-                                        
-                                        if(dt.length){
-                                            o.params['sortdate:text'] = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
-                                        }
-                                        o.params._group = 'bankrec';
-                                        o.params._name = 'bydate';
-                                        o.params['bankaccntid:number'] =  _this.bankacct.getValue();
-                                        
-                                    
-                                        
-                                    },
-                                    load : function (_self, records, options, res)
-                                    {   
-                                        var sm = _this.wgrid.getSelectionModel();
-                                        
-                                        if(_this.wgrid.lastSelectedRow * 1 >0){
-                                            sm.selectRow(_this.wgrid.lastSelectedRow);
-                                            return;
-                                        }
-                                        
-                                        if (!sm.getSelections().length) {
-                                            sm.selectFirstRow();
-                                        }
-                                    
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'sotrdate', direction: 'ASC' },
                                 proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/metasql.php',
                                     method : 'GET',
+                                    xtype : 'HttpProxy',
                                     timeout : 900000,
-                                    url : baseURL + '/Roo/metasql.php'
+                                    xns : Roo.data
                                 },
                                 reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
+                                    '|xns' : 'Roo.data',
                                     id : 'id',
                                     root : 'data',
-                                    totalProperty : 'total',
+                                    xtype : 'JsonReader',
                                     fields : [
                                         {
                                             'name': 'sortdate',
                                             'type': 'string'
                                         }
-                                    ]
-                                }
+                                    ],
+                                    xns : Roo.data,
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'sotrdate', direction: 'ASC' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o)
+                                          {
+                                          
+                                              if (!_this.bankacct.getValue()) {
+                                                  return false;
+                                              }
+                                              var dt = _this.monthSel.getValue();
+                                              
+                                              if(dt.length){
+                                                  o.params['sortdate:text'] = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
+                                              }
+                                              o.params._group = 'bankrec';
+                                              o.params._name = 'bydate';
+                                              o.params['bankaccntid:number'] =  _this.bankacct.getValue();
+                                              
+                                          
+                                              
+                                          },
+                                       load : function (_self, records, options, res)
+                                          {   
+                                              var sm = _this.wgrid.getSelectionModel();
+                                              
+                                              if(_this.wgrid.lastSelectedRow * 1 >0){
+                                                  sm.selectRow(_this.wgrid.lastSelectedRow);
+                                                  return;
+                                              }
+                                              
+                                              if (!sm.getSelections().length) {
+                                                  sm.selectFirstRow();
+                                              }
+                                          
+                                          }
+                                },
+                                items : [
+
+                                ]
+
                             },
                             footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : false,
-                                displayMsg : "Displaying Date{0} - {1} of {2}",
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
                                 emptyMsg : "No Date found",
-                                pageSize : 25
+                                xns : Roo,
+                                displayMsg : "Displaying Date{0} - {1} of {2}",
+                                displayInfo : false
                             },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'sortdate',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
                             colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'sortdate',
-                                    header : 'Date',
-                                    width : 100,
-                                    renderer : function(v) {   
-                                    
-                                        return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'balance',
-                                    header : 'Closing Balance',
-                                    width : 120,
-                                    renderer : function(v,x,r) { 
-                                        
-                                        var color = 'red'; // has some not 'ticked'
-                                        
-                                        if(r.data.no_records - r.data.no_posted == 0){ // all posted on that date
-                                            color = 'black';
-                                        }
-                                        if(r.data.no_records - r.data.no_cleared == 0 && r.data.no_posted != r.data.no_cleared){ // has 'ticked' or posted
-                                            color = 'blue';
-                                        }
-                                        
-                                        return String.format('<span style="color:{0}">{1}</span>', color, Roo.util.Format.number(v*1,2)); 
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'reconciled',
-                                    header : 'Reconciled',
-                                    width : 100,
-                                    renderer : function(v,x,r) { 
-                                        
-                                        if(!v){
-                                            return '';
-                                        }
-                                        
-                                        if((r.data.no_records * 1 != r.data.no_posted * 1) || r.data.balance * 1 != v * 1){ // not match
-                                            
-                                            return '<span style="color:red;font-weight:bold">' + Roo.util.Format.number(v*1,2); 
-                                        }
-                                        
-                                        return String.format('<span style="color:black">{0}</span>', Roo.util.Format.number(v*1,2)); 
-                                            
-                                     }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    align : 'right',
-                                    dataIndex : 'is_reconciled',
-                                    header : 'Post?',
-                                    width : 50,
-                                    renderer : function(v,x,r) { 
-                                        var state = v  ?  '-checked' : '';
-                                    
-                                        return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-                                     }
-                                }
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Date',
+                                       width : 100,
+                                       renderer : function(v) {   
+                                       
+                                           return v ? Date.parseDate(v,'Y-m-d').format('d/M/Y') : '';
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'sortdate'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Closing Balance',
+                                       width : 120,
+                                       renderer : function(v,x,r) { 
+                                           
+                                           var color = 'red'; // has some not 'ticked'
+                                           
+                                           if(r.data.no_records - r.data.no_posted == 0){ // all posted on that date
+                                               color = 'black';
+                                           }
+                                           if(r.data.no_records - r.data.no_cleared == 0 && r.data.no_posted != r.data.no_cleared){ // has 'ticked' or posted
+                                               color = 'blue';
+                                           }
+                                           
+                                           return String.format('<span style="color:{0}">{1}</span>', color, Roo.util.Format.number(v*1,2)); 
+                                       },
+                                       xns : Roo.grid,
+                                       dataIndex : 'balance'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Reconciled',
+                                       width : 100,
+                                       renderer : function(v,x,r) { 
+                                           
+                                           if(!v){
+                                               return '';
+                                           }
+                                           
+                                           if((r.data.no_records * 1 != r.data.no_posted * 1) || r.data.balance * 1 != v * 1){ // not match
+                                               
+                                               return '<span style="color:red;font-weight:bold">' + Roo.util.Format.number(v*1,2); 
+                                           }
+                                           
+                                           return String.format('<span style="color:black">{0}</span>', Roo.util.Format.number(v*1,2)); 
+                                               
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'reconciled'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       align : 'right',
+                                       xtype : 'ColumnModel',
+                                       header : 'Post?',
+                                       width : 50,
+                                       renderer : function(v,x,r) { 
+                                           var state = v  ?  '-checked' : '';
+                                       
+                                           return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                                        },
+                                       xns : Roo.grid,
+                                       dataIndex : 'is_reconciled'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.wgrid = this; 
+                                      //_this.dialog = Pman.Dialog.FILL_IN
+                                      //if (_this.wpanel.active) {
+                                      //   this.footer.onClick('first');
+                                      //}
+                                  },
+                               cellclick : function (_self, rowIndex, columnIndex, e)
+                                  {
+                                      var di = this.colModel.getDataIndex(columnIndex);
+                                  
+                                      if (di != 'is_reconciled') {
+                                          return;
+                                      }
+                                       
+                                      var rec = this.ds.getAt(rowIndex);
+                                      
+                                      var voidit = function(){
+                                          new Pman.Request({
+                                              url : baseURL + '/Roo/Bankrec.php',
+                                              method :'POST',
+                                              params : {
+                                                  _void : 1,
+                                                  bankaccnt_id : _this.bankacct.getValue(),
+                                                  sotrdate : rec.data.sortdate
+                                                  
+                                              },
+                                              success : function() {
+                                                  _this.wgrid.footer.onClick('refresh');
+                                              }
+                                          });
+                                      }
+                                      
+                                      var postit = function(){
+                                          new Pman.Request({
+                                              url : baseURL + '/Roo/Bankrec.php',
+                                              method :'POST',
+                                              params : {
+                                                  _post : 1,
+                                                  bankaccnt_id : _this.bankacct.getValue(),
+                                                  sotrdate : rec.data.sortdate
+                                                  
+                                              },
+                                              success : function() {
+                                                  _this.wgrid.footer.onClick('refresh');
+                                              }
+                                          });
+                                      
+                                      }
+                                      
+                                      if(rec.data.is_reconciled == 1){
+                                          voidit();
+                                          return;
+                                      }
+                                      
+                                      postit();
+                                      return;
+                                      
+                                      
+                                      
+                                  },
+                               rowclick : function (_self, rowIndex, e)
+                                  {
+                                      
+                                       _this.wgrid.lastSelectedRow = rowIndex;
+                                      
+                                  }
+                            },
+                            items : [
+
                             ]
-                        }
+
+                        },
+                        '|xns' : 'Roo',
+                        fitToframe : true,
+                        background : true,
+                        region : 'west',
+                        title : "Pick a Date",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'Groups',
+                        listeners : {
+                               activate : function() {
+                                      _this.wpanel = this;
+                                      //if (_this.wgrid) {
+                                      //    _this.wgrid.footer.onClick('first');
+                                      //}
+                                  }
+                        },
+                        items : [
+
+                        ]
+
                     }
-                ],
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                },
-                west : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    split : true,
-                    width : 400
-                }
-            }
-        };
-    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            background : true,
+            xtype : 'NestedLayoutPanel',
+            title : "Bank Reconcile",
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
 });
diff --git a/Pman.Tab.XtupleTerms.bjs b/Pman.Tab.XtupleTerms.bjs
new file mode 100644 (file)
index 0000000..d80ee00
--- /dev/null
@@ -0,0 +1,158 @@
+{
+    "name" : "Pman.Tab.XtupleTerms",
+    "parent" : "Pman.Tab.XtupleAccountsTab",
+    "title" : "",
+    "path" : "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleTerms.bjs",
+    "permname" : "",
+    "modOrder" : "700",
+    "items" : [
+        {
+            "background" : false,
+            "region" : "center",
+            "title" : "Terms",
+            "xtype" : "NestedLayoutPanel",
+            "$ xns" : "Roo",
+            "items" : [
+                {
+                    "xtype" : "BorderLayout",
+                    "$ xns" : "Roo",
+                    "* prop" : "layout",
+                    "items" : [
+                        {
+                            "xtype" : "LayoutRegion",
+                            "$ xns" : "Roo",
+                            "* prop" : "center"
+                        },
+                        {
+                            "listeners" : {
+                                "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                            },
+                            "background" : false,
+                            "region" : "center",
+                            "fitToframe" : true,
+                            "title" : "Terms",
+                            "xtype" : "GridPanel",
+                            "fitContainer" : true,
+                            "$ xns" : "Roo",
+                            "tableName" : "terms",
+                            "items" : [
+                                {
+                                    "listeners" : {
+                                        "|render" : "function() \n{\n    _this.grid = this; \n    \n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+                                    },
+                                    "autoExpandColumn" : "terms_descrip",
+                                    "xtype" : "Grid",
+                                    "loadMask" : true,
+                                    "$ xns" : "Roo.grid",
+                                    "* prop" : "grid",
+                                    "items" : [
+                                        {
+                                            "xtype" : "Toolbar",
+                                            "$ xns" : "Roo",
+                                            "* prop" : "toolbar",
+                                            "items" : [
+                                                {
+                                                    "listeners" : {
+                                                        "specialkey" : "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}",
+                                                        "render" : "function (_self)\n{\n    _this.searchBox = _self;\n}"
+                                                    },
+                                                    "xtype" : "TextField",
+                                                    "$ xns" : "Roo.form"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                                    },
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "click" : "function (_self, e)\n{\n    _this.searchBox.setValue('');\r\n\r\n    _this.grid.footer.onClick('first');\r\n}"
+                                                    },
+                                                    "xtype" : "Button",
+                                                    "cls" : "x-btn-icon",
+                                                    "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                                    "$ xns" : "Roo.Toolbar"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    var s = _this.searchBox.getValue();\n    \n    if(s.length){\n        o.params['search[name]'] = s;\n    }\n    \n  \n}"
+                                            },
+                                            "xtype" : "Store",
+                                            "remoteSort" : true,
+                                            "$ sortInfo" : "{ field : 'crdate', direction: 'ASC' }",
+                                            "$ xns" : "Roo.data",
+                                            "* prop" : "dataSource",
+                                            "items" : [
+                                                {
+                                                    "$ url" : "baseURL + '/Roo/terms.php'",
+                                                    "method" : "GET",
+                                                    "xtype" : "HttpProxy",
+                                                    "$ xns" : "Roo.data",
+                                                    "* prop" : "proxy"
+                                                },
+                                                {
+                                                    "id" : "id",
+                                                    "root" : "data",
+                                                    "xtype" : "JsonReader",
+                                                    "$ xns" : "Roo.data",
+                                                    "$ fields" : "[\n    {\n        'name': 'terms_id',\n        'type': 'int'\n    },\n    {\n        'name': 'terms_code',\n        'type': 'string'\n    },\n    {\n        'name': 'terms_descrip',\n        'type': 'string',\n    }\n]",
+                                                    "* prop" : "reader",
+                                                    "totalProperty" : "total"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "pageSize" : 25,
+                                            "xtype" : "PagingToolbar",
+                                            "emptyMsg" : "No terms found",
+                                            "$ xns" : "Roo",
+                                            "displayInfo" : true,
+                                            "displayMsg" : "Displaying Terms{0} - {1} of {2}",
+                                            "* prop" : "footer"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "width" : 200,
+                                            "header" : "ID",
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_id"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Code",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_code"
+                                        },
+                                        {
+                                            "xtype" : "ColumnModel",
+                                            "header" : "Description",
+                                            "width" : 150,
+                                            "$ renderer" : "function(v) { return String.format('{0}', v ? v : ''); }",
+                                            "$ xns" : "Roo.grid",
+                                            "Boolean sortable" : true,
+                                            "* prop" : "cm[]",
+                                            "dataIndex" : "terms_descrip"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/Pman.Tab.XtupleTerms.js b/Pman.Tab.XtupleTerms.js
new file mode 100644 (file)
index 0000000..114ad9b
--- /dev/null
@@ -0,0 +1,234 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Pman.Tab');
+
+Pman.Tab.XtupleTerms = new Roo.XComponent({
+    part     :  ["Xtuple", "Terms" ],
+    order    : '700-Pman.Tab.XtupleTerms',
+    region   : 'center',
+    parent   : 'Pman.Tab.XtupleAccountsTab',
+    name     : "unnamed module",
+    disabled : false, 
+    permname : '', 
+    _tree : function()
+    {
+        var _this = this;
+        var MODULE = this;
+        return {
+            layout : {
+                center : {
+                    '|xns' : 'Roo',
+                    xtype : 'LayoutRegion',
+                    xns : Roo
+                },
+                '|xns' : 'Roo',
+                xtype : 'BorderLayout',
+                xns : Roo,
+                items : [
+                       {
+                        grid : {
+                            toolbar : {
+                                '|xns' : 'Roo',
+                                xtype : 'Toolbar',
+                                xns : Roo,
+                                items : [
+                                       {
+                                        '|xns' : 'Roo.form',
+                                        xtype : 'TextField',
+                                        xns : Roo.form,
+                                        listeners : {
+                                               specialkey : function (_self, e)
+                                                  {
+                                                    _this.grid.footer.onClick('first');
+                                                  },
+                                               render : function (_self)
+                                                  {
+                                                      _this.searchBox = _self;
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
+                                        cls : 'x-btn-icon',
+                                        icon : rootURL + '/Pman/templates/images/search.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.grid.footer.onClick('first');
+                                                  }
+                                        }
+                                    },
+                                       {
+                                        '|xns' : 'Roo.Toolbar',
+                                        xtype : 'Button',
+                                        cls : 'x-btn-icon',
+                                        icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+                                        xns : Roo.Toolbar,
+                                        listeners : {
+                                               click : function (_self, e)
+                                                  {
+                                                      _this.searchBox.setValue('');\r
+                                                  \r
+                                                      _this.grid.footer.onClick('first');\r
+                                                  }
+                                        }
+                                    }
+                                ]
+
+                            },
+                            dataSource : {
+                                proxy : {
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/terms.php',
+                                    method : 'GET',
+                                    xtype : 'HttpProxy',
+                                    xns : Roo.data
+                                },
+                                reader : {
+                                    '|xns' : 'Roo.data',
+                                    id : 'id',
+                                    root : 'data',
+                                    xtype : 'JsonReader',
+                                    xns : Roo.data,
+                                    fields : [
+                                        {
+                                            'name': 'terms_id',
+                                            'type': 'int'
+                                        },
+                                        {
+                                            'name': 'terms_code',
+                                            'type': 'string'
+                                        },
+                                        {
+                                            'name': 'terms_descrip',
+                                            'type': 'string',
+                                        }
+                                    ],
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { field : 'crdate', direction: 'ASC' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o)
+                                          {
+                                              o.params = o.params || {};
+                                              
+                                              var s = _this.searchBox.getValue();
+                                              
+                                              if(s.length){
+                                                  o.params['search[name]'] = s;
+                                              }
+                                              
+                                            
+                                          }
+                                },
+                                items : [
+
+                                ]
+
+                            },
+                            footer : {
+                                '|xns' : 'Roo',
+                                pageSize : 25,
+                                xtype : 'PagingToolbar',
+                                emptyMsg : "No terms found",
+                                xns : Roo,
+                                displayInfo : true,
+                                displayMsg : "Displaying Terms{0} - {1} of {2}"
+                            },
+                            '|xns' : 'Roo.grid',
+                            autoExpandColumn : 'terms_descrip',
+                            xtype : 'Grid',
+                            loadMask : true,
+                            xns : Roo.grid,
+                            cm : [
+                                {
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       width : 200,
+                                       header : 'ID',
+                                       renderer : function(v) { return String.format('{0}', v ? v : ''); },
+                                       xns : Roo.grid,
+                                       sortable : true,
+                                       dataIndex : 'terms_id'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Code',
+                                       width : 150,
+                                       renderer : function(v) { return String.format('{0}', v ? v : ''); },
+                                       xns : Roo.grid,
+                                       sortable : true,
+                                       dataIndex : 'terms_code'
+                                   },
+{
+                                       '|xns' : 'Roo.grid',
+                                       xtype : 'ColumnModel',
+                                       header : 'Description',
+                                       width : 150,
+                                       renderer : function(v) { return String.format('{0}', v ? v : ''); },
+                                       xns : Roo.grid,
+                                       sortable : true,
+                                       dataIndex : 'terms_descrip'
+                                   }
+                            ],
+                            listeners : {
+                               render : function() 
+                                  {
+                                      _this.grid = this; 
+                                      
+                                      if (_this.panel.active) {
+                                         this.footer.onClick('first');
+                                      }
+                                  }
+                            },
+                            items : [
+
+                            ]
+
+                        },
+                        '|xns' : 'Roo',
+                        background : false,
+                        region : 'center',
+                        fitToframe : true,
+                        title : "Terms",
+                        xtype : 'GridPanel',
+                        fitContainer : true,
+                        xns : Roo,
+                        tableName : 'terms',
+                        listeners : {
+                               activate : function() {
+                                      _this.panel = this;
+                                      if (_this.grid) {
+                                          _this.grid.footer.onClick('first');
+                                      }
+                                  }
+                        },
+                        items : [
+
+                        ]
+
+                    }
+                ]
+
+            },
+            '|xns' : 'Roo',
+            background : false,
+            region : 'center',
+            title : "Terms",
+            xtype : 'NestedLayoutPanel',
+            xns : Roo,
+            items : [
+
+            ]
+
+        };    }
+});
diff --git a/metasql/registrar.invoice.sql b/metasql/registrar.invoice.sql
deleted file mode 100644 (file)
index 0c16649..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-
-SELECT 
-        invchead_id,
-        invchead_invcdate,
-        invcitem_custpn,
-        invcitem_price,
-        invcitem_billed,
-        invchead_billto_registrar_organization,
-        invchead_billto_name,
-        invchead_billto_address1,
-        invchead_billto_address2,
-        invchead_billto_address3,
-        invchead_billto_city,
-        invchead_billto_state,
-        invchead_billto_zipcode,
-        invchead_billto_phone,
-        invchead_billto_country,
-        amount,
-        SUM(amount) OVER (ORDER BY x.invchead_invcdate ASC, x.invchead_id ASC) AS balance,
-        item_number,
-        item_descrip1,
-        (
-            SELECT 
-                    array_to_string(array_agg(item.item_number), E'\n')
-            FROM
-                    invcitem
-            LEFT JOIN
-                    invchead AS invchead
-            ON
-                    invchead.invchead_id = invcitem_invchead_id
-            LEFT JOIN
-                    item AS item
-            ON
-                    item.item_id = invcitem_item_id
-            WHERE
-                (
-                        (item.item_type = 'R')
-                    AND
-                        (invcitem_invchead_id = x.invchead_id)
-                )
-        ) AS parts
-FROM
-(
-    SELECT 
-            invchead_id,
-            invchead_invcdate,
-            invcitem_custpn,
-            invcitem_price,
-            invcitem_billed,
-            invchead.invchead_billto_registrar_organization AS invchead_billto_registrar_organization,
-            invchead.invchead_billto_name AS invchead_billto_name,
-            invchead.invchead_billto_address1 AS invchead_billto_address1,
-            invchead.invchead_billto_address2 AS invchead_billto_address2,
-            invchead.invchead_billto_address3 AS invchead_billto_address3,
-            invchead.invchead_billto_city AS invchead_billto_city,
-            invchead.invchead_billto_state AS invchead_billto_state,
-            invchead.invchead_billto_zipcode AS invchead_billto_zipcode,
-            invchead.invchead_billto_phone AS invchead_billto_phone,
-            invchead.invchead_billto_country AS invchead_billto_country,
-            COALESCE(currtocurr(
-                aropen.aropen_curr_id,
-                custinfo.cust_curr_id,
-                (aropen.aropen_amount - aropen.aropen_paid),
-                aropen.aropen_distdate
-            ), 0) AS amount,
-            item.item_number,
-            item.item_descrip1
-    FROM 
-            invcitem
-    LEFT JOIN
-            invchead AS invchead
-    ON
-            invchead.invchead_id = invcitem_invchead_id
-    LEFT JOIN
-            custinfo AS custinfo
-    ON
-            custinfo.cust_id = invchead.invchead_cust_id
-    LEFT JOIN
-            item AS item
-    ON
-            item.item_id = invcitem_item_id
-    LEFT JOIN
-            aropen AS aropen
-    ON
-            aropen.aropen_doctype = 'I'
-            AND
-            aropen.aropen_docnumber =  invchead.invchead_invcnumber
-    WHERE
-        (
-                (item.item_type = 'K')
-            <? if exists("cust_id") ?>
-            AND 
-                (invchead.invchead_cust_id = <? value("cust_id") ?>)
-            <? endif ?>
-            <? if exists("search") ?>
-            AND 
-                (
-                    invcitem_custpn ILIKE <? value("search") ?>
-                    OR
-                    invchead.invchead_billto_registrar_organization ILIKE <? value("search") ?>
-                    OR
-                    invchead.invchead_billto_name ILIKE <? value("search") ?>
-                )
-            <? endif ?>
-            <? if exists("status") ?>
-            AND 
-                CASE WHEN <? value("status") ?> = 'paid' THEN
-                    (aropen.aropen_amount <= aropen.aropen_paid)
-                ELSE
-                    (aropen.aropen_amount > aropen.aropen_paid)
-                END
-            <? endif ?>
-        )
-
-    ORDER BY invchead.invchead_invcdate ASC, invchead.invchead_id ASC
-) AS x
-
-ORDER BY <? value("sort") ?> <? value("dir") ?>, invchead_id <? value("dir") ?>
-;
\ No newline at end of file