A couple of minor bugs in tax report when displaying supplier credit notes
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 14 Sep 2009 20:40:25 +0000 (20:40 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 14 Sep 2009 20:40:25 +0000 (20:40 +0000)
CHANGELOG.txt
purchasing/includes/db/invoice_db.inc

index 7a2bedd509531071385694cbfe4c5958069b58c7..c6cd42fffbeec576382fbe1fd2275d26397d4558 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+14-Sep-2009 Joe Hunt
+# A couple of minor bugs in tax report when displaying supplier credit notes
+$ /purchasing/includes/db/invoice_db.inc
+
 05-Sep-2009 Joe Hunt
 # Changed Class Type to Class Name in GL Account groups
 $ /gl/manage/gl_account_types.php
index a9636b33dcbb61c41a78829c0ac9dc776dcb24a4..4703f802ba52ac6ebe06161aa10774d42de54757 100644 (file)
@@ -188,6 +188,8 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                        $entered_gl_code->amount, $memo_);
 
                // store tax details if the gl account is a tax account
+               if (!$supp_trans->is_invoice)
+                       $entered_gl_code->amount = -$entered_gl_code->amount;
                add_gl_tax_details($entered_gl_code->gl_code, 
                        $trans_type, $invoice_id, $entered_gl_code->amount,
                        $ex_rate, $date_, $supp_trans->supp_reference);
@@ -269,12 +271,17 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
        {
 
                if (!$supp_trans->is_invoice)
+               {
+                       $taxitem['Net'] = -$taxitem['Net'];
                        $taxitem['Value'] = -$taxitem['Value'];
+               }       
                // here we suppose that tax is never included in price (we are company customer).
                        add_trans_tax_details($trans_type, $invoice_id, 
                                $taxitem['tax_type_id'], $taxitem['rate'], 0, $taxitem['Value'],
                                $taxitem['Net'], $ex_rate, $date_, $supp_trans->supp_reference);
 
+               if (!$supp_trans->is_invoice)
+                       $taxitem['Value'] = -$taxitem['Value'];
                $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_,
                        $taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
                        $supp_trans->supplier_id,