From d2d780320b8430a099ebfe013dc81ba9c2b70253 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 17 Sep 2018 12:02:54 +0200 Subject: [PATCH] Auftrags-Controller: totalen Ertrag unten anzeigen --- SL/Controller/Order.pm | 13 ++++++++++++ templates/webpages/order/tabs/basic_data.html | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index a367a56a5..8cd8b6f0c 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -967,6 +967,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)) diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html index 8e4776ca6..c67981292 100644 --- a/templates/webpages/order/tabs/basic_data.html +++ b/templates/webpages/order/tabs/basic_data.html @@ -291,6 +291,27 @@ + [%- IF (SELF.type == "sales_order" || SELF.type == "sales_quotation") -%] + [%- SET marge_class = (SELF.order.marge_total < 0) ? 'plus0' : '' -%] + + + + + + + + + + + +
[% 'Ertrag' | $T8 %] + [%- L.div_tag(SELF.order.marge_total_as_number, id='marge_total_id', class=marge_class) %] +
[% 'Ertrag prozentual' | $T8 %] + [%- L.div_tag(LxERP.format_amount(SELF.order.marge_percent, 2), id='marge_percent_id', class=marge_class) %] + [%- L.div_tag('%', id='marge_percent_sign_id', class=marge_class) %]
+ + [%- END %] + -- 2.20.1