Jad Zarzour
07/03/2024, 3:32 PMtransaction
table)
Here is how I currently retrieve the invoices for which a given payment has been made
SELECT
pt.id AS invoice_id,
FROM
transaction t
JOIN previoustransactionlink ptl ON ptl.nextdoc = t.id
JOIN transaction pt ON ptl.previousdoc = pt.id
WHERE
pt.type = 'CustInvc'
AND t.id = "payment_id"
Thanks for your help !Edgar Valdes
07/03/2024, 4:12 PMtransactionline
tablemichoel
07/03/2024, 11:31 PMSELECT
ptll.previousdoc AS applied_to_transaction,
ptll.foreignamount AS amount_applied
FROM
transaction t
JOIN transactionline tl ON t.id = tl.transaction
JOIN previoustransactionlinelink ptll ON (
tl.transaction = ptll.nextdoc
AND tl.id = ptll.nextline
AND ptll.linktype = 'Payment'
)
WHERE
t.id = ?
Jad Zarzour
07/04/2024, 7:28 AM