From 84e12ef548351bd996301d3a6abf1665e6767186 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 4 Sep 2006 00:31:38 +0000 Subject: [PATCH] use cents internally git-svn-id: svn://svn.open-ils.org/ILS/trunk@5910 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../Application/Storage/Publisher/action.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index 4ae577dd5a..9395af982f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -518,7 +518,7 @@ sub generate_fines { } my $current_fine_total = 0; - $current_fine_total += $_->amount for (grep { $_ and !$_->voided } @fines); + $current_fine_total += int($_->amount * 100) for (grep { $_ and !$_->voided } @fines); my $last_fine; if ($fine) { @@ -544,10 +544,13 @@ sub generate_fines { $client->respond( "\t$pending_fine_count pending fine(s)\n" ); - my ($latest_billing_ts, $latest_amount); + my $recuring_fine = int($c->recuring_fine * 100); + my $max_fine = int($c->max_fine * 100); + + my ($latest_billing_ts, $latest_amount) = ('',0);; for (my $bill = 1; $bill <= $pending_fine_count; $bill++) { - if ($current_fine_total > $c->max_fine) { + if ($current_fine_total >= $max_fine) { $c->update({stop_fines => 'MAXFINES'}); $client->respond( "\tMaximum fine level of ".$c->max_fine. @@ -574,8 +577,8 @@ sub generate_fines { ); next if (@cl); - $current_fine_total += $c->recuring_fine; - $latest_amount += $c->recuring_fine; + $current_fine_total += $recuring_fine; + $latest_amount += $recuring_fine; $latest_billing_ts = $timestamptz; $client->respond( "\t\tAdding aggregate fine of ".$c->recuring_fine." for period starting ".$$timestamptz."\n" ); @@ -585,10 +588,10 @@ sub generate_fines { { xact => ''.$c->id, note => "System Generated Overdue Fine", billing_type => "Overdue materials", - amount => ''.$latest_amount, + amount => sprintf('%0.2f', $latest_amount/100), billing_ts => $latest_billing_ts, } - ) if ($latest_billing_ts and $latest_amount > 0.0); + ) if ($latest_billing_ts and $latest_amount); $self->method_lookup('open-ils.storage.transaction.commit')->run; -- 2.43.2