[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2515] branches/1.2/bin/oe.pl
- Subject: SF.net SVN: ledger-smb:[2515] branches/1.2/bin/oe.pl
- From: ..hidden..
- Date: Wed, 18 Mar 2009 23:54:45 +0000
Revision: 2515
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2515&view=rev
Author: einhverfr
Date: 2009-03-18 23:54:44 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
Correcting handling of cumulative sales taxes on order/quote screens (affects Quebec users only AFAIK)
Modified Paths:
--------------
branches/1.2/bin/oe.pl
Modified: branches/1.2/bin/oe.pl
===================================================================
--- branches/1.2/bin/oe.pl 2009-03-18 23:19:33 UTC (rev 2514)
+++ branches/1.2/bin/oe.pl 2009-03-18 23:54:44 UTC (rev 2515)
@@ -680,16 +680,33 @@
|;
}
+ # This function is used to sort taxes by pass value.
+ sub bypass {
+ $a->pass <=> $b->pass;
+ }
+
if ( !$form->{taxincluded} ) {
- my @taxes = Tax::init_taxes( $form, $form->{taxaccounts} );
+ my @taxes = sort bypass Tax::init_taxes( $form, $form->{taxaccounts} );
+ my $passlvl = 0;
+ my $taxable_base = undef;
foreach my $item (@taxes) {
my $taccno = $item->account;
+
+ if ( $taxable_base eq undef ) {
+ $taxable_base = $form->{"${taccno}_base"};
+ }
+
+ if ( $item->pass gt $passlvl ) {
+ $taxable_base = $form->{invtotal};
+ }
+ $passlvl = $item->pass;
+
$form->{invtotal} += $form->round_amount(
- $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2);
+ $form->{"${taccno}_rate"} * $taxable_base, 2);
$form->{"${taccno}_total"} =
- $form->format_amount( \%myconfig,
- $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2 );
+ $form->format_amount( \%myconfig,
+ $form->{"${taccno}_rate"} * $taxable_base, 2 );
$tax .= qq|
<tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.