Page 9309 Purchase Credit Memos
- App
- Base Application
- Namespace
- Microsoft.Purchases.Document
- Versions
- 17-28
- Source table
- 38
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Purchases/Document/PurchaseCreditMemos.Page.al811 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.CRM.Outlook;
using Microsoft.EServices.EDocument;
using Microsoft.Finance.Dimension;
using Microsoft.Foundation.Attachment;
using Microsoft.Foundation.Reporting;
using Microsoft.Purchases.Comment;
using Microsoft.Purchases.History;
using Microsoft.Purchases.Posting;
using Microsoft.Purchases.Reports;
using Microsoft.Purchases.Setup;
using Microsoft.Purchases.Vendor;
using Microsoft.Utilities;
using System.Automation;
using System.Text;
using System.Threading;
page 9309 "Purchase Credit Memos"
{
ApplicationArea = Basic, Suite;
Caption = 'Purchase Credit Memos';
CardPageID = "Purchase Credit Memo";
DataCaptionFields = "Buy-from Vendor No.";
Editable = false;
PageType = List;
AboutTitle = 'About Purchase Credit Memos';
AboutText = 'Create, manage, and post purchase credit memos to process vendor returns, allowances, or cancellations, reverse charges from purchase invoices, and adjust inventory and vendor balances for accurate financial reconciliation.';
QueryCategory = 'Purchase Credit Memos';
RefreshOnActivate = true;
SourceTable = "Purchase Header";
SourceTableView = where("Document Type" = const("Credit Memo"));
UsageCategory = Lists;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("No."; Rec."No.")
{
ApplicationArea = All;
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 = All;
ToolTip = 'Specifies the name of the vendor who delivered the items.';
}
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;
ToolTip = 'Specifies the name of the vendor who delivered the items.';
}
field("Vendor Authorization No."; Rec."Vendor Authorization No.")
{
ApplicationArea = Basic, Suite;
}
field("Vendor Cr. Memo No."; Rec."Vendor Cr. Memo No.")
{
ApplicationArea = Basic, Suite;
}
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;
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;
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;
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;
Visible = false;
}
field("Ship-to Contact"; Rec."Ship-to Contact")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Basic, 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;
ToolTip = 'Specifies the location where the items are to be shipped. This field acts as the default location for new lines. You can update the location code for individual lines as needed.';
}
field("Purchaser Code"; Rec."Purchaser Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Assigned User ID"; Rec."Assigned User ID")
{
ApplicationArea = Basic, Suite;
}
field("Currency Code"; Rec."Currency Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Document Date"; Rec."Document Date")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field(Status; Rec.Status)
{
ApplicationArea = Basic, Suite;
Visible = false;
StyleExpr = StatusStyleTxt;
}
field("Payment Terms Code"; Rec."Payment Terms Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = Basic, Suite;
ToolTip = 'Specifies when the invoice is due. The program calculates the date using the Payment Terms Code and Document Date fields.';
}
field(Amount; Rec.Amount)
{
ApplicationArea = Basic, Suite;
}
field("Amount Including VAT"; Rec."Amount Including VAT")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Payment Discount %"; Rec."Payment Discount %")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Applies-to Doc. Type"; Rec."Applies-to Doc. Type")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Job Queue Status"; Rec."Job Queue Status")
{
ApplicationArea = All;
Style = Unfavorable;
StyleExpr = Rec."Job Queue Status" = Rec."Job Queue Status"::ERROR;
ToolTip = 'Specifies the status of a job queue entry that handles the posting of purchase credit memos.';
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;
}
}
}
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 = Basic, Suite;
ShowFilter = false;
}
part(Control1901138007; "Vendor Details FactBox")
{
ApplicationArea = Basic, 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("&Credit Memo")
{
Caption = '&Credit Memo';
Image = CreditMemo;
action(PurchaseStatistics)
{
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 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 = 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.';
}
action(Vendor)
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor';
Image = Vendor;
RunObject = Page "Vendor Card";
RunPageLink = "No." = field("Buy-from Vendor No."),
"Date Filter" = field("Date Filter");
ShortCutKey = 'Shift+F7';
ToolTip = 'View or edit detailed information about the vendor on the purchase document.';
}
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(Action7)
{
Caption = 'Release';
Image = ReleaseDoc;
action(Release)
{
ApplicationArea = Basic, 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 = Basic, 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';
Image = "Action";
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("P&osting")
{
Caption = 'P&osting';
Image = Post;
action(Post)
{
ApplicationArea = Basic, Suite;
Caption = 'P&ost';
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.";
begin
CurrPage.SetSelectionFilter(PurchaseHeader);
if PurchaseHeader.Count > 1 then begin
PurchaseHeader.FindSet();
repeat
CheckPurchaseCheckAllLinesHaveQuantityAssigned(PurchaseHeader);
until PurchaseHeader.Next() = 0;
PurchaseBatchPostMgt.RunWithUI(PurchaseHeader, Rec.Count(), ReadyToPostQst);
end else
PostDocument(CODEUNIT::"Purch.-Post (Yes/No)");
end;
}
action(Preview)
{
ApplicationArea = Basic, 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(TestReport)
{
ApplicationArea = Basic, 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(PostAndPrint)
{
ApplicationArea = Basic, Suite;
Caption = 'Post and &Print';
Image = PostPrint;
ShortCutKey = 'Shift+F9';
ToolTip = 'Finalize print the document or journal. The values and quantities are posted to the related accounts.';
Visible = not IsOfficeAddin;
trigger OnAction()
begin
PostDocument(CODEUNIT::"Purch.-Post + Print");
end;
}
action(PostBatch)
{
ApplicationArea = Basic, 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
CheckPurchaseCheckAllLinesHaveQuantityAssigned(Rec);
CurrPage.SetSelectionFilter(PurchaseHeader);
PurchaseHeader.SetFilter("No.", SelectionFilterManagement.GetSelectionFilterForPurchaseHeader(PurchaseHeader));
REPORT.RunModal(REPORT::"Batch Post Purch. Credit Memos", true, true, PurchaseHeader);
CurrPage.Update(false);
end;
}
action(RemoveFromJobQueue)
{
ApplicationArea = All;
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)
{
group(Sales)
{
Caption = 'Sales';
Image = Sales;
#if not CLEAN28
action("<Report Vendor - Top 10 List>")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor - Top 10 List (Obsolete)';
Image = "Report";
RunObject = Report "Vendor - Top 10 List";
ToolTip = 'View a list of the vendors from whom you purchase the most or to whom you owe the most.';
ObsoleteState = Pending;
ObsoleteReason = 'This report has been replaced by the report Vendor - Top List (Excel). This report will be removed in a future release.';
ObsoleteTag = '28.0';
}
#endif
action("<Report Vendor - Purchase List>")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor - Purchase List';
Image = "Report";
RunObject = Report "Vendor - Purchase List";
}
action("<Report Puchase Statistics>")
{
ApplicationArea = Basic, Suite;
Caption = 'Purchase Statistics';
Image = "Report";
RunObject = Report "Purchase Statistics";
}
}
group(Finance)
{
Caption = 'Finance';
Image = Sales;
action("Vendor - Balance to Date")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor - Balance to Date';
Image = "Report";
RunObject = Report "Vendor - Balance to Date";
}
action("<Report Vendor - Trial Balance")
{
ApplicationArea = Suite;
Caption = 'Vendor - Trial Balance';
Image = "Report";
RunObject = Report "Vendor - Trial Balance";
}
action("<Report Vendor - Detail Trial ")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor - Detail. Trial Balance';
Image = "Report";
RunObject = Report "Vendor - Detail Trial Balance";
}
#if not CLEAN28
action("<Report Vendor - Summary Aging")
{
ApplicationArea = Basic, Suite;
Caption = 'Vendor - Summary Aging (Obsolete)';
Image = "Report";
RunObject = Report "Vendor - Summary Aging";
ToolTip = 'View, print, or save a summary of the payables owed to each vendor, divided into three time periods. The report can be used to prepare liquidity analyses.';
ObsoleteState = Pending;
ObsoleteReason = 'This report will be removed in a future release. Check the documentation for alternative options such as the report Aged Accounts Payable (Excel).';
ObsoleteTag = '28.0';
}
action("<Report Aged Accounts Payables")
{
ApplicationArea = Basic, Suite;
Caption = 'Aged Accounts Payable (Obsolete)';
Image = "Report";
RunObject = Report "Aged Accounts Payable";
ToolTip = 'View an overview of when your payables to vendors are due or overdue (divided into four periods). You must specify the date you want aging calculated from and the length of the period that each column will contain data for.';
ObsoleteState = Pending;
ObsoleteReason = 'This report has been replaced by the report Aged Accounts Payable (Excel). This report will be removed in a future release.';
ObsoleteTag = '28.0';
}
#endif
action("<Report Vendor - Payment Recei")
{
ApplicationArea = Suite;
Caption = 'Vendor - Payment Receipt';
Image = "Report";
RunObject = Report "Vendor - Payment Receipt";
}
}
}
area(Promoted)
{
group(Category_Category6)
{
Caption = 'Release', Comment = 'Generated from the PromotedActionCategories property index 5.';
ShowAs = SplitButton;
actionref(Release_Promoted; Release)
{
}
actionref(Reopen_Promoted; Reopen)
{
}
}
group(Category_Category7)
{
Caption = 'Posting', Comment = 'Generated from the PromotedActionCategories property index 6.';
ShowAs = SplitButton;
actionref(Post_Promoted; Post)
{
}
actionref(PostAndPrint_Promoted; PostAndPrint)
{
}
actionref(PostBatch_Promoted; PostBatch)
{
}
actionref(Preview_Promoted; Preview)
{
}
}
group(Category_Category4)
{
Caption = 'Request Approval', Comment = 'Generated from the PromotedActionCategories property index 3.';
}
group(Category_Category5)
{
Caption = 'Credit Memo', Comment = 'Generated from the PromotedActionCategories property index 4.';
actionref(Dimensions_Promoted; Dimensions)
{
}
actionref(PurchaseStatistics_Promoted; PurchaseStatistics)
{
}
actionref("Co&mments_Promoted"; "Co&mments")
{
}
actionref(Approvals_Promoted; Approvals)
{
}
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 OnAfterGetRecord()
begin
StatusStyleTxt := Rec.GetStatusStyleText();
end;
trigger OnAfterGetCurrRecord()
begin
SetControlAppearance();
CurrPage.IncomingDocAttachFactBox.PAGE.LoadDataFromRecord(Rec);
end;
trigger OnOpenPage()
var
PurchasesPayablesSetup: Record "Purchases & Payables Setup";
OfficeMgt: Codeunit "Office Management";
begin
Rec.SetSecurityFilterOnRespCenter();
JobQueueActive := PurchasesPayablesSetup.JobQueueActive();
IsOfficeAddin := OfficeMgt.IsAvailable();
Rec.CopyBuyFromVendorFilter();
end;
var
ReportPrint: Codeunit "Test Report-Print";
LinesInstructionMgt: Codeunit "Lines Instruction Mgt.";
JobQueueActive: Boolean;
OpenApprovalEntriesExist: Boolean;
IsOfficeAddin: Boolean;
CanCancelApprovalForRecord: Boolean;
OpenPostedPurchCrMemoQst: Label 'The credit memo is posted as number %1 and moved to the Posted Purchase Credit Memos window.\\Do you want to open the posted credit memo?', Comment = '%1 = posted document number';
ReadyToPostQst: Label 'The number of credit memos 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;
local procedure CheckPurchaseCheckAllLinesHaveQuantityAssigned(PurchaseHeader: Record "Purchase Header")
var
LinesInstructionMgt: Codeunit "Lines Instruction Mgt.";
begin
LinesInstructionMgt.PurchaseCheckAllLinesHaveQuantityAssigned(PurchaseHeader);
end;
local procedure PostDocument(PostingCodeunitID: Integer)
var
PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr.";
InstructionMgt: Codeunit "Instruction Mgt.";
PreAssignedNo: Code[20];
xLastPostingNo: Code[20];
IsScheduledPosting: Boolean;
IsHandled: Boolean;
begin
LinesInstructionMgt.PurchaseCheckAllLinesHaveQuantityAssigned(Rec);
PreAssignedNo := Rec."No.";
xLastPostingNo := Rec."Last Posting No.";
Rec.SendToPosting(PostingCodeunitID);
IsScheduledPosting := Rec."Job Queue Status" = Rec."Job Queue Status"::"Scheduled for Posting";
if IsScheduledPosting then
CurrPage.Close();
CurrPage.Update(false);
IsHandled := false;
OnPostDocumentBeforeNavigateAfterPosting(Rec, PostingCodeunitID, IsHandled);
if IsHandled then
exit;
if PostingCodeunitID <> CODEUNIT::"Purch.-Post (Yes/No)" then
exit;
if IsOfficeAddin then begin
if (Rec."Last Posting No." <> '') and (Rec."Last Posting No." <> xLastPostingNo) then
PurchCrMemoHdr.SetRange("No.", Rec."Last Posting No.")
else
PurchCrMemoHdr.SetRange("Pre-Assigned No.", PreAssignedNo);
if PurchCrMemoHdr.FindFirst() then
PAGE.Run(PAGE::"Posted Purchase Credit Memo", PurchCrMemoHdr);
end else
if InstructionMgt.IsEnabled(InstructionMgt.ShowPostedConfirmationMessageCode()) then
ShowPostedConfirmationMessage(PreAssignedNo, xLastPostingNo);
end;
local procedure ShowPostedConfirmationMessage(PreAssignedNo: Code[20]; xLastPostingNo: Code[20])
var
PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr.";
InstructionMgt: Codeunit "Instruction Mgt.";
begin
if (Rec."Last Posting No." <> '') and (Rec."Last Posting No." <> xLastPostingNo) then
PurchCrMemoHdr.SetRange("No.", Rec."Last Posting No.")
else
PurchCrMemoHdr.SetRange("Pre-Assigned No.", PreAssignedNo);
if PurchCrMemoHdr.FindFirst() then
if InstructionMgt.ShowConfirm(StrSubstNo(OpenPostedPurchCrMemoQst, PurchCrMemoHdr."No."),
InstructionMgt.ShowPostedConfirmationMessageCode())
then
InstructionMgt.ShowPostedDocument(PurchCrMemoHdr, Page::"Purchase Credit Memos");
end;
[IntegrationEvent(true, false)]
local procedure OnPostDocumentBeforeNavigateAfterPosting(var PurchaseHeader: Record "Purchase Header"; var PostingCodeunitID: Integer; var IsHandled: Boolean)
begin
end;
}