this is my code for select the settlement against the customer:
{
CustTable custTable;
CustTransOpen custTransOpen;
CustTrans custTrans;
SpecTrans spectrans,_specTrans;
LedgerJournalTrans _LedgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckpost;
custvendopentransmanager manager;
AmountCur amountCur;
manager = custvendopentransmanager::construct(_LedgerJournalTrans);
if(manager.getSpecTransCount() == 0)
{
custTable = CustTable::find(_custAccount); //:findByLedgerDimension(_LedgerJournalTrans.LedgerDimension);
while select custTransOpen where custTransOpen.AccountNum == custTable.AccountNum && custTransOpen.AmountCur > 0
join custTrans where custTrans.RecId == custTransOpen.RefRecId && custTrans.AccountNum == custTransOpen.AccountNum
notexists join specTrans where specTrans.RefRecId == custTransOpen.RecId
{
manager.updateTransMarked(custTransOpen,true);
manager.updateSettleAmount(custTransOpen, custTransOpen.AmountCur);
}
ttsBegin;
_LedgerJournalTrans.selectForUpdate(true);
_LedgerJournalTrans.SettleVoucher = SettlementType::SelectedTransact;
_LedgerJournalTrans.update();
ttsCommit;
{
ledgerJournalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(_LedgerJournalTable,NoYes::No);
ledgerJournalCheckPost.run();
}
catch(Exception::Error)
{
error("Autosettlement Exception");
if(manager.getSpecTransCount() > 0)
{
manager.resetMarkedTrans();
}
}
}
I would appreciate guidance on ensuring the "AmountCurCredit" and "MarkedInvoice" field updates correctly.