Page 396 Sales Shipment Statistics

Base Application, Microsoft.Sales.History

src/Layers/W1/BaseApp/Sales/History/SalesShipmentStatistics.Page.al128 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.History;/// <summary>/// Displays statistical information for a posted sales shipment including line counts, quantities, and weights./// </summary>page 396 "Sales Shipment Statistics"{    Caption = 'Sales Shipment Statistics';    Editable = false;    LinksAllowed = false;    PageType = Card;    SourceTable = "Sales Shipment Header";    layout    {        area(content)        {            group(General)            {                Caption = 'General';                field(LineQty; LineQty)                {                    AutoFormatType = 0;                    ApplicationArea = Basic, Suite;                    Caption = 'Quantity';                    DecimalPlaces = 0 : 5;                    ToolTip = 'Specifies the total quantity of G/L account entries, items and/or resources in the sales document that were shipped.';                }                field(TotalParcels; TotalParcels)                {                    AutoFormatType = 0;                    ApplicationArea = Basic, Suite;                    Caption = 'Parcels';                    DecimalPlaces = 0 : 5;                    ToolTip = 'Specifies the total number of parcels shipped from the sales document.';                }                field(TotalNetWeight; TotalNetWeight)                {                    AutoFormatType = 0;                    ApplicationArea = Basic, Suite;                    Caption = 'Net Weight';                    DecimalPlaces = 0 : 5;                    ToolTip = 'Specifies the total net weight of the items shipped from the sales document.';                }                field(TotalGrossWeight; TotalGrossWeight)                {                    AutoFormatType = 0;                    ApplicationArea = Basic, Suite;                    Caption = 'Gross Weight';                    DecimalPlaces = 0 : 5;                    ToolTip = 'Specifies the total gross weight of the items shipped from the sales document.';                }                field(TotalVolume; TotalVolume)                {                    AutoFormatType = 0;                    ApplicationArea = Basic, Suite;                    Caption = 'Volume';                    DecimalPlaces = 0 : 5;                    ToolTip = 'Specifies the total volume of the items shipped from the sales document.';                }            }        }    }    actions    {    }    trigger OnAfterGetRecord()    begin        ClearAll();        CalculateTotals();    end;    var        LineQty: Decimal;        TotalNetWeight: Decimal;        TotalGrossWeight: Decimal;        TotalVolume: Decimal;        TotalParcels: Decimal;    local procedure CalculateTotals()    var        SalesShptLine: Record "Sales Shipment Line";        IsHandled: Boolean;    begin        IsHandled := false;        OnBeforeCalculateTotals(Rec, LineQty, TotalNetWeight, TotalGrossWeight, TotalVolume, TotalParcels, IsHandled);        if IsHandled then            exit;        SalesShptLine.SetRange("Document No.", Rec."No.");        OnCalculateTotalsOnAfterSalesShptLineSetFilters(SalesShptLine, Rec);        if SalesShptLine.Find('-') then            repeat                LineQty += SalesShptLine.Quantity;                TotalNetWeight += SalesShptLine.Quantity * SalesShptLine."Net Weight";                TotalGrossWeight += SalesShptLine.Quantity * SalesShptLine."Gross Weight";                TotalVolume += SalesShptLine.Quantity * SalesShptLine."Unit Volume";                if SalesShptLine."Units per Parcel" > 0 then                    TotalParcels += Round(SalesShptLine.Quantity / SalesShptLine."Units per Parcel", 1, '>');                OnCalculateTotalsOnAfterAddLineTotals(                    SalesShptLine, LineQty, TotalNetWeight, TotalGrossWeight, TotalVolume, TotalParcels, Rec)            until SalesShptLine.Next() = 0;    end;    [IntegrationEvent(false, false)]    local procedure OnBeforeCalculateTotals(SalesShipmentHeader: Record "Sales Shipment Header"; var LineQty: Decimal; var TotalNetWeight: Decimal; var TotalGrossWeight: Decimal; var TotalVolume: Decimal; var TotalParcels: Decimal; var IsHandled: Boolean)    begin    end;    [IntegrationEvent(false, false)]    local procedure OnCalculateTotalsOnAfterSalesShptLineSetFilters(var SalesShipmentLine: Record "Sales Shipment Line"; SalesShipmentHeader: Record "Sales Shipment Header")    begin    end;    [IntegrationEvent(false, false)]    local procedure OnCalculateTotalsOnAfterAddLineTotals(var SalesShipmentLine: Record "Sales Shipment Line"; var LineQty: Decimal; var TotalNetWeight: Decimal; var TotalGrossWeight: Decimal; var TotalVolume: Decimal; var TotalParcels: Decimal; SalesShipmentHeader: Record "Sales Shipment Header")    begin    end;}