Added an alternative way of presenting tax included on invoices.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 15 Apr 2010 11:12:33 +0000 (11:12 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 15 Apr 2010 11:12:33 +0000 (11:12 +0000)
This is done by setting a global variabel $alternative_tax_include_on_docs = 1.

CHANGELOG.txt
config.default.php
includes/ui/ui_view.inc
reporting/rep107.php
reporting/rep110.php

index 9ed47cda5edbdd639720a07ce2f295b2eb11d37d..c13a8fb7bfd05ee184827c5cca490cce25410038 100644 (file)
@@ -20,6 +20,13 @@ Legend:
 $ -> Affected files
 
 15-Apr-2010 Joe Hunt
+! Added an alternative way of presenting tax included on invoices.
+  This is done by setting a global variabel $alternative_tax_include_on_docs = 1.
+$ config.default.php 
+  /includes/ui/ui_view.inc
+  /reporting/rep107.php
+  /reporting/rep110.php
+  
 ! Added a date column and combined the # and View column in 'View / Print Transactions.
 ! Changed Voiding Transaction to also include a pager.
 $ /admin/view_print_transaction.php
index 22ab9cf1e39f73e82dede4edf5635dfb1fddf24f..4d370d9ece625eb3ac0c25c41c322a9085fa98e2 100644 (file)
@@ -108,6 +108,9 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        /* print_invoice_no. 0 = print reference number, 1 = print invoice number */
        $print_invoice_no = 0;
 
+       /* 1 = print Subtotal tax excluded, tax and Total tax included */
+       $alternative_tax_include_on_docs = 0;
+
        $dateformats    = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD");
        $dateseps               = array("/", ".", "-", " ");
        $thoseps                = array(",", ".", " ");
index 19e94b3e188dff830cdc5f0d7c18d54748580d8c..55881b1d424e6e4bdb8756ce5fe6247991863823 100644 (file)
@@ -374,12 +374,26 @@ function display_debit_or_credit_cells($value)
 
 function display_customer_trans_tax_details($tax_items, $columns)
 {
+       global $alternative_tax_include_on_docs;
+       $first = true;
     while ($tax_item = db_fetch($tax_items))
     {
        $tax = number_format2($tax_item['amount'],user_price_dec());
        if ($tax_item['included_in_price'])
-               label_row(_("Included") . " " . $tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%) " .
-                       _("Amount") . ": $tax", "", "colspan=$columns align=right", "align=right");
+       {
+                       if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1)
+                       {
+                               if ($first)
+                                       label_row(_("Total Tax Excluded"), number_format2($tax_item['net_amount'], user_price_dec()),
+                                               "colspan=$columns align=right", "align=right");
+                       label_row($tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%)",
+                               $tax, "colspan=$columns align=right", "align=right");
+                       $first = false;
+               }
+               else
+                       label_row(_("Included") . " " . $tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%) " .
+                               _("Amount") . ": $tax", "", "colspan=$columns align=right", "align=right");
+        }                      
        else
                label_row($tax_item['tax_type_name'] . " (" . $tax_item['rate'] . "%)",
                        $tax, "colspan=$columns align=right", "align=right");
index ea5234ae13fa086cd8a7945e8fc08c1bb72e905f..275498c9d184b06f92baf88756132f7d74f2cecc 100644 (file)
@@ -32,7 +32,7 @@ print_invoices();
 
 function print_invoices()
 {
-       global $path_to_root;
+       global $path_to_root, $alternative_tax_include_on_docs;
        
        include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
@@ -168,14 +168,29 @@ function print_invoices()
                        $rep->TextCol(6, 7,     $DisplayFreight, -2);
                        $rep->NewLine();
                        $tax_items = get_trans_tax_details($j, $i);
+                       $first = true;
                while ($tax_item = db_fetch($tax_items))
                {
                        $DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
 
                        if ($tax_item['included_in_price'])
                        {
-                                       $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
-                                               " (" . $tax_item['rate'] . "%) " . $doc_Amount . ": " . $DisplayTax, -2);
+                               if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1)
+                               {
+                                       if ($first)
+                                       {
+                                                       $rep->TextCol(3, 6, _("Total Tax Excluded"), -2);
+                                                       $rep->TextCol(6, 7,     number_format2($sign*$tax_item['net_amount'], $dec), -2);
+                                                       $rep->NewLine();
+                                       }
+                                               $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" .
+                                                       $tax_item['rate'] . "%)", -2);
+                                               $rep->TextCol(6, 7,     $DisplayTax, -2);
+                                               $first = false;
+                               }
+                               else
+                                               $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
+                                                       " (" . $tax_item['rate'] . "%) " . $doc_Amount . ": " . $DisplayTax, -2);
                                }
                        else
                        {
index eed61e6ce8077efbfd86f042b9be0f5013905ebe..f5b35bc065dd6e970d1c112c4e7d25be2c6539e2 100644 (file)
@@ -34,7 +34,7 @@ print_deliveries();
 
 function print_deliveries()
 {
-       global $path_to_root, $packing_slip;
+       global $path_to_root, $packing_slip, $alternative_tax_include_on_docs;
 
        include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
@@ -164,13 +164,28 @@ function print_deliveries()
                                $rep->TextCol(6, 7,     $DisplayFreight, -2);
                                $rep->NewLine();
                                $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $i);
+                               $first = true;
                        while ($tax_item = db_fetch($tax_items))
                        {
                                $DisplayTax = number_format2($tax_item['amount'], $dec);
                                if ($tax_item['included_in_price'])
                                {
-                                               $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
-                                                       " (" . $tax_item['rate'] . "%) " . $doc_Amount . ": " . $DisplayTax, -2);
+                                               if (isset($alternative_tax_include_on_docs) && $alternative_tax_include_on_docs == 1)
+                                       {
+                                               if ($first)
+                                               {
+                                                               $rep->TextCol(3, 6, _("Total Tax Excluded"), -2);
+                                                               $rep->TextCol(6, 7,     number_format2($tax_item['net_amount'], $dec), -2);
+                                                               $rep->NewLine();
+                                               }
+                                                       $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" .
+                                                               $tax_item['rate'] . "%)", -2);
+                                                       $rep->TextCol(6, 7,     $DisplayTax, -2);
+                                                       $first = false;
+                                       }
+                                       else
+                                                       $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
+                                                               " (" . $tax_item['rate'] . "%) " . $doc_Amount . ": " . $DisplayTax, -2);
                                        }
                                else
                                {