summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-17 16:24:13 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-09-17 16:24:13 +0000
commit2bb509376b95084eca458df2dd8de907f94694c5 (patch)
tree808a30c3dd2505d7e1a545d221debee2f618fed4 /scripts
parentc22beebb571b727fcc80ee9c4e4741ab6ca10010 (diff)
Performance tuning for multiple payents screen
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2325 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts')
-rw-r--r--scripts/payment.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/payment.pl b/scripts/payment.pl
index 9037aca8..6da1d5b6 100644
--- a/scripts/payment.pl
+++ b/scripts/payment.pl
@@ -360,9 +360,27 @@ sub display_payments {
my ($request) = @_;
my $payment = LedgerSMB::DBObject::Payment->new({'base' => $request});
$payment->get_payment_detail_data();
+ $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')
+ or (defined $payment->{"id_$_->{contact_id}"})){
+ if ($payment->{"paid_$_->{contact_id}"} eq 'some'){
+ for my $invoice (@{$_->{invoices}}){
+ my $i_id = $invoice->[0];
+ $contact_total
+ += $payment->{"paid_$_->{contact_id}_$i_id"};
+ }
+ } else {
+ $contact_total = $_->{total_due};
+ }
+ $payment->{grand_total} += $contact_total;
+ }
+ $_->{contact_total} = $contact_total;
}
+ $payment->debug({file => '/tmp/payment'});
@{$payment->{media_options}} = (
{text => $request->{_locale}->text('Screen'),