Page 9310 Blanket Purchase Orders, source in 29
Source29
src/Layers/W1/BaseApp/Purchases/Document/BlanketPurchaseOrders.Page.al524 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.Finance.Dimension;
using Microsoft.Foundation.Attachment;
using Microsoft.Foundation.Reporting;
using Microsoft.Purchases.Comment;
using Microsoft.Purchases.Vendor;
using System.Automation;
page 9310 "Blanket Purchase Orders"
{
ApplicationArea = Suite;
Caption = 'Blanket Purchase Orders';
CardPageID = "Blanket Purchase Order";
DataCaptionFields = "Buy-from Vendor No.";
Editable = false;
PageType = List;
AboutTitle = 'About Blanket Purchase Orders';
AboutText = 'Manage long-term purchase agreements with vendors by tracking blanket orders, scheduling multiple deliveries, and converting planned shipments into purchase orders as needed for ongoing procurement and forecasting.';
QueryCategory = 'Blanket Purchase Orders';
RefreshOnActivate = true;
SourceTable = "Purchase Header";
SourceTableView = where("Document Type" = const("Blanket Order"));
UsageCategory = Lists;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("No."; Rec."No.")
{
ApplicationArea = Suite;
ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.';
}
field("Buy-from Vendor No."; Rec."Buy-from Vendor No.")
{
ApplicationArea = Suite;
ToolTip = 'Specifies the name of the vendor who delivered the items.';
}
field("Order Address Code"; Rec."Order Address Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Buy-from Vendor Name"; Rec."Buy-from Vendor Name")
{
ApplicationArea = Suite;
ToolTip = 'Specifies the name of the vendor who delivered the items.';
}
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(Status; Rec.Status)
{
ApplicationArea = Suite;
StyleExpr = StatusStyleTxt;
}
}
}
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(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(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("Co&mments")
{
ApplicationArea = Suite;
Caption = 'Co&mments';
Image = ViewComments;
RunObject = Page "Purch. Comment Sheet";
RunPageLink = "Document Type" = const("Blanket Order"),
"No." = field("No."),
"Document Line No." = const(0);
ToolTip = 'View or add comments for the record.';
}
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(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;
}
}
}
area(processing)
{
group("F&unctions")
{
Caption = 'F&unctions';
Image = "Action";
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("Request Approval")
{
Caption = 'Request Approval';
action(SendApprovalRequest)
{
ApplicationArea = Suite;
Caption = 'Send A&pproval Request';
Enabled = not OpenApprovalEntriesExist;
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 = Suite;
Caption = 'Cancel Approval Re&quest';
Enabled = CanCancelApprovalForRecord;
Image = CancelApprovalRequest;
ToolTip = 'Cancel the approval request.';
trigger OnAction()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
begin
ApprovalsMgmt.OnCancelPurchaseApprovalRequest(Rec);
end;
}
}
action(MakeOrder)
{
ApplicationArea = Suite;
Caption = 'Make &Order';
Image = MakeOrder;
ToolTip = 'Convert the blanket purchase order to a purchase order.';
trigger OnAction()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
begin
if ApprovalsMgmt.PrePostApprovalCheckPurch(Rec) then
CODEUNIT.Run(CODEUNIT::"Blnkt Purch Ord. to Ord. (Y/N)", Rec);
end;
}
action(Print)
{
ApplicationArea = Suite;
Caption = '&Print';
Ellipsis = true;
Image = Print;
ToolTip = 'Prepare to print the document. A report request window for the document opens where you can specify what to include on the print-out.';
trigger OnAction()
begin
DocPrint.PrintPurchHeader(Rec);
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;
}
action("Delete Invoiced")
{
ApplicationArea = Suite;
Caption = 'Delete Invoiced Orders';
Image = Delete;
RunObject = Report "Delete Invd Blnkt Purch Orders";
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';
actionref(MakeOrder_Promoted; MakeOrder)
{
}
}
group(Category_Release)
{
Caption = 'Release';
ShowAs = SplitButton;
actionref(Release_Promoted; Release)
{
}
actionref(Reopen_Promoted; Reopen)
{
}
}
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)
{
}
}
group(Category_Report)
{
Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
}
}
}
trigger OnAfterGetRecord()
begin
StatusStyleTxt := Rec.GetStatusStyleText();
end;
trigger OnAfterGetCurrRecord()
begin
SetControlAppearance();
end;
trigger OnOpenPage()
begin
Rec.SetSecurityFilterOnRespCenter();
Rec.CopyBuyFromVendorFilter();
end;
var
DocPrint: Codeunit "Document-Print";
OpenApprovalEntriesExist: Boolean;
CanCancelApprovalForRecord: Boolean;
StatusStyleTxt: Text;
local procedure SetControlAppearance()
var
ApprovalsMgmt: Codeunit "Approvals Mgmt.";
begin
OpenApprovalEntriesExist := ApprovalsMgmt.HasOpenApprovalEntries(Rec.RecordId);
CanCancelApprovalForRecord := ApprovalsMgmt.CanCancelApprovalForRecord(Rec.RecordId);
end;
}