Pman.Dialog.XtuplePurchaseOrder.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 18 Dec 2013 10:20:16 +0000 (18:20 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 18 Dec 2013 10:20:16 +0000 (18:20 +0800)
Pman.Dialog.XtuplePurchaseOrder.js

Pman.Dialog.XtuplePurchaseOrder.bjs
Pman.Dialog.XtuplePurchaseOrder.js

index c393d4c..42df3c6 100644 (file)
                                                                     "xtype": "Menu",
                                                                     "*prop": "menu",
                                                                     "items": [
+                                                                        {
+                                                                            "listeners": {
+                                                                                "|click": "function()\n{\n    var pohead_number = _this.form.findField('pohead_number').getValue();\n    var pohead_id = _this.form.findField('pohead_id').getValue();\n        \n    var fixit = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/pohead.php',\n            method :'POST',\n            params : {\n                pohead_id : pohead_id,\n                _unitcost : 1\n                \n            },\n            success : function(res) {\n                Roo.MessageBox.alert('Notice', 'DONE');\n            }\n        });\n    }\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\",\n        \"Are you sure to fix the unit cost of \" + pohead_number + \" ?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n\n            fixit();\n            return;\n        }\n    ); \n    \n    \n}\n"
+                                                                            },
+                                                                            "cls": "x-btn-text-icon",
+                                                                            "text": "Fix Unit Cost",
+                                                                            "xtype": "Item",
+                                                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                                                            "|xns": "Roo.menu"
+                                                                        },
                                                                         {
                                                                             "listeners": {
                                                                                 "|click": "function()\n{\n    var pohead_number = _this.form.findField('pohead_number').getValue();\n    var pohead_id = _this.form.findField('pohead_id').getValue();\n        \n    var addv = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/pohead.php',\n            method :'POST',\n            params : {\n                pohead_id : pohead_id,\n                _variance : 1\n                \n            },\n            success : function(res) {\n                Roo.MessageBox.alert('Notice', 'DONE');\n            }\n        });\n    }\n    \n    Roo.MessageBox.confirm(\n        \"Confirm\",\n        \"Are you sure to add all the variance for \" + pohead_number + \" ?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n\n            addv();\n            return;\n        }\n    ); \n    \n    \n}\n"
index 702ef3f..aec6e54 100644 (file)
@@ -1480,6 +1480,50 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                     xtype: 'Menu',
                                                     xns: Roo.menu,
                                                     items : [
+                                                        {
+                                                            xtype: 'Item',
+                                                            xns: Roo.menu,
+                                                            listeners : {
+                                                                click : function()
+                                                                {
+                                                                    var pohead_number = _this.form.findField('pohead_number').getValue();
+                                                                    var pohead_id = _this.form.findField('pohead_id').getValue();
+                                                                        
+                                                                    var fixit = function(){
+                                                                        new Pman.Request({
+                                                                            url : baseURL + '/Roo/pohead.php',
+                                                                            method :'POST',
+                                                                            params : {
+                                                                                pohead_id : pohead_id,
+                                                                                _unitcost : 1
+                                                                                
+                                                                            },
+                                                                            success : function(res) {
+                                                                                Roo.MessageBox.alert('Notice', 'DONE');
+                                                                            }
+                                                                        });
+                                                                    }
+                                                                    
+                                                                    Roo.MessageBox.confirm(
+                                                                        "Confirm",
+                                                                        "Are you sure to fix the unit cost of " + pohead_number + " ?",
+                                                                        function(r) {
+                                                                            if (r != 'yes') {
+                                                                                return;
+                                                                            }
+                                                                
+                                                                            fixit();
+                                                                            return;
+                                                                        }
+                                                                    ); 
+                                                                    
+                                                                    
+                                                                }
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Fix Unit Cost",
+                                                            icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                        },
                                                         {
                                                             xtype: 'Item',
                                                             xns: Roo.menu,