Table 125 Purch. Cr. Memo Line, source in 29
Source29
src/Layers/W1/BaseApp/Purchases/History/PurchCrMemoLine.Table.al1114 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.Purchases.History;
using Microsoft.Finance.Currency;
using Microsoft.Finance.Deferral;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Setup;
using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.FixedAsset;
using Microsoft.FixedAssets.Insurance;
using Microsoft.FixedAssets.Maintenance;
using Microsoft.FixedAssets.Posting;
using Microsoft.Foundation.AuditCodes;
using Microsoft.Foundation.Enums;
using Microsoft.Foundation.UOM;
using Microsoft.Intercompany.Partner;
using Microsoft.Inventory.Intrastat;
using Microsoft.Inventory.Item;
using Microsoft.Inventory.Item.Catalog;
using Microsoft.Inventory.Ledger;
using Microsoft.Inventory.Location;
using Microsoft.Inventory.Tracking;
using Microsoft.Pricing.Calculation;
using Microsoft.Projects.Project.Job;
using Microsoft.Projects.Resources.Resource;
using Microsoft.Purchases.Comment;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.Vendor;
using Microsoft.Warehouse.Structure;
using System.Reflection;
using System.Security.User;
table 125 "Purch. Cr. Memo Line"
{
Caption = 'Purch. Cr. Memo Line';
DrillDownPageID = "Posted Purchase Cr. Memo Lines";
LookupPageID = "Posted Purchase Cr. Memo Lines";
DataClassification = CustomerContent;
fields
{
field(2; "Buy-from Vendor No."; Code[20])
{
Caption = 'Buy-from Vendor No.';
ToolTip = 'Specifies the name of the vendor who delivered the items.';
Editable = false;
TableRelation = Vendor;
}
field(3; "Document No."; Code[20])
{
Caption = 'Document No.';
ToolTip = 'Specifies the document number.';
TableRelation = "Purch. Cr. Memo Hdr.";
}
field(4; "Line No."; Integer)
{
Caption = 'Line No.';
}
field(5; Type; Enum "Purchase Line Type")
{
Caption = 'Type';
ToolTip = 'Specifies the line type.';
}
field(6; "No."; Code[20])
{
CaptionClass = GetCaptionClass(FieldNo("No."));
Caption = 'No.';
ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.';
TableRelation = if (Type = const("G/L Account")) "G/L Account"
else
if (Type = const(Item)) Item
else
if (Type = const("Fixed Asset")) "Fixed Asset"
else
if (Type = const("Charge (Item)")) "Item Charge"
else
if (Type = const(Resource)) Resource;
}
field(7; "Location Code"; Code[10])
{
Caption = 'Location Code';
ToolTip = 'Specifies the code for the location where the credit memo line is registered.';
TableRelation = Location where("Use As In-Transit" = const(false));
}
field(8; "Posting Group"; Code[20])
{
Caption = 'Posting Group';
Editable = false;
TableRelation = if (Type = const(Item)) "Inventory Posting Group"
else
if (Type = const("Fixed Asset")) "FA Posting Group";
}
field(10; "Expected Receipt Date"; Date)
{
Caption = 'Expected Receipt Date';
ToolTip = 'Specifies the date the items were received.';
}
field(11; Description; Text[100])
{
Caption = 'Description';
ToolTip = 'Specifies either the name of, or a description of, the item or general ledger account.';
}
field(12; "Description 2"; Text[50])
{
Caption = 'Description 2';
ToolTip = 'Specifies information in addition to the description.';
}
field(13; "Unit of Measure"; Text[50])
{
Caption = 'Unit of Measure';
ToolTip = 'Specifies the name of the item or resource''s unit of measure, such as piece or hour.';
}
field(15; Quantity; Decimal)
{
AutoFormatType = 0;
Caption = 'Quantity';
ToolTip = 'Specifies the number of units of the item specified on the credit memo line.';
DecimalPlaces = 0 : 5;
}
field(22; "Direct Unit Cost"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 2;
CaptionClass = GetCaptionClass(FieldNo("Direct Unit Cost"));
Caption = 'Direct Unit Cost';
ToolTip = 'Specifies the cost of one unit of the selected item or resource.';
}
field(23; "Unit Cost (LCY)"; Decimal)
{
AutoFormatType = 2;
AutoFormatExpression = '';
Caption = 'Unit Cost (LCY)';
}
field(25; "VAT %"; Decimal)
{
AutoFormatType = 0;
Caption = 'VAT %';
DecimalPlaces = 0 : 5;
Editable = false;
}
field(27; "Line Discount %"; Decimal)
{
AutoFormatType = 0;
Caption = 'Line Discount %';
ToolTip = 'Specifies the discount percentage that is granted for the item on the line.';
DecimalPlaces = 0 : 5;
MaxValue = 100;
MinValue = 0;
}
field(28; "Line Discount Amount"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'Line Discount Amount';
ToolTip = 'Specifies the discount amount that is granted for the item on the line.';
}
field(29; Amount; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'Amount';
ToolTip = 'Specifies the line''s net amount.';
}
field(30; "Amount Including VAT"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'Amount Including VAT';
ToolTip = 'Specifies the net amount, including VAT, for this line.';
}
field(31; "Unit Price (LCY)"; Decimal)
{
AutoFormatType = 2;
AutoFormatExpression = '';
Caption = 'Unit Price (LCY)';
}
field(32; "Allow Invoice Disc."; Boolean)
{
Caption = 'Allow Invoice Disc.';
ToolTip = 'Specifies if the invoice line is included when the invoice discount is calculated.';
InitValue = true;
}
field(34; "Gross Weight"; Decimal)
{
AutoFormatType = 0;
Caption = 'Gross Weight';
ToolTip = 'Specifies the gross weight of one unit of the item. In the purchase statistics window, the gross weight on the line is included in the total gross weight of all the lines for the particular purchase document.';
DecimalPlaces = 0 : 5;
}
field(35; "Net Weight"; Decimal)
{
AutoFormatType = 0;
Caption = 'Net Weight';
ToolTip = 'Specifies the net weight of one unit of the item. In the purchase statistics window, the net weight on the line is included in the total net weight of all the lines for the particular purchase document.';
DecimalPlaces = 0 : 5;
}
field(36; "Units per Parcel"; Decimal)
{
AutoFormatType = 0;
Caption = 'Units per Parcel';
ToolTip = 'Specifies the number of units per parcel of the item. In the purchase statistics window, the number of units per parcel on the line helps to determine the total number of units for all the lines for the particular purchase document.';
DecimalPlaces = 0 : 5;
}
field(37; "Unit Volume"; Decimal)
{
AutoFormatType = 0;
Caption = 'Unit Volume';
ToolTip = 'Specifies the volume of one unit of the item. In the purchase statistics window, the volume of one unit of the item on the line is included in the total volume of all the lines for the particular purchase document.';
DecimalPlaces = 0 : 5;
}
field(38; "Appl.-to Item Entry"; Integer)
{
AccessByPermission = TableData Item = R;
Caption = 'Appl.-to Item Entry';
ToolTip = 'Specifies the number of the item ledger entry that the document or journal line is applied to.';
}
field(40; "Shortcut Dimension 1 Code"; Code[20])
{
CaptionClass = '1,2,1';
Caption = 'Shortcut Dimension 1 Code';
ToolTip = 'Specifies the code for Shortcut Dimension 1, which is one of two global dimension codes that you set up in the General Ledger Setup window.';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(1));
}
field(41; "Shortcut Dimension 2 Code"; Code[20])
{
CaptionClass = '1,2,2';
Caption = 'Shortcut Dimension 2 Code';
ToolTip = 'Specifies the code for Shortcut Dimension 2, which is one of two global dimension codes that you set up in the General Ledger Setup window.';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(2));
}
field(45; "Job No."; Code[20])
{
Caption = 'Project No.';
ToolTip = 'Specifies the number of the related project.';
TableRelation = Job;
}
field(54; "Indirect Cost %"; Decimal)
{
AutoFormatType = 0;
Caption = 'Indirect Cost %';
ToolTip = 'Specifies the percentage of the item''s last purchase cost that includes indirect costs, such as freight that is associated with the purchase of the item.';
DecimalPlaces = 0 : 5;
MinValue = 0;
}
field(65; "Order No."; Code[20])
{
Caption = 'Order No.';
ToolTip = 'Specifies the order number this line is associated with.';
}
field(66; "Order Line No."; Integer)
{
Caption = 'Order Line No.';
}
field(68; "Pay-to Vendor No."; Code[20])
{
Caption = 'Pay-to Vendor No.';
Editable = false;
TableRelation = Vendor;
}
field(69; "Inv. Discount Amount"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'Inv. Discount Amount';
ToolTip = 'Specifies the total calculated invoice discount amount for the line.';
}
field(70; "Vendor Item No."; Text[50])
{
Caption = 'Vendor Item No.';
}
field(74; "Gen. Bus. Posting Group"; Code[20])
{
Caption = 'Gen. Bus. Posting Group';
ToolTip = 'Specifies the vendor''s or customer''s trade type to link transactions made for this business partner with the appropriate general ledger account according to the general posting setup.';
TableRelation = "Gen. Business Posting Group";
}
field(75; "Gen. Prod. Posting Group"; Code[20])
{
Caption = 'Gen. Prod. Posting Group';
ToolTip = 'Specifies the item''s product type to link transactions made for this item with the appropriate general ledger account according to the general posting setup.';
TableRelation = "Gen. Product Posting Group";
}
field(77; "VAT Calculation Type"; Enum "Tax Calculation Type")
{
Caption = 'VAT Calculation Type';
}
field(78; "Transaction Type"; Code[10])
{
Caption = 'Transaction Type';
TableRelation = "Transaction Type";
}
field(79; "Transport Method"; Code[10])
{
Caption = 'Transport Method';
TableRelation = "Transport Method";
}
field(80; "Attached to Line No."; Integer)
{
Caption = 'Attached to Line No.';
TableRelation = "Purch. Cr. Memo Line"."Line No." where("Document No." = field("Document No."));
}
field(81; "Entry Point"; Code[10])
{
Caption = 'Entry Point';
TableRelation = "Entry/Exit Point";
}
field(82; "Area"; Code[10])
{
Caption = 'Area';
TableRelation = Area;
}
field(83; "Transaction Specification"; Code[10])
{
Caption = 'Transaction Specification';
TableRelation = "Transaction Specification";
}
field(85; "Tax Area Code"; Code[20])
{
Caption = 'Tax Area Code';
TableRelation = "Tax Area";
}
field(86; "Tax Liable"; Boolean)
{
Caption = 'Tax Liable';
}
field(87; "Tax Group Code"; Code[20])
{
Caption = 'Tax Group Code';
TableRelation = "Tax Group";
}
field(88; "Use Tax"; Boolean)
{
Caption = 'Use Tax';
}
field(89; "VAT Bus. Posting Group"; Code[20])
{
Caption = 'VAT Bus. Posting Group';
ToolTip = 'Specifies the VAT specification of the involved customer or vendor to link transactions made for this record with the appropriate general ledger account according to the VAT posting setup.';
TableRelation = "VAT Business Posting Group";
}
field(90; "VAT Prod. Posting Group"; Code[20])
{
Caption = 'VAT Prod. Posting Group';
ToolTip = 'Specifies the VAT specification of the involved item or resource to link transactions made for this record with the appropriate general ledger account according to the VAT posting setup.';
TableRelation = "VAT Product Posting Group";
}
field(97; "Blanket Order No."; Code[20])
{
Caption = 'Blanket Order No.';
ToolTip = 'Specifies the number of the blanket order that the record originates from.';
TableRelation = "Purchase Header"."No." where("Document Type" = const("Blanket Order"));
}
field(98; "Blanket Order Line No."; Integer)
{
Caption = 'Blanket Order Line No.';
ToolTip = 'Specifies the number of the blanket order line that the record originates from.';
TableRelation = "Purchase Line"."Line No." where("Document Type" = const("Blanket Order"),
"Document No." = field("Blanket Order No."));
}
field(99; "VAT Base Amount"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'VAT Base Amount';
Editable = false;
}
field(100; "Unit Cost"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 2;
Caption = 'Unit Cost';
Editable = false;
}
field(101; "System-Created Entry"; Boolean)
{
Caption = 'System-Created Entry';
Editable = false;
}
field(103; "Line Amount"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
CaptionClass = GetCaptionClass(FieldNo("Line Amount"));
Caption = 'Line Amount';
ToolTip = 'Specifies the net amount, excluding any invoice discount amount, that must be paid for products on the line.';
}
field(104; "VAT Difference"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'VAT Difference';
}
field(106; "VAT Identifier"; Code[20])
{
Caption = 'VAT Identifier';
Editable = false;
}
field(107; "IC Partner Ref. Type"; Enum "IC Partner Reference Type")
{
Caption = 'IC Partner Ref. Type';
}
field(108; "IC Partner Reference"; Code[20])
{
Caption = 'IC Partner Reference';
}
field(123; "Prepayment Line"; Boolean)
{
Caption = 'Prepayment Line';
Editable = false;
}
field(130; "IC Partner Code"; Code[20])
{
Caption = 'IC Partner Code';
ToolTip = 'Specifies the code of the intercompany partner that the transaction is related to if the entry was created from an intercompany transaction.';
TableRelation = "IC Partner";
}
field(131; "Posting Date"; Date)
{
Caption = 'Posting Date';
}
field(138; "IC Item Reference No."; Code[50])
{
AccessByPermission = TableData "Item Reference" = R;
Caption = 'IC Item Reference No.';
}
field(145; "Pmt. Discount Amount"; Decimal)
{
AutoFormatExpression = GetCurrencyCode();
AutoFormatType = 1;
Caption = 'Pmt. Discount Amount';
}
field(480; "Dimension Set ID"; Integer)
{
Caption = 'Dimension Set ID';
Editable = false;
TableRelation = "Dimension Set Entry";
trigger OnLookup()
begin
Rec.ShowDimensions();
end;
}
field(1001; "Job Task No."; Code[20])
{
Caption = 'Project Task No.';
ToolTip = 'Specifies the number of the related project task.';
TableRelation = "Job Task"."Job Task No." where("Job No." = field("Job No."));
}
field(1002; "Job Line Type"; Enum "Job Line Type")
{
Caption = 'Project Line Type';
}
field(1003; "Job Unit Price"; Decimal)
{
AutoFormatType = 2;
AutoFormatExpression = "Job Currency Code";
BlankZero = true;
Caption = 'Project Unit Price';
}
field(1004; "Job Total Price"; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = "Job Currency Code";
BlankZero = true;
Caption = 'Project Total Price';
}
field(1005; "Job Line Amount"; Decimal)
{
AutoFormatExpression = "Job Currency Code";
AutoFormatType = 1;
BlankZero = true;
Caption = 'Project Line Amount';
}
field(1006; "Job Line Discount Amount"; Decimal)
{
AutoFormatExpression = "Job Currency Code";
AutoFormatType = 1;
BlankZero = true;
Caption = 'Project Line Discount Amount';
}
field(1007; "Job Line Discount %"; Decimal)
{
AutoFormatType = 0;
BlankZero = true;
Caption = 'Project Line Discount %';
DecimalPlaces = 0 : 5;
MaxValue = 100;
MinValue = 0;
}
field(1008; "Job Unit Price (LCY)"; Decimal)
{
BlankZero = true;
Caption = 'Project Unit Price (LCY)';
AutoFormatType = 2;
AutoFormatExpression = '';
}
field(1009; "Job Total Price (LCY)"; Decimal)
{
BlankZero = true;
Caption = 'Project Total Price (LCY)';
AutoFormatType = 1;
AutoFormatExpression = '';
}
field(1010; "Job Line Amount (LCY)"; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = '';
BlankZero = true;
Caption = 'Project Line Amount (LCY)';
}
field(1011; "Job Line Disc. Amount (LCY)"; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = '';
BlankZero = true;
Caption = 'Project Line Disc. Amount (LCY)';
}
field(1012; "Job Currency Factor"; Decimal)
{
AutoFormatType = 0;
BlankZero = true;
Caption = 'Project Currency Factor';
}
field(1013; "Job Currency Code"; Code[20])
{
Caption = 'Project Currency Code';
}
field(1019; "Job Planning Line No."; Integer)
{
AccessByPermission = TableData Job = R;
BlankZero = true;
Caption = 'Project Planning Line No.';
}
field(1700; "Deferral Code"; Code[10])
{
Caption = 'Deferral Code';
ToolTip = 'Specifies the deferral template that governs how expenses paid with this purchase document are deferred to the different accounting periods when the expenses were incurred.';
TableRelation = "Deferral Template"."Deferral Code";
}
field(5402; "Variant Code"; Code[10])
{
Caption = 'Variant Code';
ToolTip = 'Specifies the variant of the item on the line.';
TableRelation = if (Type = const(Item)) "Item Variant".Code where("Item No." = field("No."));
}
field(5403; "Bin Code"; Code[20])
{
Caption = 'Bin Code';
ToolTip = 'Specifies the bin where the items are picked or put away.';
TableRelation = Bin.Code where("Location Code" = field("Location Code"),
"Item Filter" = field("No."),
"Variant Filter" = field("Variant Code"));
}
field(5404; "Qty. per Unit of Measure"; Decimal)
{
AutoFormatType = 0;
Caption = 'Qty. per Unit of Measure';
DecimalPlaces = 0 : 5;
Editable = false;
}
field(5407; "Unit of Measure Code"; Code[10])
{
Caption = 'Unit of Measure Code';
ToolTip = 'Specifies how each unit of the item or resource is measured, such as in pieces or hours. By default, the value in the Base Unit of Measure field on the item or resource card is inserted.';
TableRelation = if (Type = const(Item)) "Item Unit of Measure".Code where("Item No." = field("No."))
else
"Unit of Measure";
}
field(5415; "Quantity (Base)"; Decimal)
{
AutoFormatType = 0;
Caption = 'Quantity (Base)';
DecimalPlaces = 0 : 5;
}
field(5600; "FA Posting Date"; Date)
{
Caption = 'FA Posting Date';
}
field(5601; "FA Posting Type"; Enum "Purchase FA Posting Type")
{
Caption = 'FA Posting Type';
ToolTip = 'Specifies the posting type, if Account Type field contains Fixed Asset.';
}
field(5602; "Depreciation Book Code"; Code[10])
{
Caption = 'Depreciation Book Code';
ToolTip = 'Specifies the code for the depreciation book to which the line will be posted if you have selected Fixed Asset in the Type field for this line.';
TableRelation = "Depreciation Book";
}
field(5603; "Salvage Value"; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = GetCurrencyCode();
Caption = 'Salvage Value';
}
field(5605; "Depr. until FA Posting Date"; Boolean)
{
Caption = 'Depr. until FA Posting Date';
ToolTip = 'Specifies if depreciation was calculated until the FA posting date of the line.';
}
field(5606; "Depr. Acquisition Cost"; Boolean)
{
Caption = 'Depr. Acquisition Cost';
ToolTip = 'Specifies if, when this line was posted, the additional acquisition cost posted on the line was depreciated in proportion to the amount by which the fixed asset had already been depreciated.';
}
field(5609; "Maintenance Code"; Code[10])
{
Caption = 'Maintenance Code';
TableRelation = Maintenance;
}
field(5610; "Insurance No."; Code[20])
{
Caption = 'Insurance No.';
ToolTip = 'Specifies the insurance number on the purchase credit memo line.';
TableRelation = Insurance;
}
field(5611; "Budgeted FA No."; Code[20])
{
Caption = 'Budgeted FA No.';
ToolTip = 'Specifies the number of a fixed asset with the Budgeted Asset check box selected. When you post the journal or document line, an additional entry is created for the budgeted fixed asset where the amount has the opposite sign.';
TableRelation = "Fixed Asset";
}
field(5612; "Duplicate in Depreciation Book"; Code[10])
{
Caption = 'Duplicate in Depreciation Book';
TableRelation = "Depreciation Book";
}
field(5613; "Use Duplication List"; Boolean)
{
Caption = 'Use Duplication List';
}
field(5700; "Responsibility Center"; Code[10])
{
Caption = 'Responsibility Center';
TableRelation = "Responsibility Center";
}
field(5709; "Item Category Code"; Code[20])
{
Caption = 'Item Category Code';
TableRelation = if (Type = const(Item)) "Item Category";
}
field(5710; Nonstock; Boolean)
{
Caption = 'Catalog';
ToolTip = 'Specifies that this item is a catalog item.';
}
field(5711; "Purchasing Code"; Code[10])
{
Caption = 'Purchasing Code';
TableRelation = Purchasing;
}
field(5725; "Item Reference No."; Code[50])
{
AccessByPermission = TableData "Item Reference" = R;
Caption = 'Item Reference No.';
ToolTip = 'Specifies the referenced item number.';
}
field(5726; "Item Reference Unit of Measure"; Code[10])
{
Caption = 'Unit of Measure (Item Ref.)';
TableRelation = if (Type = const(Item)) "Item Unit of Measure".Code where("Item No." = field("No."));
}
field(5727; "Item Reference Type"; Enum "Item Reference Type")
{
Caption = 'Item Reference Type';
}
field(5728; "Item Reference Type No."; Code[30])
{
Caption = 'Item Reference Type No.';
}
field(6200; "Non-Deductible VAT %"; Decimal)
{
AutoFormatType = 0;
Caption = 'Non-Deductible VAT %';
DecimalPlaces = 0 : 5;
}
field(6201; "Non-Deductible VAT Base"; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = GetCurrencyCode();
Caption = 'Non-Deductible VAT Base';
}
field(6202; "Non-Deductible VAT Amount"; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = GetCurrencyCode();
Caption = 'Non-Deductible VAT Amount';
}
field(6203; "Non-Deductible VAT Diff."; Decimal)
{
AutoFormatType = 1;
AutoFormatExpression = GetCurrencyCode();
Caption = 'Non-Deductible VAT Difference';
Editable = false;
}
field(6600; "Return Shipment No."; Code[20])
{
Caption = 'Return Shipment No.';
Editable = false;
}
field(6601; "Return Shipment Line No."; Integer)
{
Caption = 'Return Shipment Line No.';
Editable = false;
}
field(6608; "Return Reason Code"; Code[10])
{
Caption = 'Return Reason Code';
ToolTip = 'Specifies the code explaining why the item was returned.';
TableRelation = "Return Reason";
}
field(7000; "Price Calculation Method"; Enum "Price Calculation Method")
{
Caption = 'Price Calculation Method';
}
field(8512; "Buy-from Vendor Name"; Text[100])
{
CalcFormula = lookup(Vendor.Name where("No." = field("Buy-from Vendor No.")));
Caption = 'Buy-from Vendor Name';
ToolTip = 'Specifies the name of the vendor who delivered the items.';
Editable = false;
FieldClass = FlowField;
}
}
keys
{
key(Key1; "Document No.", "Line No.")
{
Clustered = true;
}
key(Key2; "Blanket Order No.", "Blanket Order Line No.")
{
}
key(Key3; "Buy-from Vendor No.")
{
}
key(Key4; "Order No.", "Order Line No.", "Posting Date")
{
}
key(Key5; "Document No.", "Location Code")
{
IncludedFields = Amount, "Amount Including VAT";
}
}
fieldgroups
{
}
trigger OnDelete()
var
PurchDocLineComments: Record "Purch. Comment Line";
PostedDeferralHeader: Record "Posted Deferral Header";
begin
PurchDocLineComments.SetRange("Document Type", PurchDocLineComments."Document Type"::"Posted Credit Memo");
PurchDocLineComments.SetRange("No.", "Document No.");
PurchDocLineComments.SetRange("Document Line No.", "Line No.");
if not PurchDocLineComments.IsEmpty() then
PurchDocLineComments.DeleteAll();
PostedDeferralHeader.DeleteHeader(
"Deferral Document Type"::Purchase.AsInteger(), '', '',
PurchDocLineComments."Document Type"::"Posted Credit Memo".AsInteger(), "Document No.", "Line No.");
end;
var
PurchCrMemoHeader: Record "Purch. Cr. Memo Hdr.";
Currency: Record Currency;
DimMgt: Codeunit DimensionManagement;
DeferralUtilities: Codeunit "Deferral Utilities";
procedure GetCurrencyCode(): Code[10]
begin
GetHeader();
exit(PurchCrMemoHeader."Currency Code");
end;
procedure ShowDimensions()
begin
DimMgt.ShowDimensionSet("Dimension Set ID", StrSubstNo('%1 %2 %3', TableCaption(), "Document No.", "Line No."));
end;
procedure ShowItemTrackingLines()
var
ItemTrackingDocMgt: Codeunit "Item Tracking Doc. Management";
begin
ItemTrackingDocMgt.ShowItemTrackingForInvoiceLine(RowID1());
end;
procedure CalcVATAmountLines(PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; var TempVATAmountLine: Record "VAT Amount Line" temporary)
begin
TempVATAmountLine.DeleteAll();
SetRange("Document No.", PurchCrMemoHdr."No.");
if Find('-') then
repeat
TempVATAmountLine.Init();
TempVATAmountLine.CopyFromPurchCrMemoLine(Rec);
TempVATAmountLine.InsertLine();
until Next() = 0;
end;
local procedure GetFieldCaption(FieldNumber: Integer): Text[100]
var
"Field": Record "Field";
begin
Field.Get(DATABASE::"Purch. Cr. Memo Line", FieldNumber);
exit(Field."Field Caption");
end;
procedure GetCaptionClass(FieldNumber: Integer): Text[80]
begin
GetHeader();
case FieldNumber of
FieldNo("No."):
exit(StrSubstNo('3,%1', GetFieldCaption(FieldNumber)));
else begin
if PurchCrMemoHeader."Prices Including VAT" then
exit('2,1,' + GetFieldCaption(FieldNumber));
exit('2,0,' + GetFieldCaption(FieldNumber));
end
end;
end;
procedure RowID1(): Text[250]
var
ItemTrackingMgt: Codeunit "Item Tracking Management";
begin
exit(ItemTrackingMgt.ComposeRowID(DATABASE::"Purch. Cr. Memo Line",
0, "Document No.", '', 0, "Line No."));
end;
procedure GetReturnShptLines(var TempReturnShipmentLine: Record "Return Shipment Line" temporary)
var
ReturnShipmentLine: Record "Return Shipment Line";
ValueItemLedgerEntries: Query "Value Item Ledger Entries";
begin
TempReturnShipmentLine.Reset();
TempReturnShipmentLine.DeleteAll();
if Type <> Type::Item then
exit;
ValueItemLedgerEntries.SetRange(Value_Entry_Doc_No, "Document No.");
ValueItemLedgerEntries.SetRange(Value_Entry_Doc_Type, Enum::"Item Ledger Document Type"::"Purchase Credit Memo");
ValueItemLedgerEntries.SetRange(Value_Entry_Doc_Line_No, "Line No.");
ValueItemLedgerEntries.SetFilter(Value_Entry_Invoiced_Qty, '<>0');
ValueItemLedgerEntries.SetRange(Item_Ledg_Document_Type, Enum::"Item Ledger Document Type"::"Purchase Return Shipment");
ValueItemLedgerEntries.Open();
while ValueItemLedgerEntries.Read() do
if ReturnShipmentLine.Get(ValueItemLedgerEntries.Item_Ledg_Document_No, ValueItemLedgerEntries.Item_Ledg_Document_Line_No) then begin
TempReturnShipmentLine.Init();
TempReturnShipmentLine := ReturnShipmentLine;
if TempReturnShipmentLine.Insert() then;
end;
end;
procedure GetItemLedgEntries(var TempItemLedgEntry: Record "Item Ledger Entry" temporary; SetQuantity: Boolean)
var
ItemLedgEntry: Record "Item Ledger Entry";
ValueEntry: Record "Value Entry";
begin
if SetQuantity then begin
TempItemLedgEntry.Reset();
TempItemLedgEntry.DeleteAll();
if Type <> Type::Item then
exit;
end;
FilterPstdDocLineValueEntries(ValueEntry);
ValueEntry.SetFilter("Invoiced Quantity", '<>0');
if ValueEntry.FindSet() then
repeat
ItemLedgEntry.Get(ValueEntry."Item Ledger Entry No.");
TempItemLedgEntry := ItemLedgEntry;
if SetQuantity then begin
TempItemLedgEntry.Quantity := ValueEntry."Invoiced Quantity";
if Abs(TempItemLedgEntry."Remaining Quantity") > Abs(TempItemLedgEntry.Quantity) then
TempItemLedgEntry."Remaining Quantity" := Abs(TempItemLedgEntry.Quantity);
end;
OnGetItemLedgEntriesOnBeforeTempItemLedgEntryInsert(TempItemLedgEntry, ValueEntry, SetQuantity);
if TempItemLedgEntry.Insert() then;
until ValueEntry.Next() = 0;
end;
procedure FilterPstdDocLineValueEntries(var ValueEntry: Record "Value Entry")
begin
ValueEntry.Reset();
ValueEntry.SetCurrentKey("Document No.");
ValueEntry.SetRange("Document No.", "Document No.");
ValueEntry.SetRange("Document Type", ValueEntry."Document Type"::"Purchase Credit Memo");
ValueEntry.SetRange("Document Line No.", "Line No.");
end;
procedure ShowItemReturnShptLines()
var
TempReturnShptLine: Record "Return Shipment Line" temporary;
begin
if Type = Type::Item then begin
GetReturnShptLines(TempReturnShptLine);
PAGE.RunModal(0, TempReturnShptLine);
end;
end;
procedure ShowLineComments()
var
PurchCommentLine: Record "Purch. Comment Line";
begin
PurchCommentLine.ShowComments(PurchCommentLine."Document Type"::"Posted Credit Memo".AsInteger(), "Document No.", "Line No.");
end;
procedure ShowShortcutDimCode(var ShortcutDimCode: array[8] of Code[20])
begin
DimMgt.GetShortcutDimensions(Rec."Dimension Set ID", ShortcutDimCode);
end;
procedure InitFromPurchLine(PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; PurchLine: Record "Purchase Line")
begin
Init();
TransferFields(PurchLine);
if ("No." = '') and HasTypeToFillMandatoryFields() then
Type := Type::" ";
"Posting Date" := PurchCrMemoHdr."Posting Date";
"Document No." := PurchCrMemoHdr."No.";
Quantity := PurchLine."Qty. to Invoice";
"Quantity (Base)" := PurchLine."Qty. to Invoice (Base)";
OnAfterInitFromPurchLine(PurchCrMemoHdr, PurchLine, Rec);
end;
procedure ShowDeferrals()
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeShowDeferrals(Rec, IsHandled);
if IsHandled then
exit;
DeferralUtilities.OpenLineScheduleView(
"Deferral Code", "Deferral Document Type"::Purchase.AsInteger(), '', '',
GetDocumentType(), "Document No.", "Line No.");
end;
procedure GetDocumentType(): Integer
var
PurchCommentLine: Record "Purch. Comment Line";
begin
exit(PurchCommentLine."Document Type"::"Posted Credit Memo".AsInteger());
end;
procedure HasTypeToFillMandatoryFields(): Boolean
begin
exit(Type <> Type::" ");
end;
procedure FormatType(): Text
var
PurchaseLine: Record "Purchase Line";
begin
if Type = Type::" " then
exit(PurchaseLine.FormatTypeAsText());
exit(Format(Type));
end;
procedure SetSecurityFilterOnRespCenter()
var
UserSetupMgt: Codeunit "User Setup Management";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeSetSecurityFilterOnRespCenter(Rec, IsHandled);
if IsHandled then
exit;
if UserSetupMgt.GetPurchasesFilter() <> '' then begin
FilterGroup(2);
SetRange("Responsibility Center", UserSetupMgt.GetPurchasesFilter());
FilterGroup(0);
end;
end;
procedure GetLineAmountExclVAT(): Decimal
begin
GetHeader();
if not PurchCrMemoHeader."Prices Including VAT" then
exit("Line Amount");
exit(Round("Line Amount" / (1 + "VAT %" / 100), Currency."Amount Rounding Precision"));
end;
procedure GetLineAmountInclVAT(): Decimal
begin
GetHeader();
if PurchCrMemoHeader."Prices Including VAT" then
exit("Line Amount");
exit(Round("Line Amount" * (1 + "VAT %" / 100), Currency."Amount Rounding Precision"));
end;
local procedure GetHeader()
begin
if PurchCrMemoHeader."No." = "Document No." then
exit;
if not PurchCrMemoHeader.Get("Document No.") then
PurchCrMemoHeader.Init();
if PurchCrMemoHeader."Currency Code" = '' then
Currency.InitRoundingPrecision()
else
if not Currency.Get(PurchCrMemoHeader."Currency Code") then
Currency.InitRoundingPrecision();
end;
internal procedure GetVATPct() VATPct: Decimal
begin
VATPct := "VAT %";
OnAfterGetVATPct(Rec, VATPct);
end;
internal procedure GetPurchaseInvoiceLine(var PurchInvLine: Record "Purch. Inv. Line")
var
ItemLedgerEntry: Record "Item Ledger Entry";
ValueEntry: Record "Value Entry";
begin
if Rec.Type = Rec.Type::Item then begin
CheckApplFromItemLedgEntry(ItemLedgerEntry);
if ItemLedgerEntry."Entry No." = 0 then
FindItemLedgerEntryFromItemApplicationEntry(ItemLedgerEntry);
if ItemLedgerEntry."Entry No." <> 0 then begin
ValueEntry.SetLoadFields("Item Ledger Entry No.", "Item Ledger Entry Type", "Document Type", "Document No.", "Document Line No.");
ValueEntry.SetRange("Item Ledger Entry No.", ItemLedgerEntry."Entry No.");
ValueEntry.SetRange("Item Ledger Entry Type", ItemLedgerEntry."Entry Type");
ValueEntry.SetRange("Document Type", ValueEntry."Document Type"::"Purchase Invoice");
if ValueEntry.FindFirst() then begin
PurchInvLine.Get(ValueEntry."Document No.", ValueEntry."Document Line No.");
exit;
end;
end;
end;
if (ItemLedgerEntry."Entry No." = 0) and ("Order No." <> '') then begin
PurchInvLine.SetRange("Order No.", "Order No.");
PurchInvLine.SetRange("Order Line No.", "Order Line No.");
if PurchInvLine.FindFirst() then;
end;
end;
local procedure CheckApplFromItemLedgEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
begin
if "Appl.-to Item Entry" = 0 then
exit;
TestField(Type, Type::Item);
TestField(Quantity);
ItemLedgerEntry.Get("Appl.-to Item Entry");
ItemLedgerEntry.TestField(Positive, true);
ItemLedgerEntry.TestField("Item No.", "No.");
ItemLedgerEntry.TestField("Variant Code", "Variant Code");
ItemLedgerEntry.CheckTrackingDoesNotExist(RecordId, FieldCaption("Appl.-to Item Entry"));
end;
local procedure FindItemLedgerEntryFromItemApplicationEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
var
ItemApplicationEntry: Record "Item Application Entry";
TempItemLedEntry: Record "Item Ledger Entry" temporary;
ItemTrackingDocMgmt: Codeunit "Item Tracking Doc. Management";
begin
ItemTrackingDocMgmt.RetrieveEntriesFromPostedInvoice(TempItemLedEntry, RowID1());
if TempItemLedEntry.IsEmpty() then
exit;
TempItemLedEntry.FindFirst();
if ItemApplicationEntry.AppliedFromEntryExists(TempItemLedEntry."Entry No.") then
ItemLedgerEntry.Get(ItemApplicationEntry."Outbound Item Entry No.");
end;
[IntegrationEvent(false, false)]
local procedure OnAfterInitFromPurchLine(PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; PurchLine: Record "Purchase Line"; var PurchCrMemoLine: Record "Purch. Cr. Memo Line")
begin
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeShowDeferrals(var PurchCrMemoLine: Record "Purch. Cr. Memo Line"; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnGetItemLedgEntriesOnBeforeTempItemLedgEntryInsert(var TempItemLedgerEntry: Record "Item Ledger Entry" temporary; ValueEntry: Record "Value Entry"; SetQuantity: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeSetSecurityFilterOnRespCenter(var PurchCrMemoLine: Record "Purch. Cr. Memo Line"; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterGetVATPct(var PurchCrMemoLine: Record "Purch. Cr. Memo Line"; var VATPct: Decimal)
begin
end;
}