},
{
"listeners": {
- "render": "function (_self)\n{\n _this.viewType = _self;\n _this.dateRange = function() {\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}",
- "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 _this.dateRange = function() {\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 \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 _this.dateRange = function() {\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 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 _this.dateRange = function() {\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 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 _this.dateRange = function() {\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 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 _this.dateRange = function() {\n return {\n date_from : _this.mfrom.getValue(),\n date_to : _this.mto.getValue()\n };\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}"
+ "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",
"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": [
{
"items": [
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByCustomer',\n params : {\n \n date_from : _this.mfrom.getValue(),\n date_to :_this.mto.getValue()\n }\n \n \n });\n}\n"
+ "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",
},
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByCountry',\n params : _this.dateRange()\n \n });\n}\n"
+ "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",
},
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SalesByProduct',\n params : _this.dateRange()\n \n });\n}\n"
+ "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",
},
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/PurchasesByVendor',\n params : _this.dateRange()\n \n });\n}\n"
+ "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",
},
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/PurchasesByProduct',\n params : _this.dateRange()\n \n });\n}\n"
+ "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",
},
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/StockAtLocation',\n params : _this.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"
+ "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",
},
{
"listeners": {
- "click": "function (_self, e)\n{\n new Pman.Download({\n url :baseURL + '/Xtuple/Reports/SGTax',\n params : _this.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"
+ "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",