This is similar to the
Finding small amounts from a larger total thread, but a little more complicated.
Basically I have the following pieces of data:
Due Amount
Due Date
Payment Amount
Payment Date
Penalty % (This is based on how different the Due Date is from the Payment Date.)
Penalty Amount (The Due Amount * Penalty %)
A couple things to keep in mind:
The Penalty % will max out once the dates are 15 days different. So, if and due amount is for sure going to incur the full penalty, you might as well pay it with the last payment available.
Payments can be split and used for more than one due amount.
The only method I can think of to handle this is the brute force method. Run through each possibility and keep the lowest or the first "$0.00".
But, if someone has thoughts on an algorithm or a better solution I'm definately open to it.
Finding small amounts from a larger total thread, but a little more complicated.
Basically I have the following pieces of data:
Due Amount
Due Date
Payment Amount
Payment Date
Penalty % (This is based on how different the Due Date is from the Payment Date.)
Penalty Amount (The Due Amount * Penalty %)
A couple things to keep in mind:
The Penalty % will max out once the dates are 15 days different. So, if and due amount is for sure going to incur the full penalty, you might as well pay it with the last payment available.
Payments can be split and used for more than one due amount.
The only method I can think of to handle this is the brute force method. Run through each possibility and keep the lowest or the first "$0.00".
But, if someone has thoughts on an algorithm or a better solution I'm definately open to it.