X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep201.php;h=fce973821f9303f2c82789854b31da7546f0feca;hb=7202616e85a0fb8907ced404e418d8a16a5ed53a;hp=de1d47e461d8526abef07b569791fcc83d352797;hpb=34f8e554ed5ac52648b5a542f02b39b6c6e3fc46;p=fa-stable.git diff --git a/reporting/rep201.php b/reporting/rep201.php index de1d47e4..fce97382 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$page_security = 2; +$page_security = 'SA_SUPPLIERANALYTIC'; // ---------------------------------------------------------------- // $ Revision: 2.0 $ // Creator: Joe Hunt @@ -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) @@ -199,7 +198,7 @@ function print_supplier_balances() else $item[3] = ($trans['TotalAmount'] + $trans['Allocated']) * $rate; */ - if ($trans['type'] == 20) + if ($trans['type'] == 20 || $trans['type'] == 2) $item[3] = $item[0] + $item[1] - $item[2]; else $item[3] = $item[0] - $item[1] + $item[2];