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

13 lines
461 B
MySQL
Raw Permalink Normal View History

2021-02-17 12:00:06 +00:00
SELECT
2021-02-18 12:01:01 +00:00
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 vn.ticket t ON t.refFk = io.ref
WHERE t.refFk = ?