Replaced sys_types names from table to systypes::name in reports
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 14 Jul 2009 22:48:10 +0000 (22:48 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 14 Jul 2009 22:48:10 +0000 (22:48 +0000)
Now the English names in table are never used in inquiries or reports

CHANGELOG.txt
reporting/rep101.php
reporting/rep102.php
reporting/rep108.php
reporting/rep201.php
reporting/rep202.php
reporting/rep203.php
reporting/rep709.php

index b6df916222cb47c9603b15baaf5bbe57f255386e..be91584ab484b0d3e9b11a6766e01a917e3d69ae 100644 (file)
@@ -19,6 +19,17 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+15-Jul-2009 Joe Hunt
+! Replaced sys_types names from table to systypes::name in reports
+  Now the English names in table are never used in inquiries or reports
+$ /reporting/rep101.php
+  /reporting/rep102.php
+  /reporting/rep108.php
+  /reporting/rep201.php
+  /reporting/rep202.php
+  /reporting/rep203.php
+  /reporting/rep709.php
+  
 13-Jul-2009 Joe Hunt
 + Added Audit Trail Report
 $ /reporting/rep710.php (new file)
index 370ad954133b43c613c571c960e2154b452ee6e0..9476d543e715d3787d175dd3d0ef4ec669fb5051 100644 (file)
@@ -71,17 +71,16 @@ function get_transactions($debtorno, $from, $to)
        $from = date2sql($from);
        $to = date2sql($to);
 
-    $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name,
+    $sql = "SELECT ".TB_PREF."debtor_trans.*,
                (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_discount)
                AS TotalAmount, ".TB_PREF."debtor_trans.alloc AS Allocated,
                ((".TB_PREF."debtor_trans.type = 10)
                AND ".TB_PREF."debtor_trans.due_date < '$to') AS OverDue
-       FROM ".TB_PREF."debtor_trans, ".TB_PREF."sys_types
+       FROM ".TB_PREF."debtor_trans
        WHERE ".TB_PREF."debtor_trans.tran_date >= '$from'
                AND ".TB_PREF."debtor_trans.tran_date <= '$to'
                AND ".TB_PREF."debtor_trans.debtor_no = '$debtorno'
                AND ".TB_PREF."debtor_trans.type <> 13
-       AND ".TB_PREF."debtor_trans.type = ".TB_PREF."sys_types.type_id
        ORDER BY ".TB_PREF."debtor_trans.tran_date";
 
     return db_query($sql,"No transactions were returned");
@@ -178,7 +177,7 @@ function print_customer_balances()
                while ($trans = db_fetch($res))
                {
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1, $trans['type_name']);
+                       $rep->TextCol(0, 1, systypes::name($trans['type']));
                        $rep->TextCol(1, 2,     $trans['reference']);
                        $rep->DateCol(2, 3,     $trans['tran_date'], true);
                        if ($trans['type'] == 10)
index dfe445705748471138d744b8ccb1648e151fa7c2..d6cc82d825e15221b0c0abc54f3af39090a0e3fa 100644 (file)
@@ -38,7 +38,7 @@ function get_invoices($costomer_id, $to)
                .TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_freight_tax + "
                .TB_PREF."debtor_trans.ov_discount)";
        $due = "IF (".TB_PREF."debtor_trans.type=10,".TB_PREF."debtor_trans.due_date,".TB_PREF."debtor_trans.tran_date)";
-       $sql = "SELECT ".TB_PREF."sys_types.type_name, ".TB_PREF."debtor_trans.type, ".TB_PREF."debtor_trans.reference,
+       $sql = "SELECT ".TB_PREF."debtor_trans.type, ".TB_PREF."debtor_trans.reference,
                ".TB_PREF."debtor_trans.tran_date,
                $value as Balance,
                IF ((TO_DAYS('$todate') - TO_DAYS($due)) >= 0,$value,0) AS Due,
@@ -47,11 +47,9 @@ function get_invoices($costomer_id, $to)
 
                FROM ".TB_PREF."debtors_master,
                        ".TB_PREF."payment_terms,
-                       ".TB_PREF."debtor_trans,
-                       ".TB_PREF."sys_types
+                       ".TB_PREF."debtor_trans
 
-               WHERE ".TB_PREF."sys_types.type_id = ".TB_PREF."debtor_trans.type
-                   AND ".TB_PREF."debtor_trans.type <> 13
+               WHERE ".TB_PREF."debtor_trans.type <> 13
                        AND ".TB_PREF."debtors_master.payment_terms = ".TB_PREF."payment_terms.terms_indicator
                        AND ".TB_PREF."debtors_master.debtor_no = ".TB_PREF."debtor_trans.debtor_no
                        AND ".TB_PREF."debtor_trans.debtor_no = $costomer_id
@@ -176,7 +174,7 @@ function print_aged_customer_analysis()
                        while ($trans=db_fetch($res))
                        {
                                $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     $trans['type_name'], -2);
+                       $rep->TextCol(0, 1,     systypes::name($trans['type']), -2);
                                $rep->TextCol(1, 2,     $trans['reference'], -2);
                                $rep->DateCol(2, 3, $trans['tran_date'], true, -2);
                                if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2)
index 8e0316d7536f322f44fbb6c0e3d8fa289af8b477..4d29faeaa005f428740441c2bcb609064025ac06 100644 (file)
@@ -31,14 +31,13 @@ print_statements();
 
 function getTransactions($debtorno, $date)
 {
-    $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name,
+    $sql = "SELECT ".TB_PREF."debtor_trans.*,
                                (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_discount)
                                AS TotalAmount, ".TB_PREF."debtor_trans.alloc AS Allocated,
                                ((".TB_PREF."debtor_trans.type = 10)
                                        AND ".TB_PREF."debtor_trans.due_date < '$date') AS OverDue
-                       FROM ".TB_PREF."debtor_trans, ".TB_PREF."sys_types
+                       FROM ".TB_PREF."debtor_trans
                        WHERE ".TB_PREF."debtor_trans.tran_date <= '$date' AND ".TB_PREF."debtor_trans.debtor_no = '$debtorno'
-                               AND ".TB_PREF."debtor_trans.type = ".TB_PREF."sys_types.type_id
                                AND ".TB_PREF."debtor_trans.type <> 13
                                ORDER BY ".TB_PREF."debtor_trans.tran_date";
 
@@ -131,7 +130,7 @@ function print_statements()
                        $DisplayAlloc = number_format2($myrow2["Allocated"],$dec);
                        $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
 
-                       $rep->TextCol(0, 1,     $myrow2['type_name'], -2);
+                       $rep->TextCol(0, 1,     systypes::name($myrow2['type']), -2);
                        $rep->TextCol(1, 2,     $myrow2['reference'], -2);
                        $rep->TextCol(2, 3,     sql2date($myrow2['tran_date']), -2);
                        if ($myrow2['type'] == 10)
index de1d47e461d8526abef07b569791fcc83d352797..45ce3ef988440856c762033aa6ed96cc31b3ce77 100644 (file)
@@ -63,15 +63,14 @@ function getTransactions($supplier_id, $from, $to)
        $from = date2sql($from);
        $to = date2sql($to);
 
-    $sql = "SELECT ".TB_PREF."supp_trans.*, ".TB_PREF."sys_types.type_name,
+    $sql = "SELECT ".TB_PREF."supp_trans.*,
                                (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)
                                AS TotalAmount, ".TB_PREF."supp_trans.alloc AS Allocated,
                                ((".TB_PREF."supp_trans.type = 20)
                                        AND ".TB_PREF."supp_trans.due_date < '$to') AS OverDue
-                       FROM ".TB_PREF."supp_trans, ".TB_PREF."sys_types
+                       FROM ".TB_PREF."supp_trans
                        WHERE ".TB_PREF."supp_trans.tran_date >= '$from' AND ".TB_PREF."supp_trans.tran_date <= '$to' 
                        AND ".TB_PREF."supp_trans.supplier_id = '$supplier_id'
-                               AND ".TB_PREF."supp_trans.type = ".TB_PREF."sys_types.type_id
                                ORDER BY ".TB_PREF."supp_trans.tran_date";
 
     $TransResult = db_query($sql,"No transactions were returned");
@@ -171,7 +170,7 @@ function print_supplier_balances()
                while ($trans=db_fetch($res))
                {
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     $trans['type_name']);
+                       $rep->TextCol(0, 1,     systypes::name($trans['type']));
                        $rep->TextCol(1, 2,     $trans['reference']);
                        $rep->DateCol(2, 3,     $trans['tran_date'], true);
                        if ($trans['type'] == 20)
index fbb803dbf08f5f468bb82cae7ed8829895144f32..3b543fcfbdc59db2b1fc88b2fd51e5c273cb4bb7 100644 (file)
@@ -38,7 +38,7 @@ function get_invoices($supplier_id, $to)
        // Revomed allocated from sql
     $value = "(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)";
        $due = "IF (".TB_PREF."supp_trans.type=20 OR ".TB_PREF."supp_trans.type=21,".TB_PREF."supp_trans.due_date,".TB_PREF."supp_trans.tran_date)";
-       $sql = "SELECT ".TB_PREF."sys_types.type_name,
+       $sql = "SELECT ".TB_PREF."supp_trans.type,
                ".TB_PREF."supp_trans.reference,
                ".TB_PREF."supp_trans.tran_date,
                $value as Balance,
@@ -48,11 +48,9 @@ function get_invoices($supplier_id, $to)
 
                FROM ".TB_PREF."suppliers,
                        ".TB_PREF."payment_terms,
-                       ".TB_PREF."supp_trans,
-                       ".TB_PREF."sys_types
+                       ".TB_PREF."supp_trans
 
-               WHERE ".TB_PREF."sys_types.type_id = ".TB_PREF."supp_trans.type
-                       AND ".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator
+               WHERE ".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator
                        AND ".TB_PREF."suppliers.supplier_id = ".TB_PREF."supp_trans.supplier_id
                        AND ".TB_PREF."supp_trans.supplier_id = $supplier_id
                        AND ".TB_PREF."supp_trans.tran_date <= '$todate'
@@ -184,7 +182,7 @@ function print_aged_supplier_analysis()
                        while ($trans=db_fetch($res))
                        {
                                $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     $trans['type_name'], -2);
+                       $rep->TextCol(0, 1,     systypes::name($trans['type']), -2);
                                $rep->TextCol(1, 2,     $trans['reference'], -2);
                                $rep->TextCol(2, 3,     sql2date($trans['tran_date']), -2);
                                foreach ($trans as $i => $value)
index c276188f8a6d0befbcb2cab9f91cb57c31c0fb85..122c6826ebec021f4652e4947a8534f2bdcbdbc6 100644 (file)
@@ -31,8 +31,7 @@ function getTransactions($supplier, $date)
 {
        $date = date2sql($date);
 
-       $sql = "SELECT ".TB_PREF."sys_types.type_name,
-                       ".TB_PREF."supp_trans.supp_reference,
+       $sql = "SELECT ".TB_PREF."supp_trans.supp_reference,
                        ".TB_PREF."supp_trans.tran_date,
                        ".TB_PREF."supp_trans.due_date,
                        ".TB_PREF."supp_trans.trans_no,
@@ -40,10 +39,8 @@ function getTransactions($supplier, $date)
                        ".TB_PREF."supp_trans.rate,
                        (ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc) AS Balance,
                        (ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) ) AS TranTotal
-               FROM ".TB_PREF."supp_trans,
-                       ".TB_PREF."sys_types
-               WHERE ".TB_PREF."sys_types.type_id = ".TB_PREF."supp_trans.type
-               AND ".TB_PREF."supp_trans.supplier_id = '" . $supplier . "'
+               FROM ".TB_PREF."supp_trans
+               WHERE ".TB_PREF."supp_trans.supplier_id = '" . $supplier . "'
                AND ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc != 0
                AND ".TB_PREF."supp_trans.tran_date <='" . $date . "'
                ORDER BY ".TB_PREF."supp_trans.type,
@@ -134,7 +131,7 @@ function print_payment_report()
                        else
                                $rate = 1.0;
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     $trans['type_name']);
+                       $rep->TextCol(0, 1,     systypes::name($trans['type']));
                        $rep->TextCol(1, 2,     $trans['supp_reference']);
                        if ($trans['type'] == 20)
                                $rep->DateCol(2, 3,     $trans['due_date'], true);
index 0cd1f519328aa01b7d26a5481c6a56e96c8bd8f9..6b1f1e40eaf05ab683d788be63012f246c9f0845 100644 (file)
@@ -35,7 +35,6 @@ function getTaxTransactions($from, $to)
 
        $sql = "SELECT taxrec.*, taxrec.amount*ex_rate AS amount,
                    taxrec.net_amount*ex_rate AS net_amount,
-                               stype.type_name,
                                IF(ISNULL(supp.supp_name), debt.name, supp.supp_name) as name,
                                branch.br_name
                FROM ".TB_PREF."trans_tax_details taxrec
@@ -45,10 +44,8 @@ function getTaxTransactions($from, $to)
                LEFT JOIN ".TB_PREF."debtor_trans dtrans
                        ON taxrec.trans_no=dtrans.trans_no AND taxrec.trans_type=dtrans.type
                LEFT JOIN ".TB_PREF."debtors_master as debt ON dtrans.debtor_no=debt.debtor_no
-               LEFT JOIN ".TB_PREF."cust_branch as branch ON dtrans.branch_code=branch.branch_code,
-               ".TB_PREF."sys_types stype
-               WHERE taxrec.trans_type=stype.type_id
-                       AND (taxrec.amount != 0 OR taxrec.net_amount != 0)
+               LEFT JOIN ".TB_PREF."cust_branch as branch ON dtrans.branch_code=branch.branch_code
+               WHERE (taxrec.amount != 0 OR taxrec.net_amount != 0)
                        AND taxrec.trans_type != 13
                        AND taxrec.tran_date >= '$fromdate'
                        AND taxrec.tran_date <= '$todate'
@@ -101,7 +98,7 @@ function print_tax_report()
                                                1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
                                                2 => array('text' => _('Type'), 'from' => $summary, 'to' => ''));
 
-       $cols = array(0, 80, 130, 180, 290, 370, 455, 505, 555);
+       $cols = array(0, 100, 130, 180, 290, 370, 455, 505, 555);
 
        $headers = array(_('Trans Type'), _('Ref'), _('Date'), _('Name'), _('Branch Name'),
                _('Net'), _('Rate'), _('Tax'));
@@ -126,7 +123,7 @@ function print_tax_report()
                
                if (!$summaryOnly)
                {
-                       $rep->TextCol(0, 1,     $trans['type_name']);
+                       $rep->TextCol(0, 1,     systypes::name($trans['trans_type']));
                        $rep->TextCol(1, 2,     $trans['memo']);
                        $rep->DateCol(2, 3,     $trans['tran_date'], true);
                        $rep->TextCol(3, 4,     $trans['name']);