General Journal to LedgerJournalTrans

Is it possible to join the general Journal transaction lines to the LedgerJournalTrans table? I need to display the invoice in the Voucher Transaction fields and I cannot find a working link anywhere.

If this isnt directly possible, is there a point during the posting of the LedgerJournalTrans that gives me access to a general journal table that I could add the invoice Id to? or perhaps a new bridging table…

Can you please elaborate your question?

Basically I need the Invoice Id to show up in the Voucher Transactions form (GL\Inquiries\Voucher Transactions). I have the voucher, the General Journal Accounting Entry record and the General Journal Entry record.

Its not often I need to program against the GL and I cant find any reasonable map to explain the data flow.

At the moment, I’ve used the voucher to select the LedgerJournalTrans record and display its Invoice Id, but that seems a trifle simple and perhaps wrong or at least not specific enough.

At the moment I have the following code:

public display InvoiceId SAB_InvoiceId(GeneralJournalVoucherView _GeneralJournalVoucherView)

{

ledgerJournalTrans _ledgerJournalTrans;

LedgerEntryJournal _LedgerEntryJournal;

GeneralJournalEntry _GeneralJournalEntry = GeneralJournalEntry::find(_GeneralJournalVoucherView.GeneralJournalEntry);

select _LedgerEntryJournal where _LedgerEntryJournal.RecId == _GeneralJournalEntry.LedgerEntryJournal;

select _ledgerJournalTrans where _ledgerJournalTrans.JournalNum == _LedgerEntryJournal.JournalNumber &&

_ledgerJournalTrans.Voucher == _GeneralJournalVoucherView.Voucher &&

_ledgerJournalTrans.Company == _GeneralJournalVoucherView.VoucherDataAreaId &&

_ledgerJournalTrans.Invoice;

return _ledgerJournalTrans.Invoice;

}

Hi Carl,

Whenvever you post a journal from Ledger journal trans,a record will be inserted in Ledger entry journal table with your respective journal number.So from ledger entry journal table select the recid and check in general journal entry table you will find correponding record.

Please check as follows.

Is Invoice field is available in LedgerTrans Table? if Yes then ( I guess we are having domcumentNum field)

  1. Check which form and its overview tab group is displayed after query form of Ledger Transaction in LedgerTrans Table.

  2. Add Invoice Column to the group.

  3. Compile the form and you are done.

Hope this will help you out.

display InvoiceId invoiceId()

{

return (select firstonly Invoice from ledgerJournalTrans

where ledgerJournalTrans.Voucher == generalJournalEntry.SubledgerVoucher &&

ledgerJournalTrans.TransDate == generalJournalEntry.AccountingDate &&

ledgerJournalTrans.DataAreaId == generalJournalEntry.SubledgerVoucherDataAreaId).Invoice;

}