Pman.Dialog.XtuplePurchaseOrder.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 10 Dec 2013 05:44:37 +0000 (13:44 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 10 Dec 2013 05:44:37 +0000 (13:44 +0800)
Pman.Dialog.XtuplePurchaseOrder.js

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

index 62d6984..cb4d84d 100644 (file)
                                                         },
                                                         {
                                                             "listeners": {
-                                                                "|click": "function()\n{\n    var s = _this.gltransgrid.getSelected();\n    if (s) {\n        Roo.MessageBox.alert(\"Error\", \"Select an item to reverse\");\n        return;\n    }\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"
+                                                                "|click": "function()\n{\n    var s = _this.gltransgrid.getSelected();\n    if (s) {\n        Roo.MessageBox.alert(\"Error\", \"Select an item to reverse\");\n        return;\n    }\n    \n    var fixit = function(){\n        new Pman.Request({\n            url : baseURL + '/Roo/invdetail.php',\n            method :'POST',\n            params : {\n                invdetail_id : s.data.invdetail_id,\n                _reverse : 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 reverse that line\",\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": "Reverse",
index 87cf35a..df04c5f 100644 (file)
@@ -1669,17 +1669,14 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                             Roo.MessageBox.alert("Error", "Select an item to reverse");
                                                             return;
                                                         }
-                                                       
-                                                        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',
+                                                                url : baseURL + '/Roo/invdetail.php',
                                                                 method :'POST',
                                                                 params : {
-                                                                    pohead_id : pohead_id,
-                                                                    _unitcost : 1
+                                                                    invdetail_id : s.data.invdetail_id,
+                                                                    _reverse : 1
                                                                     
                                                                 },
                                                                 success : function(res) {
@@ -1690,7 +1687,7 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                         
                                                         Roo.MessageBox.confirm(
                                                             "Confirm",
-                                                            "Are you sure to fix the unit cost of " + pohead_number + " ?",
+                                                            "Are you sure to reverse that line",
                                                             function(r) {
                                                                 if (r != 'yes') {
                                                                     return;