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

How to add a new discount method to Price Adjustment under Retail

(0) ShareShare
ReportReport
Posted on by 1,453

I have to add a new price adjustment discount method. Standard AX only allow for a discount percentage or discount amount under Retail -> Common -> Pricing and Discounts -> Price Adjustments to reduce the base price. Our sales reps want to mark up the base price.

I have added a new field called MarkupPercentageValue to the RetailPeriodicDiscount table. I have also added 2 fields, one for the amount and one for the percentage in the table RetailDiscountLineOffer.

The discountMethod gets its values from BASE ENUM  RetailDiscountOfferLineDiscMethodBase. The standard values are: PercentOff, AmountOff, Price ad PriceInclTax. I have added to it MarkupPercentage and MarkupAmount.

Now the setup is in place and the end-user can select a discountmethod to mark up the base price with either an amount or a percentage.

My problem is to add this calculation to the sales order price calculations. I have searched where the periodic discount tables were used and found them in classes RetailPricingDataManager and RetailPricingDataManagersimulator and in RetailCreateLinesFromProductsToAdd. I have modified these to include the 2 new fields on RetaildiscountLineOffer. However they are just populating containers.

It looks like the actual pricing calculations happens in a CRT engine. I came across a link that pointed me to Class RetailSalesOrderCalculator. However this class still only get and set values. Where can I find the calculations for the standard price adjustment discount method PercentOff and AmountOff so that I can add my logic to it?

*This post is locked for comments

I have the same question (0)
  • Vishal Dynamics Profile Picture
    255 on at
    RE: How to add a new discount method to Price Adjustment under Retail

    Hi R-AX,

    I have similar kind of requirement in D365 FinOps. Can you please advise if you were able to solution this problem.

    Thanks,

    Vishal Kohli

  • Retha Profile Picture
    1,453 on at
    RE: How to add a new discount method to Price Adjustment under Retail

    What I can figure out this far is that the method RetailSalesOrderCalculator uses methods in RetailPricingDataManager class for the pricing adjustments: findPriceAdjustments, getPriceAdjustmentsForItems and then it builds a container with method: buildRetailDiscountContainer.

    I have added my 2 new fields everywhere discPct is referenced. I also modified RetailDiscountLineOffer.applydiscount()  to include the calculations needed for the new discount methods I added.

    ****

    if (discountOffer)

       {

           switch (this.DiscountMethod)

           {

               case RetailDiscountOfferLineDiscMethodBase::AmountOff:              return decRound(_price - this.DiscAmount,2);

               case RetailDiscountOfferLineDiscMethodBase::PercentOff:             return decRound(_price - (_price * this.DiscPct /100),2);

               // <Begin Custom - add the logic for the markup>

               case RetailDiscountOfferLineDiscMethodBase::TMC_MarkupAmount:       return decRound(_price + this.MarkupAmount,2);

               case RetailDiscountOfferLineDiscMethodBase::TMC_MarkupPercentage:   return decRound(_price + (_price * this.MarkupPerc /100),2);

               // </End custom>

               case RetailDiscountOfferLineDiscMethodBase::Price:                  return decRound(this.OfferPrice,2);

               case RetailDiscountOfferLineDiscMethodBase::PriceInclTax:           return decRound(this.OfferPriceInclTax,2);

           }

       }

    ****

    I did do an incremental CIL compile.

    I stepped through the code and the PriceAdjustment container does pick up the new discountMethod with its value.

    Now here is where I am stuck.  

    It makes use of the RetailPricingEngineHelper. This seems to use a DLL: Microsoft.Dynamics.Commerce.Runtime.Services.PricingEngine.dll

    How can I view the code that makes up this DLL to see if I need to change something in here?

    I REALLY REALLY would prefer not to touch the DLL. Has anybody ever had to modify price adjustments and can tell me what I need to change for it to pick up RetailDiscountLineOffer.applydiscount() method?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans