Merged last changes from stable.
[fa-stable.git] / purchasing / includes / po_class.inc
index 4eb5c0b74a7873c6a4a8d876f17306be3295211a..be484631115353f32db1e28a419328a66d33573f 100644 (file)
@@ -35,8 +35,10 @@ class purch_order
        var $tax_algorithm;
        var $stored_algorithm; // copy to find the change after invoice in processed
        var $terms;
-       
+       var $ex_rate;
+
        var $reference;
+       var $tax_overrides = array();           // array of taxes manually inserted during sales invoice entry (direct invoice)
        
        var $prep_amount = 0; // prepayment required
        var $alloc; // sum of payments allocated
@@ -62,7 +64,7 @@ class purch_order
        
        function add_to_order($line_no, $stock_id, $qty, $item_descr, $price, $uom, $req_del_date, $qty_inv, $qty_recd)
        {
-               if ($qty != 0 && isset($qty))
+               if (isset($qty) && $qty != 0)
                {
                        $this->line_items[$line_no] = new po_line_details($line_no, $stock_id, $item_descr, $qty, $price, $uom, 
                                $req_del_date, $qty_inv, $qty_recd);
@@ -153,8 +155,13 @@ class purch_order
        // Adjustment for swiss franken, we always have 5 rappen = 1/20 franken
            if ($this->curr_code == 'CHF') {
                        $val = $taxes['1']['Value'];
-                       $taxes['1']['Value'] = (floatval((intval(round(($val*20),0)))/20));
-               } 
+                       $val1 = (floatval((intval(round(($val*20),0)))/20));
+                       $taxes['1']['Value'] = $val1;
+               }
+               foreach($this->tax_overrides as $id => $value) // add values entered manually
+               {
+                       $taxes[$id]['Override'] = $value;
+               }
                return $taxes;
        }