Table 30141 Shpfy Return Line

Shopify Connector, Microsoft.Integration.Shopify

src/Apps/W1/Shopify/App/src/Order Returns/Tables/ShpfyReturnLine.Table.al255 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.Integration.Shopify;using System.Reflection;table 30141 "Shpfy Return Line"{    Caption = 'Return Line';    DataClassification = SystemMetadata;    fields    {        field(1; "Return Line Id"; BigInteger)        {            Caption = 'Return Line Id';            DataClassification = SystemMetadata;            Editable = false;        }        field(2; "Return Id"; BigInteger)        {            Caption = 'Return Id';            DataClassification = SystemMetadata;            TableRelation = "Shpfy Return Header"."Return Id";            Editable = false;        }        field(3; "Fulfillment Line Id"; BigInteger)        {            Caption = 'Fulfillment Line Id';            DataClassification = SystemMetadata;            TableRelation = "Shpfy Fulfillment Line"."Fulfillment Line Id";            Editable = false;        }        field(4; "Order Line Id"; BigInteger)        {            Caption = 'Order Line Id';            DataClassification = SystemMetadata;            TableRelation = "Shpfy Order Line"."Line Id";            Editable = false;        }        field(5; Quantity; Integer)        {            Caption = 'Quantity';            DataClassification = SystemMetadata;            Editable = false;        }        field(6; "Return Reason"; Enum "Shpfy Return Reason")        {            Caption = 'Return Reason (deprecated)';            DataClassification = SystemMetadata;            Editable = false;        }        field(7; "Return Reason Note"; Blob)        {            Caption = 'Return Reason Note';            DataClassification = SystemMetadata;        }        field(8; "Refundable Quantity"; Integer)        {            Caption = 'Refundable Quantity';            DataClassification = SystemMetadata;            Editable = false;        }        field(9; "Refunded Quantity"; Integer)        {            Caption = 'Refunded Quantity';            DataClassification = SystemMetadata;            Editable = false;        }        field(10; "Weight Unit"; Code[20])        {            Caption = 'Weight Unit';            DataClassification = SystemMetadata;            Editable = false;        }        field(11; Weight; Decimal)        {            Caption = 'Weight';            DataClassification = SystemMetadata;            Editable = false;            AutoFormatType = 0;        }        field(12; "Discounted Total Amount"; Decimal)        {            Caption = 'Discounted Total Amount';            DataClassification = SystemMetadata;            Editable = false;            AutoFormatType = 1;            AutoFormatExpression = OrderCurrencyCode();        }        field(13; "Presentment Disc. Total Amt."; Decimal)        {            Caption = 'Presentment Discounted Total Amount';            ToolTip = 'Specifies the total line price in the presentment currency after all discounts on the line item, including both line item level discounts and code-based line item discounts, are applied.';            DataClassification = SystemMetadata;            Editable = false;            AutoFormatType = 1;            AutoFormatExpression = OrderPresentmentCurrencyCode();        }        field(14; "Customer Note"; Blob)        {            Caption = 'Customer Note';            DataClassification = SystemMetadata;        }        field(15; Type; Enum "Shpfy Return Line Type")        {            Caption = 'Type';            DataClassification = SystemMetadata;            Editable = false;        }        field(16; "Unit Price"; Decimal)        {            Caption = 'Unit Price';            DataClassification = SystemMetadata;            Editable = false;            AutoFormatType = 1;            AutoFormatExpression = "Unit Price Currency";        }        field(17; "Unit Price Currency"; Code[10])        {            Caption = 'Unit Price Currency';            DataClassification = SystemMetadata;            Editable = false;        }        field(18; "Return Reason Name"; Text[100])        {            Caption = 'Return Reason';            DataClassification = SystemMetadata;            Editable = false;        }        field(19; "Return Reason Handle"; Text[100])        {            Caption = 'Return Reason Handle';            DataClassification = SystemMetadata;            Editable = false;        }        field(101; "Item No."; Code[20])        {            Caption = 'Item No.';            FieldClass = FlowField;            CalcFormula = lookup("Shpfy Order Line"."Item No." where("Line Id" = field("Order Line Id")));        }        field(102; Description; Text[100])        {            Caption = 'Description';            FieldClass = FlowField;            CalcFormula = lookup("Shpfy Order Line".Description where("Line Id" = field("Order Line Id")));        }        field(103; "Variant Code"; Code[10])        {            Caption = 'Variant Code';            FieldClass = FlowField;            CalcFormula = lookup("Shpfy Order Line"."Variant Code" where("Line Id" = field("Order Line Id")));        }        field(104; "Location Id"; BigInteger)        {            Caption = 'Location Id';            DataClassification = SystemMetadata;            Editable = false;        }        field(105; "Unit of Measure Code"; Code[10])        {            Caption = 'Unit of Measure Code';            FieldClass = FlowField;            CalcFormula = lookup("Shpfy Order Line"."Unit of Measure Code" where("Line Id" = field("Order Line Id")));            Editable = false;        }    }    keys    {        key(PK; "Return Line Id")        {            Clustered = true;        }        key(Idx01; "Return Id", "Discounted Total Amount", "Presentment Disc. Total Amt.")        {            MaintainSiftIndex = true;            SumIndexFields = "Discounted Total Amount", "Presentment Disc. Total Amt.";        }    }    trigger OnDelete()    var        DataCapture: Record "Shpfy Data Capture";    begin        DataCapture.SetCurrentKey("Linked To Table", "Linked To Id");        DataCapture.SetRange("Linked To Table", Database::"Shpfy Return Line");        DataCapture.SetRange("Linked To Id", Rec.SystemId);        if not DataCapture.IsEmpty then            DataCapture.DeleteAll(false);    end;    internal procedure GetReturnReasonNote(): Text    var        TypeHelper: Codeunit "Type Helper";        InStream: InStream;    begin        CalcFields("Return Reason Note");        "Return Reason Note".CreateInStream(InStream, TextEncoding::UTF8);        exit(TypeHelper.ReadAsTextWithSeparator(InStream, TypeHelper.LFSeparator()));    end;    internal procedure SetReturnReasonNote(NewReturnReasonNote: Text)    var        OutStream: OutStream;    begin        Clear("Return Reason Note");        "Return Reason Note".CreateOutStream(OutStream, TextEncoding::UTF8);        OutStream.WriteText(NewReturnReasonNote);        Modify();    end;    internal procedure GetCustomerNote(): Text    var        TypeHelper: Codeunit "Type Helper";        InStream: InStream;    begin        CalcFields("Customer Note");        "Customer Note".CreateInStream(InStream, TextEncoding::UTF8);        exit(TypeHelper.ReadAsTextWithSeparator(InStream, TypeHelper.LFSeparator()));    end;    internal procedure SetCustomerNote(NewCustomerNote: Text)    var        OutStream: OutStream;    begin        Clear("Customer Note");        "Customer Note".CreateOutStream(OutStream, TextEncoding::UTF8);        OutStream.WriteText(NewCustomerNote);        Modify();    end;    local procedure OrderCurrencyCode(): Code[10]    var        OrderHeader: Record "Shpfy Order Header";        OrderLine: Record "Shpfy Order Line";    begin        if OrderLine.Get("Order Line Id") then            if OrderHeader.Get(OrderLine."Shopify Order Id") then                exit(OrderHeader."Currency Code");    end;    local procedure OrderPresentmentCurrencyCode(): Code[10]    var        OrderHeader: Record "Shpfy Order Header";        OrderLine: Record "Shpfy Order Line";    begin        if OrderLine.Get("Order Line Id") then            if OrderHeader.Get(OrderLine."Shopify Order Id") then                exit(OrderHeader."Presentment Currency Code");    end;}