From: Jan Büren Date: Tue, 11 Aug 2020 07:40:10 +0000 (+0200) Subject: Kreditoren- Debitorenbuchung: Lieferdatum für die Steuer berücksichtigen X-Git-Tag: release-3.5.6.1~74 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5c95eda791afeb2a2d5a0ff675fe5c5d9b4c69a0;p=kivitendo-erp.git Kreditoren- Debitorenbuchung: Lieferdatum für die Steuer berücksichtigen --- 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};