mtoniato
11/07/2023, 11:35 AMMark Oriend
11/07/2023, 11:46 AMmtoniato
11/07/2023, 11:54 AMSELECT
mRecordType,
mTranId,
mTranDate,
mAccount,
mType,
mAccountNo,
mDebit,
mCredit,
mMemo,
LISTAGG (cAccount, ', ') WITHIN GROUP (ORDER BY mTranId, cAccount) as counterAccount
FROM (SELECT DISTINCT
Transaction.recordType as mRecordType,
Transaction.tranId as mTranId,
Transaction.tranDate as mTranDate,
BUILTIN.DF( TransactionAccountingLine.Account ) AS mAccount,
Account.acctType as mType,
TransactionAccountingLine.Account as mAccountNo,
TransactionAccountingLine.Debit as mDebit,
TransactionAccountingLine.Credit as mCredit,
TransactionLine.Memo as mMemo,
cAccount.accountSearchDisplayName as cAccount
FROM
TransactionAccountingLine
INNER JOIN TransactionLine ON
( TransactionLine.Transaction = TransactionAccountingLine.Transaction )
AND ( TransactionLine.ID = TransactionAccountingLine.TransactionLine )
INNER JOIN Transaction ON TransactionLine.Transaction=Transaction.ID
INNER JOIN Account ON TransactionAccountingLine.Account=Account.ID
INNER JOIN TransactionAccountingLine AS cTransactionAccountingLine ON TransactionAccountingLine.Transaction=cTransactionAccountingLine.Transaction
INNER JOIN Account AS cAccount ON cTransactionAccountingLine.Account=cAccount.ID AND cAccount.acctType!='Bank'
WHERE
TransactionAccountingLine.Debit IS NOT NULL OR TransactionAccountingLine.Credit IS NOT NULL
)
WHERE
mAccountNo =1570 AND
/*mTranId = 'JE3760' AND*/
mTranId !='JE12'
GROUP BY
mRecordType,
mTranId,
mTranDate,
mAccount,
mType,
mAccountNo,
mDebit,
mCredit,
mMemo
ORDER BY
mTranDate,
mTranId
Mark Oriend
11/07/2023, 11:57 AMMark Oriend
11/07/2023, 11:57 AMMark Oriend
11/07/2023, 11:58 AMmtoniato
11/07/2023, 12:00 PMjen
11/09/2023, 12:17 AM