};
my (%taxchart_labels, @taxchart_values, $default_taxchart, $taxchart_to_use);
- my $amount_chart_id = $form->{"AR_amount_chart_id_$i"} // $default_ar_amount_chart_id;
- my $chart_has_changed = $::form->{"previous_AR_amount_chart_id_$i"} && ($amount_chart_id != $::form->{"previous_AR_amount_chart_id_$i"});
+ my $amount_chart_id = $form->{"AR_amount_chart_id_$i"} // $default_ar_amount_chart_id;
foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $transdate) ) {
my $key = $item->id . "--" . $item->rate;
$taxchart_labels{$key} = $item->taxdescription . " " . $item->rate * 100 . ' %';
}
- $taxchart_to_use = $default_taxchart // $first_taxchart if $chart_has_changed || !$taxchart_to_use;
+ $taxchart_to_use //= $default_taxchart // $first_taxchart;
my $selected_taxchart = $taxchart_to_use->id . '--' . $taxchart_to_use->rate;
$transaction->{selectAR_amount} =
if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
IS->get_customer(\%myconfig, $form);
+ if (($form->{rowcount} == 1) && ($form->{amount_1} == 0)) {
+ my $last_used_ar_chart = SL::DB::Customer->load_cached($form->{customer_id})->last_used_ar_chart;
+ $form->{"AR_amount_chart_id_1"} = $last_used_ar_chart->id if $last_used_ar_chart;
+ }
}
$form->{invtotal} =
}
# /saving the history
- $form->redirect($locale->text("AR transaction posted.")) unless $inline;
+ $form->redirect($locale->text('AR transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id}) unless $inline;
$main::lxdebug->leave_sub();
}
'ustid' => { 'text' => $locale->text('USt-IdNr.'), },
'taxzone' => { 'text' => $locale->text('Steuersatz'), },
'payment_terms' => { 'text' => $locale->text('Payment Terms'), },
- 'charts' => { 'text' => $locale->text('Buchungskonto'), },
+ 'charts' => { 'text' => $locale->text('Chart'), },
'customertype' => { 'text' => $locale->text('Customer type'), },
'direct_debit' => { 'text' => $locale->text('direct debit'), },
'department' => { 'text' => $locale->text('Department'), },