From 3a3683515f26794fa3bff9f670c437bbdab6bb86 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Tue, 23 Jun 2020 09:27:27 +0200 Subject: [PATCH] Lieferdatum in Dialogbuchung - Steuer anhand von Datum --- bin/mozilla/gl.pl | 10 +++++++--- js/kivi.GL.js | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 8f512329a..4d7ab19d0 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -802,6 +802,7 @@ sub display_rows { my %charts_by_id = map { ($_->{id} => $_) } @{ $::form->{ALL_CHARTS} }; my $default_chart = $::form->{ALL_CHARTS}[0]; my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; + my $deliverydate = $::form->{deliverydate} ? DateTime->from_kivitendo($::form->{deliverydate}) : undef; my ($source, $memo, $source_hidden, $memo_hidden); for my $i (1 .. $form->{rowcount}) { @@ -825,7 +826,9 @@ sub display_rows { $accno_id = $chart->{id}; my ($first_taxchart, $default_taxchart, $taxchart_to_use); - foreach my $item ( GL->get_active_taxes_for_chart($accno_id, $transdate) ) { + + my $taxdate = $deliverydate ? $deliverydate : $transdate; + foreach my $item ( GL->get_active_taxes_for_chart($accno_id, $taxdate) ) { my $key = $item->id . "--" . $item->rate; $first_taxchart //= $item; $default_taxchart = $item if $item->{is_default}; @@ -1482,8 +1485,9 @@ sub continue { } sub get_tax_dropdown { - my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; - my @tax_accounts = GL->get_active_taxes_for_chart($::form->{accno_id}, $transdate); + my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; + my $deliverydate = $::form->{deliverydate} ? DateTime->from_kivitendo($::form->{deliverydate}) : undef; + my @tax_accounts = GL->get_active_taxes_for_chart($::form->{accno_id}, $deliverydate // $transdate); my $html = $::form->parse_html_template("gl/update_tax_accounts", { TAX_ACCOUNTS => \@tax_accounts }); print $::form->ajax_response_header, $html; diff --git a/js/kivi.GL.js b/js/kivi.GL.js index 833d9283e..374113c54 100644 --- a/js/kivi.GL.js +++ b/js/kivi.GL.js @@ -19,8 +19,9 @@ namespace('kivi.GL', function(ns) { $.ajax({ url: 'gl.pl?action=get_tax_dropdown', - data: { accno_id: $(obj).val(), - transdate: $('#transdate').val() }, + data: { accno_id: $(obj).val(), + transdate: $('#transdate').val(), + deliverydate: $('#deliverydate').val() }, dataType: 'html', success: function (new_html) { $("#taxchart_" + row).html(new_html); -- 2.20.1