From 2f6e7625957d22de1008f2c6828835295b468fb7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 15 Mar 2013 13:51:37 +0100 Subject: [PATCH] =?utf8?q?Beim=20DATEV-Export=20Lieferdatum=20als=20entsch?= =?utf8?q?eidenden=20Tag=20zur=20Bestimmung=20der=20Steuer=20ber=C3=BCcksi?= =?utf8?q?chtigen=20Analog=20wie=20bei=20Einkaufs-=20und=20Verkaufsbelegen?= =?utf8?q?=20wird=20jetzt=20auch=20beim=20DATEV-Export=20das=20Lieferdatum?= =?utf8?q?=20der=20Transaktion=20verwendet.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DATEV.pm | 9 +++++---- SL/IC.pm | 2 ++ SL/IS.pm | 2 +- SL/Taxkeys.pm | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 21e192a08..406f09d76 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -353,7 +353,7 @@ sub _get_transactions { my $query = qq|SELECT ac.acc_trans_id, ac.transdate, ac.trans_id,ar.id, ac.amount, ac.taxkey, - ar.invnumber, ar.duedate, ar.amount as umsatz, + ar.invnumber, ar.duedate, ar.amount as umsatz, ar.deliverydate, ct.name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ar.invoice @@ -368,7 +368,7 @@ sub _get_transactions { UNION ALL SELECT ac.acc_trans_id, ac.transdate, ac.trans_id,ap.id, ac.amount, ac.taxkey, - ap.invnumber, ap.duedate, ap.amount as umsatz, + ap.invnumber, ap.duedate, ap.amount as umsatz, ap.deliverydate, ct.name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ap.invoice @@ -383,7 +383,7 @@ sub _get_transactions { UNION ALL SELECT ac.acc_trans_id, ac.transdate, ac.trans_id,gl.id, ac.amount, ac.taxkey, - gl.reference AS invnumber, gl.transdate AS duedate, ac.amount as umsatz, + gl.reference AS invnumber, gl.transdate AS duedate, ac.amount as umsatz, NULL as deliverydate, gl.description AS name, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, FALSE AS invoice @@ -528,7 +528,8 @@ sub _get_transactions { push @{ $self->{DATEV} }, [ \%new_trans, $trans->[$j] ]; } elsif (($j != $notsplitindex) && !$trans->[$j]->{is_tax}) { - my %tax_info = $taxkeys->get_full_tax_info('transdate' => $trans->[$j]->{transdate}); + my %tax_info = $taxkeys->get_full_tax_info('transdate' => $trans->[$j]->{transdate}, + 'deliverydate' => $trans->[$j]->{deliverydate}); my %new_trans = (); map { $new_trans{$_} = $trans->[$notsplitindex]->{$_}; } keys %{ $trans->[$notsplitindex] }; diff --git a/SL/IC.pm b/SL/IC.pm index 4b48dcc4f..7a52096a0 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -1497,6 +1497,8 @@ sub retrieve_accounts { # if credit_note has a deliverydate, use this instead of invdate # useful for credit_notes of invoices from an old period with different tax # if there is no deliverydate then invdate is used, old default (see next elsif) + # Falls hier der Stichtag für Steuern anders bestimmt wird, + # entsprechend auch bei Taxkeys.pm anpassen $transdate = $form->{deliverydate}; } elsif (($form->{type} eq "credit_note") || ($form->{script} eq 'ir.pl')) { $transdate = $form->{invdate}; diff --git a/SL/IS.pm b/SL/IS.pm index 1deeb2a47..28323326f 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -821,7 +821,7 @@ sub post_invoice { } $project_id = conv_i($form->{"globalproject_id"}); - + # entsprechend auch beim Bestimmen des Steuerschlüssels in Taxkey.pm berücksichtigen my $taxdate = $form->{deliverydate} ? $form->{deliverydate} : $form->{invdate}; foreach my $trans_id (keys %{ $form->{amount_cogs} }) { diff --git a/SL/Taxkeys.pm b/SL/Taxkeys.pm index cf3463bb7..d921a9056 100644 --- a/SL/Taxkeys.pm +++ b/SL/Taxkeys.pm @@ -78,7 +78,8 @@ sub get_tax_info { } my $sth = $self->{handles}->{get_tax_info}; - do_statement($form, $sth, $self->{queries}->{get_tax_info}, $params{taxkey}, $params{transdate}); + # Lieferdatum (deliverydate) ist entscheidend für den Steuersatz + do_statement($form, $sth, $self->{queries}->{get_tax_info}, $params{taxkey}, $params{deliverydate} || $params{transdate}); my $ref = $sth->fetchrow_hashref() || { }; @@ -106,7 +107,7 @@ sub get_full_tax_info { my @all_taxkeys = map { $_->{taxkey} } (selectall_hashref_query($form, $form->get_standard_dbh(), qq|SELECT DISTINCT taxkey FROM tax WHERE taxkey IS NOT NULL|)); foreach my $taxkey (@all_taxkeys) { - my $ref = $self->get_tax_info('transdate' => $params{transdate}, 'taxkey' => $taxkey); + my $ref = $self->get_tax_info('transdate' => $params{transdate}, 'taxkey' => $taxkey, 'deliverydate' => $params{deliverydate}); $tax_info{taxkeys}->{$taxkey} = $ref; $tax_info{accnos}->{$ref->{taxchart_id}} = $ref if ($ref->{taxchart_id}); -- 2.20.1