web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Calculate sales totals for partial quantity in X++

(0) ShareShare
ReportReport
Posted on by 2,100

Hi Techies,

We have a requirement where we need to get sales invoice totals from 'Totals' form of Sales orders. But here we need to modify the quantity and take the amount only for modified quantity in logic.

salesTotals = SalesTotals::construct(salesTable, SalesUpdate::All);
salesTotals.calc();

For instance - Suppose There is sales order having 2 sales lines with total sales qty 20 and each line is having 10 sales qty.  Standard will show invoice amount on Sales totals form based on total qty of Sales order i.e., 20. But in our case , Out of 10 qty of first sales line , if we are doing work creation of partial 4 qty then invoice amount should be calculated based on 4 qty of first sales line and that amount to be shown up on new customize report before doing actual invoicing.

pastedimage1661922454956v1.png

Can anyone guide on this please.

Thanks in advance.

Sangram

I have the same question (0)
  • Sangram Shinde Profile Picture
    2,100 on at
    RE: Calculate sales totals for partial quantity in X++

    Thank you for reply Judy.

    I guess we have found the solution.

    We've populated SalesParmTable and SalesParmLine tables with Sales order details and updated SalesParmLine.DeliverNow quantity as load line quantity, which we are looking for.

    Now constructed SalesTotals with salesParmTable with document status as confirmation.

    salesTotals = SalesTotals::construct(salesParmTable, SalesUpdate::All, AccountOrder::None, salesParmTable.ParmId, salesParmTable.SalesId, DocumentStatus::Confirmation);
    salesTotals.calc();

    This code worked with modified quantity (load line quantity) and given the expected result.

  • huijij Profile Picture
    19,811 on at
    RE: Calculate sales totals for partial quantity in X++

    Hi Sangram,

    What have you done so far and have you encountered any challenges?

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

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans