Hi all .
Requirement is need to settle open transaction against vendor . below code i used but it was settle all transaction for that vendor … but i want to mark the invoice and payment then for that vendor then need to settle if payment is 2000 rs means i want to settle the first invoice amount upto match the 2000 rs … here how to write code for this . can u any give me sample code for this
static void VendSettlement(Args _args)
{
VendTable vendTable;
VendTrans invCustTrans, payCustTrans;
SpecTransManager manager;
CustVendTransData custVendTransData;
while select vendTable where vendTable.AccountNum == ‘0000000’
{
while select * from invCustTrans
order by TransDate asc
where invCustTrans.AccountNum == vendTable.AccountNum &&
invCustTrans.TransType == LedgerTransType::Vend &&
!invCustTrans.LastSettleDate
{
while select * from payCustTrans
order by TransDate asc
where payCustTrans.AccountNum == vendTable.AccountNum &&
payCustTrans.TransType != LedgerTransType::Vend &&
!payCustTrans.LastSettleDate
{
ttsbegin;
custVendTransData = CustVendTransData::construct(invCustTrans);
custVendTransData.markForSettlement(vendTable);
custVendTransData = CustVendTransData::construct(payCustTrans);
custVendTransData.markForSettlement(vendTable);
ttscommit;
VendTrans::settleTransact(vendTable, null, true,
SettleDatePrinc::DaysDate, systemdateget());
info(strfmt(" Customer Account:- %1 Transactions settled",vendTable.AccountNum));
}
}
}
}