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.create(localVendTransOpen.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));
}
You forget to mention "specOffsetVoucher". What object is that? class, form, or what?
ReplyDeletespecOffsetVoucher is already declared and instantiated for you in the custOpenTrans or vendOpenTrans forms. If you look in the form's class declaration, you can see that specOffsetVoucher is an instance of the Specification class. Hope that helps.
ReplyDeleteUpdated for AX 2009 here: http://natepaine.blogspot.com/2014/06/ax-2009-open-transaction-editing-mark.html
ReplyDelete