Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to get the item price list display the unit price based on the customer discount group?

(1) ShareShare
ReportReport
Posted on by 73
I'm trying to customize the /./Pricing/ItemPriceList.rdlc/ report so that it displays the /unit price/ AND the /unit price discounted/ column that would represent the /unit price/ minus the discount given by the /Customer Discount Group/ value.
Here are my options:
 
If my item with a unit price of 100 belongs to the Item Disc. Group: /DISCOUNT4/, I would like to display in my /unit price discounted/ column the value 68 (=100-32%).
Any help would be greatly appreciated.
 
  • Verified answer
    LLEV Profile Picture
    73 on at
    How to get the item price list display the unit price based on the customer discount group?
    I actually was able to make this work by creating a record of a "Price List Line" and creating a new column based on it.
    Here is my code:
    reportextension 50107 ReportItemListExtension extends "Item Price List"
    {
        RDLCLayout = 'StandardItemPriceList-extended.rdlc';
    
        dataset
        {
            add(Item)
            {
                column(SearchDesc_Lbl; SearchDesc_Lbl) { }
                column(Search_Description; "Search Description") { }
                column(Description2_Item; "Description 2") { }
                column(IdentifierCode_Item; "Identifier Code") { }
                column(ItemCategoryCode_Lbl; ItemCategoryCode_Lbl) { }
                column(ItemCategoryCode_Item; "Item Category Code") { }
                column(ItemDiscGroup_Item; "Item Disc. Group") { }
                column(PriceIncludesVAT_Item; "Price Includes VAT") { }
                column(StandardCost_Item; "Standard Cost") { }
                column(UnitListPrice_Item; "Unit List Price") { }
                column(DecGPrixUnitaireNet_Lbl; DecGPrixUnitaireNet_Lbl) { }
                column(DecGPrixUnitaireNetHT_Item; DecGPrixUnitaireNetHT) { }
                column(DecGPrixUnitaireNetHT_Txt_Item; DecGPrixUnitaireNetHT_Txt) { }
            }
            modify(Item)
            {
                trigger OnAfterAfterGetRecord()
                begin
                    if not ItemRec.get(Item."No.") then
                        Clear(ItemRec);
    
                    // Calculate the PU with discount
                    if (ItemRec."Unit Price" > 0) then begin
                        Clear(PriceListLineRec);
                        if (PriceSource."Source No." <> '') then begin
                            PriceListLineRec.SetFilter("Source No.", PriceSource."Source No.");
                        end;
                        if (ItemRec."Item Disc. Group" <> '') then begin
                            PriceListLineRec.SetFilter("Asset No.", ItemRec."Item Disc. Group");
                        end;
                        if (PriceListLineRec.FindSet() and (PriceListLineRec."Line Discount %" <> 0)) then begin
                            DecGPrixUnitaireNetHT := Round(ItemRec."Unit Price" * (100 - PriceListLineRec."Line Discount %") / 100, 0.01);
                        end
                        else
                            DecGPrixUnitaireNetHT := Round(ItemRec."Unit Price", 0.01);
                    end
                    else
                        DecGPrixUnitaireNetHT := 0.00;
                    DecGPrixUnitaireNetHT_Txt := Format(DecGPrixUnitaireNetHT, 0, '<Precision,2:3><Standard Format,0>');
                end;
            }
        }
    
        trigger OnPreReport()
        var
        begin
            IntGBlocCounter := 0;
        end;
    
        var
            IntGBlocCounter : Integer;
            ItemCategoryCode_Lbl: Label 'Category', Comment = 'Foo', MaxLength = 999, Locked = false;
            SearchDesc_Lbl: Label 'Search Description', Comment = 'Foo', MaxLength = 999, Locked = false;
            DecGPrixUnitaireNet_Lbl: Label 'Discounted Unit Price', Comment = 'Foo', MaxLength = 999, Locked = false;
            DecGPrixUnitaireNetHT: Decimal;
            DecGPrixUnitaireNetHT_Txt: Text[30];
            ItemRec: Record "Item";
            PriceListLineRec: Record "Price List Line";
    }
     
     
     
     

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,027 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans