Thursday, August 11, 2016

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()  

Sunday, July 10, 2016

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.

Friday, July 8, 2016

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.

Tuesday, June 28, 2016

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.


Wednesday, June 1, 2016

Get unit conversion value of item in Ax 2012

To Get unit conversion value of item in Ax 2012 you can use below code. UnitOfMeasureConverter_Product is a class which has different method to give you converted value.

Here example is showing to get conversion value from liter to kilo gram.

 UnitOfMeasureConverter_Product unitConverter  = UnitOfMeasureConverter_Product::construct();  
 unitConverter.parmProduct(InventTable::find("TestIte",true).Product);  
 unitConverter.parmFromUnitOfMeasure(UnitOfMeasure::unitOfMeasureIdBySymbol("ltr"));  
 unitConverter.parmToUnitOfMeasure(UnitOfMeasure::unitOfMeasureIdBySymbol("kg"));  
 unitConverter.parmRoundAbsoluteValue(NoYes::Yes);  
 unitConverter.parmApplyRounding(NoYes::Yes);  
   info(strFmt("%1",unitConverter.convertValue(1)));