48 |
48 |
use SL::DB::Currency;
|
49 |
49 |
use SL::DB::Default;
|
50 |
50 |
use SL::DB::Order;
|
|
51 |
use SL::DB::PaymentTerm;
|
51 |
52 |
use SL::DB::PurchaseInvoice;
|
52 |
53 |
use SL::DB::RecordTemplate;
|
53 |
54 |
use SL::DB::Tax;
|
... | ... | |
252 |
253 |
$form->{transdate} = $form->{initial_transdate};
|
253 |
254 |
|
254 |
255 |
if ($form->{vendor_id}) {
|
255 |
|
my $last_used_ap_chart = SL::DB::Vendor->load_cached($form->{vendor_id})->last_used_ap_chart;
|
|
256 |
my $vendor = SL::DB::Vendor->load_cached($form->{vendor_id});
|
|
257 |
|
|
258 |
# set initial payment terms
|
|
259 |
$form->{payment_id} = $vendor->payment_id;
|
|
260 |
|
|
261 |
my $last_used_ap_chart = $vendor->last_used_ap_chart;
|
256 |
262 |
$form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart;
|
257 |
263 |
}
|
258 |
264 |
|
... | ... | |
556 |
562 |
print $form->parse_html_template('ap/form_header', {
|
557 |
563 |
today => DateTime->today,
|
558 |
564 |
currencies => SL::DB::Manager::Currency->get_all_sorted,
|
|
565 |
payment_terms => SL::DB::Manager::PaymentTerm->get_all_sorted(query => [ or => [ obsolete => 0, id => $::form->{payment_id}*1 ]]),
|
559 |
566 |
});
|
560 |
567 |
|
561 |
568 |
$main::lxdebug->leave_sub();
|
... | ... | |
656 |
663 |
|
657 |
664 |
if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
|
658 |
665 |
IR->get_vendor(\%::myconfig, $form);
|
|
666 |
|
|
667 |
my $vendor = SL::DB::Vendor->load_cached($form->{vendor_id});
|
|
668 |
|
|
669 |
# reset payment to new vendor
|
|
670 |
$form->{payment_id} = $vendor->payment_id;
|
|
671 |
|
659 |
672 |
if (($form->{rowcount} == 1) && ($form->{amount_1} == 0)) {
|
660 |
|
my $last_used_ap_chart = SL::DB::Vendor->load_cached($form->{vendor_id})->last_used_ap_chart;
|
|
673 |
my $last_used_ap_chart = $vendor->last_used_ap_chart;
|
661 |
674 |
$form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart;
|
662 |
675 |
}
|
663 |
676 |
}
|
Kreditorenbuchungen: Zahlungsbedingungen laden/speichern