Ok, this time i want to talk about some “special” thing that almost all customer asks for in Business Central and I don’t understand why Microsoft doesn’t supply by standard, the Vendor, Item Price, leadtime comparison view.

In the Item Card we have the Item Vendor relation with a table of the vendors which can sell the item and the lead time.

Also, we have the Purchase Price table by Vendor/item with the required info about price and unit of measure.

So, why Microsoft doesn’t give a page, a simple pagepart with this information? IDK.

The first thing that comes to my mind is create a pagepart from item vendor information and merge that with the purchase price table linked with the Item No in the selected page, easy don’t you think?

But remember, sales price and purchase price with the related discount tables are marked for removal from the application this year.

So, let’s start with the app definition.

First, we need to define if we start with the Item Vendor table or the price table, let´s check the new table and definitions.

The new price functionality has 2 principal tables called Price List Header and Price List Line, also we have in the Purchase and Payables setup new fields

  • "Price Calculation Method" related with Enum "Price Calculation Method"
  • "Price List Nos."
  • "Allow Editing Active Price"
  • "Default Price List Code"

So, is important to know which is the active price list.

The new purchase price list has the next presentation

If you can see, we can define a vendor, campaign, or even contact (applies to type field). The important thing here is the lines and the fields

  • Applies-to Type
  • Applies-to No.
  • Currency Code
  • Starting Date
  • Ending Date
  • Product Type
  • Product No.
  • Description
  • Variant Code
  • Work Type Code
  • Unit of Measure Code
  • Minimum Quantity
  • Defines
  • Direct Unit Cost
  • Allow Line Disc.
  • Line Discount %
  • Allow Invoice Disc.

Meanwhile, the item vendor table has only:

  • Item No.
  • Vendor No.
  • Lead Time Calculation
  • Vendor Item No.
  • Variant Code

So, I decided to start with the price list lines.

First we need to create a new pagepart based on the Price List Line adding some fields and 2 triggers

/// 

/// Page ItemVendorComp (ID XXXXX).

/// 

page XXXXX ItemVendorComp

{

    

    Caption = 'ItemVendorComp';

    PageType = ListPart;

    SourceTable = "Price List Line";

    

    layout

    {

        area(content)

        {

            repeater(General)

            {

                field("Source No."; Rec."Source No.")

                {

                    ToolTip = 'Specifies the value of the Applies-to No. field';

                    ApplicationArea = All;

                }

                field("Asset No."; Rec."Asset No.")

                {

                    ToolTip = 'Specifies the value of the Product No. field';

                    ApplicationArea = All;

                }

                field("Unit of Measure Code"; Rec."Unit of Measure Code")

                {

                    ToolTip = 'Specifies the value of the Unit of Measure Code field';

                    ApplicationArea = All;

                }

                field("Direct Unit Cost"; Rec."Direct Unit Cost")

                {

                    ToolTip = 'Specifies the value of the Direct Unit Cost field';

                    ApplicationArea = All;

                }

                field(LeadTimCalc;LeadTimCalc)

                {

                    ApplicationArea = All;

                }

            }

        }

    }

    var

        ItmVendor: Record "Item Vendor";

        PurchPay: Record "Purchases & Payables Setup";

        LeadTimCalc: DateFormula;

        ActiveList: Code[10];

 

    trigger OnOpenPage()

    begin

        PurchPay.Get();

        ActiveList := PurchPay."Default Price List Code";

        Rec.SetRange("Price List Code",ActiveList);

    end;

 

    trigger OnAfterGetRecord()

    begin

        ItmVendor.Reset();

        ItmVendor.SetRange("Item No.", Rec."Asset No.");

        ItmVendor.SetRange("Vendor No.", Rec."Source No.");

        ItmVendor.SetRange("Variant Code", Rec."Variant Code");

        if ItmVendor.FindSet() then

            LeadTimCalc := ItmVendor."Lead Time Calculation";

    end;

}

Then we can add the page part to other pages

Item List

/// 

/// PageExtension ItemVendorComparPart (ID XXXXX) extends Record Item List.

/// 

pageextension 67165 ItemVendorComparPart extends "Item List"

{

    layout

    {

        addfirst(factboxes)

        {

            part(IVC;ItemVendorComp)

            {

                Caption = 'Item Vendor Comparison';

                ApplicationArea = All;

                SubPageLink = "Asset No." = field("No.");

            }

        }

    }

}

 

Item Card

/// 

/// PageExtension ItemVendComparItemCard (ID XXXXX)extends Record Item Card.

/// 

pageextension XXXXX ItemVendComparItemCard extends "Item Card"

{

    layout

    {

        addfirst(factboxes)

        {

            part(IVC;ItemVendorComp)

            {

                Caption = 'Item Vendor Comparison';

                ApplicationArea = All;

                SubPageLink = "Asset No." = field("No.");

            }

        }

    }

}

 

Requisition Worksheet

/// 

/// PageExtension ItemVendComparReqWkst (ID XXXXX) extends Record Req. Worksheet.

/// 

pageextension XXXXX ItemVendComparReqWkst extends "Req. Worksheet"

{

    layout

    {

        addfirst(factboxes)

        {

            part(IVC;ItemVendorComp)

            {

                Caption = 'Item Vendor Comparison';

                ApplicationArea = All;

                SubPageLink = "Asset No." = field("No.");

            }

        }

    }

}

Finally we can check the results