-
Notifications
You must be signed in to change notification settings - Fork 688
Open
Labels
SCMGitHub request for SCM areaGitHub request for SCM areaevent-requestRequest for adding an eventRequest for adding an event
Description
Why do you need this change?
We need close the page by our logic.
Describe the request
Please add current page as paramater to event.
local procedure PostDocument(PostingCodeunitID: Integer; Navigate: Enum "Navigate After Posting")
var
SalesHeader: Record "Sales Header";
SalesInvoiceHeader: Record "Sales Invoice Header";
OfficeMgt: Codeunit "Office Management";
InstructionMgt: Codeunit "Instruction Mgt.";
PreAssignedNo: Code[20];
xLastPostingNo: Code[20];
IsScheduledPosting: Boolean;
IsHandled: Boolean;
begin
LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(Rec);
PreAssignedNo := Rec."No.";
xLastPostingNo := Rec."Last Posting No.";
Rec.SendToPosting(PostingCodeunitID);
IsScheduledPosting := Rec."Job Queue Status" = Rec."Job Queue Status"::"Scheduled for Posting";
DocumentIsPosted := (not SalesHeader.Get(Rec."Document Type", Rec."No.")) or IsScheduledPosting;
OnPostOnAfterSetDocumentIsPosted(SalesHeader, IsScheduledPosting, DocumentIsPosted);
if IsScheduledPosting then
CurrPage.Close();
CurrPage.Update(false);
IsHandled := false;
OnPostDocumentBeforeNavigateAfterPosting(Rec, PostingCodeunitID, Navigate, DocumentIsPosted, IsHandled);
if IsHandled then
exit;
if PostingCodeunitID <> CODEUNIT::"Sales-Post (Yes/No)" then
exit;
if OfficeMgt.IsAvailable() then begin
if (Rec."Last Posting No." <> '') and (Rec."Last Posting No." <> xLastPostingNo) then
SalesInvoiceHeader.SetRange("No.", Rec."Last Posting No.")
else begin
SalesInvoiceHeader.SetCurrentKey("Pre-Assigned No.");
SalesInvoiceHeader.SetRange("Pre-Assigned No.", PreAssignedNo);
end;
if SalesInvoiceHeader.FindFirst() then
PAGE.Run(PAGE::"Posted Sales Invoice", SalesInvoiceHeader);
end else
case Navigate of
Enum::"Navigate After Posting"::"Posted Document":
if InstructionMgt.IsEnabled(InstructionMgt.ShowPostedConfirmationMessageCode()) then
ShowPostedConfirmationMessage(PreAssignedNo, xLastPostingNo);
Enum::"Navigate After Posting"::"New Document":
if DocumentIsPosted then begin
SalesHeader.Init();
SalesHeader.Validate("Document Type", SalesHeader."Document Type"::Invoice);
OnPostOnBeforeSalesHeaderInsert(SalesHeader);
SalesHeader.Insert(true);
PAGE.Run(PAGE::"Sales Invoice", SalesHeader);
end;
else
//---------------------------------------------------------OnPostDocumentOnElseCaseNavigateAfterPosting:BEGIN
//OnPostDocumentOnElseCaseNavigateAfterPosting(SalesHeader, PostingCodeunitID, Navigate);
OnPostDocumentOnElseCaseNavigateAfterPosting(SalesHeader, PostingCodeunitID, Navigate, CurrPage);
//---------------------------------------------------------OnPostDocumentOnElseCaseNavigateAfterPosting:END
end;
end;
//---------------------------------------------------------OnPostDocumentOnElseCaseNavigateAfterPosting:BEGIN
[IntegrationEvent(false, false)]
//local procedure OnPostDocumentOnElseCaseNavigateAfterPosting(var SalesHeader: Record "Sales Header"; PostingCodeunitID: Integer; Navigate: Enum "Navigate After Posting")
local procedure OnPostDocumentOnElseCaseNavigateAfterPosting(var SalesHeader: Record "Sales Header"; PostingCodeunitID: Integer; Navigate: Enum "Navigate After Posting", var CurrPage: Page "Sales Invoice")
begin
end;
//---------------------------------------------------------OnPostDocumentOnElseCaseNavigateAfterPosting:END
Internal work item: AB#620274
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
SCMGitHub request for SCM areaGitHub request for SCM areaevent-requestRequest for adding an eventRequest for adding an event