X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep201.php;h=a5614755dc079e4f0053fcafc8cc91847a51f8e6;hb=3141d7755efbca4d2eb7babc1d31629295451885;hp=fce973821f9303f2c82789854b31da7546f0feca;hpb=902f1015d874c33bd7946b17de2ad80b4f2144b6;p=fa-stable.git diff --git a/reporting/rep201.php b/reporting/rep201.php index fce97382..a5614755 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -31,12 +31,12 @@ function get_open_balance($supplier_id, $to, $convert) { $to = date2sql($to); - $sql = "SELECT SUM(IF(".TB_PREF."supp_trans.type = 20, (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + + $sql = "SELECT SUM(IF(".TB_PREF."supp_trans.type = ".ST_SUPPINVOICE.", (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)"; if ($convert) $sql .= " * rate"; $sql .= ", 0)) AS charges, - SUM(IF(".TB_PREF."supp_trans.type <> 20, (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + + SUM(IF(".TB_PREF."supp_trans.type <> ".ST_SUPPINVOICE.", (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)"; if ($convert) $sql .= "* rate"; @@ -66,7 +66,7 @@ function getTransactions($supplier_id, $from, $to) $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) + ((".TB_PREF."supp_trans.type = ".ST_SUPPINVOICE.") AND ".TB_PREF."supp_trans.due_date < '$to') AS OverDue FROM ".TB_PREF."supp_trans WHERE ".TB_PREF."supp_trans.tran_date >= '$from' AND ".TB_PREF."supp_trans.tran_date <= '$to' @@ -82,7 +82,7 @@ function getTransactions($supplier_id, $from, $to) function print_supplier_balances() { - global $path_to_root; + global $path_to_root, $systypes_array; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -95,13 +95,13 @@ function print_supplier_balances() else include_once($path_to_root . "/reporting/includes/pdf_report.inc"); - if ($fromsupp == reserved_words::get_all_numeric()) + if ($fromsupp == ALL_NUMERIC) $supp = _('All'); else $supp = 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'); @@ -131,7 +131,7 @@ function print_supplier_balances() $grandtotal = array(0,0,0,0); $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers "; - if ($fromsupp != reserved_words::get_all_numeric()) + if ($fromsupp != ALL_NUMERIC) $sql .= "WHERE supplier_id=$fromsupp "; $sql .= "ORDER BY supp_name"; $result = db_query($sql, "The customers could not be retrieved"); @@ -170,10 +170,10 @@ function print_supplier_balances() while ($trans=db_fetch($res)) { $rep->NewLine(1, 2); - $rep->TextCol(0, 1, systypes::name($trans['type'])); + $rep->TextCol(0, 1, $systypes_array[$trans['type']]); $rep->TextCol(1, 2, $trans['reference']); $rep->DateCol(2, 3, $trans['tran_date'], true); - if ($trans['type'] == 20) + if ($trans['type'] == ST_SUPPINVOICE) $rep->DateCol(3, 4, $trans['due_date'], true); $item[0] = $item[1] = 0.0; if ($convert) @@ -198,7 +198,7 @@ function print_supplier_balances() else $item[3] = ($trans['TotalAmount'] + $trans['Allocated']) * $rate; */ - if ($trans['type'] == 20 || $trans['type'] == 2) + if ($trans['type'] == ST_SUPPINVOICE || $trans['type'] == ST_BANKDEPOSIT) $item[3] = $item[0] + $item[1] - $item[2]; else $item[3] = $item[0] - $item[1] + $item[2];