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

11 lines
361 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
JOIN invoiceOut io ON io.id = iot.invoiceOutFk
WHERE invoiceOutFk = ?
2021-02-17 12:00:06 +00:00
ORDER BY iot.id