X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fsupp_trans_class.inc;h=00226d9fc5d2c078c67c19c296518853dd822c61;hb=d5c036f01e41b7acbf36eb00a298aa2a3edfe044;hp=547d833e3012f0031f8b394649019cdfe9e36667;hpb=1571869d54be48452fdbe08f25130972ff0a7b5a;p=fa-stable.git diff --git a/purchasing/includes/supp_trans_class.inc b/purchasing/includes/supp_trans_class.inc index 547d833e..00226d9f 100644 --- a/purchasing/includes/supp_trans_class.inc +++ b/purchasing/includes/supp_trans_class.inc @@ -43,11 +43,12 @@ class supp_trans var $ov_gst; var $gl_codes_counter=0; var $credit = 0; - var $tax_algorithm; - var $stored_algorithm; var $currency; var $tax_overrides = array(); // array of taxes manually inserted during sales invoice entry + var $dimension, + $dimension2; + function supp_trans($trans_type, $trans_no=0) { $this->trans_type = $trans_type; @@ -142,25 +143,29 @@ class supp_trans if ($tax_group_id == null) $tax_group_id = $this->tax_group_id; $taxes = get_tax_for_items($items, $prices, $shipping_cost, $tax_group_id, - $this->tax_included, null, $this->tax_algorithm); + $this->tax_included); + + if (isset($this->tax_overrides)) + foreach($this->tax_overrides as $id => $value) // add values entered manually + { + $taxes[$id]['Override'] = $value; + } - if ($gl_codes) + // Taxes included in gl_codes table have exact value, but count to overrides as well. + // Therefore when we want to now taxes only for items (gl_codes==false), + // we have to subtract gl_taxes from override values. + foreach ($this->gl_codes as $gl_code) { - foreach ($this->gl_codes as $gl_code) + $index = is_tax_account($gl_code->gl_code); + if ($index !== false) { - $index = is_tax_account($gl_code->gl_code); - if ($index !== false) - { + if ($gl_codes) $taxes[$index]['Value'] += $gl_code->amount; - } + elseif (isset($this->tax_overrides)) + $taxes[$index]['Override'] -= $gl_code->amount; } } - if(isset($this->tax_overrides)) - foreach($this->tax_overrides as $id => $value) // add values entered manually - { - $taxes[$id]['Override'] = $value; - } return $taxes; } // @@ -283,4 +288,3 @@ class gl_codes } } -?>