diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-07-22 23:27:50 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-07-22 23:27:50 +0000 |
commit | ecf56eca694d9606ffe56d3cab13a6614efc6aa4 (patch) | |
tree | 84fc7c9a763a97ef1c633a885b80456fc93559a0 /scripts | |
parent | 12a0239ccda7e2bd68cae034e916c6a664c3c430 (diff) |
Added format option to LedgerSMB::format_amount
Added batch information options for check template
Added batch default_date field
Corrected issues with payment batches not preserving post dates when adding vouchers to existing batch.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2219 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/payment.pl | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/scripts/payment.pl b/scripts/payment.pl index e9aa8482..905c89c8 100644 --- a/scripts/payment.pl +++ b/scripts/payment.pl @@ -256,6 +256,7 @@ sub post_payments_bulk { sub print { use LedgerSMB::DBObject::Company; + use LedgerSMB::Batch; my ($request) = @_; my $payment = LedgerSMB::DBObject::Payment->new({'base' => $request}); $payment->{company} = $payment->{_user}->{company}; @@ -263,18 +264,18 @@ sub print { my $template; - # To be committed tonight separately -- CT - # - #if ($payment->{batch_id}){ - # my $batch = LedgerSMB::Batch->new( - # {base => $payment, - # copy => 'base' } - # ); - # $batch->{id} = $payment->{batch_id}; - # $batch->get; - # $payment->{batch_description} = $batch->{description}; - # $payment->{batch_control_code} = $batch->{control_code}; - #} + if ($payment->{batch_id}){ + my $batch = LedgerSMB::Batch->new( + {base => $payment, + copy => 'base' } + ); + $batch->{id} = $payment->{batch_id}; + $batch->get; + $payment->{batch_description} = $batch->{description}; + $payment->{batch_control_code} = $batch->{control_code}; + } + + $payment->{format_amount} = sub {return $payment->format_amount(@_); }; if ($payment->{multiple}){ $payment->{checks} = []; @@ -323,9 +324,9 @@ sub print { my $amt = $check->{amount}->copy; $amt->bfloor(); $check->{text_amount} = $payment->text_amount($amt); - $check->{amount} = $check->format_amount(amount => $check->{amount}); + $check->{amount} = $check->format_amount(amount => $check->{amount}, + format => '1000.00'); $check->{decimal} = $check->format_amount(amount => ($check->{amount} - $amt) * 100); - print STDERR "amount = $check->{amount}, texamount = $check->{textamount}\n"; push @{$payment->{checks}}, $check; } $template = LedgerSMB::Template->new( |