qq| ex.$rate AS exchangerate, | .
qq| pr.projectnumber AS globalprojectnumber, | .
qq| e.name AS employee, s.name AS salesman, | .
- qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id | .
+ qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id, | .
+ qq| tz.description AS taxzone | .
$periodic_invoices_columns .
qq|FROM oe o | .
qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
qq|LEFT JOIN exchangerate ex ON (ex.currency_id = o.currency_id | .
qq| AND ex.transdate = o.transdate) | .
qq|LEFT JOIN project pr ON (o.globalproject_id = pr.id) | .
+ qq|LEFT JOIN tax_zones tz ON (o.taxzone_id = tz.id) | .
qq|$periodic_invoices_joins | .
qq|WHERE (o.quotation = ?) |;
push(@values, $quotation);
push(@values, conv_date($form->{reqdateto}));
}
+ if ($form->{shippingpoint}) {
+ $query .= qq| AND o.shippingpoint ILIKE ?|;
+ push(@values, '%' . $form->{shippingpoint} . '%');
+ }
+
+ if ($form->{taxzone_id} ne '') { # taxzone_id could be 0
+ $query .= qq| AND tz.id = ?|;
+ push(@values, $form->{taxzone_id});
+ }
+
if ($form->{transaction_description}) {
$query .= qq| AND o.transaction_description ILIKE ?|;
push(@values, '%' . $form->{transaction_description} . '%');
"employee" => "e.name",
"salesman" => "s.name",
"shipvia" => "o.shipvia",
- "transaction_description" => "o.transaction_description"
+ "transaction_description" => "o.transaction_description",
+ "shippingpoint" => "o.shippingpoint",
+ "taxzone" => "tz.description",
);
if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) {
$sortorder = $allowed_sort_columns{$form->{sort}} . " ${sortdir}";