Hmmm...
I think somehow it's an issue of the focus of the calculation. I
suspect the logic of the process too -- but then I can't see your
script so I don't know exactly what you are doing. (I can't see how
you get the global calc to take account of more and more records as
you pass around the loop multiple times...)
Anyway, I note that you've made a change such that, at each pass
around the loop, you use a Set Field to grab the new amount
remaining. To my mind this is the sensible and logical way to do
things. It is also very clear (when you need to read the script in
five years time) and will never depend on the current record. This is
exactly how I've solved a similar problem in the past.
Incidentally, as an aside, what actually do you do when you reach an
invoice that the remaining amount is insufficient to pay off? I
worked on a solution like this for ages (having told the client that
it was a silly idea -- but the customer is always right, as you
know...). In the end we did abandon it (meaning that I persuaded the
client to abandon it) because things just got too complex... You end
up with an amount of credit outstanding that's not enough to pay off
the current debt. Then another payment (credit) comes in, so you have
to finish up the previous one then start using up the new one. It's
even possible that two current credits are insufficient to cover the
debt... OMYGOD...
It's actually much simpler to run a regular credit scheme: credits on
one side, debits on the other, and the balance is the balance. Monies
do not pay off particular invoices but simply deduct from the amount
owed.
So I'm quite interested in how you might handle what can turn into
quite a complex situation...
Steve
On 10 Sep 2008, at 18:27, Lee wrote:
As I said its hard to explain but I've removed the global field and
its working fine. I have 3 other clients using the original script
and they haven't had any problem, its just been this one client who
has found this anomaly.