X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=ee2d21f78252815877764987ca08a37feaaca98e;hb=3782a90c336bc6c506f572e607c8526cb5e79ea3;hp=b01ebac9ac7d85d107d45cbdde1246669fc1df92;hpb=a599a88144d9c90c2d1c717204ad775b721bf736;p=kivitendo-erp.git diff --git a/SL/USTVA.pm b/SL/USTVA.pm index b01ebac9a..ee2d21f78 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -26,6 +26,7 @@ package USTVA; +use Carp; use Data::Dumper; use List::Util qw(first); @@ -33,6 +34,7 @@ use SL::DB; use SL::DBUtils; use SL::DB::Default; use SL::DB::Finanzamt; +use SL::Locale::String qw(t8); use utf8; use strict; @@ -691,7 +693,7 @@ sub get_accounts_ustva { SUM( ac.amount * -- Bezahlt / Rechnungssumme ( - SELECT SUM(acc.amount), t.rate, c.accno + SELECT SUM(acc.amount) FROM acc_trans acc INNER JOIN chart c ON (acc.chart_id = c.id AND c.link like '%AR_paid%') @@ -699,13 +701,12 @@ sub get_accounts_ustva { 1=1 $ARwhere AND acc.trans_id = ac.trans_id - ) - / + ) / ( SELECT amount FROM ar WHERE id = ac.trans_id ) ) AS amount, - tk.pos_ustva + tk.pos_ustva, t.rate, c.accno FROM acc_trans ac LEFT JOIN chart c ON (c.id = ac.chart_id) LEFT JOIN ar ON (ar.id = ac.trans_id) @@ -875,6 +876,12 @@ sub get_accounts_ustva { # Dont rely on dates of taxkeys $corr = 1; $form->{"81"} += $ref->{amount}; + } elsif ($ref->{rate} == 0.07) { + # pos_ustva says 5, but rate says 7 + # see comment above: + # Dont rely on dates of taxkeys + $corr = 1; + $form->{"86"} += $ref->{amount}; } else {die ("No valid tax rate for pos 35" . Dumper($ref)); } } # USTVA Pos 36 (Steuerkonten)