data_for_tally

WHERE conditions in the outer SQL was not in the inside-the-loop SQL in
the 2 loops for credit collections and credit advances. Have fixed this
issue.

In both cases, the outer SQL had payment_date and bill_dt conditions and
inner loop only used the cust_uid obtained from the SQL outside the
loop. This caused errors when the same customer had transactions for
both the collections as well as advances loops.