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)

How to calculate Sales Quotation total cost price and gross profit?

(0) ShareShare
ReportReport
Posted on by 1,813

Hii,

I have a requirement to develop a Form to show following information about Sales Quotations and its header level.

SQ ID, SQ Status, SQ Creation Date, Customer Id, Customer Name, Sales Order Id if exist, Sales Invoice Id if exist, SQ Selling Price, SQ Cost Price, SQ Gross Profit.

I got all information except Sales Quotation Cost Price and Gross Profit.

SQ Sales Price I am getting from SalesQuotationTable -> invoiceAmount() display method.

Please help how to calculate 

- Sales Quotation total cost price for all line items?

- Sales Quotation gross profit?

Gross Profit Formula = (Sales Price - Cost Price) / Cost Price 

Thanks,

  

*This post is locked for comments

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

    Hi Rana,

    I guess you can take the total cost price from SalesQuotationTable -> totalInvoiceAmount() display method. And regarding Gross profit, you can create a new display method in Salesquotationtable with required formula and display it

  • Rana Anees Profile Picture
    1,813 on at

    Hii Tamil Selvan,

    Thanks for reply. SalesQuotationTable -> totalInvoiceAmount() returns the total invoice amount same as invoiceAmount() methods returns.

    What I am looking for us the SalesQuotationLine CostPrice. Where to get it from?

    I noticed in SalesQuotationLine table there CostPrice field. I am not sure what is this for. For some SQ it has price values while mostly are zero.

    Where to get the Sales Quotation Line Cost Price??

    Thanks,

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Rana,

    If you cant find costprice, please create a new display method for cost price as follow:

    display Amount costPrice()

    {

        Amount costPrice;

        SalesQuotationLine salesQuotationLine;

        select sum(CostPrice) from salesQuotationLine where salesQuotationLine.QuotationId == this.quotationId;

        costPrice = salesQuotationLine .CostPrice;

       return costPrice;

    }

    Above method will return sum of costprice in quotation lines with respect of quotation id

  • Rana Anees Profile Picture
    1,813 on at

    Hii Tamil Selvan,

    This display method is ok. But salesQuotationLine .CostPrice is this field the correct place to get item cost price?

    Because in our environment, we have two companies in two different partitions. One company have more thank 70k quotation lines and all have zero in CostPrice field.

    2nd company is new and have almost 200 lines where only 50 lines have cost price and all others are zero?

    In this case where to get cost price and why not costprice for all lines?

    Thanks

  • Rana Anees Profile Picture
    1,813 on at

    How this Sales Quotation totals form works on SalesQuotationLines form?

    I need the login to calculate Cost Value and Margin.

    sales-total.png

    How I can call SalesQuotationTotals -> costValue class method on SalesQuotationTable display method?

    Thanks

  • Rana Anees Profile Picture
    1,813 on at

    help please...

  • Rana Anees Profile Picture
    1,813 on at

    help please...

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Rana,

    You can try the below display method for fetching the value for CostValue:

    //BP Deviation Documented

    display AmountCur costPrice()

    {

    SalesQuotationTable    salesQuotationTable;

    SalesQuotationTotals   salesQuotationTotals;

    container               cont;

    str cost;

    real costValue;

    salesQuotationTotals = SalesQuotationTotals::construct(this);  

    //or try salesQuotationTotals = SalesQuotationTotals::construct(this.QuotationId);

    salesQuotationTotals.calc();

    cont         = salesQuotationTotals.displayFieldsCurrency(salesQuotationTotals.currencyCode());

    cost = conpeek(cont, TradeTotals::posCostValue());

    return cost;

    }

    //try and let me know please..

  • Rana Anees Profile Picture
    1,813 on at

    Hii Tamil Selvan,

    Your code is working fine.

    One more thing, I need SQ total invoice amount without VAT.

    Right now I am using SalesQuotationTable -> invoiceAmount() display method to get SQ total amount, but it is coming with TAX.

    On SalesQuotationTotals form contribution ratio is calculated exclusive VAT amount.

    Is there any method that give amount without tax?  Can I get and show VATamount separately?

    Thanks,

  • Suggested answer
    Community Member Profile Picture
    on at

    0211.Quotation-Total.jpg

    The above code fetches the value what you need from the sales Quotation total form. 

    Create a new display method like created before for contribution ratio value and tax too.

    If you find this helpful, mark the answer as Verified.

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