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.RecordTemplate.js", "kivi.File.js", "kivi.AP.js", "kivi.CustomerVendor.js", "kivi.Validator.js");
- my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
- my $first_taxchart;
-
# $form->{totalpaid} is used by the action bar setup to determine
# whether or not canceling is allowed. Therefore it must be
# calculated prior to the action bar setup.
setup_ap_display_form_action_bar();
$form->header();
+ # 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}) {
}
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;