Skip to main content

Posts

Showing posts from February, 2018

Code to get opening balance for Ledger Main account in Ax 2012

If you want to check opening balance for particular main account then you can check below code to get the same. This is sample Code to get opening balance for Ledger Main account in Ax 2012. LedgerBalanceMainAccountAmounts ledgerBalance; AmountMst opSum; ; ledgerBalance = LedgerBalanceMainAccountAmounts::construct(); ledgerBalance.parmIncludeRegularPeriod(true); ledgerBalance.parmIncludeOpeningPeriod(true); ledgerBalance.parmIncludeClosingPeriod(false); ledgerBalance.parmAccountingDateRange(mkDate(01,01,2000), mkDate(31,12,2017)); ledgerBalance.calculateBalance(MainAccount::findByMainAccountId('1123333')); opSum = ledgerBalance.getAccountingCurrencyBalance(); info(num2str(opSum,10,2,1,1));

Code to get Miscellaneous charges of purchase line in Ax 2012

This is Code to get Miscellaneous charges of purchase line in Ax 2012. You can try below code to check in job. PurchTable purchTable; PurchLine purchLine; MarkupTrans markupTrans; while select * from purchLine Join purchTable Join markupTrans Where purchTable.PurchId == purchLine.PurchId && markupTrans.TransRecId == purchLine.RecId && purchTable.PurchId=="PO-0000043" { info(strFmt("%1 , %2 , %3",purchLine.PurchId,markupTrans.Txt,markupTrans.Value)); }

Code to approve bom for product in Ax 2012.

Code to approve bom for product in Ax 2012.If you are creating or uploading bom list by code then auto approval may required,below code will help to approve bom item automatically. void God_setBOMActive(BOMId bomid,str 20 approver1) { BOMVersion BOMVersion1; BOMApprove bomApprove = new BOMApprove(); RecId approver = HcmWorker::findByPersonnelNumber(approver1).RecId; boolean ret=true; try { select forUpdate BOMVersion1 where BOMVersion1.BOMId==bomid; BOMVersion1.selectForUpdate(); BOMVersion1.Approved = true; BOMVersion1.Active = true; BOMVersion1.Approver = approver; ttsBegin; BOMVersion1.write(); ttsCommit; bomApprove.init(); bomApprove.parmApprover(approver); bomApprove.parmBOMId(bomid); bomApprove.run(); } catch { info(strFmt("(%1) approval failed.", bomid)); } }