From: Bernd Bleßmann Date: Thu, 12 Feb 2015 08:25:00 +0000 (+0100) Subject: surplus: Erfassungsdatum bei Stammdatensuche Kunden/Lieferanten ... X-Git-Tag: release-3.3.0beta~133 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=8dc4cef21cbcdcd2fd3bc6539aefd6fa104bb8c5;p=kivitendo-erp.git surplus: Erfassungsdatum bei Stammdatensuche Kunden/Lieferanten ... ... im Bericht anzeigen und danach filtern. Conflicts: SL/CT.pm bin/mozilla/ct.pl templates/webpages/ct/search.html Übernahme aus Kundenprojekt. --- diff --git a/SL/CT.pm b/SL/CT.pm index 44adb406c..8f8aa4132 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -76,6 +76,7 @@ sub search { "city" => "ct.city", "country" => "ct.country", "discount" => "ct.discount", + "insertdate" => "ct.itime", "salesman" => "e.name", "payment" => "pt.description" ); @@ -92,7 +93,7 @@ sub search { } my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; - if ($sortorder !~ /(business|id|discount)/ && !$join_records) { + if ($sortorder !~ /(business|id|discount|itime)/ && !$join_records) { $sortorder = "lower($sortorder) ${sortdir}"; } else { $sortorder .= " ${sortdir}"; @@ -176,6 +177,16 @@ sub search { push(@values, conv_i($form->{salesman_id})); } + if($form->{insertdatefrom}) { + $where .= qq| AND (ct.itime::DATE >= ?)|; + push@values, conv_date($form->{insertdatefrom}); + } + + if($form->{insertdateto}) { + $where .= qq| AND (ct.itime::DATE <= ?)|; + push @values, conv_date($form->{insertdateto}); + } + # Nur Kunden finden, bei denen ich selber der Verkäufer bin # Gilt nicht für Lieferanten if ($cv eq 'customer' && !$main::auth->assert('customer_vendor_all_edit', 1)) { @@ -203,7 +214,7 @@ sub search { } my $query = - qq|SELECT ct.*, b.description AS business, e.name as salesman, |. + qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | . qq| pt.description as payment | . (qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) . qq|FROM $cv ct | . @@ -223,7 +234,7 @@ sub search { push(@values, @saved_values); $query .= qq| UNION | . - qq|SELECT ct.*, b.description AS business, e.name as salesman, |. + qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | . qq| pt.description as payment, | . qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | . qq| '$module' AS module, 'invoice' AS formtype, | . @@ -240,7 +251,7 @@ sub search { push(@values, @saved_values); $query .= qq| UNION | . - qq|SELECT ct.*, b.description AS business, e.name as salesman, |. + qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | . qq| pt.description as payment, | . qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . qq| 'oe' AS module, 'order' AS formtype, o.closed | . @@ -256,7 +267,7 @@ sub search { push(@values, @saved_values); $query .= qq| UNION | . - qq|SELECT ct.*, b.description AS business, e.name as salesman, | . + qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | . qq| pt.description as payment, | . qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . qq| 'oe' AS module, 'quotation' AS formtype, o.closed | . diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 5a2dbd6c5..f7cb99bf0 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -160,11 +160,17 @@ sub list_names { } } + if ( $form->{insertdatefrom} or $form->{insertdateto} ) { + push @options, $locale->text('Insert Date'); + push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{insertdatefrom}, 1) if $form->{insertdatefrom}; + push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{insertdateto}, 1) if $form->{insertdateto}; + }; + my @columns = ( 'id', 'name', "$form->{db}number", 'contact', 'phone', 'discount', 'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city', 'business', 'payment', 'invnumber', 'ordnumber', 'quonumber', 'salesman', - 'country' + 'country', 'insertdate' ); my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; @@ -194,6 +200,7 @@ sub list_names { 'salesman' => { 'text' => $locale->text('Salesman'), }, 'discount' => { 'text' => $locale->text('Discount'), }, 'payment' => { 'text' => $locale->text('Payment Terms'), }, + 'insertdate' => { 'text' => $locale->text('Insert Date'), }, %column_defs_cvars, ); @@ -201,7 +208,7 @@ sub list_names { my @hidden_variables = ( qw( db status obsolete name contact email cp_name addr_street addr_zipcode - addr_city addr_country business_id salesman_id + addr_city addr_country business_id salesman_id insertdateto insertdatefrom ), "$form->{db}number", map({ "cvar_$_->{name}" } @searchable_custom_variables), map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)), diff --git a/templates/webpages/ct/search.html b/templates/webpages/ct/search.html index 933a7d1c0..21c86c006 100644 --- a/templates/webpages/ct/search.html +++ b/templates/webpages/ct/search.html @@ -66,6 +66,17 @@ [% END %] + + [% 'Insert Date' | $T8 %] [% 'From' | $T8 %] + + [% L.date_tag('insertdatefrom') %] + + [% 'Bis' | $T8 %] + + [% L.date_tag('insertdateto') %] + + + [% CUSTOM_VARIABLES_FILTER_CODE %] @@ -86,7 +97,7 @@ [% 'Include in Report' | $T8 %] - + + [% IF IS_CUSTOMER %]
@@ -172,6 +183,10 @@ + + +