X++ Code to Post the Purchase Order Invoice.
Following Job post the invoice by using PurchFormLetter class.
static void CreatePOInvoice(Args _args)
{
PurchFormLetter purchFormLetter;
PurchTable PurchTable;
ttsbegin;
PurchTable = PurchTable::find('PO-Demo');
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchtable, // Purchase record Buffer
static void CreatePOInvoice(Args _args)
{
PurchFormLetter purchFormLetter;
PurchTable PurchTable;
ttsbegin;
PurchTable = PurchTable::find('PO-Demo');
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchtable, // Purchase record Buffer
"Inv_"+purchTable.PurchId, // Invoice Number
systemdateget()); // Transaction date
systemdateget()); // Transaction date
ttscommit;
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}
Now run the CreatePOInvoice job.
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}
Now run the CreatePOInvoice job.
No comments:
Post a Comment