X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/30b4a78c4100ebdcd6e6917fbcbf1d12f4f7b4d6..5a1856a8dc3dfc32759713c23ac40c93fe8ae598:/bin/mozilla/ap.pl diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 3c1386e0d..0e3048ab6 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -496,9 +496,11 @@ sub form_header { $form->{"taxcharts_$i"} = \@taxcharts; # reverse charge hack for template, display two taxes - if ($taxchart_to_use->taxkey == 94) { + if ($taxchart_to_use->reverse_charge_chart_id) { my $tmpnetamount; - ($tmpnetamount, $form->{"tax_reverse_$i"}) = $form->calculate_tax($form->parse_amount(\%myconfig, $form->{"amount_$i"}), 0.19, $form->{taxincluded},2); + ($tmpnetamount, $form->{"tax_reverse_$i"}) = $form->calculate_tax($form->parse_amount(\%myconfig, $form->{"amount_$i"}), + $taxchart_to_use->rate, $form->{taxincluded}, 2 ); + $form->{"tax_charge_$i"} = $form->{"tax_reverse_$i"} * -1; $form->{"tax_reverse_$i"} = $form->format_amount(\%myconfig, $form->{"tax_reverse_$i"}, 2); $form->{"tax_charge_$i"} = $form->format_amount(\%myconfig, $form->{"tax_charge_$i"}, 2); @@ -807,14 +809,15 @@ sub post { $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig)); my $zero_amount_posting = 1; - # no taxincluded for 94 - my $tax = SL::DB::Manager::Tax->get_first( where => [taxkey => 94 ]); - my $tax_id = ref $tax eq 'SL::DB::Tax' ? $tax->id : undef; for my $i (1 .. $form->{rowcount}) { - # no taxincluded for 94 - if ($tax_id && $form->{"taxchart_$i"} =~ m/^$tax_id--/ && $form->{taxincluded}) { + + # no taxincluded for reverse charge + my ($used_tax_id) = split(/--/, $form->{"taxchart_$i"}); + my $tax = SL::DB::Manager::Tax->find_by(id => $used_tax_id); + if ($tax->reverse_charge_chart_id && $form->{taxincluded}) { $form->error($locale->text('Cannot Post AP transaction with tax included!')); } + if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) { $zero_amount_posting = 0; }