Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtuplePeriods.bjs
index 9d64945..b0c39db 100644 (file)
 {
-    "id": "roo-file-47",
-    "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": "007"
+    ]
 }
\ No newline at end of file