I have a requirement where I am given a main account and date range and I need to provide the general ledger entries, plus their associated ledger journal lines.
It is easy enough to grab the correct general journal rows because GeneralJournalAccountEntry has main account (through LedgerDimension) and GeneralJournaEntry has the accounting date. But I am having trouble getting the related rows in LedgerJournalTrans.
If the LedgerJournalTrans row has Account Type or Offset Account Type value of 'Ledger' then the LedgerDimension or OffsetLedgerDimension can be used to get the main account. That works fine.
But what about this actual example? The LedgerJournalTrans row has Account Type = 'Vendor', Account = '16000', Offset Account Type = 'Ledger', Offset Account = Null. How could I know that that row has the required main account? I checked vendor '16000': neither the Vendor detail form, the Invoice>Default Account, or the Invoice>Posting form shows any tie to the main account of interest.
Currently, I am provided only LedgerJournalTrans rows with AccountType = 'Ledger' and the main account, or OffsetAccountType = 'Ledger' and the main account. But then I am excluding rows such as the one above, and the LedgerJournalTrans sum can be many thousands of dollars less than the GeneralJournalAccountEntry total for the main account.
On the other hand, if I ignore AccountType, Account, OffsetAccountType, and OffsetAccount, and provide all LedgerJournalTrans rows, then I am including rows that are not for the main account of interest, and the LedgerJournalTrans sum can be many thousands of dollars more than the GeneralJournalAccountEntry total for the main account.
*This post is locked for comments