My own accounting python euler problem
steven at REMOVE.THIS.cybersource.com.au
Wed Nov 11 03:25:47 CET 2009
On Tue, 10 Nov 2009 14:46:49 -0800, John Machin wrote:
> The problems that you mention are only a SUBSET of the total problem.
> Example: oustanding invoices are for 300, 200, and 100 and the cheque is
> for 450 -- in general the total of the cheque amounts does not equal the
> total of any possible selection of outstanding invoice amounts.
> I would be very surprised if a real accounting department did not
> already have a set of business rules for dealing with a problem that has
> existed since invoices and cheques were invented.
As a sometimes accounts department, let me put my hand up for that.
Yes. Generally the rule is, "call the damn customer and ask them what
they're smoking", only more politely.
Usually they'll have some convoluted breakdown of what amount they are
paying off each invoice. Sometimes they will have taken off a settlement
discount for prompt payment (often whether or not they actually paid
promptly). Sometimes they overpay, or underpay, or apply credits to the
wrong invoice, or pay invoices twice, or pay the wrong amount, or just
make up a number from thin air. Sometimes they themselves will have no
idea what the amount represents. And, I can guarantee, they will *ALWAYS*
use a different rounding scheme to whatever accounting software you use,
so there's always odd one or two cents that need to be manually adjusted
> I would be extremely surprised if a real accounting department could be
> persuaded to imagine a subset of their unpaid/underpaid/overpaid invoice
> problem as being an instance of the (extended) knapsack problem :-)
That's because the average accounting department is mathematically
Nevertheless, many accounting software packages, like Quickbooks, will
take a wild stab at allocating payments for you, usually using some
variation of "if you can't find an exact match for a single invoice, just
blindly allocate it to the oldest invoices you can". Frankly, I'd much
prefer a knapsack solution.
More information about the Python-list