axaptadynamics-ax-2012

Relation between custinvoiceTrans and GeneralJournalAccountEntry


I know there are a lot of similar questions, but unfortunately, none of them answers my problem. For VendInvoiceTrans you can go to InventTransPosting, where the LedgerDimension and DefaultDimension resides in one table, and you can use ledgerDimension to find all GeneralJournalAccountEntry record for that specific voucher.

InventTransPosting = InventTransPosting::find(InventTrans::findTransId(vendInvoiceTrans.InventTransId).DateStatus,
vendInvoiceJour.CostLedgerVoucher,
InventTransOrigin::findByInventTransId(vendInvoiceTrans.inventTransId).RecId,
InventTransPostingType::Financial);

LedgerDimension = InventTransPosting.LedgerDimension;
select generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == SubledgerVoucherGeneralJournalEntry.GeneralJournalEntry
&& generalJournalAccountEntry.LedgerDimension == LedgerDimension
&& (generalJournalAccountEntry.PostingType == WHATEVERPOSTINGTYPE!);

Or, you can use the accountingDistribution framework alongwith SubledgerJournalAccountEntry to find the generalJournalAccountEntry for the specific VendInvoiceTrans.SOURCEDocumentLine

select accountingDistribution
where accountingDistribution.SourceDocumentLine == vendInvoiceTrans.SourceDocumentLine
join subledgerJournalAccountEntryDistribution
where subledgerJournalAccountEntryDistribution.AccountingDistribution == AccountingDistribution.RecId
join GeneralJournalAccountEntry,PostingType
from SubledgerJournalAccountEntry
where SubledgerJournalAccountEntry.RecId == SubledgerJournalAccountEntryDistribution.SubledgerJournalAccountEntry
&& SubledgerJournalAccountEntry.GeneralJournalAccountEntry
&& (SubledgerJournalAccountEntry.PostingType == WHATEVERYOUWANT);

What I am interested is in finding something similar for CustInvoiceTrans. Is there

1) any table (like InventTransPosting for VendInvoiceTrans), that keeps a track of posted invoiceTransactions with its defaultdimensions or ledgerDimensions. The CustInvoiceTrans.LedgerDimension only shows the main account, but I need some tables where the ledger dimension field would have more information.

or,

2) any table (like SubledgerJournalAccountEntryDistribution), that keeps a track of generalJournalAccountEntry and sourceDocumentLine.


Solution

  • InventTransPosting holds only transactions for inventory. Only part of Vend and Cust transactions are created by inventory posting. The best way to get what you need is to take a look at form LedgerTransVoucher� and see how it is initialized when called from CustTrans form by clicking on Voucher button. In your case you need to use SubledgerVoucherGeneralJournalEntry� and filter it by Voucher and TransDate of your CustTrans. Then you can join this to get all the subledger postings.