From 4a19c3d4287ccc276008fd78e63db25930d68f41 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Thu, 20 Sep 2007 17:17:41 +0000 Subject: [PATCH] Verkauf->Berichte: Auftrag und Angebot Suche nach Salesman implementiert. --- SL/OE.pm | 9 ++++++++- bin/mozilla/oe.pl | 35 +++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 5a1db0ccc..b0fa27294 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -72,10 +72,11 @@ sub transactions { qq| o.marge_total, o.marge_percent, | . qq| ex.$rate AS exchangerate, | . qq| pr.projectnumber AS globalprojectnumber, | . - qq| e.name AS employee | . + qq| e.name AS employee, s.name AS salesman | . qq|FROM oe o | . qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | . qq|LEFT JOIN employee e ON (o.employee_id = e.id) | . + qq|LEFT JOIN employee s ON (o.salesman_id = s.id) | . qq|LEFT JOIN exchangerate ex ON (ex.curr = o.curr | . qq| AND ex.transdate = o.transdate) | . qq|LEFT JOIN project pr ON (o.globalproject_id = pr.id) | . @@ -109,6 +110,11 @@ sub transactions { $query .= " AND o.employee_id = ?"; push @values, conv_i($form->{employee_id}); } + + if ($form->{salesman_id}) { + $query .= " AND o.salesman_id = ?"; + push @values, conv_i($form->{salesman_id}); + } if (!$form->{open} && !$form->{closed}) { $query .= " AND o.id = 0"; @@ -151,6 +157,7 @@ sub transactions { "quonumber" => "o.quonumber", "name" => "ct.name", "employee" => "e.name", + "salesman" => "e.name", "shipvia" => "o.shipvia", "transaction_description" => "o.transaction_description"); if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) { diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index c0d826bb3..f095c5f8a 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1307,10 +1307,12 @@ sub search { my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 1 }, + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + "all" => 1 }, "employees" => "ALL_EMPLOYEES", - $vc => "ALL_" . uc($vc)); + "salesmen" => "ALL_SALESMEN", + $vc => "ALL_" . uc($vc) + ); my %labels = (); my @values = (""); @@ -1329,6 +1331,14 @@ sub search { push(@values, $item->{"id"}); $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; } + + #salesmen + my %labels_salesmen = (); + my @values_salesmen = (''); + foreach my $item (@{ $form->{"ALL_SALESMEN"} }) { + push(@values_salesmen, $item->{"id"}); + $labels_salesmen{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"}; + } my $employee_block = qq| @@ -1338,6 +1348,14 @@ sub search { '-values' => \@values, '-labels' => \%labels)) . qq| + + + | . $locale->text('Salesman') . qq| + | . + NTI($cgi->popup_menu('-name' => 'salesman_id', + '-values' => \@values_salesmen, + '-labels' => \%labels_salesmen)) . qq| + |; %labels = (); @@ -1420,6 +1438,7 @@ sub search { $vc_label $employee + | . $locale->text('Ship via') . qq| @@ -1446,6 +1465,8 @@ sub search { | . $locale->text('Subtotal') . qq| + | + . $locale->text('Salesman') . qq| @@ -1513,6 +1534,7 @@ sub orders { "name", "netamount", "tax", "amount", "curr", "employee", + "salesman", "shipvia", "globalprojectnumber", "transaction_description", "open", "delivered", "marge_total", "marge_percent" @@ -1551,7 +1573,7 @@ sub orders { my @hidden_variables = map { "l_${_}" } @columns; 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); + transaction_description transdatefrom transdateto type vc employee_id salesman_id); my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables); @@ -1567,7 +1589,8 @@ sub orders { 'tax' => { 'text' => $locale->text('Tax'), }, 'amount' => { 'text' => $locale->text('Total'), }, 'curr' => { 'text' => $locale->text('Curr'), }, - 'employee' => { 'text' => $locale->text('Salesperson'), }, + 'employee' => { 'text' => $locale->text('Employee'), }, + 'salesman' => { 'text' => $locale->text('Salesman'), }, 'shipvia' => { 'text' => $locale->text('Ship via'), }, 'globalprojectnumber' => { 'text' => $locale->text('Project Number'), }, 'transaction_description' => { 'text' => $locale->text('Transaction description'), }, @@ -1577,7 +1600,7 @@ sub orders { 'marge_percent' => { 'text' => $locale->text('Ertrag prozentual'), } ); - foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee shipvia)) { + foreach my $name (qw(id transdate reqdate quonumber ordnumber name employee salesman shipvia)) { $column_defs{$name}->{link} = $href . "&sort=$name"; } -- 2.20.1