{ "id": "roo-file-605", "name": "Pman.Tab.XtupleDashboard", "parent": "Pman", "title": "Pman.Tab.XtupleDashboard", "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleDashboard.bjs", "items": [ { "listeners": { "activate": "function (_self)\n{\n \n try {\n // Pman.Xtuple.DashboardRender.load(); \n } catch (e) {\n Roo.log(e);\n }\n \n}" }, "region": "center", "title": "Management Dashboard", "xtype": "NestedLayoutPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "BorderLayout", "*prop": "layout", "items": [ { "*prop": "west", "hidden": false, "split": true, "width": 200, "xtype": "LayoutRegion", "|xns": "Roo" }, { "*prop": "center", "xtype": "LayoutRegion", "|xns": "Roo" }, { "listeners": { "render": "function (_self)\n{\n _this.dashpanel = _self;\n \n \n (function() { \n this.layout.getRegion('center').showPanel(0);\n }).defer(100,this);\n}" }, "region": "center", "xtype": "NestedLayoutPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "BorderLayout", "*prop": "layout", "items": [ { "*prop": "center", "hideTabs": true, "xtype": "LayoutRegion", "|xns": "Roo" }, { "listeners": { "render": "function (_self)\n{\n _this.viewPanel = _self;\n \n \n //_this.paper = Raphael(_self.el.dom);\n \n\n \n \n \n \n}", "resize": "function (_self, width, height)\n{\n \n Roo.log(\"RESIZE\");\n /* _this.svg.attr(\"width\", width)\n .attr(\"height\", height);\n */\n // _this.paper.setSize(width, 400);\n try {\nPman.Clipping.DashboardRender.resize(width,height);\n } catch (e) {\n Roo.log(e);\n }\n\n \n \n}", "activate": "function (_self)\n{\n if (!_this.loadonce) {\n _this.loadonce = true;\n \n (function () { Pman.Xtuple.DashboardRender.load(); }).defer(1000); \n }\n}" }, "autoScroll": true, "fitContainer": true, "fitToFrame": true, "region": "center", "xtype": "ContentPanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "text": "Show : ", "xtype": "TextItem", "|xns": "Roo.Toolbar" }, { "listeners": { "render": "function (_self)\n{\n _this.countryCombo= _self;\n}" }, "allowBlank": true, "displayField": "addr_country", "editable": false, "emptyText": " Country", "forceSelection": true, "listWidth": 400, "loadingText": "Searching...", "minChars": 2, "name": "addr_country", "pageSize": 20, "qtip": "Select addr", "selectOnFocus": true, "tpl": "
{addr_country}
", "triggerAction": "all", "typeAhead": true, "width": 100, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "listeners": { "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params._distinct = 'addr_country';\n o.params._columns = 'addr_country'; \n o.params['!addr_country'] = '';\n}\n" }, "*prop": "store", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ direction : 'ASC', field: 'addr_country' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|xns": "Roo.data", "|url": "baseURL + '/Roo/addr.php'" }, { "*prop": "reader", "xtype": "JsonReader", "|xns": "Roo.data", "id": "id", "root": "data", "totalProperty": "total", "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"addr_line1\",\"type\":\"string\"}]" } ] } ] }, { "listeners": { "render": "function (_self)\n{\n _this.viewType = _self;\n \n}", "select": "function (combo, record, index)\n{\n Roo.log('select');\n // Pman.Clipping.DashboardRender.load();\n var n = new Date();\n var ys = n.format('Y' )+ '-05-01';\n n = Date.parseDate(ys, 'Y-n-d');\n \n var ftype = record ? record.data.ftype : this.getValue();\n \n switch(ftype) {\n case 'Y':\n //Roo.log(Date.parseDate(ys, 'Y-n-d'));\n _this.mfrom.setValue(Date.parseDate(ys, 'Y-n-d'));\n _this.mfrom.show();\n _this.mto.hide(); \n _this.daypick.hide();\n \n \n \n \n break;\n case 'H': \n // ?? latest half\n var m = (new Date()).format('n')*1 > 6 ? 6 : 0;\n Roo.log(m);\n Roo.log( n.add(Date.MONTH,m));\n _this.mfrom.setValue(n.add(Date.MONTH,m)); \n _this.mfrom.show();\n _this.mto.hide(); \n _this.daypick.hide();\n \n break;\n case 'Q': \n \n var m = Math.floor(((new Date()).format('n') *1 -1) / 4) * 4;\n\n _this.mfrom.setValue(n.add(Date.MONTH, m)); \n _this.mfrom.show();\n _this.mto.hide(); \n _this.daypick.hide();\n \n break;\n\n case 'M': \n var m = (new Date()).format('n') *1 - 1 ;\n _this.mfrom.setValue(n.add(Date.MONTH, m ));\n _this.mfrom.show();\n _this.mto.hide(); \n _this.daypick.hide();\n \n break; \n \n\n \n case 'R':\n // this month..\n var m = (new Date()).format('n') * 1; \n _this.mfrom.setValue(n.add(Date.MONTH, m-1 )); \n _this.mto.setValue(n.add(Date.MONTH,m )); \n \n \n \n _this.mfrom.show();\n _this.mto.show(); \n _this.daypick.hide();\n \n \n \n break;\n /*\n case 'W': // today\n var d = (new Date()).format('w') * -1;\n _this.daypick.setValue( (new Date()).add(Date.DAY, d )); \n _this.mfrom.hide();\n _this.mto.hide(); \n _this.daypick.show();\n break;\n \n \n case 'D': // today\n _this.daypick.setValue(new Date()); \n _this.mfrom.hide();\n _this.mto.hide(); \n _this.daypick.show();\n break;\n */\n default:\n alerT(\"oops invalid ftype?\");\n return;\n }\n \n \n \n}" }, "allowBlank": false, "displayField": "fname", "editable": false, "fieldLabel": "Status", "hiddenName": "cm_status", "listWidth": 200, "mode": "local", "name": "cm_status_name", "triggerAction": "all", "value": "R", "valueField": "ftype", "width": 150, "xtype": "ComboBox", "|dateRange": "function() {\n\n \n var ftype = this.getValue();\n \n switch(ftype) {\n case 'Y':\n \n \n return {\n date_from : _this.mfrom.getValue(),\n date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.YEAR, 1).format('Y-m-d')\n \n };\n ;\n \n \n break;\n case 'H': \n // \n return {\n date_from : _this.mfrom.getValue(),\n date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.MONTH, 6).format('Y-m-d')\n };\n \n break;\n case 'Q': \n \n \n \n return {\n date_from : _this.mfrom.getValue(),\n date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.MONTH, 3).format('Y-m-d')\n };\n \n break;\n\n case 'M': \n \n return {\n date_from : _this.mfrom.getValue(),\n date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.MONTH, 1).format('Y-m-d')\n };\n \n \n \n\n \n case 'R':\n \n return {\n date_from : _this.mfrom.getValue(),\n date_to : _this.mto.getValue()\n };\n \n \n break;\n \n default:\n Roo.MessageBox.alert(\"select range\");\n return;\n }\n \n}\n", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "[ \n [ 'Y', \"Show Year From\"],\n [ 'H' , \"6 Months From\"],\n [ 'Q', \"3 Months From\"] ,\n [ 'M', \"Single Month\"],\n // [ 'W', \"Single Week Starting\"],\n [ 'R', \"Between these Dates\"] //,\n // [ 'D', \"Single Day\"]\n \n]\n", "|fields": "[ 'ftype', 'fname']", "|xns": "Roo.data" } ] }, { "listeners": { "render": "function (_self)\n{\n _this.mfrom= _self;\n}" }, "format": "d/M/Y", "useIso": true, "xtype": "DateField", "|value": "(function() {\n var n = new Date();\n // previous apr.\n var y = n.format('Y');\n if (n.format('m') < 5) { \n y--;\n }\n \n return Date.parseDate(y + '-05-01', 'Y-m-d');\n})()", "|xns": "Roo.form" }, { "listeners": { "render": "function (_self)\n{\n _this.mto= _self;\n //this.hide();\n}" }, "format": "d/M/Y", "useIso": true, "xtype": "DateField", "|value": "(function() {\n var n = (new Date()).add(Date.YEAR, 1);\n \n var n = new Date();\n // previous apr.\n var y = n.format('Y');\n if (n.format('m') >= 5) { \n y++;\n }\n \n return Date.parseDate(y + '-05-01', 'Y-m-d');\n \n \n\n})()", "|xns": "Roo.form" }, { "listeners": { "render": "function (_self)\n{\n _this.daypick = _self;\n this.hide();\n}" }, "format": "d/M/Y", "useIso": true, "xtype": "DateField", "|value": "(function() {\n// var n = new Date();\n return new Date();\n})()", "|xns": "Roo.form" }, { "listeners": { "click": "function (_self, e)\n{\n Pman.Xtuple.DashboardRender.load();\n}" }, "text": "Run Report", "xtype": "Button", "|xns": "Roo.Toolbar" }, { "text": "Other Reports", "xtype": "Button", "|xns": "Roo.Toolbar", "items": [ { "|xns": "Roo.menu", "xtype": "Menu", "*prop": "menu", "items": [ { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByCustomer',\n params : _this.viewType.dateRange()\n \n \n });\n}\n" }, "text": "Sales By Customer", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByCountry',\n params : _this.viewType.dateRange()\n \n });\n}\n" }, "text": "Sales By Country", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByProduct',\n params : _this.viewType.dateRange()\n \n });\n}\n" }, "text": "Sales By Product", "xtype": "Item", "|xns": "Roo.menu" }, { "|xns": "Roo.menu", "xtype": "Separator" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/PurchasesByVendor',\n params : _this.viewType.dateRange()\n \n });\n}\n" }, "text": "Purchases By Vendor", "xtype": "Item", "|xns": "Roo.menu" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/PurchasesByProduct',\n params : _this.viewType.dateRange()\n \n });\n}\n" }, "text": "Purchases By Product", "xtype": "Item", "|xns": "Roo.menu" }, { "|xns": "Roo.menu", "xtype": "Separator" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/StockAtLocation',\n params : _this.viewType.dateRange()\n \n });\n Roo.MessageBox.alert(\"Downloading\", \n \"The file will start downloading shortly - it may take around 1-2 minutes to calculate\");\n \n}\n" }, "text": "Historical Stock Levels (EO HKFY)", "xtype": "Item", "|xns": "Roo.menu" }, { "|xns": "Roo.menu", "xtype": "Separator" }, { "listeners": { "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SGTax',\n params : _this.viewType.dateRange()\n \n });\n Roo.MessageBox.alert(\"Downloading\", \n \"The file will start downloading shortly - it may take around 1-2 minutes to calculate\");\n \n}\n" }, "text": "SG Tax report", "xtype": "Item", "|xns": "Roo.menu" } ] } ] }, { "|xns": "Roo.Toolbar", "xtype": "Spacer" }, { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "text": "Theme : ", "xtype": "TextItem", "|xns": "Roo.Toolbar" }, { "listeners": { "select": "function (combo, record, index)\n{\n Pman.Xtuple.DashboardRender.load();\n}", "render": "function (_self)\n{\n _this.themeCombo = this;\n}" }, "allowBlank": false, "displayField": "name", "editable": false, "hiddenName": "colortheme", "listWidth": 300, "name": "colorTheme_title", "qtip": "Select a Color Theme", "selectOnFocus": true, "triggerAction": "all", "typeAhead": false, "valueField": "themeData", "xtype": "ComboBox", "|value": "(function() {\n return Pman.Xtuple ? Pman.Xtuple.DashboardRender.colorthemes()[12][1] : ''; \n})() ", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "(function() {\n return (typeof Pman.Xtuple != 'undefined') ? Pman.Xtuple.DashboardRender.colorthemes() : [];\n \n})()", "|fields": "['name','themeData']", "|xns": "Roo.data" } ] } ] } ] }, { "listeners": { "render": "function (_self)\n{\n _this.reportpanel = _self;\n}" }, "autoScroll": true, "fitToFrame": true, "region": "center", "xtype": "ContentPanel", "|showReport": "function(node, isxls) {\n if (node) {\n _this.selectedNode = node;\n }\n var rc = _this.reportCompany.getValue();\n var params = {\n flhead_name : _this.selectedNode.attributes.text,\n ts : Math.random(),\n period : _this.reportDateFrom.getValue(),\n interval: _this.reportInterval.getValue(),\n company : (_this.reportCompany.hidden) ? '' : rc == 'consolidated' ? '' : rc,\n singleCountry : rc == 'consolidated' ? 0 : 1\n };\n \n if (isxls) {\n params._xls = 1;\n new Pman.Download({\n url : baseURL + '/Xtuple/Reports/ConsolidatedAccounts',\n method: 'GET',\n timeout: 120000,\n params : params\n });\n Roo.MessageBox.alert(\"Notice\", \"Report is downloading now for the combined report this will take about 50s\");\n return;\n }\n var el = this.region.el;\n\n var done = false;\n var v= 0;\n var f = function(){\n if (done) {\n return;\n }\n Roo.MessageBox.updateProgress(v/50, 'Loading.. Around ' + (50-v) + ' seconds to go');\n v++;\n f.defer(1000)\n };\n Roo.MessageBox.show({\n title: 'Please wait...',\n msg: 'Loading...',\n width:240,\n progress:true,\n closable:true\n });\n \n\n \n ///el.mask(\"Loading - Should take around 45 seconds
if it takes longer than 2 minutes, then something is broken
If nothing displays try doing shift-reload or ctrl-reload\");\n this.load({\n url : baseURL + '/Xtuple/Reports/ConsolidatedAccounts',\n method: 'GET',\n params : params,\n timeout: 120,\n callback: function() {\n done = true;\n Roo.MessageBox.hide();\n }\n \n });\n \n f();\n \n}\n", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "text": "Report Range :", "xtype": "TextItem", "|xns": "Roo.Toolbar" }, { "listeners": { "render": "function (_self)\n{\n _this.reportDateFrom = _self;\n}", "select": "function (combo, date)\n{\n //_this.grid.footer.onClick('first');\n}" }, "format": "d/M/Y", "useIso": 1, "width": 120, "xtype": "DateField", "|value": "(function() { \n return Date.parseDate( \n '' + (new Date()).format('Y-m') + '-01'\n , 'Y-m-d' ); })()", "|xns": "Roo.form" }, { "listeners": { "render": "function (_self)\n{\n _this.reportInterval = _self;\n}", "select": "function (combo, record, index)\n{\n // Roo.log('select');\n // _this.grid.footer.onClick('first');\n}" }, "allowBlank": false, "displayField": "fname", "editable": false, "fieldLabel": "Status", "hiddenName": "cm_status", "listWidth": 400, "mode": "local", "name": "cm_status_name", "triggerAction": "all", "value": "Y", "valueField": "ftype", "width": 200, "xtype": "ComboBox", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "[ \n [ 'Y', \"Since Start of Financial Year\"],\n [ 'YY' , \"Since Start of Financial Year with same range Previous Year\"], \n [ 'M' , \"Single Month\"],\n [ 'MM' , \"Single Month with Previous Month\"], \n [ 'MY' , \"Single Month with Previous Year\"],\n [ 'MF' , \"This Months of Financia Year\"],\n [ 'ML' , \"Last 12 Months\"]\n]\n", "|fields": "[ 'ftype', 'fname']", "|xns": "Roo.data" } ] }, { "listeners": { "render": "function (_self)\n{\n _this.reportCompany = _self;\n}" }, "allowBlank": false, "displayField": "fname", "editable": false, "fieldLabel": "Status", "hiddenName": "report_company", "listWidth": 300, "mode": "local", "name": "report_company_name", "triggerAction": "all", "value": "hk", "valueField": "ftype", "width": 100, "xtype": "ComboBox", "|hidden": "(function() {\n\n return baseURL.match(/hk\\.php$/) ? false : true;\n})()", "|xns": "Roo.form", "items": [ { "*prop": "store", "xtype": "SimpleStore", "|data": "[ \n [ 'hk', \"Hong Kong\"],\n [ 'sg' , \"Singapore\"], \n [ 'my' , \"Malaysia\"],\n [ 'cn' , \"China\"], \n [ 'au' , \"Australia\"],\n [ 'consolidated' , \"Consolidated\"]\n]\n", "|fields": "[ 'ftype', 'fname']", "|xns": "Roo.data" } ] }, { "listeners": { "click": "function (_self, e)\n{\n _this.reportpanel.showReport(); \n}" }, "text": "Refresh Report", "xtype": "Button", "|xns": "Roo.Toolbar" }, { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "click": "function (_self, e)\n{\n _this.reportpanel.showReport(false,'xls'); \n}" }, "text": "Download XLS", "xtype": "Button", "|xns": "Roo.Toolbar" } ] } ] } ] } ] }, { "listeners": { "render": "function (_self)\n{\n _this.tree = _self;\n}" }, "fitToFrame": true, "region": "west", "xtype": "TreePanel", "|xns": "Roo", "items": [ { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar" }, { "*prop": "tree", "rootVisible": false, "xtype": "TreePanel", "|xns": "Roo.tree", "items": [ { "*prop": "root", "id": "root", "xtype": "TreeNode", "|xns": "Roo.tree" }, { "listeners": { "selectionchange": "function (_self, node)\n{\n var at = node.attributes.id;\n if (at > 999) {\n _this.dashpanel.layout.getRegion('center').showPanel(0);\n Pman.Xtuple.DashboardRender.load();\n return;\n \n }\n _this.dashpanel.layout.getRegion('center').showPanel(1);\n _this.reportpanel.showReport(node); \n \n \n}" }, "*prop": "selModel", "xtype": "DefaultSelectionModel", "|xns": "Roo.tree" }, { "*prop": "loader", "requestMethod": "GET", "xtype": "TreeLoader", "|baseParams": "{ _tree : 1, _dragon_only : 1 }", "|dataUrl": "baseURL + '/Roo/Flhead'", "|xns": "Roo.tree" }, { "|xns": "Roo.tree", "xtype": "AsyncTreeNode", "*prop": "root" } ] } ] } ] } ] } ], "permname": "", "modOrder": "001" }