Table 6226 Emission Fee
src/Apps/W1/Sustainability/app/src/Emission/EmissionFee.Table.al111 lines, Copyright (c) Microsoft Corporation. MIT
namespace Microsoft.Sustainability.Emission;using Microsoft.Foundation.Address;using Microsoft.Inventory.Location;using Microsoft.Sustainability.Account;table 6226 "Emission Fee"{ Caption = 'Emission Fee'; DataClassification = CustomerContent; LookupPageId = "Emission Fees"; DrillDownPageId = "Emission Fees"; fields { field(1; "Emission Type"; Enum "Emission Type") { DataClassification = CustomerContent; Caption = 'Emission Type'; trigger OnValidate() begin if Rec."Emission Type" = Rec."Emission Type"::CO2 then Rec.Validate("Carbon Equivalent Factor", 1); if Rec."Emission Type" <> Rec."Emission Type"::CO2 then Rec.TestField("Carbon Fee", 0); end; } field(3; "Carbon Fee"; Decimal) { AutoFormatType = 2; AutoFormatExpression = ''; DataClassification = CustomerContent; Caption = 'Carbon Fee'; DecimalPlaces = 2 : 5; BlankNumbers = BlankNeg; trigger OnValidate() begin if (Rec."Carbon Fee" <> 0) then Rec.TestField("Emission Type", Rec."Emission Type"::CO2); end; } field(4; "Carbon Equivalent Factor"; Decimal) { AutoFormatType = 0; DataClassification = CustomerContent; Caption = 'Carbon Equivalent Factor'; DecimalPlaces = 2 : 5; } field(5; "Starting Date"; Date) { DataClassification = CustomerContent; Caption = 'Starting Date'; trigger OnValidate() begin if (Rec."Starting Date" > Rec."Ending Date") and (Rec."Ending Date" <> 0D) then Error(InvalidStartDateErr, Rec.FieldCaption("Starting Date"), Rec.FieldCaption("Ending Date")); end; } field(6; "Ending Date"; Date) { DataClassification = CustomerContent; Caption = 'Ending Date'; trigger OnValidate() begin if CurrFieldNo = 0 then exit; Rec.Validate("Starting Date"); end; } field(7; "Scope Type"; Enum "Emission Scope") { DataClassification = CustomerContent; Caption = 'Scope Type'; trigger OnValidate() begin if Rec."Scope Type" = Rec."Scope Type"::"Water/Waste" then Error(ScopeTypeIsNotSupportedErr, Rec."Scope Type", Rec.TableCaption()); end; } field(8; "Responsibility Center"; Code[10]) { DataClassification = CustomerContent; Caption = 'Responsibility Center'; TableRelation = "Responsibility Center".Code; } field(35; "Country/Region Code"; Code[10]) { Caption = 'Country/Region Code'; TableRelation = "Country/Region"; } } keys { key(Key1; "Emission Type", "Scope Type", "Starting Date", "Ending Date", "Country/Region Code", "Responsibility Center") { Clustered = true; } } var InvalidStartDateErr: Label '%1 cannot be after %2', Comment = '%1 - Starting Date,%2 - Ending Date'; ScopeTypeIsNotSupportedErr: Label 'Scope Type %1 is not supported in %2.', Comment = '%1 = Scope Type , %2 = Table Caption';}