Page 7019 Sales Job Price Lists

App
Base Application
Namespace
Microsoft.Sales.Pricing
Versions
17-28
Source table
7000

Procedures, 2Events, 1

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Sales/Pricing/SalesJobPriceLists.Page.al183 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Sales.Pricing;

using Microsoft.Pricing.Calculation;
using Microsoft.Pricing.PriceList;
using Microsoft.Pricing.Source;

/// <summary>
/// Displays sales price lists for projects, enabling project-specific pricing management.
/// </summary>
page 7019 "Sales Job Price Lists"
{
    Caption = 'Sales Project Price Lists';
    CardPageID = "Sales Price List";
    Editable = false;
    PageType = List;
    QueryCategory = 'Sales Job Price Lists';
    RefreshOnActivate = true;
    SourceTable = "Price List Header";
    SourceTableView = where("Source Group" = const(Job), "Price Type" = const(Sale));
    ApplicationArea = Jobs;
    UsageCategory = Lists;

    layout
    {
        area(content)
        {
            repeater(Control1)
            {
                ShowCaption = false;
                field(Code; Rec.Code)
                {
                    ApplicationArea = Jobs;
                    Caption = 'Code';
                    ToolTip = 'Specifies the unique identifier of the price list.';
                }
                field(Description; Rec.Description)
                {
                    ApplicationArea = Jobs;
                    Caption = 'Description';
                    ToolTip = 'Specifies the description of the price list.';
                }
                field(Status; Rec.Status)
                {
                    ApplicationArea = Jobs;
                    Caption = 'Status';
                    ToolTip = 'Specifies whether the price list is in Draft status and can be edited, Inactive and cannot be edited or used, or Active and can be edited (when Allow Editing Active Price is enabled) and used for price calculations.';
                }
                field("Allow Updating Defaults"; Rec."Allow Updating Defaults")
                {
                    ApplicationArea = Jobs;
                    ToolTip = 'Specifies whether users can change the values in the fields on the price list lines that contain default values from the header. This does not affect the ability to allow line or invoice discounts.';
                }
                field(Defines; Rec."Amount Type")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Defines';
                    ToolTip = 'Specifies whether the price list defines prices, discounts, or both.';
                }
                field("Currency Code"; CurrRec."Currency Code")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Currency';
                    ToolTip = 'Specifies the currency that is used on the price list.';
                }
                field(SourceGroup; Rec."Source Group")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Assign-to Group';
                    Visible = false;
                    ToolTip = 'Specifies whether the prices come from groups of customers, vendors or projects.';
                }
                field(SourceType; CurrRec."Source Type")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Assign-to Type';
                    ToolTip = 'Specifies the type of entity to which the price list is assigned. The options are relevant to the entity you are currently viewing.';
                }
                field(SourceNo; CurrRec."Source No.")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Assign-to';
                    ToolTip = 'Specifies the entity to which the prices are assigned. The options depend on the selection in the Assign-to Type field. If you choose an entity, the price list will be used only for that entity.';
                }
                field(ParentSourceNo; CurrRec."Parent Source No.")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Assign-to Project No.';
                    ToolTip = 'Specifies the project to which the prices are assigned. If you choose an entity, the price list will be used only for that entity.';
                }
                field("Starting Date"; CurrRec."Starting Date")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Starting Date';
                    ToolTip = 'Specifies the date from which the price is valid.';
                }
                field("Ending Date"; CurrRec."Ending Date")
                {
                    ApplicationArea = Jobs;
                    Caption = 'Ending Date';
                    ToolTip = 'Specifies the date when the sales price agreement ends.';
                }
            }
        }
        area(factboxes)
        {
            systempart(Control1900383207; Links)
            {
                ApplicationArea = RecordLinks;
                Visible = false;
            }
            systempart(Control1905767507; Notes)
            {
                ApplicationArea = Notes;
                Visible = false;
            }
        }
    }
    actions
    {
        area(Promoted)
        {
            group(Category_Report)
            {
                Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
            }
        }
    }
    trigger OnInit()
    var
        FeaturePriceCalculation: Codeunit "Feature - Price Calculation";
    begin
        OnBeforeOnInit();
        FeaturePriceCalculation.FailIfFeatureDisabled();
    end;

    trigger OnAfterGetRecord()
    begin
        CurrRec := Rec;
    end;

    trigger OnAfterGetCurrRecord()
    begin
        CurrRec := Rec;
    end;

    var
        CurrRec: Record "Price List Header";

    /// <summary>
    /// Sets the record filter to show job-related sales price lists.
    /// </summary>
    /// <param name="PriceListHeader">The price list header record with filters to apply.</param>
    procedure SetRecordFilter(var PriceListHeader: Record "Price List Header")
    begin
        Rec.FilterGroup := 2;
        Rec.CopyFilters(PriceListHeader);
        Rec.SetRange("Source Group", Rec."Source Group"::Job);
        Rec.SetRange("Price Type", Rec."Price Type"::Sale);
        Rec.FilterGroup := 0;
    end;

    /// <summary>
    /// Sets the source filter for the price list based on the provided price source list.
    /// </summary>
    /// <param name="PriceSourceList">The price source list to use for filtering.</param>
    /// <param name="AmountType">The amount type (Price, Discount, or both) to filter by.</param>
    procedure SetSource(PriceSourceList: Codeunit "Price Source List"; AmountType: Enum "Price Amount Type")
    var
        PriceUXManagement: Codeunit "Price UX Management";
    begin
        PriceUXManagement.SetPriceListsFilters(Rec, PriceSourceList, AmountType);
    end;

    [IntegrationEvent(false, false)]
    local procedure OnBeforeOnInit()
    begin
    end;
}