LedgerTransModule class
How do I find Ledger Transaction Detail?
below X++ Code
wrote by Jimmy oct 25th 2010
1) declaration
public class ReportRun extends ObjectRun
{
TmpLedgerBase TmpLedgerBase; //Jimmy 2010-05-27
LedgerTransModule LedgerTransModule; //Jimmy 2010-05-27
}
2) Calc
public void executeSection() //Jimmy 2010-05-27 calc financial Amount
{
CustInvoiceJour CustInvoiceJour;
;
CustInvoiceJour = CustInvoiceJour::findFromCustInvoiceTrans(CustInvoiceTrans_1.OrigSalesId,CustInvoiceTrans_1.InvoiceId,CustInvoiceTrans_1.InvoiceDate,CustInvoiceTrans_1.numberSequenceGroup);
LedgerTransModule = new LedgerTransModule(CustInvoiceJour.LedgerVoucher,CustInvoiceTrans_1.InvoiceDate);
LedgerTransModule.createTransModule();
TmpLedgerBase.setTmpData(LedgerTransModule.transModule());
super();
}
3)get values from temp table
display Amount Amount()
{
;
select firstonly TmpLedgerBase
where TmpLedgerBase.id == CustInvoiceTrans_1.ItemId;
return - TmpLedgerBase.Amount;
}
Example:
For a Purchase Order transaction that is posted to the ledger, how can I find the vendor and the item that was purchased? I am currently using LedgerTrans table and I am able to see the ledger transaction type (Purchase Order,Production, Inventory, Payment, etc.), but how do I get to the detail level for a purchase order transaction to determine what item was purchased and from whom?
Jobs below as
static void Jimmy_ledgerTransfromVoucher(Args _args)
{
LedgerTrans ledgerTrans;
LedgerTransModule ledgerTransModule;
TmpLedgerBase tmpLedgerBase;
;
while select Voucher,TransDate from ledgertrans
where ledgertrans.TransType == ledgertransType::Purch
{
ledgerTransModule = new LedgerTransModule(ledgerTrans.Voucher,ledgertrans.TransDate);
ledgerTransModule.createTransModule();
tmpLedgerBase.setTmpData(ledgerTransModule.transModule());
while select tmpLedgerBase
where tmpLedgerBase.Module == SysModule::Purch
|| tmpLedgerBase.Module == SysModule::Invent
|| tmpLedgerBase.OriginalDocument == OriginalDocument::PurchaseInvoice
{
info(strfmt("Amoount = %1,id = %2,IdName = %3,Module = %4,OrgDocument = %5,voucher %6",
tmpLedgerBase.Amount,
tmpLedgerBase.id,
tmpLedgerBase.IdName,
tmpLedgerBase.Module,
tmpLedgerBase.OriginalDocument,
tmpLedgerBase.Voucher)
);
}
break;
}
}

浙公网安备 33010602011771号