X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FUSTVA.pm;h=b10fea6377d4d8aae149cf0f87bb3ac30291916d;hb=786b3862388eb8d4cdcc5dfc663a37fe0e9a82a1;hp=658e2c766e510006c63555da070d358b0daa12ac;hpb=ccd0b365250f57021a756203f65a4d153709b45d;p=kivitendo-erp.git diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 658e2c766..b10fea637 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -386,11 +386,7 @@ sub info { } else { - if ($form->{error_function}) { - &{ $form->{error_function} }($msg); - } else { - die "Hinweis: $msg\n"; - } + die "Hinweis: $msg\n"; } $main::lxdebug->leave_sub(); @@ -800,6 +796,21 @@ sub get_accounts_ustva { $ARwhere .= " AND acc.transdate <= '$todate'"; } + my $acc_trans_where = '1=1'; + if ($fromdate || $todate) { + $acc_trans_where = "ac.trans_id IN (SELECT DISTINCT trans_id FROM acc_trans WHERE "; + + if ($fromdate) { + $acc_trans_where .= "transdate >= '$fromdate'"; + } + if ($todate) { + $acc_trans_where .= " AND " if ($fromdate); + $acc_trans_where .= "transdate <= '$todate'"; + } + + $acc_trans_where .= ")"; + } + ############################################ # Method eq 'cash' = IST Versteuerung ############################################ @@ -847,9 +858,7 @@ sub get_accounts_ustva { ) ) WHERE - 1=1 - -- Here no where, please. All Transactions ever should be - -- testet if they are paied in the USTVA report period. + $acc_trans_where GROUP BY tk.pos_ustva |; @@ -882,7 +891,7 @@ sub get_accounts_ustva { } else { - $self->error("Unknown tax method: $form->{method}") + $form->error("Unknown tax method: $form->{method}") }