Revision e655480e
Von Jan Büren vor etwa 4 Jahren hinzugefügt
SL/USTVA.pm | ||
---|---|---|
26 | 26 |
|
27 | 27 |
package USTVA; |
28 | 28 |
|
29 |
use Data::Dumper; |
|
29 | 30 |
use List::Util qw(first); |
30 | 31 |
|
31 | 32 |
use SL::DB; |
... | ... | |
523 | 524 |
|
524 | 525 |
$form->{coa} = $::instance_conf->get_coa; |
525 | 526 |
|
527 |
unless ($form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') { |
|
528 |
croak t8("Advance turnover tax return only valid for SKR03 or SKR04"); |
|
529 |
} |
|
526 | 530 |
my @category_cent = USTVA->report_variables({ |
527 | 531 |
myconfig => $myconfig, |
528 | 532 |
form => $form, |
... | ... | |
834 | 838 |
|
835 | 839 |
|; |
836 | 840 |
|
837 |
my @accno; |
|
838 |
my $accno; |
|
839 |
my $ref; |
|
840 |
|
|
841 | 841 |
# Show all $query in Debuglevel LXDebug::QUERY |
842 | 842 |
my $callingdetails = (caller (0))[3]; |
843 | 843 |
$main::lxdebug->message(LXDebug->QUERY(), "$callingdetails \$query=\n $query"); |
... | ... | |
846 | 846 |
|
847 | 847 |
$sth->execute || $form->dberror($query); |
848 | 848 |
# ugly, but we need to use static accnos |
849 |
my $accno_five = 3803; # SKR04
|
|
850 |
my $accno_sixteen = 3805; # SKR04 |
|
849 |
my ($accno_five, $accno_sixteen, $corr);
|
|
850 |
|
|
851 | 851 |
if ($form->{coa} eq 'Germany-DATEV-SKR03EU') { |
852 |
$accno_five = 1773; |
|
853 |
$accno_sixteen = 1775; |
|
854 |
} |
|
852 |
$accno_five = 1773; |
|
853 |
$accno_sixteen = 1775; |
|
854 |
} elsif (($form->{coa} eq 'Germany-DATEV-SKR04EU')) { |
|
855 |
$accno_five = 3803; # SKR04 |
|
856 |
$accno_sixteen = 3805; # SKR04 |
|
857 |
} else {die "wrong call"; } |
|
858 |
|
|
855 | 859 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { |
856 | 860 |
next unless $ref->{$category}; |
861 |
$corr = 0; |
|
857 | 862 |
$ref->{amount} *= -1; |
858 |
$form->{ $ref->{$category} } += $ref->{amount}; |
|
859 |
|
|
860 |
# umsatzsteuer 16% pos 35 |
|
863 |
# USTVA Pos 35 |
|
861 | 864 |
if ($ref->{pos_ustva} eq '35') { |
862 | 865 |
if ($ref->{rate} == 0.16) { |
863 | 866 |
$form->{"pos_ustva_81b_kivi"} += $ref->{amount}; |
864 | 867 |
} elsif ($ref->{rate} == 0.05) { |
865 | 868 |
$form->{"pos_ustva_86b_kivi"} += $ref->{amount}; |
866 |
} else {die ("No valid tax rate for pos 35"); } |
|
869 |
} elsif ($ref->{rate} == 0.19) { |
|
870 |
# pos_ustva says 16, but rate says 19 |
|
871 |
# (pos_ustva should be tax dependant and not taxkeys dependant) |
|
872 |
# correction hotfix for this case: |
|
873 |
# bookings exists with 19% -> |
|
874 |
# move 19% bookings to the 19% position |
|
875 |
# Dont rely on dates of taxkeys |
|
876 |
$corr = 1; |
|
877 |
$form->{"81"} += $ref->{amount}; |
|
878 |
} else {die ("No valid tax rate for pos 35" . Dumper($ref)); } |
|
867 | 879 |
} |
880 |
# USTVA Pos 36 (Steuerkonten) |
|
868 | 881 |
if ($ref->{pos_ustva} eq '36') { |
869 |
if ($ref->{accno} eq $accno_sixteen) {
|
|
882 |
if ($ref->{accno} =~ /^$accno_sixteen/) {
|
|
870 | 883 |
$form->{"pos_ustva_811b_kivi"} += $ref->{amount}; |
871 |
} elsif ($ref->{accno} eq $accno_five) {
|
|
884 |
} elsif ($ref->{accno} =~ /^$accno_five/) {
|
|
872 | 885 |
$form->{"pos_ustva_861b_kivi"} += $ref->{amount}; |
873 |
} else { die "No valid accno for pos 36"; }
|
|
886 |
} else { die ("No valid accno for pos 36" . Dumper($ref)); }
|
|
874 | 887 |
} |
875 |
# umsatzsteuer 5% temp |
|
876 |
#if ($ref->{rate} == 0.05 && $ref->{pos_ustva} ne '66') { |
|
877 |
# if ($ref->{pos_ustva} eq '35') { |
|
878 |
# $form->{"pos_ustva_86b_kivi"} += $ref->{amount}; |
|
879 |
# } elsif ($ref->{pos_ustva} eq '36') { |
|
880 |
# $form->{"pos_ustva_861b_kivi"} += $ref->{amount}; |
|
881 |
# } else { die "Kein pos_ustva Eintrag!" . Dumper($ref); } |
|
882 |
#} |
|
883 |
|
|
888 |
$form->{ $ref->{$category} } += $ref->{amount} unless $corr; |
|
884 | 889 |
} |
885 | 890 |
|
886 | 891 |
$sth->finish; |
Auch abrufbar als: Unified diff
USTVA nur noch für SKR03/SKR04 Hotfix für 19% Buchungen im 16% Zeitraum
Falls kivi doch 19% Buchungen erzeugt ist die Logik
über taxkeys zum Zeitpunkt ungünstig, da die USTVA
die Wahrheit in der acc_trans so nicht erfassen kann