public void
settlementnew(InvoiceId _invoice)
{
custvendopentransmanager
manager;
VendTransOpen
vendTransOpen;
VendTrans vendTrans;
ExchangeRateHelper
exchangeRateHelper;
AmountCur totalSettlement;
//To mark particular invoice based on Acc num
select vendtransopen where vendTransOpen.AccountNum ==AccountNumb
join vendTrans where
vendTrans.Invoice == _invoice
&& vendTrans.RecId == vendtransopen.RefRecId
&& vendTrans.AccountNum == vendTransOpen.AccountNum;
&& vendTrans.RecId == vendtransopen.RefRecId
&& vendTrans.AccountNum == vendTransOpen.AccountNum;
if(vendtransopen)
{
//To check transaction line which we want to settle
manager =
custvendopentransmanager::construct(ledgerJournalTrans);
manager.updateTransMarked(vendTransOpen,true);
//To get total settlement
exchangeRateHelper =
ExchangeRateHelper::newCurrency(Ledger::primaryLedger(CompanyInfo::findDataArea(ledgerJournalTrans.Company).RecId),ledgerJournalTrans.CurrencyCode);
totalSettlement =
SpecTransManager::getTotalSettleAmountForSpecReference(
ledgerJournalTrans.Company,
ledgerJournalTrans.TableId,
ledgerJournalTrans.RecId,
ledgerJournalTrans.CurrencyCode,
ledgerJournalTrans.Company,
ledgerJournalTrans.TransDate,
exchangeRateHelper.prepareExchangeRateForStorage(ledgerJournalTrans.crossrate()));
//To update in ledgerJournal trans
ttsBegin;
ledgerJournalTrans.selectForUpdate(true);
ledgerJournalTrans.AmountCurDebit
= abs(totalSettlement);
ledgerJournalTrans.SettleVoucher
= SettlementType::SelectedTransact;
ledgerJournalTrans.update();
ttsCommit;
}
}
http://www.andesoft.net/automatic-mark-settlement-transactions-payment-journal-ax-2012/
http://www.andesoft.net/automatic-mark-settlement-transactions-payment-journal-ax-2012/
how we will initialize ledgerJournalTrans?
ReplyDeletehow we will initialize ledgerJournalTrans?
ReplyDelete