salix/print/templates/reports/invoice-incoterms/sql/client.sql

13 lines
458 B
MySQL
Raw Normal View History

2021-03-01 10:25:37 +00:00
SELECT
c.id,
c.socialName,
c.street AS postalAddress,
IF (ios.taxAreaFk IS NOT NULL, CONCAT(cty.code, c.fi), c.fi) fi,
CONCAT(c.postcode, ' - ', c.city) postcodeCity
FROM vn.invoiceOut io
JOIN vn.client c ON c.id = io.clientFk
JOIN vn.country cty ON cty.id = c.countryFk
LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
AND ios.taxAreaFk = 'CEE'
2022-07-21 08:05:37 +00:00
LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ?