"city" => "ct.city",
"country" => "ct.country",
"discount" => "ct.discount",
- "salesman" => "e.name"
+ "salesman" => "e.name",
+ "payment" => "pt.description"
);
$form->{sort} ||= "name";
}
my $query =
- qq|SELECT ct.*, b.description AS business, e.name as salesman | .
+ qq|SELECT ct.*, b.description AS business, e.name as salesman, |.
+ qq| pt.description as payment | .
(qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) .
qq|FROM $cv ct | .
qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | .
+ qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | .
qq|WHERE $where|;
my @saved_values = @values;
push(@values, @saved_values);
$query .=
qq| UNION | .
- qq|SELECT ct.*, b.description AS business, e.name as salesman, | .
+ qq|SELECT ct.*, b.description AS business, e.name as salesman, |.
+ qq| pt.description as payment, | .
qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | .
qq| '$module' AS module, 'invoice' AS formtype, | .
qq| (a.amount = a.paid) AS closed | .
qq|JOIN $ar a ON (a.${cv}_id = ct.id) | .
qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | .
+ qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | .
qq|WHERE $where AND (a.invoice = '1')|;
}
push(@values, @saved_values);
$query .=
qq| UNION | .
- qq|SELECT ct.*, b.description AS business, e.name as salesman, | .
+ qq|SELECT ct.*, b.description AS business, e.name as salesman, |.
+ qq| pt.description as payment, | .
qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
qq| 'oe' AS module, 'order' AS formtype, o.closed | .
qq|FROM $cv ct | .
qq|JOIN oe o ON (o.${cv}_id = ct.id) | .
qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | .
+ qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | .
qq|WHERE $where AND (o.quotation = '0')|;
}
$query .=
qq| UNION | .
qq|SELECT ct.*, b.description AS business, e.name as salesman, | .
+ qq| pt.description as payment, | .
qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
qq| 'oe' AS module, 'quotation' AS formtype, o.closed | .
qq|FROM $cv ct | .
qq|JOIN oe o ON (o.${cv}_id = ct.id) | .
qq|LEFT JOIN business b ON (ct.business_id = b.id) | .
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | .
+ qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | .
qq|WHERE $where AND (o.quotation = '1')|;
}
}
}
my @columns = (
- 'id', 'name', "$form->{db}number", 'contact', 'phone', 'discount',
- 'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city',
- 'business', 'invnumber', 'ordnumber', 'quonumber', 'salesman', 'country'
+ 'id', 'name', "$form->{db}number", 'contact', 'phone', 'discount',
+ 'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city',
+ 'business', 'payment', 'invnumber', 'ordnumber', 'quonumber', 'salesman',
+ 'country'
);
my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
'country' => { 'text' => $locale->text('Country'), },
'salesman' => { 'text' => $locale->text('Salesman'), },
'discount' => { 'text' => $locale->text('Discount'), },
+ 'payment' => { 'text' => $locale->text('Payment Terms'), },
%column_defs_cvars,
);