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 current Sales Price of item from Code (after evaluating all trade agreements and discount offers)

(0) ShareShare
ReportReport
Posted on by 865

I need to develop a SSRS which will list all items and their sales prices, some items have discount offers, some have trade agreements and some items have both applied on them, I am wondering if there is a built-in method which will return current sales price after taking all offers and trade agreements into account.

any code example would be much appreciated.

*This post is locked for comments

I have the same question (0)
  • Pradeep Itnal Profile Picture
    3,248 on at

    have u tried debugging SalesOrder form.?? that should give you an idea, how the salesPrice is calculated  at saleslines.

  • alphaprolix Profile Picture
    865 on at

    Can you please suggest where should I put breakpoint, I tried write method of SalesLine Datasource but unable to figure out whats happening.

  • Pradeep Itnal Profile Picture
    3,248 on at

    You can try using the below piece of code. Its available at  \Classes\PriceDisc_Price\findPriceAgreement . 

    Customize it as per your requirement. However 7th parameter needs customer account. So if u want to consider trade agreements etc, AFAIK, u can use below mentioned piece of code. Then store the itemid, price in a tempTable and show it in SSRS report. 

    PriceDisc::findItemPriceAgreement (this.parmModuleType(),

                                                                                                       this.parmItemId(), 

                                                                                                       this.parmInventDim(),

                                                                                                       this.parmUnitID(),

                                                                                                       this.parmPriceDate(),

                                                                                                       this.parmQty(),

                                                                                                       this.parmAccountNum(),

                                                                                                       this.parmCurrencyCode(),

                                                                                                       this.parmPriceGroupId());

  • venkatesh vadlamani Profile Picture
    3,180 on at

    there is  a basic assumption in your report requirement.

    Sales Price if different for different users and quantities at different dimensions.

    In such a setup the report is a mess

    You need list of items reports with sales price

    You need to assume that standard sales price mentioned inventTableModule  for this or

    Assume that salesprice is

    For all customers  irrespective of the dimensions and qty purchased the price of item

    Account code  = all

    Price Type  = Price(Sales)

    InventDimID = AllBlank

    Qty from = 0

    qtyTo  = unmentioned

    regads

    VEnkatesh

  • Community Member Profile Picture
    on at

    I was looking for simmilar solution,thanx

  • Pradeep Itnal Profile Picture
    3,248 on at

    How did you manage to do it?

  • Suggested answer
    Pradeep Itnal Profile Picture
    3,248 on at

    This could be one solution.

    static void NetAmountwithdiscounts(Args _args)

    {

       PriceDisc_Price             priceDisc_Price    = PriceDisc_Price::construct();

       PriceDisc_LineDisc          priceDisc_LineDisc = PriceDisc_LineDisc::construct();

       InventDim                   inventDim;

       AmountCur                   LineAmount;

       priceDisc_Price.parmModuleType( ModuleInventPurchSales::Sales);

       priceDisc_Price.parmItemId("iphone7");

       priceDisc_Price.parmInventDim(InventDim);

       priceDisc_Price.parmUnitID("ea");

       priceDisc_Price.parmPriceDate(systemDateGet());

       priceDisc_Price.parmQty(1);

       priceDisc_Price.parmAccountNum("");

       priceDisc_Price.parmCurrencyCode("USD");

       priceDisc_Price.parmPriceGroupId("");

       print priceDisc_Price.price();

       print priceDisc_Price.priceUnit();

       pause;

       priceDisc_LineDisc.parmModuleType( ModuleInventPurchSales::Sales);

       priceDisc_LineDisc.parmItemId("iphone7");

       priceDisc_LineDisc.parmInventDim(inventDim);

       priceDisc_LineDisc.parmUnitID("ea");

       priceDisc_LineDisc.parmDiscDate(systemDateGet());

       priceDisc_LineDisc.parmQty(1);

       priceDisc_LineDisc.parmAccountNum("");

       priceDisc_LineDisc.parmCurrencyCode("USD");

       priceDisc_LineDisc.parmAccountLineDiscCode();

       priceDisc_LineDisc.parmItemLineDiscCode(InventTableModule::find("iphone7", ModuleInventPurchSales::Sales).LineDisc);

     //  priceDisc_LineDisc.parmSalesPurchLine(_salesPurchLine);

       priceDisc_LineDisc.findLineDiscAgreement();

       print priceDisc_LineDisc.discAmount();   //linedisc

       print priceDisc_LineDisc.discPct(); //LinePercent

       pause;

       LineAmount = PriceDisc::price2Amount(priceDisc_Price.price(),

                                                priceDisc_Price.priceUnit(), //1

                                                PriceDisc::discAmount(SalesParameters::find().Disc, priceDisc_LineDisc.discAmount(), 0),//should call this,

                                                1,                   // deliver now

                                                1,

                                                0,

                                                PriceDisc::discPercent(SalesParameters::find().Disc, priceDisc_LineDisc.discPct(), 0),

                                                "USD",

                                                 0,

                                               true);  

       print LineAmount;

       pause;

    }

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