Skip to main content

Mark All for Open Cust Trans and Open Vend Trans

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));
}

Popular posts from this blog

Dynamics Axapta: Sales Orders & Business Connector

Well, again folllowing my same idea of writting close to nothing and pasting code, I'll paste in some code to create a sales order from some basic data and the invoice it. I'll try to explain more in the future. AxaptaObject axSalesTable = ax.CreateAxaptaObject("AxSalesTable"); AxaptaRecord rcInventDim = ax.CreateAxaptaRecord("InventDim"); AxaptaRecord rcCustTable = ax.CreateAxaptaRecord("CustTable"); rcCustTable.ExecuteStmt("select * from %1 where %1.AccountNum == '" + MySalesOrderObject.CustAccount + "'"); if (MySalesOrderObject.CurrencyCode.Trim().Length == 0) MySalesOrderObject.CurrencyCode = rcCustTable.get_Field("Currency").ToString().Trim(); string sTaxGroup = rcCustTable.get_Field("taxgroup").ToString().Trim(); //set header level fields axSalesTable.Call("parmSalesName", MySalesOrderObject.SalesName.Trim()); axSalesTable.Call("parmCustAccount", M

Passing values between form and class

Class name is EmplDuplication and Form is EmplTable . void clicked() {    MenuFunction mf;    args args = new Args();    ;     args.record(EmplTable);     mf = new menufunction(identifierstr(EmplDuplication), MenuItemType::Action); mf.run(args); } Meanwhile, in the main() method of the EmplDuplication class, we need to put this Axapta x++ code to get the datasource: static void main(Args args) {     EmplDuplication EmplDuplication; EmplTable localEmplTable; ;     if(args.record().TableId == tablenum(EmplTable)) localEmplTable = args.record();     ... }