X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep202.php;h=4f13042e9c21b09026a306a844431a74f8121690;hb=9561c66909d960cd75bcbb08bae2132f3de7e6da;hp=0e122ab4f25a4f5c6bc9587a896dc14e030a3d06;hpb=0bb9ce50f39b09b93005c45a49d9c47c4521267c;p=fa-stable.git diff --git a/reporting/rep202.php b/reporting/rep202.php index 0e122ab4..4f13042e 100644 --- a/reporting/rep202.php +++ b/reporting/rep202.php @@ -39,9 +39,9 @@ function get_invoices($supplier_id, $to, $all=true) if ($all) $value = "(trans.ov_amount + trans.ov_gst + trans.ov_discount)"; else - $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT.", - (trans.ov_amount + trans.ov_gst + trans.ov_discount - trans.alloc), - (trans.ov_amount + trans.ov_gst + trans.ov_discount + trans.alloc))"; + $value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT." OR (trans.type=".ST_JOURNAL." AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), + (trans.ov_amount + trans.ov_gst + trans.ov_discount - trans.alloc), + (trans.ov_amount + trans.ov_gst + trans.ov_discount + trans.alloc))"; $due = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_SUPPCREDIT.",trans.due_date,trans.tran_date)"; $sql = "SELECT trans.type, trans.reference, @@ -59,7 +59,7 @@ function get_invoices($supplier_id, $to, $all=true) AND trans.tran_date <= '$todate' AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) > ".FLOAT_COMP_DELTA; if (!$all) - $sql .= " AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc > ".FLOAT_COMP_DELTA; + $sql .= "AND $value <> 0 "; $sql .= " ORDER BY trans.tran_date"; @@ -158,7 +158,7 @@ function print_aged_supplier_analysis() $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . _('Days'); $pastdue2 = _('Over') . " " . $PastDueDays2 . " " . _('Days'); - $sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers"; + $sql = "SELECT supplier_id, supp_name AS name, curr_code, inactive FROM ".TB_PREF."suppliers"; if ($fromsupp != ALL_TEXT) $sql .= " WHERE supplier_id=".db_escape($fromsupp); $sql .= " ORDER BY supp_name"; @@ -188,7 +188,7 @@ function print_aged_supplier_analysis() if ($no_zeros && floatcmp(array_sum($str), 0) == 0) continue; $rep->fontSize += 2; - $rep->TextCol(0, 2, $myrow['name']); + $rep->TextCol(0, 2, $myrow['name'].($myrow['inactive']==1 ? " ("._("Inactive").")" : "")); if ($convert) $rep->TextCol(2, 3, $myrow['curr_code']); $rep->fontSize -= 2; $total[0] += ($supprec["Balance"] - $supprec["Due"]);