Skip to main content

Posts

Code to get date time difference in ax 2012

This is a sample example to get date time difference in ax 2012 TransDateTime dateTime_a, dateTime_b; date date1, date2; int64 c; #define.NoOfHrsInADay(24); dateTime_a= 2014-09-26T11:59:59; dateTime_b= 2014-09-19T08:50:50; c = DateTimeUtil::getDifference(dateTime_a,dateTime_b); date1 = DateTimeUtil::date(dateTime_a); date2 = DateTimeUtil::date(dateTime_b); c = c - (date1-date2)*(#NoOfHrsInADay)*60*60; info(strFmt("%1 day, %2 hrs.",(date1-date2), c div 3600)); Output will be like this:-7 day, 3 hrs. I hope it will help you in your date  time troubleshooting.

Code to Create On Account Transaction for Project in Ax 2012

Path for On Account Transaction for Project is as below. Project management and accounting/Common/Projects/All projects/  On Account Transactions This is Code sample to Create On Account Transaction for Project in Ax 2012. You need to declare required variables. _ProjTable =ProjTable::find(_projId); projOnAccTrans.clear(); projOnAccTrans.ProjID = _projId; projOnAccTrans.TransDate = _str2Date("3/11/2015",123); projOnAccTrans.editTransactionOrigin(true,ProjOriginOnAcc::Milestone); projOnAccTrans.Description = _Description; projOnAccTrans.CurrencyId = _Currency; projOnAccTrans.TotalSalesAmountCur = _SalesPrice; projOnAccTrans.TransId = ProjParameters::newTransId(); projOnAccTrans.Qty=_Quantity; projOnAccTrans.DefaultDimension=_ProjTable.DefaultDimension; projOnAccTrans.projInvoiceStatus(); projOnAccTrans.insert

Finalization of Purchase order if PO is not in invoiced status Ax 2012

You can use following steps for Finalization of PO . Check the Status of the Purchase Order(PO) of Purchase Order is with approval status Confirmed & PO status ‘Invoiced’ than you can finalized directly but if its not invoiced then you can use below steps. You need to do change request for workflow Click on ‘Request Change’. Then Cancel the ‘Deliver Remainder’ for all the items in the Purchase Order. Then Submit the Purchase Order for Workflow approval. Then Make the Purchase Order ‘Approved’ Then Confirm the Purchase Order. After above step now you can Finalize the Purchase Order.

Number sequence gap issues for Orders in Ax 2012

Some time we noticed that there is Number sequence gap issues for Orders in Ax 2012 like you have created SO00001 then after sometimes you created then you got order SO00004 is creating instead of SO00002. Reason for this kind of issue is as follow. 1.If you check to number sequence type then you will find that a continuous number sequence could be setup as Order. 2. If you create a new order and then delete it, no numbers added to the status list which can be freed and used again system maintain itself. 3. If you create a new order using but then you cancel it for example "Create sales order" form, and click "cancel" in the form then the number will be added to the status list. Then the number can be freed by clean-up and can be used again when a new order is created. I hope you can get Idea from above observation.

Solved Error during Inventory Closing and Recalculation in Ax 2012

Getting following Error during Inventory Closing and Recalculation in Ax 2012. Error Details: "You can't have unallocated cost on a planning formula" Solution : This error may come many ways. First check the item in production type is formula or not, if not, change production type to formula. Then you can debug following method in class InventCostItemDim  \Classes\InventCostItemDim.addFormulaKeyAdjustment() To get any error due to rounding you can check ledgervouchertransobject class in checkrounding method. Then you can correct rounding issue. If still error exist then find the recid by debugging on error editing message and find that record in inventtrans table. If in inventtrans table valueopen field if its yes then select no this option you can use only if there is no other solution you found.