) AS charts } .
qq|FROM ap a | .
qq|JOIN vendor v ON (a.vendor_id = v.id) | .
+ qq|LEFT JOIN contacts cp ON (a.cp_id = cp.cp_id) | .
qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id) | .
qq|LEFT JOIN tax_zones tz ON (tz.id = v.taxzone_id)| .
$where .= " AND v.name ILIKE ?";
push(@values, $form->like($form->{vendor}));
}
+ if ($form->{"cp_name"}) {
+ $where .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
+ push(@values, ('%' . $form->{"cp_name"} . '%')x2);
+ }
if ($form->{department}) {
# ähnlich wie commit 0bbfb33b6aa8e38bb6c81d1684ab7d08e5b5c5af abteilung
# wird so nicht mehr als zeichenkette zusammengebaut
) AS charts } .
qq|FROM ar a | .
qq|JOIN customer c ON (a.customer_id = c.id) | .
+ qq|LEFT JOIN contacts cp ON (a.cp_id = cp.cp_id) | .
qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | .
qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| .
$where .= " AND c.name ILIKE ?";
push(@values, $form->like($form->{customer}));
}
+ if ($form->{"cp_name"}) {
+ $where .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
+ push(@values, ('%' . $form->{"cp_name"} . '%')x2);
+ }
if ($form->{business_id}) {
my $business_id = $form->{business_id};
$where .= " AND c.business_id = ?";
sm.name AS salesman
FROM delivery_orders dord
LEFT JOIN $vc ct ON (dord.${vc}_id = ct.id)
+ LEFT JOIN contacts cp ON (dord.cp_id = cp.cp_id)
LEFT JOIN employee e ON (dord.employee_id = e.id)
LEFT JOIN employee sm ON (dord.salesman_id = sm.id)
LEFT JOIN project pr ON (dord.globalproject_id = pr.id)
push @values, '%' . $form->{$vc} . '%';
}
+ if ($form->{"cp_name"}) {
+ push @where, "(cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
+ push @values, ('%' . $form->{"cp_name"} . '%')x2;
+ }
+
foreach my $item (qw(employee_id salesman_id)) {
next unless ($form->{$item});
push @where, "dord.$item = ?";
qq| , o.order_probability, o.expected_billing_date, (o.netamount * o.order_probability / 100) AS expected_netamount | .
qq|FROM oe o | .
qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
+ qq|LEFT JOIN contacts cp ON (o.cp_id = cp.cp_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.currency_id = o.currency_id | .
push(@values, '%' . $form->{$vc} . '%');
}
+ if ($form->{"cp_name"}) {
+ $query .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
+ push(@values, ('%' . $form->{"cp_name"} . '%')x2);
+ }
+
if (!$main::auth->assert('sales_all_edit', 1)) {
$query .= " AND o.employee_id = (select id from employee where login= ?)";
push @values, $form->{login};
my @options;
push @options, $locale->text('Vendor') . " : $form->{vendor}" if ($form->{vendor});
+ push @options, $locale->text('Contact Person') . " : $form->{cp_name}" if ($form->{cp_name});
push @options, $locale->text('Department') . " : " . (split /--/, $form->{department})[0] if ($form->{department});
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}" if ($form->{invnumber});
push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if ($form->{ordnumber});
if ($form->{customer}) {
push @options, $locale->text('Customer') . " : $form->{customer}";
}
+ if ($form->{cp_name}) {
+ push @options, $locale->text('Contact Person') . " : $form->{cp_name}";
+ }
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
if ($form->{vendor}) {
push @options, $locale->text('Vendor') . " : $form->{vendor}";
}
+ if ($form->{cp_name}) {
+ push @options, $locale->text('Contact Person') . " : $form->{cp_name}";
+ }
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
push @options, $locale->text('Customer') . " : $form->{customer}" if $form->{customer};
push @options, $locale->text('Vendor') . " : $form->{vendor}" if $form->{vendor};
+ push @options, $locale->text('Contact Person') . " : $form->{cp_name}" if $form->{cp_name};
push @options, $locale->text('Department') . " : $department" if $form->{department};
push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if $form->{ordnumber};
push @options, $locale->text('Customer Order Number') . " : $form->{cusordnumber}" if $form->{cusordnumber};
-%]
</td>
</tr>
+ <tr>
+ <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
+ <td colspan="3">[% L.input_tag("cp_name", '', size=20) %]</td>
+ </tr>
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
<td>
-%]
</td>
</tr>
+ <tr>
+ <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
+ <td colspan="3">[% L.input_tag("cp_name", '', size=20) %]</td>
+ </tr>
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
<td>
</td>
</tr>
+ <tr>
+ <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
+ <td colspan="3">[% L.input_tag("cp_name", '', class="fixed_width") %]</td>
+ </tr>
+
<tr>
<th align="right">[% 'Delivery Order Number' | $T8 %]</th>
<td colspan="3"><input name="donumber" class="fixed_width"></td>
-%]
</td>
</tr>
+ <tr>
+ <th align="right" nowrap>[% 'Contact Person' | $T8 %]</th>
+ <td colspan="3">[% L.input_tag("cp_name", '', style="width: 250px") %]</td>
+ </tr>
[%- IF ALL_DEPARTMENTS.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>