From c69c1871d7fbb9fccf96463d9a133714ae244873 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Fri, 10 Dec 2010 21:36:02 +0100 Subject: [PATCH] =?utf8?q?In=20Verkaufsberichte->Rechnungen=20auch=20nach?= =?utf8?q?=20Bearbeiter/Verk=C3=A4ufer=20filtern?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wie in den anderen Berichten auch --- SL/AR.pm | 15 +++++++++++++-- bin/mozilla/ar.pl | 4 ++++ templates/webpages/ar/search.html | 31 +++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/SL/AR.pm b/SL/AR.pm index 11333cef0..a2512c8aa 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -490,10 +490,21 @@ sub ar_transactions { } } - if (!$main::auth->assert('sales_all_edit', 1)) { + if (!$main::auth->assert('sales_all_edit', 1)) { + # only show own invoices $where .= " AND a.employee_id = (select id from employee where login= ?)"; push (@values, $form->{login}); - } + } else { + if ($form->{employee_id}) { + $where .= " AND a.employee_id = ?"; + push @values, conv_i($form->{employee_id}); + } + if ($form->{salesman_id}) { + $where .= " AND a.salesman_id = ?"; + push @values, conv_i($form->{salesman_id}); + } + }; + my @a = qw(transdate invnumber name); push @a, "employee" if $form->{l_employee}; my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 6f0b738ac..f0c3f4f18 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1279,12 +1279,16 @@ sub search { $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, "departments" => "ALL_DEPARTMENTS", "customers" => "ALL_VC", + "employees" => "ALL_EMPLOYEES", + "salesmen" => "ALL_SALESMEN", "business_types" => "ALL_BUSINESS_TYPES"); $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0; # constants and subs for template $form->{jsscript} = 1; $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; + $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} }; + $form->{salesman_labels} = $form->{employee_labels}; $form->header; print $form->parse_html_template('ar/search', { %myconfig }); diff --git a/templates/webpages/ar/search.html b/templates/webpages/ar/search.html index 45d6ebf92..c45f28613 100644 --- a/templates/webpages/ar/search.html +++ b/templates/webpages/ar/search.html @@ -49,6 +49,37 @@ [% 'Order Number' | $T8 %] + + [% 'Employee' | $T8 %] + + [%- INCLUDE 'generic/multibox.html' + name = 'employee_id', + style = 'width: 250px', + DATA = ALL_EMPLOYEES, + id_key = 'id', + label_sub = 'employee_labels', + limit = vclimit, + show_empty = 1, + allow_textbox = 0, + default = ' ', + -%] + + + + [% 'Salesman' | $T8 %] + + [%- INCLUDE 'generic/multibox.html' + name = 'salesman_id', + style = 'width: 250px', + DATA = ALL_SALESMEN, + id_key = 'id', + label_sub = 'salesman_labels', + limit = vclimit, + show_empty = 1, + allow_textbox = 0, + -%] + + [% 'Transaction description' | $T8 %] -- 2.20.1