sql - Report Pending Payments with mixed Monthly & Weekly intervals -
we working database tracks payment plans patients. patients pay monthly, weekly, , every other week.
the paymentsschedule table fields patient, frequency, nextduedate, paymentsremaining, amount. once payment processed nextduedate , paymentsremaining fields updated @ given time there 1 record representing future payments given payment plan.
the report want generate show payments expected within next month. this:
report date: 3/1/2014 patient frequency next date pmts left amount 01 monthly 3/01/2014 5 $100 02 weekly 3/02/2014 3 $30 03 weekly 3/02/2014 7 $25 04 bi-weekly 3/03/2014 4 $75 02 weekly 3/09/2014 2 $30 03 weekly 3/09/2014 6 $25 02 weekly 3/16/2014 1 $30 03 weekly 3/16/2014 5 $25 04 bi-weekly 3/17/2014 3 $75 03 weekly 3/23/2014 4 $25 03 weekly 3/30/2014 3 $25
i set 5 different queries 5 date possibilities (weekly) of payment plan next 31 days, pull them in union , filter out dates not in time horizon find simpler solution.
your appreciated.
thanks,
jim s
Comments
Post a Comment