Pman.Tab.XtupleCurrency.bjs
[Pman.Xtuple] / Pman.Tab.XtupleCurrency.js
index 0d8361e..05f48e1 100644 (file)
@@ -256,6 +256,57 @@ Pman.Tab.XtupleCurrency = new Roo.XComponent({
                                     {
                                         xtype: 'Fill',
                                         xns: Roo.Toolbar
+                                    },
+                                    {
+                                        xtype: 'Button',
+                                        xns: Roo.Toolbar,
+                                        listeners : {
+                                            click : function ()
+                                            {
+                                            
+                                                 var sel  = _this.invgrid.getSelectionModel().getSelected();
+                                                if (!sel) {
+                                                    Roo.MessageBox.alert("Error", "Select a invoice");
+                                                    return;
+                                                }
+                                                // check current status of shipment..
+                                                
+                                                var params =  {
+                                            //        cobmisc_id : sel.data.cobmisc_id,
+                                                    _void : 1
+                                                };
+                                                if (sel.data.cobmisc_id * 1) {
+                                                    params.cobmisc_id = sel.data.cobmisc_id * 1 ;
+                                                }
+                                                if (sel.data.cobmisc_invchead_id_invchead_id * 1) {    
+                                                    params.invchead_id  =  sel.data.cobmisc_invchead_id_invchead_id * 1;
+                                                }
+                                                
+                                                Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that invoice?",
+                                                    function(r) {
+                                                        if (r != 'yes') {
+                                                            return;
+                                                        }
+                                                        new Pman.Request({
+                                                            mask : 'Sending',
+                                                            url : baseURL + '/Roo/cobmisc',
+                                                            method : 'POST',
+                                                            params :  params,
+                                                            success : function() {
+                                                                _this.invgrid.ds.load({});
+                                                            }
+                                                        })
+                                                        
+                                                    }
+                                                );
+                                                        
+                                                        
+                                               
+                                            }
+                                        },
+                                        cls : 'x-btn-text-icon',
+                                        text : "Void / Unpost",
+                                        icon : rootURL + '/Pman/templates/images/trash.gif'
                                     }
                                 ]
                             },