PHP 8 rerun of number_format fix.
[fa-stable.git] / reporting / rep101.php
index 667604c86c32621c7f72cd7e67ca95b5ce35c719..1a800d0077336c50c097970e6ba35382c9341b6b 100644 (file)
@@ -157,7 +157,7 @@ function print_customer_balances()
 
        $grandtotal = array(0,0,0,0);
 
-       $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
+       $sql = "SELECT debtor_no, name, curr_code, inactive FROM ".TB_PREF."debtors_master ";
        if ($fromcust != ALL_TEXT)
                $sql .= "WHERE debtor_no=".db_escape($fromcust);
        $sql .= " ORDER BY name";
@@ -172,22 +172,22 @@ function print_customer_balances()
                $bal = get_open_balance($myrow['debtor_no'], $from);
                $init = array();
 
-               $init[0] = round2(abs($bal['charges']*$rate), $dec);
-               $init[1] = round2(abs($bal['credits']*$rate), $dec);
-               $init[2] = round2($bal['Allocated']*$rate, $dec);
+               $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec);
+               $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec);
+               $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec);
                if ($show_balance)
                {
                        $init[3] = $init[0] - $init[1];
                        $accumulate += $init[3];
                }       
                else    
-                       $init[3] = round2($bal['OutStanding']*$rate, $dec);
+                       $init[3] = round2(($bal != false ? $bal['OutStanding'] : 0)*$rate, $dec);
 
                $res = get_transactions($myrow['debtor_no'], $from, $to);
                if ($no_zeros && db_num_rows($res) == 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;