diff --git a/print/templates/reports/invoice/sql/rectified.sql b/print/templates/reports/invoice/sql/rectified.sql index ea814a05a..49db8f68b 100644 --- a/print/templates/reports/invoice/sql/rectified.sql +++ b/print/templates/reports/invoice/sql/rectified.sql @@ -1,10 +1,10 @@ -SELECT - io.amount, - io.ref, - io.issued, +SELECT + io.amount, + io.ref, + io.issued, ict.description -FROM vn.invoiceCorrection ic - JOIN vn.invoiceOut io ON io.id = ic.correctedFk - JOIN vn.invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk +FROM invoiceOut io + JOIN invoiceCorrection ic ON ic.correctingFk = io.id + JOIN invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk LEFT JOIN ticket t ON t.refFk = io.ref -WHERE t.refFk = ? \ No newline at end of file +WHERE io.ref = ? \ No newline at end of file