From: G. Richardson Date: Mon, 2 Oct 2017 06:54:16 +0000 (+0200) Subject: DATEV-Export: Option "als Personenkonten exportieren" X-Git-Tag: release-3.5.4~738 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a3a6ec066c6860a3aab44449d0620660665ed6e0;p=kivitendo-erp.git DATEV-Export: Option "als Personenkonten exportieren" statt der Sammelkontonummer wird beim Export immer die Kunden- bzw. Lieferantennummer exportiert. Es wird noch nicht auf eine gültige Kontonummer (z.B. 10000-69999 und 70000-99999) geprüft. --- diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 00e0aa3b7..426788ab0 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -225,6 +225,16 @@ sub warnings { } } +sub use_pk { + my $self = shift; + + if (@_) { + $self->{use_pk} = $_[0]; + } + + return $self->{use_pk}; +} + sub accnofrom { my $self = shift; @@ -440,11 +450,18 @@ sub generate_datev_data { my %all_taxchart_ids = selectall_as_map($form, $self->dbh, qq|SELECT DISTINCT chart_id, TRUE AS is_set FROM tax|, 'chart_id', 'is_set'); + my $ar_accno = "c.accno"; + my $ap_accno = "c.accno"; + if ( $self->use_pk ) { + $ar_accno = "CASE WHEN ac.chart_link = 'AR' THEN ct.customernumber ELSE c.accno END as accno"; + $ap_accno = "CASE WHEN ac.chart_link = 'AP' THEN ct.vendornumber ELSE c.accno END as accno"; + } + my $query = qq|SELECT ac.acc_trans_id, ac.transdate, ac.gldate, ac.trans_id,ar.id, ac.amount, ac.taxkey, ac.memo, ar.invnumber, ar.duedate, ar.amount as umsatz, ar.deliverydate, ar.itime::date, ct.name, ct.ustid, ct.customernumber AS vcnumber, ct.id AS customer_id, NULL AS vendor_id, - c.accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, + $ar_accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ar.invoice, t.rate AS taxrate, t.taxdescription, 'ar' as table, @@ -473,7 +490,7 @@ sub generate_datev_data { SELECT ac.acc_trans_id, ac.transdate, ac.gldate, ac.trans_id,ap.id, ac.amount, ac.taxkey, ac.memo, ap.invnumber, ap.duedate, ap.amount as umsatz, ap.deliverydate, ap.itime::date, ct.name, ct.ustid, ct.vendornumber AS vcnumber, NULL AS customer_id, ct.id AS vendor_id, - c.accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, + $ap_accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ap.invoice, t.rate AS taxrate, t.taxdescription, 'ap' as table, @@ -956,6 +973,7 @@ sub generate_datev_lines { if ($trans_lines >= 2) { + # Personenkontenerweiterung: accno has already been replaced if use_pk was set $datev_data{'gegenkonto'} = $transaction->[$haben]->{'accno'}; $datev_data{'konto'} = $transaction->[$soll]->{'accno'}; if ($transaction->[$haben]->{'invnumber'} ne "") { diff --git a/bin/mozilla/datev.pl b/bin/mozilla/datev.pl index e5c048b66..d34f0e32d 100644 --- a/bin/mozilla/datev.pl +++ b/bin/mozilla/datev.pl @@ -112,6 +112,7 @@ sub export3 { $::form->{zeitraum}, $::form->{monat}, $::form->{quartal}, $::form->{transdatefrom}, $::form->{transdateto}, ); + $data{use_pk} = $::form->{use_pk}; } else { die 'invalid exporttype'; } diff --git a/locale/de/all b/locale/de/all index 0bb312692..9b5f4d22c 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1341,6 +1341,7 @@ $self->{texts} = { 'Export date to' => 'Exportdatum bis', 'Export error in transaction #1: Rounding error too large #2' => 'Exportfehler in Transaktion #1: Zu großer Rundungsfehler (#2)', 'Export error in transaction #1: Unbalanced ledger before next transaction (#2)' => 'Exportfehler in Transaktion #1: Unausgeglichene Buchung', + 'Export with CV Charts' => 'Mit Personenkonten exportieren', 'Extend automatically by n months' => 'Automatische Verlängerung um x Monate', 'Extended' => 'Gesamt', 'Extended status' => 'Erweiterter Status', diff --git a/locale/en/all b/locale/en/all index efa2072b3..7f38936e1 100644 --- a/locale/en/all +++ b/locale/en/all @@ -1340,6 +1340,7 @@ $self->{texts} = { 'Export date to' => '', 'Export error in transaction #1: Rounding error too large #2' => '', 'Export error in transaction #1: Unbalanced ledger before next transaction (#2)' => '', + 'Export with CV Charts' => '', 'Extend automatically by n months' => '', 'Extended' => '', 'Extended status' => '', diff --git a/templates/webpages/datev/export_bewegungsdaten.html b/templates/webpages/datev/export_bewegungsdaten.html index f8bd353b0..e10aa7932 100644 --- a/templates/webpages/datev/export_bewegungsdaten.html +++ b/templates/webpages/datev/export_bewegungsdaten.html @@ -88,6 +88,20 @@
[% END %] + + + + + + + + +
[% 'Export with CV Charts' | $T8 %][% L.checkbox_tag('use_pk', value => 1, checked => 0) %]
+ + + +
+