- my $open_sql =
- "having 0 != charged - coalesce(sum(cust_bill_pay.amount),0)
- - coalesce(sum(cust_credit_bill.amount),0)";
- my $having = '';
- my $where = '';
+ my $owed = "charged - ( select coalesce(sum(amount),0) from cust_bill_pay
+ where cust_bill_pay.invnum = cust_bill.invnum )
+ - ( select coalesce(sum(amount),0) from cust_credit_bill
+ where cust_credit_bill.invnum = cust_bill.invnum )";
+ my @where;