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) | .
$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";
"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))) {
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 = ("");
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|
<tr>
'-values' => \@values,
'-labels' => \%labels)) . qq|
</td>
+ </tr>
+ <tr>
+ <th align="right">| . $locale->text('Salesman') . qq|</th>
+ <td>| .
+ NTI($cgi->popup_menu('-name' => 'salesman_id',
+ '-values' => \@values_salesmen,
+ '-labels' => \%labels_salesmen)) . qq|
+ </td>
</tr>|;
%labels = ();
<tr>
<td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
<td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
+
<td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
. $locale->text('Ship via') . qq|</td>
</tr>
<tr>
<td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
. $locale->text('Subtotal') . qq|</td>
+ <td><input name="l_salesman" class="checkbox" type="checkbox" value="Y"> |
+ . $locale->text('Salesman') . qq|</td>
</tr>
</table>
</td>
"name", "netamount",
"tax", "amount",
"curr", "employee",
+ "salesman",
"shipvia", "globalprojectnumber",
"transaction_description", "open",
"delivered", "marge_total", "marge_percent"
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);
'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'), },
'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";
}