# get customer/vendor
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
- # retrieve order/quotation and webdav config
- $form->{webdav} = $::instance_conf->get_webdav;
-
+ # retrieve order/quotation
my $editing = $form->{id};
OE->retrieve(\%myconfig, \%$form);
</tr> |;
}
}
-
-# $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); # template does this
-
} else {
foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
}
}
+ $form->{rounding} = $form->round_amount(
+ $form->round_amount($form->{invtotal}, 2, 1) - $form->round_amount($form->{invtotal}, 2)
+ );
+ $form->{invtotal} = $form->round_amount( $form->{invtotal}, 2, 1);
$form->{oldinvtotal} = $form->{invtotal};
$TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
$tpca_reminder = check_transport_cost_reminder_article_number() if $::instance_conf->get_transport_cost_reminder_article_number_id;
print $form->parse_html_template("oe/form_footer", {
%TMPL_VAR,
- webdav => $::instance_conf->get_webdav,
tpca_reminder => $tpca_reminder,
print_options => print_options(inline => 1),
label_edit => $locale->text("Edit the $form->{type}"),
$form->header();
print $form->parse_html_template('oe/search', {
- %myconfig,
is_order => scalar($form->{type} =~ /_order/),
});
my $locale = $main::locale;
check_oe_access();
+ $form->mtime_ischanged('oe');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
check_oe_access();
+ $form->mtime_ischanged('oe');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
check_oe_access();
check_oe_conversion_to_sales_invoice_allowed();
+ $form->mtime_ischanged('oe');
+
$main::auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit');
$form->{old_salesman_id} = $form->{salesman_id};
if ( $form->{reqdate} && $form->{id} ) {
my $saved_order = OE->retrieve_simple(id => $form->{id});
if ( $saved_order && $saved_order->{reqdate} eq $form->{reqdate} && $saved_order->{transdate} eq $form->{transdate} ) {
- my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1;
- my $next_workday = DateTime->today_local->add(days => $extra_days);
- my $day_of_week = $next_workday->day_of_week;
-
- $next_workday->add(days => (8 - $day_of_week)) if $day_of_week >= 6;
-
+ my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1;
+ $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo;
$form->{transdate} = DateTime->today_local->to_kivitendo;
- $form->{reqdate} = $next_workday->to_kivitendo;
}
}
my $locale = $main::locale;
check_oe_access();
+ $form->mtime_ischanged('oe');
+
$main::auth->assert('purchase_order_edit');
$form->{sales_order_to_purchase_order} = 0;
check_oe_access();
$main::auth->assert('sales_order_edit');
+ $form->mtime_ischanged('oe');
if ($form->{type} eq "purchase_order") {
delete($form->{ordnumber});
my $form = $main::form;
my %myconfig = %main::myconfig;
+ $form->mtime_ischanged('oe');
+
if ($form->{type} =~ /^sales/) {
$main::auth->assert('sales_delivery_order_edit');
check_oe_access();
+ $form->mtime_ischanged('oe','mail');
$form->{print_and_save} = 1;
my $saved_form = save_form();