Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtuplePurchaseOrder.js
index a8889f5..a6c52c2 100644 (file)
@@ -62,6 +62,9 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                             _this.saveBtn.show();
                                             _this.form.findField('pohead_agent_username').setValue(Pman.Login.authUser.name);
                                             _this.form.findField('pohead_orderdate').setValue(new Date());
+                                            _this.form.findField('pohead_bg_arrival_est_day').setValue(new Date());
+                                            _this.form.findField('pohead_bg_available_est_day').setValue(new Date());
+                                            _this.form.findField('pohead_bg_available_latest_day').setValue(new Date());
                                             return;
                                         }
                                         _this.dialog.setTitle("Edit Purchase Order");
@@ -578,7 +581,7 @@ Pman.Dialog.XtuplePurchaseOrder = {
                             },
                             beforeedit : function (e)
                             {
-                                var r = e.record.data.is_receipted * 1;
+                                var r = e.record.data.poitem_qty_received * 1;
                                 
                                 if(r > 0){
                                     Roo.MessageBox.alert("Error", "This item has been receipted");
@@ -612,7 +615,6 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                     
                                     o.params.poitem_pohead_id = hid;
                                     o.params._with_item = 1;
-                                    o.params.is_receipted = 1;
                                     o.params._roo_office = _this.data.office ? _this.data.office : baseURL.split('/').pop().substr(0,2);
                                 
                                 },
@@ -704,10 +706,10 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                 Roo.MessageBox.alert("Error", "Select a cell");
                                                 return;
                                             }
-                                            _this.grid.stopEditing()
+                                            _this.grid.stopEditing();
                                             var r = _this.grid.ds.getAt(cs[0]);
                                             
-                                            if(r.data.is_receipted * 1 > 0){
+                                            if(r.data.poitem_qty_received * 1 > 0){
                                                 Roo.MessageBox.alert("Error", "This item has been receipted");
                                                 return;
                                             }
@@ -913,6 +915,7 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                     field : {
                                         xtype: 'NumberField',
                                         xns: Roo.form,
+                                        allowBlank : false,
                                         allowDecimals : false,
                                         decimalPrecision : 0,
                                         minValue : 1,
@@ -1023,6 +1026,10 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                 
                                                 o.params._with_item = 1;
                                                 
+                                            },
+                                            load : function (_self, records, options)
+                                            {
+                                                _this.gltransgrid.footer.onClick('first');
                                             }
                                         },
                                         remoteSort : true,
@@ -1216,6 +1223,13 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                             width : 50,
                                             renderer : function(v,x,r) 
                                             {
+                                                
+                                            
+                                                var recv = (v- r.data.poitem_qty_returned);
+                                                if (recv !=  r.data.tx_qty) {
+                                                    return String.format('<s style="color:red;font-weight:bold">{0}</s>{1} ', recv, 
+                                                        (r.data.tx_qty *1).toFixed(0)        ) ;      
+                                                }
                                                 return String.format('{0}', (v- r.data.poitem_qty_returned)) ;  
                                                 
                                             }
@@ -1283,7 +1297,7 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                 
                                                 var s = _this.itemgrid.getSelectionModel().getSelected();
                                                 if(!s){
-                                                    Roo.MessageBox.alert('Error', 'Please select a item');
+                                                    this.removeAll();
                                                     return false;
                                                 }
                                                 
@@ -1465,157 +1479,289 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                             {
                                                 xtype: 'Button',
                                                 xns: Roo.Toolbar,
-                                                listeners : {
-                                                    click : function()
-                                                    {
-                                                        var pohead_number = _this.form.findField('pohead_number').getValue();
-                                                        var pohead_id = _this.form.findField('pohead_id').getValue();
-                                                            
-                                                        var addv = function(){
-                                                            new Pman.Request({
-                                                                url : baseURL + '/Roo/pohead.php',
-                                                                method :'POST',
-                                                                params : {
-                                                                    pohead_id : pohead_id,
-                                                                    _variance : 1
+                                                text : "Apply fixes",
+                                                menu : {
+                                                    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();
+                                                                        
+                                                                    
+                                                                        new Pman.Request({
+                                                                            url : baseURL + '/Roo/pohead.php',
+                                                                            mask : 'sending',
+                                                                            method :'POST',
+                                                                            params : {
+                                                                                pohead_id : pohead_id,
+                                                                                _recv_fix : 1
+                                                                                
+                                                                            },
+                                                                            success : function(res) {
+                                                                                Roo.MessageBox.alert('Notice', 'DONE');
+                                                                            }
+                                                                        });
+                                                                    
+                                                                    
+                                                                    
+                                                                    
                                                                     
-                                                                },
-                                                                success : function(res) {
-                                                                    Roo.MessageBox.alert('Notice', 'DONE');
                                                                 }
-                                                            });
-                                                        }
-                                                        
-                                                        Roo.MessageBox.confirm(
-                                                            "Confirm",
-                                                            "Are you sure to add all the variance for " + pohead_number + " ?",
-                                                            function(r) {
-                                                                if (r != 'yes') {
-                                                                    return;
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Repost goods reciept",
+                                                            icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                        },
+                                                        {
+                                                            xtype: 'Separator',
+                                                            xns: Roo.menu
+                                                        },
+                                                        {
+                                                            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;
+                                                                        }
+                                                                    ); 
+                                                                    
+                                                                    
                                                                 }
-                                                    
-                                                                addv();
-                                                                return;
-                                                            }
-                                                        ); 
-                                                        
-                                                        
-                                                    }
-                                                },
-                                                cls : 'x-btn-text-icon',
-                                                text : "Add All Variance",
-                                                icon : Roo.rootURL + 'images/default/tree/leaf.gif'
-                                            },
-                                            {
-                                                xtype: 'Button',
-                                                xns: Roo.Toolbar,
-                                                listeners : {
-                                                    click : function()
-                                                    {
-                                                        var s = _this.gltransgrid.getSelectionModel().getSelected();
-                                                        
-                                                        if(!s){
-                                                            Roo.MessageBox.alert('Error','Please select a transaction');
-                                                            return;
-                                                        }
-                                                        
-                                                        if(s.data.gltrans_misc_id == -1){
-                                                            Roo.MessageBox.alert('Error','Please select a transaction not variance');
-                                                            return;
-                                                        }
-                                                        
-                                                        var addit = function(){
-                                                            new Pman.Request({
-                                                                url : baseURL + '/Roo/Gltrans.php',
-                                                                method :'POST',
-                                                                params : {
-                                                                    gltrans_id : s.data.gltrans_id,
-                                                                    _variance : 1
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Fix Unit Cost",
+                                                            icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                        },
+                                                        {
+                                                            xtype: 'Separator',
+                                                            xns: Roo.menu
+                                                        },
+                                                        {
+                                                            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 addv = function(){
+                                                                        new Pman.Request({
+                                                                            url : baseURL + '/Roo/pohead.php',
+                                                                            method :'POST',
+                                                                            params : {
+                                                                                pohead_id : pohead_id,
+                                                                                _variance : 1
+                                                                                
+                                                                            },
+                                                                            success : function(res) {
+                                                                                Roo.MessageBox.alert('Notice', 'DONE');
+                                                                            }
+                                                                        });
+                                                                    }
                                                                     
-                                                                },
-                                                                success : function(res) {
-                                                                    if(res.data == 0){
-                                                                        Roo.MessageBox.alert('Error','Variance already exist');
+                                                                    Roo.MessageBox.confirm(
+                                                                        "Confirm",
+                                                                        "Are you sure to add all the variance for " + pohead_number + " ?",
+                                                                        function(r) {
+                                                                            if (r != 'yes') {
+                                                                                return;
+                                                                            }
+                                                                
+                                                                            addv();
+                                                                            return;
+                                                                        }
+                                                                    ); 
+                                                                    
+                                                                    
+                                                                }
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Add All Variance",
+                                                            icon : Roo.rootURL + 'images/default/tree/leaf.gif'
+                                                        },
+                                                        {
+                                                            xtype: 'Item',
+                                                            xns: Roo.menu,
+                                                            listeners : {
+                                                                click : function()
+                                                                {
+                                                                    var s = _this.gltransgrid.getSelectionModel().getSelected();
+                                                                    
+                                                                    if(!s){
+                                                                        Roo.MessageBox.alert('Error','Please select a transaction');
+                                                                        return;
+                                                                    }
+                                                                    
+                                                                    if(s.data.gltrans_misc_id != -1){
+                                                                        Roo.MessageBox.alert('Error','Just allow to delete the variance');
+                                                                        return;
+                                                                    }
+                                                                    
+                                                                    var delit = function(){
+                                                                        new Pman.Request({
+                                                                            url : baseURL + '/Roo/Gltrans.php',
+                                                                            method :'POST',
+                                                                            params : {
+                                                                                gltrans_id : s.data.gltrans_id,
+                                                                                _del : 1
+                                                                                
+                                                                            },
+                                                                            success : function(res) {
+                                                                                _this.gltransgrid.footer.onClick('refresh');
+                                                                                
+                                                                            }
+                                                                        });
                                                                     }
-                                                                    _this.gltransgrid.footer.onClick('refresh');
+                                                                    
+                                                                    Roo.MessageBox.confirm(
+                                                                        "Confirm",
+                                                                        "Are you sure to delete ?",
+                                                                        function(r) {
+                                                                            if (r != 'yes') {
+                                                                                return;
+                                                                            }
+                                                                
+                                                                            delit();
+                                                                            return;
+                                                                        }
+                                                                    ); 
+                                                                    
                                                                     
                                                                 }
-                                                            });
-                                                        }
-                                                        
-                                                        Roo.MessageBox.confirm(
-                                                            "Confirm",
-                                                            "Are you sure to add a variance ?",
-                                                            function(r) {
-                                                                if (r != 'yes') {
-                                                                    return;
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Delete Variance",
+                                                            icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                        },
+                                                        {
+                                                            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 delv = function(){
+                                                                        new Pman.Request({
+                                                                            url : baseURL + '/Roo/pohead.php',
+                                                                            method :'POST',
+                                                                            params : {
+                                                                                pohead_id : pohead_id,
+                                                                                _del : 1
+                                                                                
+                                                                            },
+                                                                            success : function(res) {
+                                                                                Roo.MessageBox.alert('Notice', 'DONE');
+                                                                            }
+                                                                        });
+                                                                    }
+                                                                    
+                                                                    Roo.MessageBox.confirm(
+                                                                        "Confirm",
+                                                                        "Are you sure to delete the variance on voucher of " + pohead_number + " ?",
+                                                                        function(r) {
+                                                                            if (r != 'yes') {
+                                                                                return;
+                                                                            }
+                                                                
+                                                                            delv();
+                                                                            return;
+                                                                        }
+                                                                    ); 
+                                                                    
+                                                                    
                                                                 }
-                                                    
-                                                                addit();
-                                                                return;
-                                                            }
-                                                        ); 
-                                                        
-                                                        
-                                                    }
-                                                },
-                                                cls : 'x-btn-text-icon',
-                                                text : "Add Variance",
-                                                icon : Roo.rootURL + 'images/default/tree/leaf.gif'
-                                            },
-                                            {
-                                                xtype: 'Button',
-                                                xns: Roo.Toolbar,
-                                                listeners : {
-                                                    click : function()
-                                                    {
-                                                        var s = _this.gltransgrid.getSelectionModel().getSelected();
-                                                        
-                                                        if(!s){
-                                                            Roo.MessageBox.alert('Error','Please select a transaction');
-                                                            return;
-                                                        }
-                                                        
-                                                        if(s.data.gltrans_misc_id != -1){
-                                                            Roo.MessageBox.alert('Error','Just allow to delete the variance');
-                                                            return;
-                                                        }
-                                                        
-                                                        var delit = function(){
-                                                            new Pman.Request({
-                                                                url : baseURL + '/Roo/Gltrans.php',
-                                                                method :'POST',
-                                                                params : {
-                                                                    gltrans_id : s.data.gltrans_id,
-                                                                    _del : 1
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Delete Varinace on voucher",
+                                                            icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                        },
+                                                        {
+                                                            xtype: 'Separator',
+                                                            xns: Roo.menu
+                                                        },
+                                                        {
+                                                            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 addv = function(){
+                                                                        new Pman.Request({
+                                                                            url : baseURL + '/Roo/pohead.php',
+                                                                            method :'POST',
+                                                                            params : {
+                                                                                pohead_id : pohead_id,
+                                                                                _fix_voids : 1
+                                                                                
+                                                                            },
+                                                                            success : function(res) {
+                                                                                Roo.MessageBox.alert('Notice', 'DONE');
+                                                                            }
+                                                                        });
+                                                                    }
+                                                                    
+                                                                    Roo.MessageBox.confirm(
+                                                                        "Confirm",
+                                                                        "Are you sure to add all the fix the voids for " + pohead_number + " ?",
+                                                                        function(r) {
+                                                                            if (r != 'yes') {
+                                                                                return;
+                                                                            }
+                                                                
+                                                                            addv();
+                                                                            return;
+                                                                        }
+                                                                    ); 
                                                                     
-                                                                },
-                                                                success : function(res) {
-                                                                    _this.gltransgrid.footer.onClick('refresh');
                                                                     
                                                                 }
-                                                            });
+                                                            },
+                                                            cls : 'x-btn-text-icon',
+                                                            text : "Recalculate voids",
+                                                            icon : Roo.rootURL + 'images/default/tree/leaf.gif'
                                                         }
-                                                        
-                                                        Roo.MessageBox.confirm(
-                                                            "Confirm",
-                                                            "Are you sure to delete ?",
-                                                            function(r) {
-                                                                if (r != 'yes') {
-                                                                    return;
-                                                                }
-                                                    
-                                                                delit();
-                                                                return;
-                                                            }
-                                                        ); 
-                                                        
-                                                        
-                                                    }
-                                                },
-                                                cls : 'x-btn-text-icon',
-                                                text : "Delete Variance",
-                                                icon : rootURL + '/Pman/templates/images/trash.gif'
+                                                    ]
+                                                }
                                             },
                                             {
                                                 xtype: 'Button',
@@ -1623,61 +1769,19 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                 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');
-                                                                }
-                                                            });
+                                                        var s = _this.gltransgrid.selModel.getSelected();
+                                                        if (!s) {
+                                                            Roo.MessageBox.alert("Error", "Select an item to reverse");
+                                                            return;
                                                         }
                                                         
-                                                        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: 'Button',
-                                                xns: Roo.Toolbar,
-                                                listeners : {
-                                                    click : function()
-                                                    {
-                                                        var pohead_number = _this.form.findField('pohead_number').getValue();
-                                                        var pohead_id = _this.form.findField('pohead_id').getValue();
-                                                            
-                                                        var delv = function(){
+                                                        var fixit = function(){
                                                             new Pman.Request({
-                                                                url : baseURL + '/Roo/pohead.php',
+                                                                url : baseURL + '/Roo/invdetail.php',
                                                                 method :'POST',
                                                                 params : {
-                                                                    pohead_id : pohead_id,
-                                                                    _del : 1
-                                                                    
+                                                                   
+                                                                    _reverse :  s.data.invdetail_id 
                                                                 },
                                                                 success : function(res) {
                                                                     Roo.MessageBox.alert('Notice', 'DONE');
@@ -1687,13 +1791,13 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                         
                                                         Roo.MessageBox.confirm(
                                                             "Confirm",
-                                                            "Are you sure to delete the variance on voucher of " + pohead_number + " ?",
+                                                            "Are you sure to reverse that line",
                                                             function(r) {
                                                                 if (r != 'yes') {
                                                                     return;
                                                                 }
                                                     
-                                                                delv();
+                                                                fixit();
                                                                 return;
                                                             }
                                                         ); 
@@ -1702,7 +1806,7 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                     }
                                                 },
                                                 cls : 'x-btn-text-icon',
-                                                text : "Delete Varinace on voucher",
+                                                text : "Reverse",
                                                 icon : rootURL + '/Pman/templates/images/trash.gif'
                                             }
                                         ]
@@ -1735,10 +1839,42 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                         {
                                             xtype: 'ColumnModel',
                                             xns: Roo.grid,
+                                            align : 'right',
+                                            dataIndex : 'location_name',
+                                            header : 'Location',
+                                            width : 60,
+                                            renderer : function(v,x,r) {
+                                              
+                                               
+                                                return String.format('{0}', v); 
+                                            
+                                            }
+                                        },
+                                        {
+                                            xtype: 'ColumnModel',
+                                            xns: Roo.grid,
+                                            align : 'right',
                                             dataIndex : 'gltrans_amount',
                                             header : 'Amount',
                                             width : 100,
-                                            renderer : function(v) { return String.format('{0}', v); }
+                                            renderer : function(v,x,r) { 
+                                             return String.format('{0}', v); 
+                                            
+                                            }
+                                        },
+                                        {
+                                            xtype: 'ColumnModel',
+                                            xns: Roo.grid,
+                                            align : 'right',
+                                            dataIndex : 'invdetail_qty',
+                                            header : 'Qty',
+                                            width : 60,
+                                            renderer : function(v,x,r) {
+                                               var f = r.data.invfifo_void * 1 ? '<s>{0}</s>' : '{0}';
+                                               
+                                                return String.format(f, (v*1).toFixed(0)); 
+                                            
+                                            }
                                         },
                                         {
                                             xtype: 'ColumnModel',
@@ -1837,6 +1973,10 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                     return false;
                                                 }
                                                 o.params._split_sales = _this.glsalesbtn.pressed ? 1 : 0;
+                                            },
+                                            load : function (_self, records, options)
+                                            {
+                                             _this.gltxdgrid.footer.onClick('first');
                                             }
                                         },
                                         remoteSort : true,
@@ -2146,6 +2286,57 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                     },
                                     autoExpandColumn : 'gltrans_notes',
                                     loadMask : true,
+                                    toolbar : {
+                                        xtype: 'Toolbar',
+                                        xns: Roo,
+                                        items : [
+                                            {
+                                                xtype: 'Button',
+                                                xns: Roo.Toolbar,
+                                                listeners : {
+                                                    render : function (_self)
+                                                    {
+                                                        _this.glvoidshow = _self;
+                                                    },
+                                                    click : function (_self, e)
+                                                    {
+                                                        (function()  { _this.gltxgrid.footer.onClick('first'); }).defer(100);
+                                                    }
+                                                },
+                                                enableToggle : true,
+                                                pressed : true,
+                                                text : "Hide Void"
+                                            },
+                                            {
+                                                xtype: 'Fill',
+                                                xns: Roo.Toolbar
+                                            },
+                                            {
+                                                xtype: 'Button',
+                                                xns: Roo.Toolbar,
+                                                listeners : {
+                                                    click : function (_self, e)
+                                                    {
+                                                        new Pman.Request( {
+                                                            url : baseURL + '/Roo/Gltrans',
+                                                            method : 'GET',
+                                                            mask:  'sending',
+                                                            params : {
+                                                                pohead_id : _this.form.findField('pohead_id').getValue(),
+                                                                _autovoid : 1
+                                                            },
+                                                            success : function() {
+                                                                _this.gltxpanel.footer.onClick('first');
+                                                            }
+                                                                
+                                                        
+                                                        });
+                                                    }
+                                                },
+                                                text : "AutoVoid"
+                                            }
+                                        ]
+                                    },
                                     dataSource : {
                                         xtype: 'Store',
                                         xns: Roo.data,
@@ -2255,23 +2446,6 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                                     }
                                                 },
                                                 text : "Download"
-                                            },
-                                            {
-                                                xtype: 'Button',
-                                                xns: Roo.Toolbar,
-                                                listeners : {
-                                                    render : function (_self)
-                                                    {
-                                                        _this.glvoidshow = _self;
-                                                    },
-                                                    click : function (_self, e)
-                                                    {
-                                                        (function()  { _this.gltxgrid.footer.onClick('first'); }).defer(100);
-                                                    }
-                                                },
-                                                enableToggle : true,
-                                                pressed : true,
-                                                text : "Hide Void"
                                             }
                                         ]
                                     },
@@ -2300,10 +2474,15 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                             header : 'Doc#',
                                             width : 75,
                                             renderer : function(v,x,r) { 
+                                            
+                                                var style = '';
+                                                if (r.data.gltrans_misc_id > 0 && (r.data.invdetail_id *1) < 1) {
+                                                    style = ' style="color:red;font-weight:bold"';
+                                               }
                                                 if (r.data.gltrans_deleted) {
-                                                   return String.format('<s>{0}</s>', v);     
+                                                   return String.format('<s'+style+'>{0}</s>', v);     
                                                 }
-                                                return String.format('{0}', v); 
+                                                return String.format('<span' + style + '>{0}</span>', v); 
                                             }
                                         },
                                         {
@@ -2509,8 +2688,12 @@ Pman.Dialog.XtuplePurchaseOrder = {
                         {
                             if(_this.grid){
                                 var ar = [];
-                        
+                                var err = false;
                                 _this.grid.ds.each(function(r) {
+                                    if(r.data.poitem_unitprice < 1){
+                                        err = true;
+                                        return;
+                                    }
                                     ar.push({
                                         poitem_id : r.data.poitem_id,
                                         poitem_itemsite_id : r.data.poitem_itemsite_id,
@@ -2519,7 +2702,12 @@ Pman.Dialog.XtuplePurchaseOrder = {
                                     });
                                         
                                 });
-                                
+                         
+                                if(err){
+                                    Roo.MessageBox.alert('Error','Unit Price does not allow $0' );
+                                    return;
+                                }   
+                                       
                                 _this.form.findField('items').setValue(JSON.stringify(ar));
                             }