X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep203.php;h=6fe008d410bceeeb8f3493c0d32d97baea34fb46;hb=29e68a1b8dcbe7c7ecb797396945e0cccf2d6cd8;hp=078c7c0801bc8e147efcf730963314d6f1091543;hpb=f50187b9c3095886d7fd847f635cd8763109a75e;p=fa-stable.git diff --git a/reporting/rep203.php b/reporting/rep203.php index 078c7c08..6fe008d4 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$page_security = 2; +$page_security = 'SA_SUPPPAYMREP'; // ---------------------------------------------------------------- // $ Revision: 2.0 $ // Creator: Joe Hunt @@ -25,15 +25,14 @@ include_once($path_to_root . "/gl/includes/gl_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_payment_report(); function getTransactions($supplier, $date) { $date = date2sql($date); + $dec = user_price_dec(); - $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, @@ -41,11 +40,10 @@ 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 . "' - AND ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc != 0 + FROM ".TB_PREF."supp_trans + WHERE ".TB_PREF."supp_trans.supplier_id = '" . $supplier . "' + AND ROUND(ABS(".TB_PREF."supp_trans.ov_amount),$dec) + ROUND(ABS(".TB_PREF."supp_trans.ov_gst),$dec) - + ROUND(".TB_PREF."supp_trans.alloc,$dec) != 0 AND ".TB_PREF."supp_trans.tran_date <='" . $date . "' ORDER BY ".TB_PREF."supp_trans.type, ".TB_PREF."supp_trans.trans_no"; @@ -57,7 +55,7 @@ function getTransactions($supplier, $date) function print_payment_report() { - global $path_to_root; + global $path_to_root, $systypes_array; $to = $_POST['PARAM_0']; $fromsupp = $_POST['PARAM_1']; @@ -65,24 +63,18 @@ function print_payment_report() $comments = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; if ($destination) - { include_once($path_to_root . "/reporting/includes/excel_report.inc"); - $filename = "PaymentReport.xml"; - } else - { include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - $filename = "PaymentReport.pdf"; - } - if ($fromsupp == reserved_words::get_all_numeric()) + if ($fromsupp == ALL_NUMERIC) $from = _('All'); else $from = get_supplier_name($fromsupp); $dec = user_price_dec(); - if ($currency == reserved_words::get_all()) + if ($currency == ALL_TEXT) { $convert = true; $currency = _('Balances in Home Currency'); @@ -102,19 +94,19 @@ function print_payment_report() 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => '')); - $rep = new FrontReport(_('Payment Report'), "PaymentReport.pdf", user_pagesize()); + $rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); - $rep->Header(); + $rep->NewPage(); $total = array(); $grandtotal = array(0,0); $sql = "SELECT supplier_id, supp_name AS name, curr_code, ".TB_PREF."payment_terms.terms FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms WHERE "; - if ($fromsupp != reserved_words::get_all_numeric()) - $sql .= "supplier_id=$fromsupp AND "; + if ($fromsupp != ALL_NUMERIC) + $sql .= "supplier_id=".db_escape($fromsupp)." AND "; $sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator ORDER BY supp_name"; $result = db_query($sql, "The customers could not be retrieved"); @@ -141,13 +133,13 @@ function print_payment_report() else $rate = 1.0; $rep->NewLine(1, 2); - $rep->TextCol(0, 1, $trans['type_name']); + $rep->TextCol(0, 1, $systypes_array[$trans['type']]); $rep->TextCol(1, 2, $trans['supp_reference']); - if ($trans['type'] == 20) + if ($trans['type'] == ST_SUPPINVOICE) $rep->DateCol(2, 3, $trans['due_date'], true); else $rep->DateCol(2, 3, $trans['tran_date'], true); - if ($trans['type'] != 20) + if ($trans['type'] != ST_SUPPINVOICE) { $trans['TranTotal'] = -$trans['TranTotal']; $trans['Balance'] = -$trans['Balance'];