- Truffle Dog Digital newsletter
- Posts
- AI: Which of These 8 Invoices Match What We've Been Paid?
AI: Which of These 8 Invoices Match What We've Been Paid?
AI swiftly identified which of the 8 invoices summed to the payment amount.
A simple Python script using itertools.combinations handled the heavy lifting.
It saved time and avoided the need for manual cross-checking.
Here's another example of how AI tools can take the hassle out of your life.
My son runs an arbory business and often receives payments from customers that cover multiple invoices. However, the customers don't always send a remittance advice.
When that happens, and it's not immediately clear which invoices the payment covers, they have to follow up with the customer's accounts department before they can complete the reconciliation, which delays end-of-month reporting.
Last week, he received a payment of $538, which could cover any of the 8 outstanding amounts ($89, $88, $80, $83, $82, $91, $95, $92).
I started squinting at it, trying to figure it out, but it wasn't obvious to me (maybe you've figured it out already?).
A quick query to GenAI provided the answer.
When I clicked the [>_] icon, it even gave me the code — bonus! 🙂
import itertools
# The provided values
values = [89, 88, 80, 83, 82, 91, 95, 92]
target_sum = 538
# Check all combinations to find which add up to 538
matching_combinations = [comb for i in range(1, len(values)+1) for comb in itertools.combinations(values, i) if sum(comb) == target_sum]
matching_combinations
Andrew Walker
Technology consulting for charities
https://www.linkedin.com/in/andrew-walker-the-impatient-futurist/
Did someone forward this email to you? Want your own subscription? Head over here and sign yourself right up!
Back issues available here.
Reply