summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-25 02:01:35 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-25 02:01:35 +0000
commit7fad3552f9a62dcaf51fb13880bf0dba476883bf (patch)
tree53bd6883280b5f57290a7a1ccfbd28cd0d4ccf85 /scripts
parent0a1573bd053a30b3ba2690fcf3545be02cb2eaa8 (diff)
Addressing performance issues in multiple payments interface. Adding additional formatting options to format_number, and making multiple payment interface more locale safe.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2340 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts')
-rw-r--r--scripts/payment.pl36
1 files changed, 26 insertions, 10 deletions
diff --git a/scripts/payment.pl b/scripts/payment.pl
index 09472dd3..b9d6f94c 100644
--- a/scripts/payment.pl
+++ b/scripts/payment.pl
@@ -363,24 +363,40 @@ sub display_payments {
$payment->{grand_total} = 0;
for (@{$payment->{contact_invoices}}){
my $contact_total = 0;
- $_->{total_due} = $payment->format_amount(amount => $_->{total_due});
-
- if (($payment->{action} ne 'update_payments')
+ $_->{total_due} = $payment->format_amount(amount => $_->{total_due},
+ money => 1);
+ for my $invoice (@{$_->{invoices}}){
+ if (($payment->{action} ne 'update_payments')
or (defined $payment->{"id_$_->{contact_id}"})){
- if ($payment->{"paid_$_->{contact_id}"} eq 'some'){
- for my $invoice (@{$_->{invoices}}){
+
+ if ($payment->{"paid_$_->{contact_id}"} eq 'some'){
my $i_id = $invoice->[0];
$contact_total
+= $payment->{"paid_$_->{contact_id}_$i_id"};
- }
- } else {
- $contact_total = $_->{total_due};
+ }
+ }
+ $invoice->[3] = $payment->format_amount(amount => $invoice->[3],
+ money => 1);
+ $invoice->[4] = $payment->format_amount(amount => $invoice->[4],
+ money => 1);
+ $invoice->[5] = $payment->format_amount(amount => $invoice->[5],
+ money => 1);
+ $invoice->[6] = $payment->format_amount(amount => $invoice->[6],
+ money => 1);
+ if (!$payment->{action} ne 'update_payments'){
+ my $fld = "payment_" . $invoice->[0];
+ $payment->{"$fld"} = $invoice->[6];
}
+ }
+ if ($payment->{"paid_$_->{contact_id}"} ne 'some') {
+ $contact_total = $_->{total_due};
+ }
+ if (($payment->{action} ne 'update_payments')
+ or (defined $payment->{"id_$_->{contact_id}"})){
+ $_->{contact_total} = $contact_total;
$payment->{grand_total} += $contact_total;
}
- $_->{contact_total} = $contact_total;
}
-
@{$payment->{media_options}} = (
{text => $request->{_locale}->text('Screen'),
value => 'screen'});