Given the JournalID of a make deposit entry, this query shows all of the payments that went into that Make Deposit. It also includes the make deposit entry itself (this is normally the top entry).

None. This is a selection query and no data is modified in the running of it.

-- Identify the transactions for a make-deposit sequence
DECLARE @DepositJournalID INT;
SET @DepositJournalID = 102794;
SELECT ID, EntryDateTime, Amount,  
		(SELECT AccountName FROM GLAccount WHERE ID = GLAccountID) AS AccountName,
		(SELECT OrderNumber FROM TransHeader WHERE ID = TransactionID) AS OrderNumber,
        (SELECT AccountName FROM PaymentAccount WHERE ID = Classification) AS PaymentType,
		IsModified, Reconciled, 
		GLAccountID, Classification, 
	    GroupID, TransactionID, JournalID, ReconciliationID, OffBalanceSheet, DepositJournalID,
        (SELECT Description FROM Journal WHERE ID = JournalID) AS Description,
        (SELECT Notes FROM Journal WHERE ID = JournalID) AS Notes,
		ModifiedDate
FROM Ledger
WHERE (JournalID = @DepositJournalID) 
      OR (DepositJournalID = @DepositJournalID AND GLClassificationType = 1007 )
ORDER BY
id DESC
  • Entered : 9/2011
  • Version : Control 4.4+
You could leave a comment if you were logged in.