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 :
Microsoft Dynamics AX (Archived)

Post PO Invoice From X++ Code

(0) ShareShare
ReportReport
Posted on by 575

Dear Professionals

I have a case in which I want to post a PO invoice from code and I want to select the from the product receipts already postedI already can post the invoice through the code but it posts all the product receipt quantity.

Can any one help?

Appreciating...

Amr Saad

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    My understanding is, you want to do invoice the PO with received quantity. In this case we can use below method.

    PurchFormLetter.chooseLinesQuery(queryRun);

    This job may help you.


    PurchFormLetter PurchFormLetter;
    Query query = new Query(QueryStr(PurchUpdatePackingSlip));;
    QueryRun queryRun;

    query.dataSourceTable(tableNum(purchline)).addRange(fieldNum(purchline, PurchStatus)).value(queryValue(PurchStatus::Received));



    PurchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
    PurchFormLetter.chooseLinesQuery(queryRun);
    PurchFormLetter.update(purchtable::find("XXX"),"1");

  • Amr Saad Profile Picture
    575 on at

    Hi

    Thanks a lot for your kind reply

    I want to post the invoice based on an already posted "Product Receipt" like what I can do when posting it from the form. I want to select one or more product receipt from the already post receipts before.

    Appreciating...

    Amr

  • Bashir Ahmad Profile Picture
    5,248 on at

    Just to give you an idea you can do some thing like that here is a code for product receipts from X++ CODE :

    this may help to generate invoices from receipts:

    kurthatlevik.wordpress.com/.../help-requested-ax2012-fp-product-receipt-from-x

  • Community Member Profile Picture
    on at

    Have a look on this; it might give some ideas.
    Note: just replace any word "Sales" with "Purch"; it may work. 

    dynamicsuser.net/.../199021.aspx

    And let me know your results.

  • Amr Saad Profile Picture
    575 on at

    I have already posted the product receipt in the same way but the problem is that I want to select one or more product receipts to make the invoice for them.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans