Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How can I show the invoice before I post it?

Posted on by 570

The proforma does not work for me, because the form is closed and I must re-enter the information.

I want to generate the report without posting the invoice, 

In this way the user first verifies the information of the lines to be invoiced and if the information is correct then the post.

Thanks in advance!

*This post is locked for comments

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: How can I show the invoice before I post it?

    Hi Ismaelivan,

    The data in custinvoice… tables will be deleted after printing the pro-forma. Probably the SalesParm.. tables not. You can also consider creating new tables and store information about the settings when it is a pro-forma during the data collection for printing the pro-foma.

  • RE: How can I show the invoice before I post it?

    Could you also post the screenshot after clicking preview button ?  I am also facing the same issue

  • ismaelivan Profile Picture
    ismaelivan 570 on at
    RE: How can I show the invoice before I post it?

    Hi André, I could consider saving it in another table (inside salesformletter / run) but the updates are inside a transaction and are deleted?. So I must save data from salesparm and salesparmtable only? I see that custinvoicejour, custinvoicetrans, custinvoiceline and salesparmline are also updated, How can I set that data when posting the invoice? That part of business logic I do not understand very well.

  • ismaelivan Profile Picture
    ismaelivan 570 on at
    RE: How can I show the invoice before I post it?

    For me the solution would be to call from another button (different of close) to the proforma to not close the form, and once it was checked that everything is correct, click ok to publish.

    fdd.PNG

    I found this code, I would like that instead of saving it, I show it

        SalesTable          salesTable_;
        PrintJobSettings    printJobSettings_;
        SalesFormLetter     salesFormLetter_;
        ;
    
        select firstOnly salesTable
            where salesTable.DocumentStatus == DocumentStatus::PackingSlip
               && salesTable.SalesStatus    == SalesStatus::Delivered;
    
        salesTable_ = SalesParmTable.salesTable(false);
    
        printJobSettings_ = new PrintJobSettings();
        printJobSettings_.setTarget(PrintMedium::File);
        printJobSettings_.format(PrintFormat::PDF);
        printJobSettings_.fileName(@'C:\Temp\proforma_invoice.pdf');
    
        salesFormLetter_ = SalesFormLetter::construct(DocumentStatus::Invoice);
        salesFormLetter_.updatePrinterSettingsFormLetter(printJobSettings_.packPrintJobSettings());
        salesFormLetter_.update(salesTable_,
                               systemDateGet(),
                               SalesUpdate::PackingSlip,
                               AccountOrder::None,
                               true,
                               true);

    but it shows this error Called without valid buffer.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: How can I show the invoice before I post it?

    Hi Ismaelivan,

    Like mentioned, the form is like a dialog and all coding is executed after you click the OK button. I don't think it will be an easy job to leave the form open. It would be more easy to do something like mentioned in my previous reply to copy values from a previous run. If they are not available, then you can consider storing them in a new table as part of a customization.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: How can I show the invoice before I post it?

    Hello ismaelivan,

    Have you created the form that you shared above or was this part of the solution you bought from your MS partner?

    Best regards,

    Ludwig

  • ismaelivan Profile Picture
    ismaelivan 570 on at
    RE: How can I show the invoice before I post it?

    if they are custom fields, but the amounts and totals do not, I understand that when making a proforma, everything is generated within a commit and it is eliminated, so how can I execute the proforma from another button so that the form is not closed? .

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: How can I show the invoice before I post it?

    Hi Ismaelivan,

    I have never seen these fields. Are they part of a localization or ISV/customization? I would not try to prevent closing the form as it is a kind of dialog for the report and posting. You can consider a customization. I thought that also for a pro-forma, the tables used on the form will be kept in the tables SalesParmTable and some other SalesParm… tables with the status executed. Then you can try to receive the values when the purchase order was selected before.

  • ismaelivan Profile Picture
    ismaelivan 570 on at
    RE: How can I show the invoice before I post it?

    3073.fd.png

    thanks for your help!!

    the fields to select are the purchase order and when selecting it they must verify the totals, too the amount to be invoiced where they again validate totals, and finally extra fields that were included in the configure tab.

    Is it possible to prevent the form from being closed?

    thanks

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: How can I show the invoice before I post it?

    Hi IsmaelIvan,

    My last comment was not submitted correctly. You are correct that after entering all 'Posting invoice' details, the information is 'lost' because the form will be closed when you did print the pro-forma. However, usually all details are defaulted on e.g. quantities from packing slip. Also the date is set to todays date. So, like Ludwig, I also like to know the details the user has to retype.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans