From ad033a768bbe46566afa159008c42ff7fc6bb35a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 12 Feb 2015 11:40:06 +0100 Subject: [PATCH] surplus: Erfassungsdatum bei Stammdatensuche Waren/Dienstleistungen/Erzeugnisse ... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ... im Bericht anzeigen und danach filtern. Conflicts: SL/IC.pm bin/mozilla/ic.pl templates/webpages/ic/search.html Übernahme aus Kundenprojekt. --- SL/IC.pm | 23 ++++++++++++++++++++--- bin/mozilla/ic.pl | 11 +++++++---- templates/webpages/ic/search.html | 9 +++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index da263bede..e25e13e26 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -744,7 +744,7 @@ sub all_parts { my @apoe_filters = qw(transdate); my @like_filters = (@simple_filters, @invoice_oi_filters); my @all_columns = (@simple_filters, @makemodel_filters, @apoe_filters, @project_filters, qw(serialnumber)); - my @simple_l_switches = (@all_columns, qw(notes listprice sellprice lastcost priceupdate weight unit rop image shop)); + my @simple_l_switches = (@all_columns, qw(notes listprice sellprice lastcost priceupdate weight unit rop image shop insertdate)); my @oe_flags = qw(bought sold onorder ordered rfq quoted); my @qsooqr_flags = qw(invnumber ordnumber quonumber trans_id name module qty); my @deliverydate_flags = qw(deliverydate); @@ -820,10 +820,12 @@ sub all_parts { 'ioi.id' => 'ioi_id', 'ioi.ioi' => 'ioi', 'projectdescription' => 'projectdescription', + 'insertdate' => 'insertdate', ); my %real_column = ( projectdescription => 'description', + insertdate => 'itime::DATE', ); if (($form->{searchitems} eq 'assembly') && $form->{l_lastcost}) { @@ -864,6 +866,21 @@ sub all_parts { } } + # special case insertdate + if (grep { $form->{$_} } qw(insertdatefrom insertdateto)) { + $form->{"l_insertdate"} = 1; + push @select_tokens, 'insertdate'; + + my $token_builder = $make_token_builder->(); + my $token = $token_builder->('insertdate'); + + for (qw(insertdatefrom insertdateto)) { + next unless $form->{$_}; + push @where_tokens, sprintf "$token %s ?", /from$/ ? '>=' : '<='; + push @bind_vars, $form->{$_}; + } + } + if ($form->{"partsgroup_id"}) { $form->{"l_partsgroup"} = '1'; # show the column push @where_tokens, "pg.id = ?"; @@ -997,7 +1014,7 @@ sub all_parts { my $token_builder = $make_token_builder->(\%joins_needed); - my @sort_cols = (@simple_filters, qw(id priceupdate onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate shop)); + my @sort_cols = (@simple_filters, qw(id priceupdate onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate insertdate shop)); $form->{sort} = 'id' unless grep { $form->{"l_$_"} } grep { $form->{sort} eq $_ } @sort_cols; # sort by id if unknown or invisible column my $sort_order = ($form->{revers} ? ' DESC' : ' ASC'); my $order_clause = " ORDER BY " . $token_builder->($form->{sort}) . ($form->{revers} ? ' DESC' : ' ASC'); @@ -1055,7 +1072,7 @@ sub all_parts { if ($form->{searchitems} eq 'assembly' && $form->{bom}) { $query = qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand, - p.unit, p.notes, + p.unit, p.notes, p.itime::DATE as insertdate, p.sellprice, p.listprice, p.lastcost, p.rop, p.weight, p.priceupdate, p.image, p.drawing, p.microfiche, diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 98b4037b0..f83d42a53 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1023,6 +1023,7 @@ sub generate_report { 'drawing' => { 'text' => $locale->text('Drawing'), }, 'ean' => { 'text' => $locale->text('EAN'), }, 'image' => { 'text' => $locale->text('Image'), }, + 'insertdate' => { 'text' => $locale->text('Insert Date'), }, 'invnumber' => { 'text' => $locale->text('Invoice Number'), }, 'lastcost' => { 'text' => $locale->text('Last Cost'), }, 'linetotallastcost' => { 'text' => $locale->text('Extended'), }, @@ -1130,11 +1131,13 @@ sub generate_report { microfiche => $locale->text('Microfiche') . ": '$form->{microfiche}'", l_soldtotal => $locale->text('Qty in Selected Records'), ean => $locale->text('EAN') . ": '$form->{ean}'", + insertdatefrom => $locale->text('Insert Date') . ": " . $locale->text('From') . " " . $locale->date(\%myconfig, $form->{insertdatefrom}, 1), + insertdateto => $locale->text('Insert Date') . ": " . $locale->text('To (time)') . " " . $locale->date(\%myconfig, $form->{insertdateto}, 1), ); my @itemstatus_keys = qw(active obsolete orphaned onhand short); my @callback_keys = qw(onorder ordered rfq quoted bought sold partnumber partsgroup partsgroup_id serialnumber description make model - drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean shop); + drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto insertdatefrom insertdateto ean shop); # calculate dependencies for (@itemstatus_keys, @callback_keys) { @@ -1220,7 +1223,7 @@ sub generate_report { linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber transdate name serialnumber deliverydate ean projectnumber projectdescription - shop + insertdate shop ); my $pricegroups = SL::DB::Manager::Pricegroup->get_all(sort => 'id'); @@ -1248,7 +1251,7 @@ sub generate_report { map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal shop), @pricegroup_columns; my @hidden_variables = ( - qw(l_subtotal l_linetotal searchitems itemstatus bom l_pricegroups), + qw(l_subtotal l_linetotal searchitems itemstatus bom l_pricegroups insertdatefrom insertdateto), @itemstatus_keys, @callback_keys, map({ "cvar_$_->{name}" } @searchable_custom_variables), @@ -1258,7 +1261,7 @@ sub generate_report { my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables); - my @sort_full = qw(partnumber description onhand soldtotal deliverydate shop); + my @sort_full = qw(partnumber description onhand soldtotal deliverydate insertdate shop); my @sort_no_revers = qw(partsgroup bin priceupdate invnumber ordnumber quonumber name image drawing serialnumber); foreach my $col (@sort_full) { diff --git a/templates/webpages/ic/search.html b/templates/webpages/ic/search.html index d0f0616a0..8e71cb659 100644 --- a/templates/webpages/ic/search.html +++ b/templates/webpages/ic/search.html @@ -70,6 +70,14 @@ [% L.yes_no_tag('shop', shop, default='', with_empty=1, empty_title='---') %] + + [% 'Insert Date' | $T8 %] + + [% 'From' | $T8 %][% L.date_tag('insertdatefrom') %] + [% 'Bis' | $T8 %] [% L.date_tag('insertdateto') %] + + + [% CUSTOM_VARIABLES_FILTER_CODE %] [%- IF is_assembly %] @@ -214,6 +222,7 @@ [%- L.checkbox_tag('l_notes', label=LxERP.t8('Notes'), value='Y') %] [%- L.checkbox_tag('l_name', label=LxERP.t8('Name in Selected Records'), value='Y') %] [%- L.checkbox_tag('l_shop', label=LxERP.t8('Shopartikel'), value='Y') %] + [%- L.checkbox_tag('l_insertdate', label=LxERP.t8('Insert Date'), value='Y') %] [% CUSTOM_VARIABLES_INCLUSION_CODE %] -- 2.20.1