From 011e5922a52da435e6bb639fe92039762bfa124e Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Thu, 1 Feb 2007 14:47:30 +0000 Subject: [PATCH] fix patient balance computation to be independent of due date --- accounting/ws_server_26.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/accounting/ws_server_26.pl b/accounting/ws_server_26.pl index 45e4fc340..6e7e34d0f 100755 --- a/accounting/ws_server_26.pl +++ b/accounting/ws_server_26.pl @@ -57,12 +57,16 @@ sub rpc_customer_balance { my ($paid,$amount) = 0; # Exclude invoices that are not yet due (i.e. waiting for insurance). + # We no longer use the due date for this; instead ar.notes identifies + # insurances used, and ar.shipvia indicates which of those are done. + # If all insurances are done, it's due. # - my @now = localtime; - my $today = sprintf("%04u-%02u-%02u", $now[5] + 1900, $now[4] + 1, $now[3]); foreach my $resref (@{$$form{transactions}}) { - my $duedate = substr($$resref{duedate}, 6) . "-" . substr($$resref{duedate}, 0, 5); - if ($duedate le $today) { + my $inspending = 0; + foreach my $tmp ('Ins1','Ins2','Ins3') { + ++$inspending if ($$resref{notes} =~ /$tmp/ && $$resref{shipvia} !~ /$tmp/); + } + if ($inspending == 0) { $paid += $$resref{paid}; $amount += $$resref{amount}; } -- 2.11.4.GIT