->val( '#order_payment_id', $self->order->payment_id)
->val( '#order_delivery_term_id', $self->order->delivery_term_id)
->val( '#order_intnotes', $self->order->intnotes)
+ ->val( '#language_id', $self->order->$cv_method->language_id)
->focus( '#order_' . $self->cv . '_id');
$self->js_redisplay_amounts_and_taxes;
$self->js->show('#subtotal_row_id');
}
+ if ($self->order->is_sales) {
+ my $is_neg = $self->order->marge_total < 0;
+ $self->js
+ ->html('#marge_total_id', $::form->format_amount(\%::myconfig, $self->order->marge_total, 2))
+ ->html('#marge_percent_id', $::form->format_amount(\%::myconfig, $self->order->marge_percent, 2))
+ ->action_if( $is_neg, 'addClass', '#marge_total_id', 'plus0')
+ ->action_if( $is_neg, 'addClass', '#marge_percent_id', 'plus0')
+ ->action_if( $is_neg, 'addClass', '#marge_percent_sign_id', 'plus0')
+ ->action_if(!$is_neg, 'removeClass', '#marge_total_id', 'plus0')
+ ->action_if(!$is_neg, 'removeClass', '#marge_percent_id', 'plus0')
+ ->action_if(!$is_neg, 'removeClass', '#marge_percent_sign_id', 'plus0');
+ }
+
$self->js
->html('#netamount_id', $::form->format_amount(\%::myconfig, $self->order->netamount, -2))
->html('#amount_id', $::form->format_amount(\%::myconfig, $self->order->amount, -2))
$order->intnotes($order->customervendor->notes);
if ($order->is_sales) {
- $order->salesman_id($order->customer->salesman_id);
+ $order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
$order->taxincluded(defined($order->customer->taxincluded_checked)
? $order->customer->taxincluded_checked
: $::myconfig{taxincluded_checked});