- $bal = get_open_balance($myrow['debtor_no'], $from, $convert);
- $init[0] = $init[1] = 0.0;
- $init[0] = round2(abs($bal['charges']*$rate), $dec);
- $init[1] = round2(Abs($bal['credits']*$rate), $dec);
- $init[2] = round2($bal['Allocated']*$rate, $dec);
+ $bal = get_open_balance($myrow['debtor_no'], $from);
+ $init = array();
+
+ $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);