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

8 lines
325 B
MySQL
Raw Normal View History

2021-03-01 10:25:37 +00:00
SELECT IF(incotermsFk IS NULL, FALSE, TRUE) AS hasIncoterms
FROM ticket t
JOIN invoiceOut io ON io.ref = t.refFk
JOIN client c ON c.id = t.clientFk
JOIN address a ON a.id = t.addressFk
WHERE io.id = ?
AND IF(c.hasToinvoiceByAddress = FALSE, c.defaultAddressFk, TRUE)
LIMIT 1