We have situations where there are lots of open transactions that need to be settled against each other. This can be the case if auto settlement is turned off.
One solution is to add a "Mark All" button to the custOpenTrans or vendOpenTrans forms. This button "checks" the mark checkbox on every line. The user can then uncheck several lines if needed and Update to settle the lines.
The code below is an example of what we used on the open vendor transaction screen. The code is very similar on the AR side. One note: I used vendTable.AccountNum in the code below. That should be generalized to work with any buffer that is passed into the open trans form.
void customMarkAll()
{ VendTransOpen localVendTransOpen;
VendTrans localVendTrans;
container conSum;
int linesProcessed;
;
//show wait cursor
startLengthyOperation();
element.lock();
//remove all prior markings
specOffsetVoucher.deleteSpecifications();
settle.empty();
ttsbegin;
while select localVendTransOpen
where localVendTransOpen.AccountNum == vendTable.AccountNum
{
localVendTrans = VendTrans::find(localVendTransOpen.RefRecId);
specOffsetVoucher.createlocalVendTransOpen.TableId, localVendTransOpen.RecId, localVendTransOpen.AmountCur, localVendTrans.CurrencyCode);
settle.insert(localVendTransOpen.RecId,localVendTransOpen.AmountCur); linesProcessed++;
}
ttscommit;
element.unLock();
//calculate totals for display
conSum = custVendSettle_Vend.openSumRemainAmount(common,currencyCode); remainAmountCur = conpeek(conSum,1);
remainAmountMST = conpeek(conSum,2);
element.initCashDiscTotal();
element.initVendBalance();
//refresh the screen with the calculated totals
element.redraw();
//remove wait cursor
endLengthyOperation();
box::info(strfmt("%1 Vouchers Marked",linesProcessed));
}
One solution is to add a "Mark All" button to the custOpenTrans or vendOpenTrans forms. This button "checks" the mark checkbox on every line. The user can then uncheck several lines if needed and Update to settle the lines.
The code below is an example of what we used on the open vendor transaction screen. The code is very similar on the AR side. One note: I used vendTable.AccountNum in the code below. That should be generalized to work with any buffer that is passed into the open trans form.
void customMarkAll()
{ VendTransOpen localVendTransOpen;
VendTrans localVendTrans;
container conSum;
int linesProcessed;
;
//show wait cursor
startLengthyOperation();
element.lock();
//remove all prior markings
specOffsetVoucher.deleteSpecifications();
settle.empty();
ttsbegin;
while select localVendTransOpen
where localVendTransOpen.AccountNum == vendTable.AccountNum
{
localVendTrans = VendTrans::find(localVendTransOpen.RefRecId);
specOffsetVoucher.createlocalVendTransOpen.TableId, localVendTransOpen.RecId, localVendTransOpen.AmountCur, localVendTrans.CurrencyCode);
settle.insert(localVendTransOpen.RecId,localVendTransOpen.AmountCur); linesProcessed++;
}
ttscommit;
element.unLock();
//calculate totals for display
conSum = custVendSettle_Vend.openSumRemainAmount(common,currencyCode); remainAmountCur = conpeek(conSum,1);
remainAmountMST = conpeek(conSum,2);
element.initCashDiscTotal();
element.initVendBalance();
//refresh the screen with the calculated totals
element.redraw();
//remove wait cursor
endLengthyOperation();
box::info(strfmt("%1 Vouchers Marked",linesProcessed));
}