page 54002 PurchaseLinepart
{
ApplicationArea = All;
Caption = 'PurchaseLinepart';
PageType = ListPart;
SourceTable = "Purchase Line";
PopulateAllFields = true;
DelayedInsert = true;
ODataKeyFields = SystemId;
AutoSplitKey = true;
SourceTableView = where("Document Type" = filter(Order));
layout
{
area(Content)
{
repeater(General)
{
field(SystemId; Rec.SystemId)
{
ApplicationArea = All;
}
field(id; Format(rec.SystemId, 0, 4).ToLower())
{
ApplicationArea=all;
}
field("Document No."; Rec."Document No.")
{
ApplicationArea = All;
}
field("Document Type"; Rec."Document Type")
{
ApplicationArea = All;
}
field(headerId; Rec.headerId)
{
ApplicationArea = All;
}
field("Line No."; Rec."Line No.")
{
ApplicationArea = All;
}
field("Buy-from Vendor No.";Rec."Buy-from Vendor No.")
{
ApplicationArea = All;
}
field(Type;Rec.Type)
{
ApplicationArea = All;
}
field("No."; Rec."No.")
{
ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.';
}
field("Variant Code"; Rec."Variant Code")
{
ToolTip = 'Specifies the variant of the item on the line.';
}
field("Unit Cost";Rec."Unit Cost")
{
ApplicationArea = All;
}
field(Quantity; Rec.Quantity)
{
ToolTip = 'Specifies the quantity of the sales order line.';
}
field(Description;Rec.Description)
{
ApplicationArea = All;
}
}
}
}
var
IsDeepInsert: Boolean;
trigger OnInsertRecord(BelowxRec: Boolean): Boolean
var
MyHeader: Record "Purchase Header";
MyLine: Record "Purchase Line";
begin
if IsDeepInsert then begin
MyHeader.GetBySystemId(rec.headerId);
Rec."Document No." := MyHeader."No.";
//rec.headerId := MyHeader.SystemId;
MyLine.SetRange("Document No.", Rec."Document No.");
if MyLine.FindLast() then
Rec."Line No." := MyLine."Line No." + 10000
else
Rec."Line No." := 10000;
end;
end;
trigger OnNewRecord(BelowxRec: Boolean)
var
MyHeader: Record "Purchase Header";
begin
IsDeepInsert := IsNullGuid(rec.headerId);
if not IsDeepInsert then begin
MyHeader.GetBySystemId(rec.headerId);
Rec."Document No." := MyHeader."No.";
// MyHeader.get(rec."Document No.");
// rec.headerId := MyHeader.SystemId;
end;
end;
}