Hello,
Can someone please share the code to post single invoice for multiple Purchase orders through x++.
These are service item purchase orders so packing slip is not required.
I am able to create invoice for inidividual purchase order but struggling to crease single invoice for multiple purchase orders.
I am using ax 2012 R2.
An urgent feedback will be highly appreciated.
Thanks.
*This post is locked for comments
The following code will post single invoice against multiple purchase orders.
static void Bilal_postPOMultiple(Args _args)
{
PurchFormLetter purchFormLetter;
//PurchTable _purchTable = PurchTable::find("000592");
PurchTable purchTable;
Map mapPurchTable;
ttsBegin;
// Confirm order
//purchFormLetter = purchFormLetter::construct(DocumentStatus::PurchaseOrder);
//purchFormLetter.update(_purchTable,'');
// Invoice order
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
mapPurchTable = new Map(typeName2Type(extendedTypeStr(RecId)), Types::Record);
purchTable = PurchTable::find("001228");
mapPurchTable.insert(purchTable.RecId, purchTable);
purchTable = PurchTable::find("001229");
mapPurchTable.insert(purchTable.RecId, purchTable);
purchFormLetter.parmDataSourceRecordsPacked(mapPurchTable.pack());
purchFormLetter.initNewPurchParmUpdate();
purchFormLetter.sumBy(AccountOrder::Account);
purchFormLetter.reArrangeNow(true);
purchFormLetter.update(purchTable,
"In4f9231",
systemDateGet(), PurchUpdate::All);
ttsCommit;
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156