From 142ea3bff784ba29bd87de5615bb4f2aec8c977f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 10 Nov 2020 11:37:41 +0100 Subject: [PATCH] Leistungsdatum: DATEV, Debitoren-/Kreditoren-/Dialogbuchungen --- SL/AP.pm | 4 ++-- SL/AR.pm | 4 ++-- SL/DATEV.pm | 6 +++--- SL/DB/MetaSetup/GLTransaction.pm | 1 + SL/Form.pm | 2 +- SL/GL.pm | 6 +++--- sql/Pg-upgrade2/tax_point.sql | 1 + templates/webpages/ap/form_header.html | 4 ++++ templates/webpages/ar/form_header.html | 4 ++++ templates/webpages/gl/form_header.html | 16 ++++++++-------- 10 files changed, 29 insertions(+), 19 deletions(-) diff --git a/SL/AP.pm b/SL/AP.pm index 937af8b58..71c2b4b00 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -139,14 +139,14 @@ sub _post_transaction { $query = qq|UPDATE ap SET invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?, - amount = ?, duedate = ?, deliverydate = ?, paid = ?, netamount = ?, + amount = ?, duedate = ?, deliverydate = ?, tax_point = ?, paid = ?, netamount = ?, currency_id = (SELECT id FROM currencies WHERE name = ?), notes = ?, department_id = ?, storno = ?, storno_id = ?, globalproject_id = ?, direct_debit = ? WHERE id = ?|; @values = ($form->{invnumber}, conv_date($form->{transdate}), $form->{ordnumber}, conv_i($form->{vendor_id}), $form->{taxincluded} ? 't' : 'f', $form->{invtotal}, - conv_date($form->{duedate}), conv_date($form->{deliverydate}), + conv_date($form->{duedate}), conv_date($form->{deliverydate}), conv_date($form->{tax_point}), $form->{invpaid}, $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}), $form->{storno}, diff --git a/SL/AR.pm b/SL/AR.pm index b26911af7..30fb5e8a8 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -134,14 +134,14 @@ sub _post_transaction { $query = qq|UPDATE ar set invnumber = ?, ordnumber = ?, transdate = ?, customer_id = ?, - taxincluded = ?, amount = ?, duedate = ?, deliverydate = ?, paid = ?, + taxincluded = ?, amount = ?, duedate = ?, deliverydate = ?, tax_point = ?, paid = ?, currency_id = (SELECT id FROM currencies WHERE name = ?), netamount = ?, notes = ?, department_id = ?, employee_id = ?, storno = ?, storno_id = ?, globalproject_id = ?, direct_debit = ? WHERE id = ?|; my @values = ($form->{invnumber}, $form->{ordnumber}, conv_date($form->{transdate}), conv_i($form->{customer_id}), $form->{taxincluded} ? 't' : 'f', $form->{amount}, - conv_date($form->{duedate}), conv_date($form->{deliverydate}), $form->{paid}, + conv_date($form->{duedate}), conv_date($form->{deliverydate}), conv_date($form->{tax_point}), $form->{paid}, $form->{currency}, $form->{netamount}, $form->{notes}, conv_i($form->{department_id}), conv_i($form->{employee_id}), $form->{storno} ? 't' : 'f', $form->{storno_id}, diff --git a/SL/DATEV.pm b/SL/DATEV.pm index af188f70a..c6ce5b2a0 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -517,7 +517,7 @@ sub generate_datev_data { 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, + ar.invnumber, ar.duedate, ar.amount as umsatz, COALESCE(ar.tax_point, ar.deliverydate) AS deliverydate, ar.itime::date, ct.name, ct.ustid, ct.customernumber AS vcnumber, ct.id AS customer_id, NULL AS vendor_id, $ar_accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ar.invoice, @@ -546,7 +546,7 @@ sub generate_datev_data { UNION ALL 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, + ap.invnumber, ap.duedate, ap.amount as umsatz, COALESCE(ap.tax_point, ap.deliverydate) AS deliverydate, ap.itime::date, ct.name, ct.ustid, ct.vendornumber AS vcnumber, NULL AS customer_id, ct.id AS vendor_id, $ap_accno, c.description AS accname, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ap.invoice, @@ -575,7 +575,7 @@ sub generate_datev_data { UNION ALL SELECT ac.acc_trans_id, ac.transdate, ac.gldate, ac.trans_id,gl.id, ac.amount, ac.taxkey, ac.memo, - gl.reference AS invnumber, NULL AS duedate, ac.amount as umsatz, gl.deliverydate, gl.itime::date, + gl.reference AS invnumber, NULL AS duedate, ac.amount as umsatz, COALESCE(gl.tax_point, gl.deliverydate) AS deliverydate, gl.itime::date, gl.description AS name, NULL as ustid, '' AS vcname, NULL 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, FALSE AS invoice, diff --git a/SL/DB/MetaSetup/GLTransaction.pm b/SL/DB/MetaSetup/GLTransaction.pm index f59251362..4d0e41b13 100644 --- a/SL/DB/MetaSetup/GLTransaction.pm +++ b/SL/DB/MetaSetup/GLTransaction.pm @@ -23,6 +23,7 @@ __PACKAGE__->meta->columns( reference => { type => 'text' }, storno => { type => 'boolean', default => 'false' }, storno_id => { type => 'integer' }, + tax_point => { type => 'date' }, taxincluded => { type => 'boolean' }, transdate => { type => 'date', default => 'now' }, type => { type => 'text' }, diff --git a/SL/Form.pm b/SL/Form.pm index a596a7561..fa6e70a17 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2566,7 +2566,7 @@ sub create_links { $query = qq|SELECT a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid, a.deliverydate, - a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes, + a.duedate, a.tax_point, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes, a.mtime, a.itime, a.intnotes, a.department_id, a.amount AS oldinvtotal, a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type, diff --git a/SL/GL.pm b/SL/GL.pm index 245e5b800..9eb741d83 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -123,12 +123,12 @@ sub _post_transaction { $query = qq|UPDATE gl SET reference = ?, description = ?, notes = ?, - transdate = ?, deliverydate = ?, department_id = ?, taxincluded = ?, + transdate = ?, deliverydate = ?, tax_point = ?, department_id = ?, taxincluded = ?, storno = ?, storno_id = ?, ob_transaction = ?, cb_transaction = ? WHERE id = ?|; @values = ($form->{reference}, $form->{description}, $form->{notes}, - conv_date($form->{transdate}), conv_date($form->{deliverydate}), conv_i($form->{department_id}), $form->{taxincluded} ? 't' : 'f', + conv_date($form->{transdate}), conv_date($form->{deliverydate}), conv_date($form->{tax_point}), conv_i($form->{department_id}), $form->{taxincluded} ? 't' : 'f', $form->{storno} ? 't' : 'f', conv_i($form->{storno_id}), $form->{ob_transaction} ? 't' : 'f', $form->{cb_transaction} ? 't' : 'f', conv_i($form->{id})); do_query($form, $dbh, $query, @values); @@ -637,7 +637,7 @@ sub transaction { if ($form->{id}) { $query = - qq|SELECT g.reference, g.description, g.notes, g.transdate, g.deliverydate, + qq|SELECT g.reference, g.description, g.notes, g.transdate, g.deliverydate, g.tax_point, g.storno, g.storno_id, g.department_id, d.description AS department, e.name AS employee, g.taxincluded, g.gldate, diff --git a/sql/Pg-upgrade2/tax_point.sql b/sql/Pg-upgrade2/tax_point.sql index e0cd3809c..7fcb65d74 100644 --- a/sql/Pg-upgrade2/tax_point.sql +++ b/sql/Pg-upgrade2/tax_point.sql @@ -3,4 +3,5 @@ -- @depends: release_3_5_6_1 ALTER TABLE ap ADD COLUMN tax_point DATE; ALTER TABLE ar ADD COLUMN tax_point DATE; +ALTER TABLE gl ADD COLUMN tax_point DATE; ALTER TABLE oe ADD COLUMN tax_point DATE; diff --git a/templates/webpages/ap/form_header.html b/templates/webpages/ap/form_header.html index 6f73fd9d5..4905645ff 100644 --- a/templates/webpages/ap/form_header.html +++ b/templates/webpages/ap/form_header.html @@ -163,6 +163,10 @@ [% 'Due Date' | $T8 %] [% L.date_tag('duedate', duedate) %] + + [% LxERP.t8('Tax point') %] + [% L.date_tag('tax_point', tax_point, id='tax_point') %] + [% 'Delivery Date' | $T8 %] [% L.date_tag('deliverydate', deliverydate) %] diff --git a/templates/webpages/ar/form_header.html b/templates/webpages/ar/form_header.html index c1908a418..755d564c0 100644 --- a/templates/webpages/ar/form_header.html +++ b/templates/webpages/ar/form_header.html @@ -141,6 +141,10 @@ [% 'Due Date' | $T8 %] [% L.date_tag('duedate', duedate) %] + + [% LxERP.t8('Tax point') %] + [% L.date_tag('tax_point', tax_point, id='tax_point') %] + [% 'Delivery Date' | $T8 %] [% L.date_tag('deliverydate', deliverydate) %] diff --git a/templates/webpages/gl/form_header.html b/templates/webpages/gl/form_header.html index 8a53cab2b..797821acf 100644 --- a/templates/webpages/gl/form_header.html +++ b/templates/webpages/gl/form_header.html @@ -72,21 +72,21 @@ [% 'Department' | $T8 %] [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1) %] - [% 'Delivery Date' | $T8 %] - [% L.date_tag('deliverydate', deliverydate) %] + [% 'Tax point' | $T8 %] + [% L.date_tag('tax_point', tax_point) %] [% 'Description' | $T8 %] [% L.areainput_tag('description', description, cols=50, readonly=readonly) %] - [% 'MwSt. inkl.' | $T8 %] - [% L.checkbox_tag('taxincluded', checked=taxincluded) %] + [% 'Delivery Date' | $T8 %] + [% L.date_tag('deliverydate', deliverydate) %] -[%- IF id %] - [% 'Mitarbeiter' | $T8 %] - [% L.input_tag('employee', employee, size=20, readonly=readonly) %] + [%- IF id %][% 'Mitarbeiter' | $T8 %][% END %] + [%- IF id %][% L.input_tag('employee', employee, size=20, readonly=readonly) %][% END %] + [% 'MwSt. inkl.' | $T8 %] + [% L.checkbox_tag('taxincluded', checked=taxincluded) %] -[%- END %] -- 2.20.1