[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2325] trunk



Revision: 2325
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2325&view=rev
Author:   einhverfr
Date:     2008-09-17 16:24:13 +0000 (Wed, 17 Sep 2008)

Log Message:
-----------
Performance tuning for multiple payents screen

Modified Paths:
--------------
    trunk/UI/payments/payments_detail.html
    trunk/scripts/payment.pl

Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html	2008-09-13 01:44:05 UTC (rev 2324)
+++ trunk/UI/payments/payments_detail.html	2008-09-17 16:24:13 UTC (rev 2325)
@@ -168,9 +168,8 @@
         <th class="payment"><?lsmb text('Payment') ?></th>
         <th class="payment"><?lsmb text('Details') ?></th>
     </tr>
-    <?lsmb rc = 1 ?><?lsmb count = 0 ?><?lsmb grand_total = 0 ?>
+    <?lsmb rc = 1 ?><?lsmb count = 0 ?>
     <?lsmb FOREACH r = contact_invoices ?>
-    <?lsmb contact_total = 0 ?>
     <?lsmb rc = (rc + 1) % 2; count = count + 1 ?>
     <tr class="listrow<?lsmb rc ?>">
        <td class="account_number" rowspan="2" >
@@ -294,19 +293,12 @@
 			name = "invoice_count_${r.contact_id}"
 			value = icount
 		} ?>
-		<?lsmb IF !r.unselected;
-			IF (${"paid_$r.contact_id"} == 'some');
-				grand_total = grand_total + contact_total;
-			ELSE;
-				grand_total = grand_total + r.total_due;
-			END; # IF (paid...)
-		END # IF !r.unselected) ?>
 		<tr class="subtotal">
 			<td colspan="5" class="total_label">
 				<?lsmb text('Contact Total (if paying "some")') ?>
 			</td>
 			<td><span id='<?lsmb ${"contact_total_$r.id"} ?>'>
-			<?lsmb INCLUDE format_money number= contact_total ?>
+			<?lsmb INCLUDE format_money number= r.contact_total ?>
 			</span><span class="currency">
 				<?lsmb currency ?></span>
 			</td>

Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	2008-09-13 01:44:05 UTC (rev 2324)
+++ trunk/scripts/payment.pl	2008-09-17 16:24:13 UTC (rev 2325)
@@ -360,9 +360,27 @@
     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'), 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.