web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Partial sales order through code in Dynamics ax 2012 R2

Mohamed Asarafali Profile Picture Mohamed Asarafali 445
I had been searching the internet to find the code. But i couldnt, every code leads to full invoice or line by line invoice. so i did some exploring to come up with a below code it will invoice partial quantity

I updated the partial sales invoice through code...

 SalesFormLetter salesFormLetter =  SalesFormLetter::construct(DocumentStatus::Invoice);
 SalesTable salesTAble;
 SalesParmLine parmLine;
 ;
 salesTable = SalesTable::find('FUAE-000002');
 salesFormLetter.salesTable(salesTAble);
 salesFormLetter.transDate (systemDateGet());
 salesFormLetter.specQty (SalesUpdate::All);
 //If you want proforma you can enable the code
 //salesFormLetter.proforma (true);
 //salesFormLetter.printFormLetter (true);
 salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.s alesParmUpdate());
 salesFormLetter.initParmSalesTable(salesTAble);

 salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
 salesFormLetter.initLinesQuery();
 while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
 {
 ttsBegin;
 parmLine.DeliverNow = 10;
 parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
 parmLine.setInventDeliverNow();
 parmLine.setLineAmount(); 
 parmLine.update();
 ttsCommit;
 }
 salesFormLetter.run();

This was originally posted here.

Comments

*This post is locked for comments