From 3fcf64fc989a816e02251ea66fdc2bb0552cd3bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 4 Nov 2013 15:18:07 +0100 Subject: [PATCH] Versandort und Steuersatz (Zone) im Auftragsbericht filter- und anzeigbar --- SL/OE.pm | 18 ++++++++++++++++-- bin/mozilla/oe.pl | 22 +++++++++++++++++----- templates/webpages/oe/search.html | 10 ++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 12cbb8aa1..aaf0faece 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -88,7 +88,8 @@ sub transactions { qq| ex.$rate AS exchangerate, | . qq| pr.projectnumber AS globalprojectnumber, | . qq| e.name AS employee, s.name AS salesman, | . - qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id | . + qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id, | . + qq| tz.description AS taxzone | . $periodic_invoices_columns . qq|FROM oe o | . qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | . @@ -97,6 +98,7 @@ sub transactions { qq|LEFT JOIN exchangerate ex ON (ex.currency_id = o.currency_id | . qq| AND ex.transdate = o.transdate) | . qq|LEFT JOIN project pr ON (o.globalproject_id = pr.id) | . + qq|LEFT JOIN tax_zones tz ON (o.taxzone_id = tz.id) | . qq|$periodic_invoices_joins | . qq|WHERE (o.quotation = ?) |; push(@values, $quotation); @@ -192,6 +194,16 @@ SQL push(@values, conv_date($form->{reqdateto})); } + if ($form->{shippingpoint}) { + $query .= qq| AND o.shippingpoint ILIKE ?|; + push(@values, '%' . $form->{shippingpoint} . '%'); + } + + if ($form->{taxzone_id} ne '') { # taxzone_id could be 0 + $query .= qq| AND tz.id = ?|; + push(@values, $form->{taxzone_id}); + } + if ($form->{transaction_description}) { $query .= qq| AND o.transaction_description ILIKE ?|; push(@values, '%' . $form->{transaction_description} . '%'); @@ -214,7 +226,9 @@ SQL "employee" => "e.name", "salesman" => "s.name", "shipvia" => "o.shipvia", - "transaction_description" => "o.transaction_description" + "transaction_description" => "o.transaction_description", + "shippingpoint" => "o.shippingpoint", + "taxzone" => "tz.description", ); if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) { $sortorder = $allowed_sort_columns{$form->{sort}} . " ${sortdir}"; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 6b8410354..1c1135c2f 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -48,6 +48,7 @@ use List::Util qw(min max reduce sum); use Data::Dumper; use SL::DB::Customer; +use SL::DB::TaxZone; require "bin/mozilla/io.pl"; require "bin/mozilla/arap.pl"; @@ -722,7 +723,8 @@ sub search { $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, "departments" => "ALL_DEPARTMENTS", "$form->{vc}s" => "ALL_VC", - "business_types" => "ALL_BUSINESS_TYPES"); + "taxzones" => "ALL_TAXZONES", + "business_types" => "ALL_BUSINESS_TYPES",); $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); # constants and subs for template @@ -792,7 +794,8 @@ sub orders { "delivered", "periodic_invoices", "marge_total", "marge_percent", "vcnumber", "ustid", - "country", + "country", "shippingpoint", + "taxzone", ); # only show checkboxes if gotten here via sales_order form. @@ -831,9 +834,12 @@ sub orders { push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber transaction_description transdatefrom transdateto type vc employee_id salesman_id reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive - business_id); + business_id shippingpoint taxzone_id); - my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables); + my @keys_for_url = grep { $form->{$_} } @hidden_variables; + push @keys_for_url, 'taxzone_id' if $form->{taxzone_id} ne ''; # taxzone_id could be 0 + + my $href = build_std_url('action=orders', @keys_for_url); my %column_defs = ( 'ids' => { 'text' => '', }, @@ -861,9 +867,11 @@ sub orders { 'country' => { 'text' => $locale->text('Country'), }, 'ustid' => { 'text' => $locale->text('USt-IdNr.'), }, 'periodic_invoices' => { 'text' => $locale->text('Per. Inv.'), }, + 'shippingpoint' => { 'text' => $locale->text('Shipping Point'), }, + 'taxzone' => { 'text' => $locale->text('Steuersatz'), }, ); - foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia transaction_description)) { + foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia transaction_description shippingpoint taxzone)) { my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } @@ -888,6 +896,7 @@ sub orders { push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if $form->{ordnumber}; push @options, $locale->text('Notes') . " : $form->{notes}" if $form->{notes}; push @options, $locale->text('Transaction description') . " : $form->{transaction_description}" if $form->{transaction_description}; + push @options, $locale->text('Shipping Point') . " : $form->{shippingpoint}" if $form->{shippingpoint}; if ( $form->{transdatefrom} or $form->{transdateto} ) { push @options, $locale->text('Order Date'); push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1) if $form->{transdatefrom}; @@ -908,6 +917,9 @@ sub orders { my $vc_type_label = $form->{vc} eq 'customer' ? $locale->text('Customer type') : $locale->text('Vendor type'); push @options, $vc_type_label . " : " . SL::DB::Business->new(id => $form->{business_id})->load->description; } + if ($form->{taxzone_id} ne '') { # taxzone_id could be 0 + push @options, $locale->text('Steuersatz') . " : " . SL::DB::TaxZone->new(id => $form->{taxzone_id})->load->description; + } $report->set_options('top_info_text' => join("\n", @options), 'raw_top_info_text' => $form->parse_html_template('oe/orders_top'), diff --git a/templates/webpages/oe/search.html b/templates/webpages/oe/search.html index c71e60f6d..8d76ecb59 100644 --- a/templates/webpages/oe/search.html +++ b/templates/webpages/oe/search.html @@ -61,6 +61,14 @@ [% 'Salesman' | $T8 %] [% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %] + + [% 'Steuersatz' | $T8 %] + [% L.select_tag('taxzone_id', ALL_TAXZONES, with_empty=1, title_key='description', style='width: 250px') %] + + + [% 'Shipping Point' | $T8 %] + [% L.input_tag('shippingpoint', '', style='width:250px') %] + [% 'Transaction description' | $T8 %] @@ -183,6 +191,8 @@ + [%- L.checkbox_tag('l_taxzone', label => LxERP.t8('Steuersatz')) %] + [%- L.checkbox_tag('l_shippingpoint', label => LxERP.t8('Shipping Point')) %] -- 2.20.1