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

11 lines
351 B
MySQL
Raw Permalink 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
2022-08-17 10:19:54 +00:00
WHERE io.ref = ?
2021-02-17 12:00:06 +00:00
ORDER BY iot.id