Subject: Combinations & Permutations..... sort of
Date: Mon, 29 Sep 2014 17:17:55 -0700
Put your math hats on......
I'm looking at a means to *attempt* to auto-match payments to
invoices. We do not want to apply payments to oldest first and end
up with a partial payment or credit leftover.
Pick an arbitrary number of invoices for the attempt - say 10.
Any combination of 1 or more of these 10 invoices that total the
payment amount would be considered a match.
Could be invoice 1, or 2, or.... Could be invoices 2 and 5 and
I assume it's going to have to be a brute force approach but I'm
stumped on the total # of possible matches. Combinations &
permutations I understand (3 out of 10, etc) but this "1 or 2 or (1
and 2) or (2 and 5 and 8)" is giving me a mind block. I do know
it's a big number and I'll likely cut back the sampling size.
Any suggestions or clarifications would be very welcome.
COMMON Certified Application
Developer - ILE RPG on IBM i on Power