X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/40f11b80336beaa14392867889d2fec8ffe12859..2fe6237c8b09d2f5a83145673c15be84bdfadf8a:/SL/Controller/Order.pm diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index ec28ad950..d8d197a85 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -623,6 +623,7 @@ sub action_customer_vendor_changed { ->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; @@ -967,6 +968,19 @@ sub 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)) @@ -1282,7 +1296,7 @@ sub setup_order_from_cv { $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});