From c69bd73ab0f04393cad2f14bd233948cabbc2dc3 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 14 Jul 2009 22:48:10 +0000 Subject: [PATCH] Replaced sys_types names from table to systypes::name in reports Now the English names in table are never used in inquiries or reports --- CHANGELOG.txt | 11 +++++++++++ reporting/rep101.php | 7 +++---- reporting/rep102.php | 10 ++++------ reporting/rep108.php | 7 +++---- reporting/rep201.php | 7 +++---- reporting/rep202.php | 10 ++++------ reporting/rep203.php | 11 ++++------- reporting/rep709.php | 11 ++++------- 8 files changed, 36 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b6df9162..be91584a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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) diff --git a/reporting/rep101.php b/reporting/rep101.php index 370ad954..9476d543 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -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) diff --git a/reporting/rep102.php b/reporting/rep102.php index dfe44570..d6cc82d8 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -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) diff --git a/reporting/rep108.php b/reporting/rep108.php index 8e0316d7..4d29faea 100644 --- a/reporting/rep108.php +++ b/reporting/rep108.php @@ -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) diff --git a/reporting/rep201.php b/reporting/rep201.php index de1d47e4..45ce3ef9 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -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) diff --git a/reporting/rep202.php b/reporting/rep202.php index fbb803db..3b543fcf 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -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) diff --git a/reporting/rep203.php b/reporting/rep203.php index c276188f..122c6826 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -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); diff --git a/reporting/rep709.php b/reporting/rep709.php index 0cd1f519..6b1f1e40 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -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']); -- 2.30.2