From d4557a8bfab9f122ae19e91a8735e22a4b0c275b Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Tue, 9 Aug 2016 12:12:36 +0200 Subject: [PATCH] Neue Maske: Auftragsartikelsuche MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit um schnell Positionen aus (alten) Verkaufsaufträgen zu finden: Verkauf -> Berichte -> Auftragsartikelsuche Dies ist kein druckbarer Bericht, sondern soll helfen, schnell einen bestimmten Auftrag oder eine Information zu einer bestimmten verkauften Ware zu finden. Wurde die Ware per Lieferschein verschickt und ausgelagert wird auch der Lieferschein und die verschickte Menge angezeigt. Dies klappt aber nur für Aufträge, wo die Einzelpositionen per RecordLinks verknüpft sind. --- SL/Controller/OrderItem.pm | 125 ++++++++++++++++++ css/common.css | 3 + doc/changelog | 4 + locale/de/all | 3 + menus/user/00-erp.yaml | 7 + .../order_items_search/_order_item_list.html | 40 ++++++ .../order_items_search/order_items.html | 92 +++++++++++++ 7 files changed, 274 insertions(+) create mode 100644 SL/Controller/OrderItem.pm create mode 100644 templates/webpages/order_items_search/_order_item_list.html create mode 100644 templates/webpages/order_items_search/order_items.html diff --git a/SL/Controller/OrderItem.pm b/SL/Controller/OrderItem.pm new file mode 100644 index 000000000..7cdfb3555 --- /dev/null +++ b/SL/Controller/OrderItem.pm @@ -0,0 +1,125 @@ +package SL::Controller::OrderItem; + +use strict; + +use parent qw(SL::Controller::Base); +use SL::DB::Order; +use SL::DB::OrderItem; +use SL::DB::Customer; +use SL::DB::Part; +use SL::Controller::Helper::GetModels; +use SL::Controller::Helper::ParseFilter; +use SL::Locale::String qw(t8); + +__PACKAGE__->run_before('check_auth'); + +use Rose::Object::MakeMethods::Generic ( + 'scalar' => [ qw(orderitems) ], + 'scalar --get_set_init' => [ qw(model) ], +); + +my %sort_columns = ( + partnumber => t8('Part Number'), + ordnumber => t8('Order'), + customer => t8('Customer'), + transdate => t8('Date'), +); + +sub action_search { + + my ($self, %params) = @_; + + my $title = t8("Sold order items"); + + $::request->layout->use_javascript('client_js.js'); + + # The actual loading of orderitems happens in action_order_item_list_dynamic_table + # which is processed inside this template and automatically called upon + # loading. This causes all filtered orderitems to be displayed, + # there is no paginate mechanism or export + $self->render('order_items_search/order_items', { layout => 1, process => 1 }, + title => $title, + ); +} + + +sub action_order_item_list_dynamic_table { + my ($self) = @_; + + $self->orderitems( $self->model->get ); + + + $self->add_linked_delivery_order_items; + + $self->render('order_items_search/_order_item_list', { layout => 0 , process => 1 }); +} + +sub add_linked_delivery_order_items { + my ($self) = @_; + + my $qty_round = 2; + + foreach my $orderitem ( @{ $self->orderitems } ) { + my $dois = $orderitem->linked_delivery_order_items; + $orderitem->{deliveryorders} = join('
', map { $_->displayable_delivery_order_info($qty_round) } @{$dois}); + }; +}; + +sub init_model { + my ($self) = @_; + + SL::Controller::Helper::GetModels->new( + controller => $self, + model => 'OrderItem', + query => [ SL::DB::Manager::Order->type_filter('sales_order') ], + sorted => { + _default => { + by => 'transdate', + dir => 0, + }, + %sort_columns, + } , + with_objects => [ 'order', 'order.customer', 'part' ], + ); +} + +sub check_auth { + $::auth->assert('sales_order_edit'); +} + +1; + +__END__ + +=encoding utf-8 + +=head1 NAME + +SL::Controller::OrderItem - Controller for OrderItems + +=head2 OVERVIEW + +Controller for quickly finding orderitems in sales orders. For example the +customer phones you, saying he would like to order another one of the green +thingies he ordered 2 years ago. You have no idea what he is referring to, but +you can quickly filter by customer (a customerpicker) and e.g. part description +or partnumber or order date, successively narrowing down the search. The +resulting list is updated dynamically after keypresses. + +=head1 Usage + +Certain fields can be preset by passing them as get parameters in the URL, so +you could create links to this report: + + controller.pl?action=OrderItem/search&ordnumber=24 + controller.pl?action=OrderItem/search&customer_id=3455 + +=head1 TODO AND CAVEATS + +=over 4 + +=item * amount of results is limited + +=back + +=cut diff --git a/css/common.css b/css/common.css index fe764b82e..889358088 100644 --- a/css/common.css +++ b/css/common.css @@ -72,3 +72,6 @@ input.grow_on_focus:focus { width: 150px } #dunning_invoice_list .direct_debit a { color: #aaa; } +/* orderitems */ +.shipped { color: green } +.not_shipped { color: red } diff --git a/doc/changelog b/doc/changelog index b0e70fb65..2b77b59a5 100644 --- a/doc/changelog +++ b/doc/changelog @@ -41,6 +41,10 @@ kleinere neue Features und Detailverbesserungen: - Neuer Controller für Preisgruppen, die nun sortiert und ungültig gesetzt werden können. + - Neuer Berichte "Auftragsartikelsuche", um schnell Autragspositionen aus + Verkaufsauträge finden zu können: + Verkauf -> Berichte -> Auftragsartikelsuche + Administrative Änderungen - Diverse Textsuchen werden jetzt durch eine neue Klasse Indizes diff --git a/locale/de/all b/locale/de/all index 3dfa0390d..c91d6be29 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1942,6 +1942,7 @@ $self->{texts} = { 'Order Number missing!' => 'Auftragsnummer fehlt!', 'Order amount' => 'Auftragswert', 'Order deleted!' => 'Auftrag gelöscht!', + 'Order item search' => 'Auftragsartikelsuche', 'Order probability' => 'Auftragswahrscheinlichkeit', 'Order probability & expected billing date' => 'Auftragswahrscheinlichkeit & vorrauss. Abrechnungsdatum', 'Order value periodicity' => 'Auftragswert basiert auf Periodizität', @@ -2570,6 +2571,7 @@ $self->{texts} = { 'Show follow ups...' => 'Zeige Wiedervorlagen...', 'Show help text' => 'Hilfetext anzeigen', 'Show history' => 'Verlauf anzeigen', + 'Show images' => 'Bilder zeigen', 'Show items from invoices individually' => 'Artikel aus Rechnungen anzeigen', 'Show mappings (csv_import)' => 'Spaltenzuordnungen anzeigen', 'Show old dunnings' => 'Alte Mahnungen anzeigen', @@ -2607,6 +2609,7 @@ $self->{texts} = { 'Skonto information' => 'Skonto Information', 'So far you could use one partnumber for severel parts, for example a service and an article.' => 'Bisher war es möglich eine Artikelnummer für mehrere Artikel zu verwenden, zum Beispiel eine Artikelnummer für eine Dienstleistung, eine Ware und ein Erzeugnis.', 'Sold' => 'Verkauft', + 'Sold order items' => 'Verkaufte Auftragsartikel', 'Soldtotal does not make sense without any bsooqr options' => 'Option "Menge in gewählten Belegen" ohne gewählte Belege wird ignoriert.', 'Solution' => 'Lösung', 'Sort By' => 'Sortiert nach', diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 5f2af6572..5ef1f7f1d 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -348,6 +348,13 @@ module: dn.pl params: action: search +- parent: ar_reports + id: ar_order_item_search + name: Order item search + order: 750 + access: sales_order_edit + params: + action: OrderItem/search - parent: ar_reports id: ar_reports_delivery_plan name: Delivery Plan diff --git a/templates/webpages/order_items_search/_order_item_list.html b/templates/webpages/order_items_search/_order_item_list.html new file mode 100644 index 000000000..3a66857d9 --- /dev/null +++ b/templates/webpages/order_items_search/_order_item_list.html @@ -0,0 +1,40 @@ +[%- USE LxERP %] +[%- USE T8 %] +[%- USE L %] +[%- USE HTML %] +[%- USE P %] +[% SET qty_round = 2 %] + + + + + + + + + + + + [% IF FORM.show_images %] + + [% END %] + + [% FOREACH order_item = SELF.orderitems %] + + + + + + + + + + + [% IF FORM.show_images %] + + [% END %] + + [% END %] +
[%- LxERP.t8("Part") %][%- LxERP.t8("Customer") %][%- LxERP.t8("Order") %][%- LxERP.t8("Transdate") %][%- LxERP.t8("Qty") %][%- LxERP.t8("Delivered") %][%- LxERP.t8("Price") %][%- LxERP.t8("Discount") %] %[%- LxERP.t8("Delivery Order") %][%- LxERP.t8("Image") %]
[% P.part(order_item.part, no_link => 0) %] [% P.customer(order_item.order.customer, no_link => 0) %] [% P.sales_order(order_item.order, no_link => 0) %] [% order_item.order.transdate.to_kivitendo %] + [% LxERP.format_amount(order_item.qty, qty_round) %] [% order_item.unit | html %] + [% LxERP.format_amount(order_item.delivered_qty, qty_round) %] [% order_item.unit | html %] [% order_item.sellprice_as_number %] [% order_item.discount_as_percent %] [% order_item.deliveryorders %] [% IF order_item.part.image %][% END %]
diff --git a/templates/webpages/order_items_search/order_items.html b/templates/webpages/order_items_search/order_items.html new file mode 100644 index 000000000..8bcfa9202 --- /dev/null +++ b/templates/webpages/order_items_search/order_items.html @@ -0,0 +1,92 @@ +[% USE HTML %] +[%- USE LxERP %] +[%- USE T8 %] +[%- USE L %] + +[% SET size=50 %] +[% SET show_images=0 %] + +

[% title %]

+
+[% 'Filter' | $T8 %]: +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% 'Customer' | $T8 %][% L.customer_vendor_picker('filter.order.customer.id', FORM.customer_id, type='customer', class="filter", size=size) %]
[% 'Part' | $T8 %][% L.input_tag('filter.part.all:substr:multi::ilike', FORM.part, size = size, class="filter") %]
[% 'Order Number' | $T8 %][% L.input_tag('filter.order.ordnumber:substr::ilike', FORM.ordnumber, size = 10, class="filter") %]
[% 'Order Date' | $T8 %][% 'From' | $T8 %] [% L.date_tag("filter.order.transdate:date::ge", filter.order.transdate_date___ge, class="filter") %] [% 'Until' | $T8 %] [% L.date_tag('filter.order.transdate:date::le', filter.order.transdate_date__le, class="filter") %]
[% 'Description' | $T8 %][% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size = size, class="filter") %]
[% 'Long Description' | $T8 %][% L.input_tag('filter.longdescription:substr::ilike', filter.longdescription_substr__ilike, size = size, class="filter") %]
[% 'Show images' | $T8 %][% L.checkbox_tag('show_images', checked=show_images) %]
+[% L.button_tag("this.form.reset(); refresh_plot();", LxERP.t8("Reset")) %] +
+ +
+[% PROCESS 'order_items_search/_order_item_list.html' %] +
+ + + -- 2.20.1