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
use List::Util qw(first);
use SL::DB;
use List::Util qw(first);
use SL::DB;
$form->{coa} = $::instance_conf->get_coa;
$form->{coa} = $::instance_conf->get_coa;
+ unless ($form->{coa} eq 'Germany-DATEV-SKR03EU' or $form->{coa} eq 'Germany-DATEV-SKR04EU') {
+ croak t8("Advance turnover tax return only valid for SKR03 or SKR04");
+ }
my @category_cent = USTVA->report_variables({
myconfig => $myconfig,
form => $form,
my @category_cent = USTVA->report_variables({
myconfig => $myconfig,
form => $form,
- my @accno;
- my $accno;
- my $ref;
-
# Show all $query in Debuglevel LXDebug::QUERY
my $callingdetails = (caller (0))[3];
$main::lxdebug->message(LXDebug->QUERY(), "$callingdetails \$query=\n $query");
# Show all $query in Debuglevel LXDebug::QUERY
my $callingdetails = (caller (0))[3];
$main::lxdebug->message(LXDebug->QUERY(), "$callingdetails \$query=\n $query");
$sth->execute || $form->dberror($query);
# ugly, but we need to use static accnos
$sth->execute || $form->dberror($query);
# ugly, but we need to use static accnos
- my $accno_five = 3803; # SKR04
- my $accno_sixteen = 3805; # SKR04
+ my ($accno_five, $accno_sixteen, $corr);
+
if ($form->{coa} eq 'Germany-DATEV-SKR03EU') {
if ($form->{coa} eq 'Germany-DATEV-SKR03EU') {
- $accno_five = 1773;
- $accno_sixteen = 1775;
- }
+ $accno_five = 1773;
+ $accno_sixteen = 1775;
+ } elsif (($form->{coa} eq 'Germany-DATEV-SKR04EU')) {
+ $accno_five = 3803; # SKR04
+ $accno_sixteen = 3805; # SKR04
+ } else {die "wrong call"; }
+
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
next unless $ref->{$category};
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
next unless $ref->{$category};
- $form->{ $ref->{$category} } += $ref->{amount};
-
- # umsatzsteuer 16% pos 35
if ($ref->{pos_ustva} eq '35') {
if ($ref->{rate} == 0.16) {
$form->{"pos_ustva_81b_kivi"} += $ref->{amount};
} elsif ($ref->{rate} == 0.05) {
$form->{"pos_ustva_86b_kivi"} += $ref->{amount};
if ($ref->{pos_ustva} eq '35') {
if ($ref->{rate} == 0.16) {
$form->{"pos_ustva_81b_kivi"} += $ref->{amount};
} elsif ($ref->{rate} == 0.05) {
$form->{"pos_ustva_86b_kivi"} += $ref->{amount};
- } else {die ("No valid tax rate for pos 35"); }
+ } elsif ($ref->{rate} == 0.19) {
+ # pos_ustva says 16, but rate says 19
+ # (pos_ustva should be tax dependant and not taxkeys dependant)
+ # 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};
+ } else {die ("No valid tax rate for pos 35" . Dumper($ref)); }
+ # USTVA Pos 36 (Steuerkonten)
if ($ref->{pos_ustva} eq '36') {
if ($ref->{pos_ustva} eq '36') {
- if ($ref->{accno} eq $accno_sixteen) {
+ if ($ref->{accno} =~ /^$accno_sixteen/) {
$form->{"pos_ustva_811b_kivi"} += $ref->{amount};
$form->{"pos_ustva_811b_kivi"} += $ref->{amount};
- } elsif ($ref->{accno} eq $accno_five) {
+ } elsif ($ref->{accno} =~ /^$accno_five/) {
$form->{"pos_ustva_861b_kivi"} += $ref->{amount};
$form->{"pos_ustva_861b_kivi"} += $ref->{amount};
- } else { die "No valid accno for pos 36"; }
+ } else { die ("No valid accno for pos 36" . Dumper($ref)); }
- # umsatzsteuer 5% temp
- #if ($ref->{rate} == 0.05 && $ref->{pos_ustva} ne '66') {
- # if ($ref->{pos_ustva} eq '35') {
- # $form->{"pos_ustva_86b_kivi"} += $ref->{amount};
- # } elsif ($ref->{pos_ustva} eq '36') {
- # $form->{"pos_ustva_861b_kivi"} += $ref->{amount};
- # } else { die "Kein pos_ustva Eintrag!" . Dumper($ref); }
- #}
-
+ $form->{ $ref->{$category} } += $ref->{amount} unless $corr;
'Administration' => 'Administration',
'Administration area' => 'Administration',
'Advance turnover tax return' => 'Umsatzsteuervoranmeldung',
'Administration' => 'Administration',
'Administration area' => 'Administration',
'Advance turnover tax return' => 'Umsatzsteuervoranmeldung',
+ 'Advance turnover tax return only valid for SKR03 or SKR04' => 'UstVA nur für Standardkontenrahmen SKR03 oder SKR04 möglich.',
'After closed period' => 'Ab geschlossenem Zeitraum',
'Aktion' => 'Aktion',
'All' => 'Alle',
'After closed period' => 'Ab geschlossenem Zeitraum',
'Aktion' => 'Aktion',
'All' => 'Alle',