Page 146 Posted Purchase Invoices, source in 29
Source29
src/Layers/W1/BaseApp/Purchases/History/PostedPurchaseInvoices.Page.al607 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.CRM.Outlook;
using Microsoft.EServices.EDocument;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Ledger;
using Microsoft.Foundation.Attachment;
using Microsoft.Purchases.Comment;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.Vendor;
page 146 "Posted Purchase Invoices"
{
ApplicationArea = Basic, Suite;
Caption = 'Posted Purchase Invoices';
CardPageID = "Posted Purchase Invoice";
Editable = false;
PageType = List;
AboutTitle = 'About Posted Purchase Invoices';
AboutText = 'Review, track, and manage all posted purchase invoices, including viewing invoice details, payment status, related ledger entries, and performing corrections or cancellations before vendor payment. Print, send, or reverse invoices as needed to ensure accurate processing and compliance.';
QueryCategory = 'Posted Purchase Invoices';
SourceTable = "Purch. Inv. Header";
SourceTableView = sorting("Posting Date")
order(descending);
UsageCategory = History;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("No."; Rec."No.")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.';
}
field("Order No."; Rec."Order No.")
{
ApplicationArea = Suite;
ToolTip = 'Specifies the number of the associated order.';
Visible = false;
}
field("Vendor Invoice No."; Rec."Vendor Invoice No.")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the document number of the original document you received from the vendor. You can require the document number for posting, or let it be optional. By default, it''s required, so that this document references the original. Making document numbers optional removes a step from the posting process. For example, if you attach the original invoice as a PDF, you might not need to enter the document number. To specify whether document numbers are required, in the Purchases & Payables Setup window, select or clear the Ext. Doc. No. Mandatory field.';
}
field("Buy-from Vendor No."; Rec."Buy-from Vendor No.")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor No.';
}
field("Order Address Code"; Rec."Order Address Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Buy-from Vendor Name"; Rec."Buy-from Vendor Name")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor';
}
field("Currency Code"; Rec."Currency Code")
{
ApplicationArea = Suite;
}
field(Amount; Rec.Amount)
{
ApplicationArea = Basic, Suite;
trigger OnDrillDown()
begin
DoDrillDown();
end;
}
field("Amount Including VAT"; Rec."Amount Including VAT")
{
ApplicationArea = Basic, Suite;
trigger OnDrillDown()
begin
DoDrillDown();
end;
}
field("Buy-from Post Code"; Rec."Buy-from Post Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Buy-from Country/Region Code"; Rec."Buy-from Country/Region Code")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the city of the vendor who delivered the items.';
Visible = false;
}
field("Buy-from Contact"; Rec."Buy-from Contact")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Pay-to Vendor No."; Rec."Pay-to Vendor No.")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Pay-to Name"; Rec."Pay-to Name")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Pay-to Post Code"; Rec."Pay-to Post Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Pay-to Country/Region Code"; Rec."Pay-to Country/Region Code")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the country/region code of the address.';
Visible = false;
}
field("Pay-to Contact"; Rec."Pay-to Contact")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Ship-to Code"; Rec."Ship-to Code")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies a code for an alternate shipment address if you want to ship to another address than the one that has been entered automatically. This field is also used in case of drop shipment.';
Visible = false;
}
field("Ship-to Name"; Rec."Ship-to Name")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Ship-to Post Code"; Rec."Ship-to Post Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Ship-to Country/Region Code"; Rec."Ship-to Country/Region Code")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the country/region code of the address that the items are shipped to.';
Visible = false;
}
field("Ship-to Contact"; Rec."Ship-to Contact")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the name of the contact person at the address that the items are shipped to.';
Visible = false;
}
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Purchaser Code"; Rec."Purchaser Code")
{
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("No. Printed"; Rec."No. Printed")
{
ApplicationArea = Basic, Suite;
}
field("Document Date"; Rec."Document Date")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the date when the related document was created.';
Visible = false;
}
field("Payment Terms Code"; Rec."Payment Terms Code")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies a formula that calculates the payment due date, payment discount date, and payment discount amount.';
Visible = false;
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = Basic, Suite;
}
field("Payment Discount %"; Rec."Payment Discount %")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Payment Method Code"; Rec."Payment Method Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Shipment Method Code"; Rec."Shipment Method Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Remaining Amount"; Rec."Remaining Amount")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies the amount that remains to be paid for the posted purchase invoice.';
}
field(Closed; Rec.Closed)
{
ApplicationArea = Basic, Suite;
}
field(Cancelled; Rec.Cancelled)
{
ApplicationArea = Basic, Suite;
HideValue = not Rec.Cancelled;
Style = Unfavorable;
StyleExpr = Rec.Cancelled;
trigger OnDrillDown()
begin
Rec.ShowCorrectiveCreditMemo();
end;
}
field(Corrective; Rec.Corrective)
{
ApplicationArea = Basic, Suite;
HideValue = not Rec.Corrective;
Style = Unfavorable;
StyleExpr = Rec.Corrective;
trigger OnDrillDown()
begin
Rec.ShowCancelledCreditMemo();
end;
}
}
}
area(factboxes)
{
part("Attached Documents List"; "Doc. Attachment List Factbox")
{
ApplicationArea = All;
Caption = 'Documents';
UpdatePropagation = Both;
SubPageLink = "Table ID" = const(Database::"Purch. Inv. Header"),
"No." = field("No.");
}
part(IncomingDocAttachFactBox; "Incoming Doc. Attach. FactBox")
{
ApplicationArea = Basic, Suite;
ShowFilter = false;
Visible = not IsOfficeAddin;
}
part(GLEntriesPart; "G/L Entries Part")
{
ApplicationArea = Basic, Suite;
Caption = 'Related G/L Entries';
ShowFilter = false;
SubPageLink = "Posting Date" = field("Posting Date"), "Document No." = field("No.");
}
systempart(Control1900383207; Links)
{
ApplicationArea = RecordLinks;
Visible = false;
}
systempart(Control1905767507; Notes)
{
ApplicationArea = Notes;
}
}
}
actions
{
area(navigation)
{
group("&Invoice")
{
Caption = '&Invoice';
Image = Invoice;
action(Statistics)
{
ApplicationArea = Suite;
Caption = 'Statistics';
Image = Statistics;
RunObject = Page "Purchase Invoice Statistics";
RunPageLink = "No." = field("No.");
ShortCutKey = 'F7';
ToolTip = 'View statistical information, such as the value of posted entries, for the record.';
}
action("Co&mments")
{
ApplicationArea = Comments;
Caption = 'Co&mments';
Image = ViewComments;
RunObject = Page "Purch. Comment Sheet";
RunPageLink = "Document Type" = const("Posted Invoice"),
"No." = field("No.");
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.ShowDimensions();
end;
}
action(IncomingDoc)
{
AccessByPermission = TableData "Incoming Document" = R;
ApplicationArea = Basic, Suite;
Caption = 'Incoming Document';
Image = Document;
ToolTip = 'View or create an incoming document record that is linked to the entry or document.';
trigger OnAction()
var
IncomingDocument: Record "Incoming Document";
begin
IncomingDocument.ShowCard(Rec."No.", Rec."Posting Date");
end;
}
}
}
area(processing)
{
action("&Print")
{
ApplicationArea = Basic, 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.';
Visible = not IsOfficeAddin;
trigger OnAction()
var
PurchInvHeader: Record "Purch. Inv. Header";
begin
PurchInvHeader := Rec;
CurrPage.SetSelectionFilter(PurchInvHeader);
PurchInvHeader.PrintRecords(true);
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
PurchInvHeader: Record "Purch. Inv. Header";
begin
PurchInvHeader := Rec;
CurrPage.SetSelectionFilter(PurchInvHeader);
Rec.PrintToDocumentAttachment(PurchInvHeader);
end;
}
action(Navigate)
{
ApplicationArea = Basic, Suite;
Caption = 'Find entries...';
Image = Navigate;
Scope = Repeater;
ShortCutKey = 'Ctrl+Alt+Q';
ToolTip = 'Find entries and documents that exist for the document number and posting date on the selected document. (Formerly this action was named Navigate.)';
Visible = not IsOfficeAddin;
trigger OnAction()
begin
Rec.Navigate();
end;
}
group(RelatedInformationNavigation)
{
Caption = 'Navigation';
Image = Invoice;
action(Vendor)
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor';
Image = Vendor;
RunObject = Page "Vendor Card";
RunPageLink = "No." = field("Buy-from Vendor No.");
Scope = Repeater;
ShortCutKey = 'Shift+F7';
ToolTip = 'View or edit detailed information about the vendor on the purchase document.';
}
}
group(Correct)
{
Caption = 'Correct';
action(CorrectInvoice)
{
ApplicationArea = Basic, Suite;
Caption = 'Correct';
Image = Undo;
Scope = Repeater;
ToolTip = 'Reverse this posted invoice. A credit memo will be created and matched with the invoice, and the invoice will be canceled. Shipments for the invoice will be reversed. To create a new invoice with the same information, use the Copy function. When you copy an invoice, remember to post shipments for the new invoice.';
Visible = not Rec.Cancelled;
trigger OnAction()
begin
CODEUNIT.Run(CODEUNIT::"Correct PstdPurchInv (Yes/No)", Rec);
end;
}
action(CancelInvoice)
{
ApplicationArea = Basic, Suite;
Caption = 'Cancel';
Image = Cancel;
Scope = Repeater;
ToolTip = 'Create and post a purchase credit memo that reverses this posted purchase invoice. This posted purchase invoice will be canceled.';
Visible = not Rec.Cancelled;
trigger OnAction()
begin
CODEUNIT.Run(CODEUNIT::"Cancel PstdPurchInv (Yes/No)", Rec);
end;
}
action(CreateCreditMemo)
{
ApplicationArea = Basic, Suite;
Caption = 'Create Corrective Credit Memo';
Image = CreateCreditMemo;
Scope = Repeater;
ToolTip = 'Create a credit memo for this posted invoice that you complete and post manually to reverse the posted invoice.';
trigger OnAction()
var
PurchaseHeader: Record "Purchase Header";
CorrectPostedPurchInvoice: Codeunit "Correct Posted Purch. Invoice";
begin
if CorrectPostedPurchInvoice.CreateCreditMemoCopyDocument(Rec, PurchaseHeader) then
PAGE.Run(PAGE::"Purchase Credit Memo", PurchaseHeader);
end;
}
action(ShowCreditMemo)
{
ApplicationArea = Basic, Suite;
Caption = 'Show Canceled/Corrective Credit Memo';
Image = CreditMemo;
Scope = Repeater;
ToolTip = 'Open the posted purchase credit memo that was created when you canceled the posted purchase invoice. If the posted purchase invoice is the result of a canceled purchase credit memo, then the canceled purchase credit memo will open.';
Visible = Rec.Cancelled or Rec.Corrective;
trigger OnAction()
begin
Rec.ShowCanceledOrCorrCrMemo();
end;
}
}
action("Update Document")
{
ApplicationArea = Basic, Suite;
Caption = 'Update Document';
Image = Edit;
ToolTip = 'Add new information that is relevant to the document, such as a payment reference. You can only edit a few fields because the document has already been posted.';
trigger OnAction()
var
PostedPurchInvoiceUpdate: Page "Posted Purch. Invoice - Update";
begin
PostedPurchInvoiceUpdate.LookupMode := true;
PostedPurchInvoiceUpdate.SetRec(Rec);
PostedPurchInvoiceUpdate.RunModal();
end;
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';
actionref("Update Document_Promoted"; "Update Document")
{
}
actionref(Navigate_Promoted; Navigate)
{
}
}
group(Category_Category7)
{
Caption = 'Print/Send', Comment = 'Generated from the PromotedActionCategories property index 6.';
actionref("&Print_Promoted"; "&Print")
{
}
actionref(AttachAsPDF_Promoted; AttachAsPDF)
{
}
}
group(Category_Category6)
{
Caption = 'Print', Comment = 'Generated from the PromotedActionCategories property index 5.';
}
group(Category_Category4)
{
Caption = 'Correct', Comment = 'Generated from the PromotedActionCategories property index 3.';
ShowAs = SplitButton;
actionref(CorrectInvoice_Promoted; CorrectInvoice)
{
}
actionref(CancelInvoice_Promoted; CancelInvoice)
{
}
actionref(CreateCreditMemo_Promoted; CreateCreditMemo)
{
}
actionref(ShowCreditMemo_Promoted; ShowCreditMemo)
{
}
}
group(Category_Category5)
{
Caption = 'Invoice', Comment = 'Generated from the PromotedActionCategories property index 4.';
actionref(Dimensions_Promoted; Dimensions)
{
}
actionref(Statistics_Promoted; Statistics)
{
}
actionref("Co&mments_Promoted"; "Co&mments")
{
}
separator(Navigate_Separator)
{
}
actionref(IncomingDoc_Promoted; IncomingDoc)
{
}
actionref(Vendor_Promoted; Vendor)
{
}
}
group(Category_Category8)
{
Caption = 'Navigate', Comment = 'Generated from the PromotedActionCategories property index 7.';
}
group(Category_Report)
{
Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
}
}
}
trigger OnAfterGetCurrRecord()
begin
CurrPage.IncomingDocAttachFactBox.PAGE.LoadDataFromRecord(Rec);
end;
trigger OnOpenPage()
var
OfficeMgt: Codeunit "Office Management";
HasFilters: Boolean;
begin
HasFilters := Rec.GetFilters() <> '';
Rec.SetSecurityFilterOnRespCenter();
if HasFilters and not Rec.Find() then
if Rec.FindFirst() then;
IsOfficeAddin := OfficeMgt.IsAvailable();
end;
local procedure DoDrillDown()
var
PurchInvHeader: Record "Purch. Inv. Header";
begin
PurchInvHeader.Copy(Rec);
PurchInvHeader.SetRange("No.");
PAGE.Run(PAGE::"Posted Purchase Invoice", PurchInvHeader);
end;
var
IsOfficeAddin: Boolean;
}