From 5c95eda791afeb2a2d5a0ff675fe5c5d9b4c69a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 11 Aug 2020 09:40:10 +0200 Subject: [PATCH] =?utf8?q?Kreditoren-=20Debitorenbuchung:=20Lieferdatum=20?= =?utf8?q?f=C3=BCr=20die=20Steuer=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ap.pl | 9 ++++++--- bin/mozilla/ar.pl | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 31ac25d09..2a031bded 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -468,8 +468,11 @@ sub form_header { setup_ap_display_form_action_bar(); $form->header(); - - my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; + # get the correct date for tax + my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; + my $deliverydate = $::form->{deliverydate} ? DateTime->from_kivitendo($::form->{deliverydate}) : undef; + my $taxdate = $deliverydate ? $deliverydate : $transdate; + # helper for loop my $first_taxchart; for my $i (1 .. $form->{rowcount}) { @@ -485,7 +488,7 @@ sub form_header { } my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id; - my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $transdate, $used_tax_id); + my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $taxdate, $used_tax_id); foreach my $item (@taxcharts) { my $key = $item->id . "--" . $item->rate; $first_taxchart //= $item; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index ba70adb1d..44819398c 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -412,11 +412,14 @@ sub form_header { my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; $::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.File.js", "kivi.RecordTemplate.js", "kivi.AR.js", "kivi.CustomerVendor.js", "kivi.Validator.js"); - - my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; + # get the correct date for tax + my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; + my $deliverydate = $::form->{deliverydate} ? DateTime->from_kivitendo($::form->{deliverydate}) : undef; + my $taxdate = $deliverydate ? $deliverydate : $transdate; + # helpers for loop my $first_taxchart; - my @transactions; + for my $i (1 .. $form->{rowcount}) { my $transaction = { amount => $form->{"amount_$i"}, @@ -431,7 +434,7 @@ sub form_header { if ( $form->{"taxchart_$i"} ) { ($used_tax_id) = split(/--/, $form->{"taxchart_$i"}); } - foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $transdate, $used_tax_id) ) { + foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $taxdate, $used_tax_id) ) { my $key = $item->id . "--" . $item->rate; $first_taxchart //= $item; $default_taxchart = $item if $item->{is_default}; -- 2.20.1