Pman.Tab.XtupleDashboard.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 8 May 2014 03:48:43 +0000 (11:48 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 8 May 2014 03:48:43 +0000 (11:48 +0800)
Pman.Tab.XtupleDashboard.js

Pman.Tab.XtupleDashboard.bjs
Pman.Tab.XtupleDashboard.js

index c07229c..0ad70d6 100644 (file)
                                                         {
                                                             "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           _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}"
+                                                                "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",
index 662768c..963d592 100644 (file)
@@ -192,14 +192,7 @@ Pman.Tab.XtupleDashboard = new Roo.XComponent({
                                                                _this.mto.hide(); 
                                                                _this.daypick.hide();
                                                                
-                                                               _this.dateRange = function() {
-                                                                    return {
-                                                                       date_from : _this.mfrom.getValue(),
-                                                                        date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.YEAR, 1).format('Y-m-d')
-                                                             
-                                                                    };
-                                                               
-                                                               };
+                                                          
                                                                
                                                                
                                                                 break;
@@ -212,12 +205,7 @@ Pman.Tab.XtupleDashboard = new Roo.XComponent({
                                                                _this.mfrom.show();
                                                                _this.mto.hide(); 
                                                                _this.daypick.hide();
-                                                               _this.dateRange = function() {
-                                                                    return {
-                                                                        date_from : _this.mfrom.getValue(),
-                                                                        date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.MONTH, 6).format('Y-m-d')
-                                                                    };
-                                                               };
+                                                             
                                                               break;
                                                             case 'Q':                
                                                             
@@ -227,12 +215,7 @@ Pman.Tab.XtupleDashboard = new Roo.XComponent({
                                                                _this.mfrom.show();
                                                                _this.mto.hide(); 
                                                                _this.daypick.hide();
-                                                               _this.dateRange = function() {
-                                                                    return {
-                                                                        date_from : _this.mfrom.getValue(),
-                                                                        date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.MONTH, 3).format('Y-m-d')
-                                                                    };
-                                                                };   
+                                                                  
                                                                 break;
                                                     
                                                             case 'M':        
@@ -241,12 +224,7 @@ Pman.Tab.XtupleDashboard = new Roo.XComponent({
                                                                _this.mfrom.show();
                                                                _this.mto.hide(); 
                                                                _this.daypick.hide();
-                                                                _this.dateRange = function() {
-                                                                    return {
-                                                                        date_from : _this.mfrom.getValue(),
-                                                                        date_to :Date.parseDate(_this.mfrom.getValue(), 'Y-n-d').add(Date.MONTH, 1).format('Y-m-d')
-                                                                    };
-                                                                };   
+                                                                 
                                                                 break;        
                                                             
                                                     
@@ -262,12 +240,7 @@ Pman.Tab.XtupleDashboard = new Roo.XComponent({
                                                                  _this.mfrom.show();
                                                                 _this.mto.show(); 
                                                                 _this.daypick.hide();
-                                                                 _this.dateRange = function() {
-                                                                    return {
-                                                                        date_from : _this.mfrom.getValue(),
-                                                                        date_to : _this.mto.getValue()
-                                                                    };
-                                                                };   
+                                                                 
                                                                 
                                                                 
                                                                 break;