Hi All,
Could, any one help me out through code how to post multiple so to a single sales invoice post and show saleseditlines form to user. In used the blow code but there are lot of chanes in Ax2012 in FormLetter Classes:
SalesFormLetter letter=SalesFormLetter::construct(DocumentStatus::Invoice);
SalesParmLine parmLine;
salesLine _salesLine;
SalesParmTable SalesParmTable;
salesParmUpdate salesParmUpdate;
SalesTable SalesTableMarked;
;
ttsBegin;
letter.transDate(systemDateGet());
letter.multiForm(true);
letter.specQty(SalesUpdate::All);
letter.printFormLetter (true);
letter.createParmUpdate();
select forupdate firstonly salesParmUpdate where
salesParmUpdate.RecId == letter.salesParmUpdate().RecId;
salesParmUpdate.SumBy = AccountOrder::Account;
salesParmUpdate.update();
letter.salesParmUpdate(salesParmUpdate);
letter.initParameters(letter.salesParmUpdate(), PrintOut::Current);
if (SalesTable_ds.anyMarked())
{
SalesTableMarked = SalesTable_ds.getFirst(1,false);
while(SalesTableMarked)
{
letter.createParmTable(SalesParmTable, SalesTable::find(SalesTableMarked.SalesId));
SalesParmTable.DocumentDate = SalesTable::find(SalesTableMarked.SalesId).DeliveryDate;
SalesParmTable.Transdate = SalesTable::find(SalesTableMarked.SalesId).DeliveryDate;
SalesParmTable.DocNumberingCode_LT = "P_SF1";
SalesParmTable.insert();
SalesParmTable.clear();
while select _salesLine where _salesLine.SalesId == SalesTableMarked.SalesId letter.createParmLine(_salesLine);
SalesTableMarked = SalesTable_ds.getNext();
}
}
letter.run();
ttscommit;
But, in Ax2012 there are SalesFormLetter , SalesFormLetterParmData, SalesFormLetterService , SalesFromLetterContract , SalesFormLetterController etc. classes to how to insert record in SalesParmUpdate , SalesParmTable and SalesParmLine Tables while posting...!
Thanks a lot...!!
Daxing
*This post is locked for comments