3 "name": "Pman.Tab.XtupleDashboard",
5 "title": "Pman.Tab.XtupleDashboard",
6 "path": "/home/alan/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleDashboard.bjs",
10 "activate": "function (_self)\n{\n \n try {\n // Pman.Xtuple.DashboardRender.load(); \n } catch (e) {\n Roo.log(e);\n }\n \n}"
13 "title": "Management Dashboard",
14 "xtype": "NestedLayoutPanel",
19 "xtype": "BorderLayout",
27 "xtype": "LayoutRegion",
32 "xtype": "LayoutRegion",
37 "render": "function (_self)\n{\n _this.dashpanel = _self;\n \n \n (function() { \n this.layout.getRegion('center').showPanel(0);\n }).defer(100,this);\n}"
40 "xtype": "NestedLayoutPanel",
45 "xtype": "BorderLayout",
51 "xtype": "LayoutRegion",
56 "render": "function (_self)\n{\n _this.viewPanel = _self;\n \n \n //_this.paper = Raphael(_self.el.dom);\n \n\n \n \n \n \n}",
57 "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}",
58 "activate": "function (_self)\n{\n if (!_this.loadonce) {\n _this.loadonce = true;\n \n (function () { Pman.Xtuple.DashboardRender.load(); }).defer(1000); \n }\n}"
64 "xtype": "ContentPanel",
79 "render": "function (_self)\n{\n _this.countryCombo= _self;\n}"
82 "displayField": "addr_country",
84 "emptyText": " Country",
85 "forceSelection": true,
87 "loadingText": "Searching...",
89 "name": "addr_country",
91 "qtip": "Select addr",
92 "selectOnFocus": true,
93 "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{addr_country}</b> </div>",
94 "triggerAction": "all",
102 "|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"
107 "|sortInfo": "{ direction : 'ASC', field: 'addr_country' }",
112 "xtype": "HttpProxy",
115 "|url": "baseURL + '/Roo/addr.php'"
119 "xtype": "JsonReader",
123 "totalProperty": "total",
124 "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"addr_line1\",\"type\":\"string\"}]"
132 "render": "function (_self)\n{\n _this.viewType = _self;\n \n}",
133 "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}"
136 "displayField": "fname",
138 "fieldLabel": "Status",
139 "hiddenName": "cm_status",
142 "name": "cm_status_name",
143 "triggerAction": "all",
145 "valueField": "ftype",
148 "|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",
153 "xtype": "SimpleStore",
154 "|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",
155 "|fields": "[ 'ftype', 'fname']",
162 "render": "function (_self)\n{\n _this.mfrom= _self;\n}"
166 "xtype": "DateField",
167 "|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})()",
172 "render": "function (_self)\n{\n _this.mto= _self;\n //this.hide();\n}"
176 "xtype": "DateField",
177 "|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})()",
182 "render": "function (_self)\n{\n _this.daypick = _self;\n this.hide();\n}"
186 "xtype": "DateField",
187 "|value": "(function() {\n// var n = new Date();\n return new Date();\n})()",
192 "click": "function (_self, e)\n{\n Pman.Xtuple.DashboardRender.load();\n}"
194 "text": "Run Report",
196 "|xns": "Roo.Toolbar"
199 "text": "Other Reports",
201 "|xns": "Roo.Toolbar",
210 "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"
212 "text": "Sales By Customer",
218 "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByCountry',\n params : _this.viewType.dateRange()\n \n });\n}\n"
220 "text": "Sales By Country",
226 "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByProduct',\n params : _this.viewType.dateRange()\n \n });\n}\n"
228 "text": "Sales By Product",
238 "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/PurchasesByVendor',\n params : _this.viewType.dateRange()\n \n });\n}\n"
240 "text": "Purchases By Vendor",
246 "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/PurchasesByProduct',\n params : _this.viewType.dateRange()\n \n });\n}\n"
248 "text": "Purchases By Product",
258 "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"
260 "text": "Historical Stock Levels (EO HKFY)",
270 "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"
272 "text": "SG Tax report",
281 "|xns": "Roo.Toolbar",
285 "|xns": "Roo.Toolbar",
291 "|xns": "Roo.Toolbar"
295 "select": "function (combo, record, index)\n{\n Pman.Xtuple.DashboardRender.load();\n}",
296 "render": "function (_self)\n{\n _this.themeCombo = this;\n}"
299 "displayField": "name",
301 "hiddenName": "colortheme",
303 "name": "colorTheme_title",
304 "qtip": "Select a Color Theme",
305 "selectOnFocus": true,
306 "triggerAction": "all",
308 "valueField": "themeData",
310 "|value": "(function() {\n return Pman.Xtuple ? Pman.Xtuple.DashboardRender.colorthemes()[12][1] : ''; \n})() ",
315 "xtype": "SimpleStore",
316 "|data": "(function() {\n return (typeof Pman.Xtuple != 'undefined') ? Pman.Xtuple.DashboardRender.colorthemes() : [];\n \n})()",
317 "|fields": "['name','themeData']",
328 "render": "function (_self)\n{\n _this.reportpanel = _self;\n}"
333 "xtype": "ContentPanel",
334 "|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 <br/> if it takes longer than 2 minutes, then something is broken<br/> 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",
343 "text": "Report Range :",
345 "|xns": "Roo.Toolbar"
349 "render": "function (_self)\n{\n _this.reportDateFrom = _self;\n}",
350 "select": "function (combo, date)\n{\n //_this.grid.footer.onClick('first');\n}"
355 "xtype": "DateField",
356 "|value": "(function() { \n return Date.parseDate( \n '' + (new Date()).format('Y-m') + '-01'\n , 'Y-m-d' ); })()",
361 "render": "function (_self)\n{\n _this.reportInterval = _self;\n}",
362 "select": "function (combo, record, index)\n{\n // Roo.log('select');\n // _this.grid.footer.onClick('first');\n}"
365 "displayField": "fname",
367 "fieldLabel": "Status",
368 "hiddenName": "cm_status",
371 "name": "cm_status_name",
372 "triggerAction": "all",
374 "valueField": "ftype",
381 "xtype": "SimpleStore",
382 "|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",
383 "|fields": "[ 'ftype', 'fname']",
390 "render": "function (_self)\n{\n _this.reportCompany = _self;\n}"
393 "displayField": "fname",
395 "fieldLabel": "Status",
396 "hiddenName": "report_company",
399 "name": "report_company_name",
400 "triggerAction": "all",
402 "valueField": "ftype",
405 "|hidden": "(function() {\n\n return baseURL.match(/hk\\.php$/) ? false : true;\n})()",
410 "xtype": "SimpleStore",
411 "|data": "[ \n [ 'hk', \"Hong Kong\"],\n [ 'sg' , \"Singapore\"], \n [ 'my' , \"Malaysia\"],\n [ 'cn' , \"China\"], \n [ 'au' , \"Australia\"],\n [ 'consolidated' , \"Consolidated\"]\n]\n",
412 "|fields": "[ 'ftype', 'fname']",
419 "click": "function (_self, e)\n{\n _this.reportpanel.showReport(); \n}"
421 "text": "Refresh Report",
423 "|xns": "Roo.Toolbar"
426 "|xns": "Roo.Toolbar",
431 "click": "function (_self, e)\n{\n _this.reportpanel.showReport(false,'xls'); \n}"
433 "text": "Download XLS",
435 "|xns": "Roo.Toolbar"
447 "render": "function (_self)\n{\n _this.tree = _self;\n}"
451 "xtype": "TreePanel",
461 "rootVisible": false,
462 "xtype": "TreePanel",
473 "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}"
476 "xtype": "DefaultSelectionModel",
481 "requestMethod": "GET",
482 "xtype": "TreeLoader",
483 "|baseParams": "{ _tree : 1, _dragon_only : 1 }",
484 "|dataUrl": "baseURL + '/Roo/Flhead'",
489 "xtype": "AsyncTreeNode",