X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/698bf12d23e82883b9cc8920e40e1d15c6298d00..2fe6237c8b09d2f5a83145673c15be84bdfadf8a:/SL/Controller/Order.pm diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index cd36a07a5..d8d197a85 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -388,10 +388,10 @@ sub action_send_email { my $pdf; my @errors = generate_pdf($self->order, \$pdf, {media => $::form->{media}, - format => $::form->{print_options}->{format}, - formname => $::form->{print_options}->{formname}, - language => $language, - groupitems => $::form->{print_options}->{groupitems}}); + format => $::form->{print_options}->{format}, + formname => $::form->{print_options}->{formname}, + language => $language, + groupitems => $::form->{print_options}->{groupitems}}); if (scalar @errors) { return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render($self); } @@ -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}); @@ -1511,19 +1525,6 @@ sub setup_edit_action_bar { checks => [ 'kivi.Order.check_save_active_periodic_invoices' ], disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef, ], - action => [ - t8('Save and Delivery Order'), - call => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts, - $::instance_conf->get_order_warn_no_deliverydate, - ], - checks => [ 'kivi.Order.check_save_active_periodic_invoices' ], - only_if => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type())) - ], - action => [ - t8('Save and Invoice'), - call => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ], - checks => [ 'kivi.Order.check_save_active_periodic_invoices' ], - ], ], # end of combobox "Save" combobox => [ @@ -1542,6 +1543,19 @@ sub setup_edit_action_bar { only_if => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())), disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef, ], + action => [ + t8('Save and Delivery Order'), + call => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts, + $::instance_conf->get_order_warn_no_deliverydate, + ], + checks => [ 'kivi.Order.check_save_active_periodic_invoices' ], + only_if => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type())) + ], + action => [ + t8('Save and Invoice'), + call => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ], + checks => [ 'kivi.Order.check_save_active_periodic_invoices' ], + ], ], # end of combobox "Workflow" combobox => [ @@ -1868,7 +1882,7 @@ java script functions =item * credit limit -=item * more workflows (save as new, quotation, purchase order) +=item * more workflows (quotation, rfq) =item * price sources: little symbols showing better price / better discount @@ -1973,12 +1987,6 @@ editor or on text processing application). A warning when leaving the page without saveing unchanged inputs. -=item * - -Workflows for delivery order and invoice are in the menu "Save", because the -order is saved before opening the new document form. Nevertheless perhaps these -workflow buttons should be put under "Workflows". - =back