X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=ee2d21f78252815877764987ca08a37feaaca98e;hb=65604fea85234a5ae3e787f7cafd81ece6b8621d;hp=7fb3997bbf82f9c16489ebdd050915c46adef878;hpb=e655480e81e8373a08456ac6dc664195a8503573;p=kivitendo-erp.git diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 7fb3997bb..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) @@ -868,13 +869,19 @@ sub get_accounts_ustva { $form->{"pos_ustva_86b_kivi"} += $ref->{amount}; } elsif ($ref->{rate} == 0.19) { # pos_ustva says 16, but rate says 19 - # (pos_ustva should be tax dependant and not taxkeys dependant) + # (pos_ustva should be tax dependent and not taxkeys dependent) # correction hotfix for this case: # bookings exists with 19% -> # move 19% bookings to the 19% position # 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)