Get voucher transactions,settlement , and other details from customer , invocie other posted transactions via GJentry and subledger entry
//From here the code is common for all posted transactions if Project invoice one then we need to join with projinvoicejour instead of vendinvoicejour like this way
GeneralJournalAccountEntry accEntry;
SubledgerVoucherGeneralJournalEntry subGjEntry ;
LedgerDimensionPreviewTmp ledgerDimensionPreviewTmpLocal;
while select maxof(GeneralJournalEntry) from subGjEntry
where subGjEntry.AccountingDate == vendInvoiceJour.InvoiceDate
&& subGjEntry.Voucher == vendInvoiceJour.LedgerVoucher
join sum(TransactionCurrencyAmount),LedgerDimension,maxof(Text),maxof(IsCredit) from accEntry group by accEntry.LedgerDimension
where accEntry.GeneralJournalEntry == subGjEntry.GeneralJournalEntry
&& accEntry.PostingType != LedgerPostingType::VendBalance
&& accEntry.PostingType != LedgerPostingType::InterunitCredit
&& accEntry.PostingType != LedgerPostingType::InterunitDebit
{
if (accEntry.LedgerDimension)
{
// Build the preview data. to get the dimesions values
ledgerDimensionPreviewTmpLocal = LedgerDimensionPreviewTmp::buildLedgerDimensionPreviewTmp(accEntry.ledgerDimension);
select firstonly ledgerDimensionPreviewTmpLocal
where ledgerDimensionPreviewTmpLocal.Name == "Funds";
fundValue = ledgerDimensionPreviewTmpLocal.Value;
select firstonly ledgerDimensionPreviewTmpLocal
where ledgerDimensionPreviewTmpLocal.Name == "MainAccount";
MainAccValue = ledgerDimensionPreviewTmpLocal.Value;
select firstonly ledgerFund
where ledgerFund.FundNumber == fundValue;
select firstonly mainAcc
where mainAcc.MainAccountId == MainAccValue;
}
}
// IF it is journal trnasactions or settlements we need to get spectrans from there we need to use above code
while select journalTrans
where journalTrans.JournalNum == journalTable.JournalNum
&& journalTrans.PaymentStatus == CustVendPaymStatus::Sent
join specTrans
where specTrans.SpecTableId == journalTrans.TableId
&& specTrans.SpecRecId == journalTrans.RecId
{
vendTrans = specTrans.vendTrans();
vendInvoiceJour = vendTrans.vendInvoiceJour();
// Here we need to use again above code
}
Comments
Post a Comment