Page 9307 Purchase Order List

Base Application, Microsoft.Purchases.Document

src/Layers/W1/BaseApp/Purchases/Document/PurchaseOrderList.Page.al1,005 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.Document;using Microsoft.EServices.EDocument;using Microsoft.Finance.Dimension;using Microsoft.Finance.VAT.Setup;using Microsoft.Foundation.Attachment;using Microsoft.Foundation.BatchProcessing;using Microsoft.Foundation.Reporting;using Microsoft.Intercompany.GLAccount;using Microsoft.Purchases.Analysis;using Microsoft.Purchases.Comment;using Microsoft.Purchases.History;using Microsoft.Purchases.Posting;using Microsoft.Purchases.Setup;using Microsoft.Purchases.Vendor;using Microsoft.Utilities;using Microsoft.Warehouse.Activity;using Microsoft.Warehouse.Document;using Microsoft.Warehouse.InventoryDocument;using Microsoft.Warehouse.Request;using System.Automation;using System.Text;using System.Threading;page 9307 "Purchase Order List"{    ApplicationArea = Basic, Suite;    Caption = 'Purchase Orders';    CardPageID = "Purchase Order";    DataCaptionFields = "Buy-from Vendor No.";    Editable = false;    PageType = List;    AboutTitle = 'About Purchase Orders';    AboutText = 'Create, track, and manage purchase orders for goods and services, including vendor details, order lines, amounts, discounts, and order status. Monitor the progress of each order from creation through receipt and posting to ensure accurate procurement and financial processing.';    QueryCategory = 'Purchase Order List';    RefreshOnActivate = true;    SourceTable = "Purchase Header";    SourceTableView = where("Document Type" = const(Order));    UsageCategory = Lists;    AdditionalSearchTerms = 'Procurement List, Buy Order Overview, Vendor Orders, Order Purchase Log, Acquisition List, Supplier Orders, Buy List, Purchase Log, Supply Order List, Goods Order Overview';    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field("No."; Rec."No.")                {                    ApplicationArea = Suite;                }                field("Buy-from Vendor No."; Rec."Buy-from Vendor No.")                {                    ApplicationArea = Suite;                }                field("Order Address Code"; Rec."Order Address Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Buy-from Vendor Name"; Rec."Buy-from Vendor Name")                {                    ApplicationArea = Suite;                }                field("Vendor Authorization No."; Rec."Vendor Authorization No.")                {                    ApplicationArea = Suite;                }                field("Buy-from Post Code"; Rec."Buy-from Post Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Buy-from Country/Region Code"; Rec."Buy-from Country/Region Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Buy-from Contact"; Rec."Buy-from Contact")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Pay-to Vendor No."; Rec."Pay-to Vendor No.")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Pay-to Name"; Rec."Pay-to Name")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Pay-to Post Code"; Rec."Pay-to Post Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Pay-to Country/Region Code"; Rec."Pay-to Country/Region Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Pay-to Contact"; Rec."Pay-to Contact")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Ship-to Code"; Rec."Ship-to Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Ship-to Name"; Rec."Ship-to Name")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Ship-to Post Code"; Rec."Ship-to Post Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Ship-to Country/Region Code"; Rec."Ship-to Country/Region Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Ship-to Contact"; Rec."Ship-to Contact")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Posting Date"; Rec."Posting Date")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")                {                    ApplicationArea = Dimensions;                    Visible = false;                }                field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")                {                    ApplicationArea = Dimensions;                    Visible = false;                }                field("Location Code"; Rec."Location Code")                {                    ApplicationArea = Location;                }                field("Purchaser Code"; Rec."Purchaser Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Assigned User ID"; Rec."Assigned User ID")                {                    ApplicationArea = Suite;                }                field("Currency Code"; Rec."Currency Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Document Date"; Rec."Document Date")                {                    ApplicationArea = Suite;                }                field(Status; Rec.Status)                {                    ApplicationArea = Suite;                    StyleExpr = StatusStyleTxt;                }                field("Payment Terms Code"; Rec."Payment Terms Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Due Date"; Rec."Due Date")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Payment Discount %"; Rec."Payment Discount %")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Payment Method Code"; Rec."Payment Method Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Shipment Method Code"; Rec."Shipment Method Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Requested Receipt Date"; Rec."Requested Receipt Date")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Job Queue Status"; Rec."Job Queue Status")                {                    ApplicationArea = Suite;                    Style = Unfavorable;                    StyleExpr = Rec."Job Queue Status" = Rec."Job Queue Status"::ERROR;                    Visible = JobQueueActive;                    trigger OnDrillDown()                    var                        JobQueueEntry: Record "Job Queue Entry";                    begin                        if Rec."Job Queue Status" = Rec."Job Queue Status"::" " then                            exit;                        JobQueueEntry.ShowStatusMsg(Rec."Job Queue Entry ID");                    end;                }                field("Amount Received Not Invoiced excl. VAT (LCY)"; Rec."A. Rcd. Not Inv. Ex. VAT (LCY)")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Amount Received Not Invoiced (LCY)"; Rec."Amt. Rcd. Not Invoiced (LCY)")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field(Amount; Rec.Amount)                {                    ApplicationArea = Suite;                }                field("Amount Including VAT"; Rec."Amount Including VAT")                {                    ApplicationArea = Suite;                }                field("Posting Description"; Rec."Posting Description")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Your Reference"; Rec."Your Reference")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Vendor Order No."; Rec."Vendor Order No.")                {                    ApplicationArea = Suite;                    Visible = false;                }            }        }        area(factboxes)        {            part("Attached Documents List"; "Doc. Attachment List Factbox")            {                ApplicationArea = All;                Caption = 'Documents';                UpdatePropagation = Both;                SubPageLink = "Table ID" = const(Database::"Purchase Header"),                              "No." = field("No."),                              "Document Type" = field("Document Type");            }            part(IncomingDocAttachFactBox; "Incoming Doc. Attach. FactBox")            {                ApplicationArea = Suite;                ShowFilter = false;                Visible = false;            }            part(Control1901138007; "Vendor Details FactBox")            {                ApplicationArea = Suite;                SubPageLink = "No." = field("Buy-from Vendor No."),                              "Date Filter" = field("Date Filter");            }            systempart(Control1900383207; Links)            {                ApplicationArea = RecordLinks;                Visible = false;            }            systempart(Control1905767507; Notes)            {                ApplicationArea = Notes;            }        }    }    actions    {        area(navigation)        {            group("O&rder")            {                Caption = 'O&rder';                Image = "Order";                action(Dimensions)                {                    AccessByPermission = TableData Dimension = R;                    ApplicationArea = Dimensions;                    Caption = 'Dimensions';                    Image = Dimensions;                    ShortCutKey = 'Alt+D';                    ToolTip = 'View or edit dimensions, such as area, project, or department, that you can assign to sales and purchase documents to distribute costs and analyze transaction history.';                    trigger OnAction()                    begin                        Rec.ShowDocDim();                    end;                }                action(PurchaseOrderStatistics)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Statistics';                    Enabled = Rec."No." <> '';                    Image = Statistics;                    ShortCutKey = 'F7';                    Visible = true;                    ToolTip = 'View statistical information, such as the value of posted entries, for the record.';                    RunObject = Page "Purchase Order Statistics";                    RunPageOnRec = true;                }                action(VendorStatistics)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Vendor Statistics';                    Enabled = Rec."Buy-from Vendor No." <> '';                    Image = Statistics;                    RunObject = Page "Vendor Statistics";                    RunPageLink = "No." = field("Buy-from Vendor No."),                                  "Date Filter" = field("Date Filter");                    ToolTip = 'View statistical information, such as the value of posted entries, for the buy-from vendor on the purchase document.';                }                action(Approvals)                {                    AccessByPermission = TableData "Approval Entry" = R;                    ApplicationArea = Suite;                    Caption = 'Approvals';                    Image = Approvals;                    ToolTip = 'View a list of the records that are waiting to be approved. For example, you can see who requested the record to be approved, when it was sent, and when it is due to be approved.';                    trigger OnAction()                    var                        ApprovalsMgmt: Codeunit "Approvals Mgmt.";                    begin                        ApprovalsMgmt.OpenApprovalsPurchase(Rec);                    end;                }                action("Co&mments")                {                    ApplicationArea = Comments;                    Caption = 'Co&mments';                    Image = ViewComments;                    RunObject = Page "Purch. Comment Sheet";                    RunPageLink = "Document Type" = field("Document Type"),                                  "No." = field("No."),                                  "Document Line No." = const(0);                    ToolTip = 'View or add comments for the record.';                }            }            group(Documents)            {                Caption = 'Documents';                Image = Documents;                action(Receipts)                {                    ApplicationArea = Suite;                    Caption = 'Receipts';                    Image = PostedReceipts;                    RunObject = Page "Posted Purchase Receipts";                    RunPageLink = "Order No." = field("No.");                    RunPageView = sorting("Order No.");                    ToolTip = 'View a list of posted purchase receipts for the order.';                }                action(PostedPurchaseInvoices)                {                    ApplicationArea = Suite;                    Caption = 'Invoices';                    Image = Invoice;                    ToolTip = 'View a list of ongoing purchase invoices for the order.';                    trigger OnAction()                    var                        TempPurchInvHeader: Record "Purch. Inv. Header" temporary;                        PurchGetReceipt: Codeunit "Purch.-Get Receipt";                    begin                        PurchGetReceipt.GetPurchOrderInvoices(TempPurchInvHeader, Rec."No.");                        Page.Run(Page::"Posted Purchase Invoices", TempPurchInvHeader);                    end;                }                action(PostedPurchasePrepmtInvoices)                {                    ApplicationArea = Prepayments;                    Caption = 'Prepa&yment Invoices';                    Image = PrepaymentInvoice;                    RunObject = Page "Posted Purchase Invoices";                    RunPageLink = "Prepayment Order No." = field("No.");                    RunPageView = sorting("Prepayment Order No.");                    ToolTip = 'View related posted purchase invoices that involve a prepayment.';                }                action("Prepayment Credi&t Memos")                {                    ApplicationArea = Prepayments;                    Caption = 'Prepayment Credi&t Memos';                    Image = PrepaymentCreditMemo;                    RunObject = Page "Posted Purchase Credit Memos";                    RunPageLink = "Prepayment Order No." = field("No.");                    RunPageView = sorting("Prepayment Order No.");                    ToolTip = 'View related posted purchase credit memos that involve a prepayment.';                }            }            group(Warehouse)            {                Caption = 'Warehouse';                Image = Warehouse;                action("In&vt. Put-away/Pick Lines")                {                    ApplicationArea = Warehouse;                    Caption = 'In&vt. Put-away/Pick Lines';                    Image = PickLines;                    RunObject = Page "Warehouse Activity List";                    RunPageLink = "Source Document" = const("Purchase Order"),                                  "Source No." = field("No.");                    RunPageView = sorting("Source Document", "Source No.", "Location Code");                    ToolTip = 'View items that are inbound or outbound on inventory put-away or inventory pick documents for the purchase order.';                }                action("Whse. Receipt Lines")                {                    ApplicationArea = Warehouse;                    Caption = 'Whse. Receipt Lines';                    Image = ReceiptLines;                    RunObject = Page "Whse. Receipt Lines";                    RunPageLink = "Source Type" = const(39),#pragma warning disable AL0603                                  "Source Subtype" = field("Document Type"),#pragma warning restore                                  "Source No." = field("No.");                    RunPageView = sorting("Source Type", "Source Subtype", "Source No.", "Source Line No.");                    ToolTip = 'View ongoing warehouse receipts for the document, in advanced warehouse configurations.';                }                action("Whse. Put-away Lines")                {                    ApplicationArea = Warehouse;                    Caption = 'Warehouse Put-away Lines';                    Image = PutawayLines;                    RunObject = page "Warehouse Activity Lines";                    RunPageLink = "Source Document" = const("Purchase Order"), "Source No." = field("No.");                    RunPageView = sorting("Source Type", "Source Subtype", "Source No.");                    ToolTip = 'View items that are inbound on warehouse put-away documents for the purchase order.';                }            }        }        area(processing)        {            group(Action9)            {                Caption = 'Print';                Image = Print;                action(Print)                {                    ApplicationArea = Suite;                    Caption = '&Print';                    Ellipsis = true;                    Image = Print;                    ToolTip = 'Prepare to print the document. The report request window for the document opens where you can specify what to include on the print-out.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                    begin                        PurchaseHeader := Rec;                        CurrPage.SetSelectionFilter(PurchaseHeader);                        PurchaseHeader.PrintRecords(true);                    end;                }                action(Email)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Send by Email';                    Ellipsis = true;                    Image = Email;                    ToolTip = 'Finalize and prepare to email the document. The Send Email window opens prefilled with the vendor''s email address so you can add or edit information.';                    trigger OnAction()                    var                        DocPrint: Codeunit "Document-Print";                    begin                        DocPrint.EmailPurchHeader(Rec);                    end;                }                action(Send)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Send';                    Ellipsis = true;                    Image = SendToMultiple;                    ToolTip = 'Prepare to send the document according to the vendor''s sending profile, such as attached to an email. The Send document to window opens first so you can confirm or select a sending profile.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                    begin                        PurchaseHeader := Rec;                        CurrPage.SetSelectionFilter(PurchaseHeader);                        PurchaseHeader.SendRecords();                    end;                }                action(AttachAsPDF)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Attach as PDF';                    Image = PrintAttachment;                    ToolTip = 'Create a PDF file and attach it to the document.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                        DocPrint: Codeunit "Document-Print";                    begin                        PurchaseHeader := Rec;                        CurrPage.SetSelectionFilter(PurchaseHeader);                        DocPrint.PrintPurchaseHeaderToDocumentAttachment(PurchaseHeader);                    end;                }            }            group(Action10)            {                Caption = 'Release';                Image = ReleaseDoc;                action(Release)                {                    ApplicationArea = Suite;                    Caption = 'Re&lease';                    Image = ReleaseDoc;                    ShortCutKey = 'Ctrl+F9';                    ToolTip = 'Release the document to the next stage of processing. You must reopen the document before you can make changes to it.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                    begin                        CurrPage.SetSelectionFilter(PurchaseHeader);                        Rec.PerformManualRelease(PurchaseHeader);                    end;                }                action(Reopen)                {                    ApplicationArea = Suite;                    Caption = 'Re&open';                    Image = ReOpen;                    ToolTip = 'Reopen the document to change it after it has been approved. Approved documents have the Released status and must be opened before they can be changed';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                    begin                        CurrPage.SetSelectionFilter(PurchaseHeader);                        Rec.PerformManualReopen(PurchaseHeader);                    end;                }            }            group("F&unctions")            {                Caption = 'F&unctions';                Image = "Action";                action("Send IC Purchase Order")                {                    AccessByPermission = TableData "IC G/L Account" = R;                    ApplicationArea = Intercompany;                    Caption = 'Send IC Purchase Order';                    Image = IntercompanyOrder;                    ToolTip = 'Send the document to the intercompany outbox or directly to the intercompany partner if automatic transaction sending is enabled.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                    begin                        CurrPage.SetSelectionFilter(PurchaseHeader);                        Rec.SendICPurchaseDoc(PurchaseHeader);                    end;                }                action("Delete Invoiced")                {                    ApplicationArea = Suite;                    Caption = 'Delete Invoiced Orders';                    Image = Delete;                    RunObject = Report "Delete Invoiced Purch. Orders";                }            }            group("Request Approval")            {                Caption = 'Request Approval';                action(SendApprovalRequest)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Send A&pproval Request';                    Enabled = not OpenApprovalEntriesExist and CanRequestApprovalForFlow;                    Image = SendApprovalRequest;                    ToolTip = 'Request approval of the document.';                    trigger OnAction()                    var                        ApprovalsMgmt: Codeunit "Approvals Mgmt.";                    begin                        if ApprovalsMgmt.CheckPurchaseApprovalPossible(Rec) then                            ApprovalsMgmt.OnSendPurchaseDocForApproval(Rec);                    end;                }                action(CancelApprovalRequest)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Cancel Approval Re&quest';                    Enabled = CanCancelApprovalForRecord or CanCancelApprovalForFlow;                    Image = CancelApprovalRequest;                    ToolTip = 'Cancel the approval request.';                    trigger OnAction()                    var                        ApprovalsMgmt: Codeunit "Approvals Mgmt.";                        WorkflowWebhookManagement: Codeunit "Workflow Webhook Management";                    begin                        ApprovalsMgmt.OnCancelPurchaseApprovalRequest(Rec);                        WorkflowWebhookManagement.FindAndCancel(Rec.RecordId);                    end;                }            }            group(Action12)            {                Caption = 'Warehouse';                Image = Warehouse;                action("Create &Whse. Receipt")                {                    AccessByPermission = TableData "Warehouse Receipt Header" = R;                    ApplicationArea = Warehouse;                    Caption = 'Create &Whse. Receipt';                    Image = NewReceipt;                    ToolTip = 'Create a warehouse receipt to start a receive and put-away process according to an advanced warehouse configuration.';                    trigger OnAction()                    var                        GetSourceDocInbound: Codeunit "Get Source Doc. Inbound";                    begin                        Rec.PerformManualRelease();                        GetSourceDocInbound.CreateFromPurchOrder(Rec);                        if not Rec.Find('=><') then                            Rec.Init();                    end;                }                action("Create Inventor&y Put-away/Pick")                {                    AccessByPermission = TableData "Posted Invt. Put-away Header" = R;                    ApplicationArea = Warehouse;                    Caption = 'Create Inventor&y Put-away/Pick';                    Ellipsis = true;                    Image = CreatePutawayPick;                    ToolTip = 'Create an inventory put-away or inventory pick to handle items on the document according to a basic warehouse configuration that does not require warehouse receipt or shipment documents.';                    trigger OnAction()                    begin                        Rec.PerformManualRelease();                        Rec.CreateInvtPutAwayPick();                        if not Rec.Find('=><') then                            Rec.Init();                    end;                }            }            group("P&osting")            {                Caption = 'P&osting';                Image = Post;                action(TestReport)                {                    ApplicationArea = Suite;                    Caption = 'Test Report';                    Ellipsis = true;                    Image = TestReport;                    ToolTip = 'View a test report so that you can find and correct any errors before you perform the actual posting of the journal or document.';                    trigger OnAction()                    begin                        ReportPrint.PrintPurchHeader(Rec);                    end;                }                action(Post)                {                    ApplicationArea = Suite;                    Caption = 'P&ost';                    Ellipsis = true;                    Image = PostOrder;                    ShortCutKey = 'F9';                    ToolTip = 'Finalize the document or journal by posting the amounts and quantities to the related accounts in your company books.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                        PurchaseBatchPostMgt: Codeunit "Purchase Batch Post Mgt.";                        BatchProcessingMgt: Codeunit "Batch Processing Mgt.";                        LinesInstructionMgt: Codeunit "Lines Instruction Mgt.";                    begin                        LinesInstructionMgt.PurchaseCheckAllLinesHaveQuantityAssigned(Rec);                        CurrPage.SetSelectionFilter(PurchaseHeader);                        if PurchaseHeader.Count > 1 then begin                            BatchProcessingMgt.SetParametersForPageID(Page::"Purchase Order List");                            PurchaseBatchPostMgt.SetBatchProcessor(BatchProcessingMgt);                            PurchaseBatchPostMgt.RunWithUI(PurchaseHeader, Rec.Count(), ReadyToPostQst);                        end else                            Rec.SendToPosting(Codeunit::"Purch.-Post (Yes/No)");                    end;                }                action(Preview)                {                    ApplicationArea = Suite;                    Caption = 'Preview Posting';                    Image = ViewPostedOrder;                    ShortCutKey = 'Ctrl+Alt+F9';                    ToolTip = 'Review the different types of entries that will be created when you post the document or journal.';                    trigger OnAction()                    var                        SelectedPurchaseHeader: Record "Purchase Header";                        PurchPostYesNo: Codeunit "Purch.-Post (Yes/No)";                    begin                        CurrPage.SetSelectionFilter(SelectedPurchaseHeader);                        PurchPostYesNo.MessageIfPostingPreviewMultipleDocuments(SelectedPurchaseHeader, Rec."No.");                        PurchPostYesNo.Preview(Rec);                    end;                }                action(PostAndPrint)                {                    ApplicationArea = Suite;                    Caption = 'Post and &Print';                    Ellipsis = true;                    Image = PostPrint;                    ShortCutKey = 'Shift+F9';                    ToolTip = 'Finalize and prepare to print the document or journal. The values and quantities are posted to the related accounts. A report request window where you can specify what to include on the print-out.';                    trigger OnAction()                    begin                        Rec.SendToPosting(Codeunit::"Purch.-Post + Print");                    end;                }                action(PostBatch)                {                    ApplicationArea = Suite;                    Caption = 'Post &Batch';                    Ellipsis = true;                    Image = PostBatch;                    ToolTip = 'Post several documents at once. A report request window opens where you can specify which documents to post.';                    trigger OnAction()                    var                        PurchaseHeader: Record "Purchase Header";                        SelectionFilterManagement: Codeunit SelectionFilterManagement;                    begin                        CurrPage.SetSelectionFilter(PurchaseHeader);                        PurchaseHeader.SetFilter("No.", SelectionFilterManagement.GetSelectionFilterForPurchaseHeader(PurchaseHeader));                        REPORT.RunModal(REPORT::"Batch Post Purchase Orders", true, true, PurchaseHeader);                        CurrPage.Update(false);                    end;                }                action(RemoveFromJobQueue)                {                    ApplicationArea = Suite;                    Caption = 'Remove From Job Queue';                    Image = RemoveLine;                    ToolTip = 'Remove the scheduled processing of this record from the job queue.';                    Visible = JobQueueActive;                    trigger OnAction()                    begin                        Rec.CancelBackgroundPosting();                    end;                }            }        }        area(Reporting)        {            action("Purch. Order Perf. Analysis")            {                ApplicationArea = Suite;                Caption = 'Analyze Purchase Orders';                Image = Purchase;                RunObject = query "Purch. Order Perf. Analysis";                ToolTip = 'Analyze (group, summarize, pivot) your Purchase Order performance against vendors and goods/services bought, including outstanding vs. posted quantities and amounts.';            }        }        area(Promoted)        {            group(Category_Process)            {                Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';                actionref("Create &Whse. Receipt_Promoted"; "Create &Whse. Receipt")                {                }                actionref("Send IC Purchase Order_Promoted"; "Send IC Purchase Order")                {                }            }            group(Category_Category7)            {                Caption = 'Release', Comment = 'Generated from the PromotedActionCategories property index 6.';                ShowAs = SplitButton;                actionref(Release_Promoted; Release)                {                }                actionref(Reopen_Promoted; Reopen)                {                }            }            group(Category_Category8)            {                Caption = 'Posting', Comment = 'Generated from the PromotedActionCategories property index 7.';                ShowAs = SplitButton;                actionref(Post_Promoted; Post)                {                }                actionref(PostBatch_Promoted; PostBatch)                {                }                actionref(Preview_Promoted; Preview)                {                }                actionref(PostAndPrint_Promoted; PostAndPrint)                {                }            }            group(Category_Category5)            {                Caption = 'Print/Send', Comment = 'Generated from the PromotedActionCategories property index 4.';                actionref(Email_Promoted; Email)                {                }                actionref(Print_Promoted; Print)                {                }                actionref(Send_Promoted; Send)                {                }                actionref(AttachAsPDF_Promoted; AttachAsPDF)                {                }            }            group(Category_Category4)            {                Caption = 'Request Approval', Comment = 'Generated from the PromotedActionCategories property index 3.';            }            group(Category_Category6)            {                Caption = 'Order', Comment = 'Generated from the PromotedActionCategories property index 5.';                actionref(Dimensions_Promoted; Dimensions)                {                }                actionref(PurchaseOrderStatistics_Promoted; PurchaseOrderStatistics)                {                }                actionref("Co&mments_Promoted"; "Co&mments")                {                }                actionref(Approvals_Promoted; Approvals)                {                }                separator(Navigate_Separator)                {                }                actionref(PostedPurchaseInvoices_Promoted; PostedPurchaseInvoices)                {                }                actionref(Receipts_Promoted; Receipts)                {                }            }            group(Category_Category9)            {                Caption = 'Navigate', Comment = 'Generated from the PromotedActionCategories property index 8.';            }            group(Category_Report)            {                Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';            }        }    }    views    {        view(PendingConfirmation)        {            Caption = 'Pending Confirmation';            Filters = where(Status = filter(Open));        }        view(UpcomingOrders)        {            Caption = 'Upcoming Orders';            Filters = where(Status = filter(Released), "Expected Receipt Date" = filter(>= '%workdate'));        }        view(OutstandingPurchaseOrders)        {            Caption = 'Outstanding Purchase Orders';            Filters = where(Status = filter(Released), "Completely Received" = const(false));        }        view(PartiallyInvoiced)        {            Caption = 'Partially Invoiced';            Filters = where("Partially Invoiced" = const(true), "Completely Received" = const(true));        }        view(ReceivedNotInvoiced)        {            Caption = 'Received Not Invoiced';            Filters = where("Received Not Invoiced" = const(true));        }    }    trigger OnAfterGetRecord()    begin        StatusStyleTxt := Rec.GetStatusStyleText();    end;    trigger OnAfterGetCurrRecord()    begin        SetControlAppearance();        CurrPage.IncomingDocAttachFactBox.PAGE.LoadDataFromRecord(Rec);    end;    trigger OnOpenPage()    var        PurchasesPayablesSetup: Record "Purchases & Payables Setup";    begin        if Rec.GetFilter(Receive) <> '' then            Rec.FilterPartialReceived();        if Rec.GetFilter(Invoice) <> '' then            Rec.FilterPartialInvoiced();        Rec.SetSecurityFilterOnRespCenter();        JobQueueActive := PurchasesPayablesSetup.JobQueueActive();        Rec.CopyBuyFromVendorFilter();        if OnlyShowHeadersWithVat then            SetFilterOnPositiveVatPostingGroups();    end;    var        ReportPrint: Codeunit "Test Report-Print";        JobQueueActive: Boolean;        OpenApprovalEntriesExist: Boolean;        CanCancelApprovalForRecord: Boolean;        OnlyShowHeadersWithVat: Boolean;        ReadyToPostQst: Label 'The number of orders that will be posted is %1. \Do you want to continue?', Comment = '%1 - selected count';        CanRequestApprovalForFlow: Boolean;        CanCancelApprovalForFlow: Boolean;        StatusStyleTxt: Text;    local procedure SetControlAppearance()    var        ApprovalsMgmt: Codeunit "Approvals Mgmt.";        WorkflowWebhookManagement: Codeunit "Workflow Webhook Management";    begin        OpenApprovalEntriesExist := ApprovalsMgmt.HasOpenApprovalEntries(Rec.RecordId);        CanCancelApprovalForRecord := ApprovalsMgmt.CanCancelApprovalForRecord(Rec.RecordId);        WorkflowWebhookManagement.GetCanRequestAndCanCancel(Rec.RecordId, CanRequestApprovalForFlow, CanCancelApprovalForFlow);    end;    procedure SkipShowingLinesWithoutVAT()    begin        OnlyShowHeadersWithVat := true;    end;    local procedure SetFilterOnPositiveVatPostingGroups()    var        VatPostingSetup: Record "VAT Posting Setup";        VatBusPostingCodeFilter: Text;    begin        VatPostingSetup.SetFilter("VAT %", '>0');        VatPostingSetup.SetLoadFields("VAT Bus. Posting Group");        if not VatPostingSetup.FindSet() then            exit;        repeat            if StrPos(VatBusPostingCodeFilter, VatPostingSetup."VAT Bus. Posting Group") < 1 then begin                if VatBusPostingCodeFilter <> '' then                    VatBusPostingCodeFilter += '|';                VatBusPostingCodeFilter += VatPostingSetup."VAT Bus. Posting Group";            end;        until VatPostingSetup.Next() = 0;        Rec.SetFilter("VAT Bus. Posting Group", VatBusPostingCodeFilter);    end;}