Marking transactions settled in the order they were created

So hereโ€™s a tricky one.

I have a table which records sales transactions. If the transaction type is Credit, there is a date(30 days from created date) before which the credit amount should be paid.

There is another table which records all the cash collected. The cash collected is not recorded against any particular transaction in the Sales transaction table, but against the Agent who made the transaction.

So, suppose, if there are 2 transactions by Agent A in the Sales table, 1) Credit amount = 10000 2) Credit amount = 20000.
Cash collected by Agent A before Credit limit date is 20000, I want to mark the transaction as settled in the sales transaction table in the order they were created. So, the 1st transaction in the Sales tab would be completely settled (20000-10000=+10000) and 2nd Transaction would be partially settled. (+10000-20000=-10000).

How do I achieve this?

I hope I explained the issue properly. Let me know if it needs more details.

I have been stuck on this for a while and any help would be appreciated.

Thanks.

0 3 50
3 REPLIES 3

Should this not be logged under QUESTIONS and not TIPS & TRICKS.

Sorry for the misunderstanding.
I have posted it under the questions now.

Thanks.

No problem. Just think you will get more people looking at it under Questions

Top Labels in this Space