I am using AX 2012.I have below requirement.
For one PO no I have maylines.
PurchTable
#PO12312 Test Purchase Vendorooo1
Purchline
Item1 Testitem1
Item2 TestItem2
Item3 TestItem3
Item4 TestItem4
Item5 TestItem5
PO is in received status.Now I want to invoice only Item3.How we will achieve this using x++.
//This code will invoice all items for the same PO
PurchTable purch = PurchTable::find(‘TestPO’);
poinv = PurchFormLetter::construct(DocumentStatus::Invoice);
poinv.update(purch,strFmt(“Test01%1”, purch.PurchId));
//This code will invoice all items for the same PO
looking for the same, but for sales, how to post a saloes order to invoice with specific line(s) only
Saju you found anything ?
I made sth like this in sales module with a parm method.
I dont remember the name of this method, but it takes as parm posted deliveryNotes. so you create a set or map or container (don’t remember now) with deliveryNotes you suppose to invoice, call SalesFormLetter parm method (system checks this parameter in update method) , and than SFL.Update();
it looks similar in purch module
Hubert
I made sth like this in sales module with a parm method.
I dont remember the name of this method, but it takes as parm posted deliveryNotes. so you create a set or map or container (don’t remember now) with deliveryNotes you suppose to invoice, call SalesFormLetter parm method (system checks this parameter in update method) , and than SFL.Update();
this parm method should allow to parm what u want
it looks similar in purch module
Hubert
Hi Abdul,
Following code will work for Sales Order. but I am looking for PO, I tried same for PO but its throwing exception. if you found anything please let me know.
SalesTable salesTable;
SalesFormLetter salesInvoice;
Query query;
QueryRun queryRun;
;
salesTable = SalesTable::find(_salesId);
query = new Query(QueryStr(SalesUpdatePackingSlip));
query.dataSourceTable(tableNum(SalesLine)).addRange(fieldNum(SalesTable,SalesId)).value(_salesId);
query.dataSourceTable(tableNum(SalesLine)).addRange(fieldNum(SalesLine,ItemId)).value(itemId);
queryRun = new QueryRun(query);
salesInvoice = SalesFormLetter::construct(DocumentStatus::Invoice);
salesInvoice.chooseLinesQuery(queryRun);
salesInvoice.update(salesTable,
_invoiceDate,
SalesUpdate::PackingSlip,
AccountOrder::None,
false,
false);