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

12 lines
399 B
MySQL
Raw Normal View History

2021-02-24 06:51:05 +00:00
SELECT
iot.vat,
pgc.name,
IF(pe.equFk IS NULL, taxableBase, 0) AS base,
pgc.rate / 100 AS vatPercent
FROM invoiceOutTax iot
JOIN pgc ON pgc.code = iot.pgcFk
LEFT JOIN pgcEqu pe ON pe.equFk = pgc.code
2022-08-10 10:13:31 +00:00
JOIN invoiceOut io ON io.id = iot.invoiceOutFk
LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ?
2021-02-17 12:00:06 +00:00
ORDER BY iot.id