[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2340] trunk
- Subject: SF.net SVN: ledger-smb:[2340] trunk
- From: ..hidden..
- Date: Thu, 25 Sep 2008 02:01:35 +0000
Revision: 2340
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2340&view=rev
Author: einhverfr
Date: 2008-09-25 02:01:35 +0000 (Thu, 25 Sep 2008)
Log Message:
-----------
Addressing performance issues in multiple payments interface. Adding additional formatting options to format_number, and making multiple payment interface more locale safe.
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Payment.pm
trunk/LedgerSMB.pm
trunk/UI/payments/payments_detail.html
trunk/scripts/payment.pl
Modified: trunk/LedgerSMB/DBObject/Payment.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Payment.pm 2008-09-23 23:23:03 UTC (rev 2339)
+++ trunk/LedgerSMB/DBObject/Payment.pm 2008-09-25 02:01:35 UTC (rev 2340)
@@ -459,10 +459,14 @@
my $tmp_invoices = $inv->{invoices};
$inv->{invoices} = [];
@{$inv->{invoices}} = $self->_parse_array($tmp_invoices);
-# $self->error(Dumper($inv->{invoices}));
@{$inv->{invoices}} = sort { $a->[2] cmp $b->[2] } @{ $inv->{invoices} };
+ for my $invoice (@{$inv->{invoices}}){
+ $invoice->[6] = Math::BigFloat->new($invoice->[6]);
+ $invoice->[3] = Math::BigFloat->new($invoice->[3]);
+ $invoice->[4] = Math::BigFloat->new($invoice->[4]);
+ }
}
-
+
$self->{dbh}->commit; # Commit locks
}
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2008-09-23 23:23:03 UTC (rev 2339)
+++ trunk/LedgerSMB.pm 2008-09-25 02:01:35 UTC (rev 2340)
@@ -380,6 +380,9 @@
if (!defined $format){
$format = $myconfig->{numberformat}
}
+ if (!defined $args{precision} and defined $args{money}){
+ $places = $LedgerSMB::Sysconfig::decimal_places;
+ }
my $negative;
if ($amount) {
Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html 2008-09-23 23:23:03 UTC (rev 2339)
+++ trunk/UI/payments/payments_detail.html 2008-09-25 02:01:35 UTC (rev 2340)
@@ -5,8 +5,8 @@
'UI/payments/payments.css'
]
?>
-<?lsmb BLOCK format_money ?><?lsmb FILTER format('%15.2f') ?><?lsmb number
-?><?lsmb END # filter ?><?lsmb END # block ?>
+<?lsmb BLOCK format_money ?><?lsmb number
+?><?lsmb END # block ?>
<?lsmb PROCESS elements.html # Include form elements helper. ?>
<?lsmb contact_type = (account_class == 1) ? text('Vendor') : text('Customer')
?>
@@ -198,7 +198,7 @@
ELSE ; 'name_has_no_vouchers' ;
END
?>"><?lsmb r.contact_name ?></span></td>
- <td class="invoice"><?lsmb INCLUDE format_money number=r.total_due ?>
+ <td class="invoice"><?lsmb r.total_due ?>
<?lsmb currency ?></td>
<td class="payment" class="details_select">
<?lsmb INCLUDE input element_data = {
@@ -243,47 +243,42 @@
<?lsmb icount = icount + 1 ?>
<tr>
<td class="invoice_date_list"> <?lsmb i.2 ?></td>
- <?lsmb PROCESS input element_data = {
- name = "invdate_$i.0"
+ <input
+ name = "<?lsmb "invdate_$i.0" ?>"
type = "hidden"
value = i.2
- } ?>
+ />
<td class="invoice_list"> <?lsmb i.1 ?></td>
- <?lsmb PROCESS input element_data = {
- name = "invnumber_$i.0"
+ <input
+ name = "<?lsmb "invnumber_$i.0" ?>"
type = "hidden"
- value = i.1
+ value = "<?lsmb i.1 ?>"
} ?>
<td class="total_due_list">
- <?lsmb INCLUDE format_money number=i.3 ?></td>
+ <?lsmb i.3 ?></td>
<td class="paid_list">
- <?lsmb INCLUDE format_money number=i.4 ?></td>
+ <?lsmb i.4 ?></td>
<td class="net_due_list">
- <?lsmb INCLUDE format_money number= i.6 ?>
+ <?lsmb i.6 ?>
<?lsmb currency ?></td>
<td class="to_pay_list">
- <?lsmb IF ! ${"payment_$r.contact_id_$i.0"} ?>
-
- <?lsmb ${"payment_$r.contact_id_$i.0"} =
- INCLUDE format_money number= i.6 ?>
- <?lsmb END # if ?>
- <?lsmb INCLUDE input element_data = {
- name = "payment_$r.contact_id_$i.0"
- value = ${"payment_$r.contact_id_$i.0"}
+ <input
+ name = "<?lsmb "payment_$i.0" ?>"
+ value = "<?lsmb ${"payment_$i.0"} ?>"
size = 20
type = "text"
class = "monetary"
- } ?>
- <?lsmb INCLUDE input element_data = {
+ />
+ <input
type = "hidden"
- name = "invoice_${r.contact_id}_$icount"
- value = i.0
- } ?>
- <?lsmb INCLUDE input element_data = {
+ name = "<?lsmb "invoice_${r.contact_id}_$icount" ?>"
+ value = "<?lsmb i.0 ?>"
+ />
+ <input
type = "hidden"
- name = "net_$i.0"
- value = ${"payment_$r.contact_id_$i.0"}
- } ?>
+ name = "<?lsmb "net_$i.0" ?>"
+ value = "<?lsmb ${"payment_$r.contact_id_$i.0"} ?>"
+ />
</td>
</tr>
<?lsmb END # foreach i ?>
@@ -297,7 +292,7 @@
<?lsmb text('Contact Total (if paying "some")') ?>
</td>
<td><span id='<?lsmb ${"contact_total_$r.id"} ?>'>
- <?lsmb INCLUDE format_money number= r.contact_total ?>
+ <?lsmb r.contact_total ?>
</span><span class="currency">
<?lsmb currency ?></span>
</td>
@@ -310,7 +305,7 @@
<td class="total_label"><?lsmb text('Grand Total') ?></td>
<td>
<span id="grand_total">
- <?lsmb INCLUDE format_money number = grand_total ?>
+ <?lsmb grand_total ?>
</span>
<span class="currency">
<?lsmb currency ?>
Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl 2008-09-23 23:23:03 UTC (rev 2339)
+++ trunk/scripts/payment.pl 2008-09-25 02:01:35 UTC (rev 2340)
@@ -363,24 +363,40 @@
$payment->{grand_total} = 0;
for (@{$payment->{contact_invoices}}){
my $contact_total = 0;
- $_->{total_due} = $payment->format_amount(amount => $_->{total_due});
+ $_->{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->{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 {
+ }
+ }
+ $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'});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.