summaryrefslogtreecommitdiff
path: root/bin/io.pl
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-07-21 17:14:15 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-07-21 17:14:15 +0000
commit65e1d575e4fec9395074525e8f1cff8ee1899d13 (patch)
treef9d16f1c7828684043a9fa141cf96528d060833d /bin/io.pl
parented1d4414cb15a901ecca5e5f96c88f44025c34ec (diff)
Correcting cumulative tax display issues, bug 1745757
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1433 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin/io.pl')
-rwxr-xr-xbin/io.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/io.pl b/bin/io.pl
index cbcc9e73..8fbfb31e 100755
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -81,6 +81,40 @@ if ( -f "bin/custom/$form->{login}_io.pl" ) {
# $locale->text('Nov')
# $locale->text('Dec')
+sub _calc_taxes {
+ for $i (1 .. $form->{rowcount}){
+ my $linetotal =
+ $form->parse_amount(\%myconfig, $form->{"sellprice_$i"})
+ * $form->parse_amount(\%myconfig, $form->{"qty_$i"})
+ * (1 - $form->parse_amount(\%myconfig, $form->{"discount_$i"})
+ / 100);
+ @taxaccounts = Tax::init_taxes(
+ $form, $form->{"taxaccounts_$i"},
+ $form->{'taxaccounts'}
+ );
+ my $tax;
+ my $fxtax;
+ my $amount;
+ if ( $form->{taxincluded} ) {
+ $tax += $amount =
+ Tax::calculate_taxes( \@taxaccounts, $form, $linetotal, 1 );
+
+ $form->{"sellprice_$i"} -= $amount / $form->{"qty_$i"};
+ }
+ else {
+ $tax += $amount =
+ Tax::calculate_taxes( \@taxaccounts, $form, $linetotal, 0 );
+ $fxtax +=
+ Tax::calculate_taxes( \@taxaccounts, $form, $fxlinetotal, 0 )
+ if $fxlinetotal;
+ }
+ for (@taxaccounts) {
+ $form->{taxes}{$_->account} = 0 if ! $form->{taxes}{$_->account};
+ $form->{taxes}{$_->account} += $_->value;
+ }
+ }
+}
+
sub display_row {
my $numrows = shift;