Page 9305 Sales Order List
- App
- Base Application
- Namespace
- Microsoft.Sales.Document
- Versions
- 17-28
- Source table
- 36
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Sales/Document/SalesOrderList.Page.al1337 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.Sales.Document;
using Microsoft.CRM.Outlook;
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.Integration.D365Sales;
using Microsoft.Integration.Dataverse;
using Microsoft.Intercompany.GLAccount;
using Microsoft.Inventory.Availability;
using Microsoft.Sales.Analysis;
using Microsoft.Sales.Comment;
using Microsoft.Sales.Customer;
using Microsoft.Sales.History;
using Microsoft.Sales.Posting;
#if not CLEAN28
using Microsoft.Sales.Reports;
#endif
using Microsoft.Sales.Setup;
using Microsoft.Utilities;
using Microsoft.Warehouse.Activity;
using Microsoft.Warehouse.Document;
using Microsoft.Warehouse.InventoryDocument;
using Microsoft.Warehouse.Request;
using System.Automation;
using System.Integration.PowerBI;
using System.Text;
using System.Threading;
/// <summary>
/// Displays a list of sales orders for managing customer order processing and fulfillment.
/// </summary>
page 9305 "Sales Order List"
{
ApplicationArea = Basic, Suite, Assembly;
Caption = 'Sales Orders';
CardPageID = "Sales Order";
DataCaptionFields = "Sell-to Customer No.";
Editable = false;
PageType = List;
QueryCategory = 'Sales Order List';
RefreshOnActivate = true;
SourceTable = "Sales Header";
SourceTableView = where("Document Type" = const(Order));
UsageCategory = Lists;
AdditionalSearchTerms = 'Sales Commitments, Sales Order Overview, Sale Orders, Order Log, Sale List, Client Orders';
AboutTitle = 'About sales orders';
AboutText = 'Use a sales order when you partially ship or invoice an order, and when you use drop shipments or prepayments. For sales that are fully shipped and invoiced in one go, sales invoices are typically used instead.';
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("No."; Rec."No.")
{
ApplicationArea = Basic, Suite;
}
field("Sell-to Customer No."; Rec."Sell-to Customer No.")
{
ApplicationArea = Basic, Suite;
}
field("Sell-to Customer Name"; Rec."Sell-to Customer Name")
{
ApplicationArea = Basic, Suite;
}
field("External Document No."; Rec."External Document No.")
{
ApplicationArea = Basic, Suite;
}
field("Sell-to Post Code"; Rec."Sell-to Post Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Sell-to Country/Region Code"; Rec."Sell-to Country/Region Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Sell-to Contact"; Rec."Sell-to Contact")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Bill-to Customer No."; Rec."Bill-to Customer No.")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Bill-to Name"; Rec."Bill-to Name")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Bill-to Post Code"; Rec."Bill-to Post Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Bill-to Country/Region Code"; Rec."Bill-to Country/Region Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Bill-to Contact"; Rec."Bill-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;
}
field("Quote No."; Rec."Quote No.")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Salesperson Code"; Rec."Salesperson 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;
}
field("Requested Delivery Date"; Rec."Requested Delivery Date")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Campaign No."; Rec."Campaign No.")
{
ApplicationArea = RelationshipMgmt;
Visible = false;
}
field(Status; Rec.Status)
{
ApplicationArea = Basic, Suite;
StyleExpr = StatusStyleTxt;
}
field("Payment Terms Code"; Rec."Payment Terms Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Payment Discount %"; Rec."Payment Discount %")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Shipment Method Code"; Rec."Shipment Method Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Shipping Agent Code"; Rec."Shipping Agent Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Shipping Agent Service Code"; Rec."Shipping Agent Service Code")
{
ApplicationArea = Suite;
Visible = false;
}
field("Package Tracking No."; Rec."Package Tracking No.")
{
ApplicationArea = Suite;
Visible = false;
}
field("Shipment Date"; Rec."Shipment Date")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Shipping Advice"; Rec."Shipping Advice")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Completely Shipped"; Rec."Completely Shipped")
{
ApplicationArea = Basic, Suite;
AboutTitle = 'Is the order completely shipped?';
AboutText = 'Sales orders stay in this list until their order quantities are fully shipped and invoiced. After that you can find them in the Posted Sales Invoice and Posted Sales Shipment lists.';
}
field("Job Queue Status"; Rec."Job Queue Status")
{
ApplicationArea = All;
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("Amt. Ship. Not Inv. (LCY) Base"; Rec."Amt. Ship. Not Inv. (LCY) Base")
{
ApplicationArea = Basic, Suite;
}
field("Amt. Ship. Not Inv. (LCY)"; Rec."Amt. Ship. Not Inv. (LCY)")
{
ApplicationArea = Basic, Suite;
}
field(Amount; Rec.Amount)
{
ApplicationArea = Basic, Suite;
}
field("Amount Including VAT"; Rec."Amount Including VAT")
{
ApplicationArea = Basic, Suite;
}
field("Posting Description"; Rec."Posting Description")
{
ApplicationArea = Suite;
Visible = false;
}
field("Your Reference"; Rec."Your Reference")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Coupled to Dataverse"; Rec."Coupled to Dataverse")
{
ApplicationArea = All;
Visible = CRMIntegrationEnabled and BidirectionalSalesOrderIntEnabled;
}
}
}
area(factboxes)
{
part("Attached Documents List"; "Doc. Attachment List Factbox")
{
ApplicationArea = All;
Caption = 'Documents';
UpdatePropagation = Both;
SubPageLink = "Table ID" = const(Database::"Sales Header"),
"No." = field("No."),
"Document Type" = field("Document Type");
}
part(PowerBIEmbeddedReportPart; "Power BI Embedded Report Part")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
part(Control1902018507; "Customer Statistics FactBox")
{
ApplicationArea = Basic, Suite;
SubPageLink = "No." = field("Bill-to Customer No."),
"Date Filter" = field("Date Filter");
}
part(Control1900316107; "Customer Details FactBox")
{
ApplicationArea = Basic, Suite;
SubPageLink = "No." = field("Bill-to Customer No."),
"Date Filter" = field("Date Filter");
}
part(IncomingDocAttachFactBox; "Incoming Doc. Attach. FactBox")
{
ApplicationArea = Basic, Suite;
ShowFilter = false;
Visible = false;
}
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(SalesOrderStatistics)
{
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 "Sales Order Statistics";
RunPageOnRec = true;
}
action(CustomerStatistics)
{
ApplicationArea = Basic, Suite;
Caption = 'Customer Statistics';
Image = Statistics;
RunObject = Page "Customer Statistics";
RunPageLink = "No." = field("Sell-to Customer No."),
"Date Filter" = field("Date Filter");
ToolTip = 'View statistical information, such as the value of posted entries, for the sell-to customer on the sales document.';
}
action(Approvals)
{
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.OpenApprovalsSales(Rec);
end;
}
action("Co&mments")
{
ApplicationArea = Comments;
Caption = 'Co&mments';
Image = ViewComments;
RunObject = Page "Sales 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("S&hipments")
{
ApplicationArea = Basic, Suite;
Caption = 'S&hipments';
Image = Shipment;
RunObject = Page "Posted Sales Shipments";
RunPageLink = "Order No." = field("No.");
RunPageView = sorting("Order No.");
ToolTip = 'View related posted sales shipments.';
}
action(PostedSalesInvoices)
{
ApplicationArea = Basic, Suite;
Caption = 'Invoices';
Image = Invoice;
ToolTip = 'View a list of ongoing sales invoices for the order.';
AboutTitle = 'What has been invoiced?';
AboutText = 'Here you can look up what has already been invoiced on an order.';
trigger OnAction()
var
TempSalesInvoiceHeader: Record "Sales Invoice Header" temporary;
SalesGetShipment: Codeunit "Sales-Get Shipment";
begin
SalesGetShipment.GetSalesOrderInvoices(TempSalesInvoiceHeader, Rec."No.");
Page.Run(Page::"Posted Sales Invoices", TempSalesInvoiceHeader);
end;
}
action(PostedSalesPrepmtInvoices)
{
ApplicationArea = Prepayments;
Caption = 'Prepa&yment Invoices';
Image = PrepaymentInvoice;
RunObject = Page "Posted Sales Invoices";
RunPageLink = "Prepayment Order No." = field("No.");
RunPageView = sorting("Prepayment Order No.");
ToolTip = 'View related posted sales invoices that involve a prepayment. ';
}
action("Prepayment Credi&t Memos")
{
ApplicationArea = Prepayments;
Caption = 'Prepayment Credi&t Memos';
Image = PrepaymentCreditMemo;
RunObject = Page "Posted Sales Credit Memos";
RunPageLink = "Prepayment Order No." = field("No.");
RunPageView = sorting("Prepayment Order No.");
ToolTip = 'View related posted sales credit memos that involve a prepayment. ';
}
}
group(Warehouse)
{
Caption = 'Warehouse';
Image = Warehouse;
action("Warehouse Shipment Lines")
{
ApplicationArea = Warehouse;
Caption = 'Warehouse Shipment Lines';
Image = ShipmentLines;
RunObject = Page "Whse. Shipment Lines";
RunPageLink = "Source Type" = const(37),
#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 shipments for the document, in advanced warehouse configurations.';
}
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("Sales 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 sales order.';
}
action("Whse. Pick Lines")
{
ApplicationArea = Warehouse;
Caption = 'Warehouse Pick Lines';
Image = PickLines;
RunObject = page "Warehouse Activity Lines";
RunPageLink = "Source Document" = const("Sales Order"), "Source No." = field("No.");
RunPageView = sorting("Source Type", "Source Subtype", "Source No.");
ToolTip = 'View items that are outbound on warehouse pick documents for the sales order.';
}
}
group(ActionGroupCRM)
{
Caption = 'Dynamics 365 Sales';
Visible = CRMIntegrationEnabled;
action(CRMGoToSalesOrderListInNAV)
{
ApplicationArea = Basic, Suite;
Caption = 'Sales Order List';
Enabled = CRMIntegrationEnabled;
Image = "Order";
ToolTip = 'Open the Sales Order List - Dynamics 365 Sales page in Business Central';
Visible = CRMIntegrationEnabled and (not BidirectionalSalesOrderIntEnabled);
trigger OnAction()
var
CRMSalesorder: Record "CRM Salesorder";
begin
PAGE.Run(PAGE::"CRM Sales Order List", CRMSalesorder);
end;
}
action(CRMGoToSalesOrder)
{
ApplicationArea = Basic, Suite;
Caption = 'Sales Order';
Enabled = CRMIntegrationEnabled and CRMIsCoupledToRecord;
Image = CoupledOrder;
ToolTip = 'View the selected sales order.';
Visible = BidirectionalSalesOrderIntEnabled;
trigger OnAction()
var
CRMIntegrationManagement: Codeunit "CRM Integration Management";
begin
CRMIntegrationManagement.ShowCRMEntityFromRecordID(Rec.RecordId);
end;
}
action(CRMSynchronizeNow)
{
AccessByPermission = TableData "CRM Integration Record" = IM;
ApplicationArea = Suite;
Caption = 'Synchronize';
Image = Refresh;
ToolTip = 'Send updated data to Dynamics 365 Sales.';
Visible = BidirectionalSalesOrderIntEnabled;
trigger OnAction()
var
SalesHeader: Record "Sales Header";
CRMIntegrationManagement: Codeunit "CRM Integration Management";
SalesHeaderRecordRef: RecordRef;
begin
CurrPage.SetSelectionFilter(SalesHeader);
SalesHeader.SetRange(Status, SalesHeader.Status::Released);
SalesHeader.Next();
if SalesHeader.Count = 1 then
CRMIntegrationManagement.UpdateOneNow(SalesHeader.RecordId)
else begin
SalesHeaderRecordRef.GetTable(SalesHeader);
CRMIntegrationManagement.UpdateMultipleNow(SalesHeaderRecordRef);
end
end;
}
group(Coupling)
{
Caption = 'Coupling', Comment = 'Coupling is a noun';
Image = LinkAccount;
ToolTip = 'Create, change, or delete a coupling between the Business Central record and a Dynamics 365 Sales record.';
Enabled = Rec.Status = Rec.Status::Released;
Visible = BidirectionalSalesOrderIntEnabled;
action(ManageCRMCoupling)
{
AccessByPermission = TableData "CRM Integration Record" = IM;
ApplicationArea = Suite;
Caption = 'Set Up Coupling';
Image = LinkAccount;
ToolTip = 'Create or modify the coupling to a Dynamics 365 Sales order.';
trigger OnAction()
var
CRMIntegrationManagement: Codeunit "CRM Integration Management";
begin
CRMIntegrationManagement.DefineCoupling(Rec.RecordId);
end;
}
action(DeleteCRMCoupling)
{
AccessByPermission = TableData "CRM Integration Record" = D;
ApplicationArea = Suite;
Caption = 'Delete Coupling';
Enabled = CRMIsCoupledToRecord;
Image = UnLinkAccount;
ToolTip = 'Delete the coupling to a Dynamics 365 Sales order.';
trigger OnAction()
var
SalesHeader: Record "Sales Header";
CRMCouplingManagement: Codeunit "CRM Coupling Management";
RecRef: RecordRef;
begin
CurrPage.SetSelectionFilter(SalesHeader);
RecRef.GetTable(SalesHeader);
CRMCouplingManagement.RemoveCoupling(RecRef);
end;
}
}
action(ShowLog)
{
ApplicationArea = Suite;
Caption = 'Synchronization Log';
Image = Log;
ToolTip = 'View integration synchronization jobs for the sales order table.';
Visible = BidirectionalSalesOrderIntEnabled;
Enabled = Rec.Status = Rec.Status::Released;
trigger OnAction()
var
CRMIntegrationManagement: Codeunit "CRM Integration Management";
begin
CRMIntegrationManagement.ShowLog(Rec.RecordId);
end;
}
}
}
area(processing)
{
group(Action12)
{
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
SalesHeader: Record "Sales Header";
begin
CurrPage.SetSelectionFilter(SalesHeader);
Rec.PerformManualRelease(SalesHeader);
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
SalesHeader: Record "Sales Header";
begin
CurrPage.SetSelectionFilter(SalesHeader);
Rec.PerformManualReopen(SalesHeader);
end;
}
}
group("F&unctions")
{
Caption = 'F&unctions';
Image = "Action";
action("Pla&nning")
{
ApplicationArea = Planning;
Caption = 'Pla&nning';
Image = Planning;
ToolTip = 'Open a tool for manual supply planning that displays all new demand along with availability information and suggestions for supply. It provides the visibility and tools needed to plan for demand from sales lines and component lines and then create different types of supply orders directly.';
trigger OnAction()
var
SalesOrderPlanningForm: Page "Sales Order Planning";
begin
SalesOrderPlanningForm.SetSalesOrder(Rec."No.");
SalesOrderPlanningForm.RunModal();
end;
}
action("Order &Promising")
{
AccessByPermission = TableData "Order Promising Line" = R;
ApplicationArea = OrderPromising;
Caption = 'Order &Promising';
Image = OrderPromising;
ToolTip = 'Calculate the shipment and delivery dates based on the item''s known and expected availability dates, and then promise the dates to the customer.';
trigger OnAction()
var
TempOrderPromisingLine: Record "Order Promising Line" temporary;
begin
TempOrderPromisingLine.SetRange("Source Type", Rec."Document Type");
TempOrderPromisingLine.SetRange("Source ID", Rec."No.");
PAGE.RunModal(PAGE::"Order Promising Lines", TempOrderPromisingLine);
end;
}
action("Send IC Sales Order Cnfmn.")
{
AccessByPermission = TableData "IC G/L Account" = R;
ApplicationArea = Intercompany;
Caption = 'Send IC Sales Order Cnfmn.';
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
SalesHeader: Record "Sales Header";
begin
CurrPage.SetSelectionFilter(SalesHeader);
Rec.SendICSalesDoc(SalesHeader);
end;
}
action("Delete Invoiced")
{
ApplicationArea = Basic, Suite;
Caption = 'Delete Invoiced Sales Orders';
Image = Delete;
RunObject = Report "Delete Invoiced Sales 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.CheckSalesApprovalPossible(Rec) then
ApprovalsMgmt.OnSendSalesDocForApproval(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.OnCancelSalesApprovalRequest(Rec);
WorkflowWebhookManagement.FindAndCancel(Rec.RecordId);
end;
}
}
group(Action3)
{
Caption = 'Warehouse';
Image = Warehouse;
action("Create Inventor&y Put-away/Pick")
{
AccessByPermission = TableData "Posted Invt. Pick 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;
}
action("Create &Warehouse Shipment")
{
AccessByPermission = TableData "Warehouse Shipment Header" = R;
ApplicationArea = Warehouse;
Caption = 'Create &Warehouse Shipment';
Image = NewShipment;
ToolTip = 'Create a warehouse shipment to start a pick a ship process according to an advanced warehouse configuration.';
trigger OnAction()
var
GetSourceDocOutbound: Codeunit "Get Source Doc. Outbound";
begin
Rec.PerformManualRelease();
GetSourceDocOutbound.CreateFromSalesOrder(Rec);
if not Rec.Find('=><') then
Rec.Init();
end;
}
}
group("P&osting")
{
Caption = 'P&osting';
Image = Post;
action(Post)
{
ApplicationArea = Basic, 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
SalesHeader: Record "Sales Header";
SalesBatchPostMgt: Codeunit "Sales Batch Post Mgt.";
BatchProcessingMgt: Codeunit "Batch Processing Mgt.";
IsHandled: Boolean;
begin
CurrPage.SetSelectionFilter(SalesHeader);
OnAfterPostingSetSelectionFilter(SalesHeader, Rec);
if SalesHeader.Count > 1 then begin
IsHandled := false;
OnBeforePostActionWithMoreThanOneDoc(SalesHeader, BatchProcessingMgt, IsHandled);
if IsHandled then
exit;
BatchProcessingMgt.SetParametersForPageID(Page::"Sales Order List");
SalesBatchPostMgt.SetBatchProcessor(BatchProcessingMgt);
SalesBatchPostMgt.RunWithUI(SalesHeader, Rec.Count, ReadyToPostQst);
end else
PostDocument(CODEUNIT::"Sales-Post (Yes/No)");
end;
}
action(PostAndSend)
{
ApplicationArea = Basic, Suite;
Caption = 'Post and Send';
Ellipsis = true;
Image = PostMail;
ToolTip = 'Finalize and prepare to send the document according to the customer''s sending profile, such as attached to an email. The Send document to window opens where you can confirm or select a sending profile.';
trigger OnAction()
begin
PostDocument(CODEUNIT::"Sales-Post and Send");
end;
}
action("Test Report")
{
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.PrintSalesHeader(Rec);
end;
}
action("Post &Batch")
{
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
SalesHeader: Record "Sales Header";
SelectionFilterManagement: Codeunit SelectionFilterManagement;
begin
CurrPage.SetSelectionFilter(SalesHeader);
SalesHeader.SetFilter("No.", SelectionFilterManagement.GetSelectionFilterForSalesHeader(SalesHeader));
REPORT.RunModal(REPORT::"Batch Post Sales Orders", true, true, SalesHeader);
CurrPage.Update(false);
end;
}
action("Remove From Job Queue")
{
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;
}
action("Preview Posting")
{
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()
begin
ShowPreview();
end;
}
}
group("&Print")
{
Caption = '&Print';
Image = Print;
action("Work Order")
{
ApplicationArea = Basic, Suite;
Caption = 'Work Order';
Ellipsis = true;
Image = Print;
ToolTip = 'Prepare to registers actual item quantities or time used in connection with the sales order. For example, the document can be used by staff who perform any kind of processing work in connection with the sales order. It can also be exported to Excel if you need to process the sales line data further.';
trigger OnAction()
begin
PrintForUsage(Usage::"Work Order");
end;
}
action("Pick Instruction")
{
ApplicationArea = Warehouse;
Caption = 'Pick Instruction';
Image = Print;
ToolTip = 'Print a picking list that shows which items to pick and ship for the sales order. If an item is assembled to order, then the report includes rows for the assembly components that must be picked. Use this report as a pick instruction to employees in charge of picking sales items or assembly components for the sales order.';
trigger OnAction()
begin
PrintForUsage(Usage::"Pick Instruction");
end;
}
}
group("&Order Confirmation")
{
Caption = '&Order Confirmation';
Image = Email;
action("Email Confirmation")
{
ApplicationArea = Basic, Suite;
Caption = 'Email Confirmation';
Ellipsis = true;
Image = Email;
ToolTip = 'Send an order confirmation by email. The Send Email window opens prefilled for the customer so you can add or change information before you send the email.';
trigger OnAction()
begin
DocPrint.EmailSalesHeader(Rec);
end;
}
action("Print Confirmation")
{
ApplicationArea = Basic, Suite;
Caption = 'Print Confirmation';
Ellipsis = true;
Image = Print;
ToolTip = 'Print an order confirmation. A report request window opens where you can specify what to include on the print-out.';
Visible = not IsOfficeAddin;
trigger OnAction()
begin
DocPrint.PrintSalesOrder(Rec, Usage::"Order Confirmation");
end;
}
action(AttachAsPDF)
{
ApplicationArea = Basic, Suite;
Caption = 'Attach as PDF';
Image = PrintAttachment;
Ellipsis = true;
ToolTip = 'Create a PDF file and attach it to the document.';
trigger OnAction()
var
SalesHeader: Record "Sales Header";
begin
SalesHeader := Rec;
CurrPage.SetSelectionFilter(SalesHeader);
DocPrint.PrintSalesOrderToDocumentAttachment(SalesHeader, DocPrint.GetSalesOrderPrintToAttachmentOption(Rec));
end;
}
}
}
area(reporting)
{
action("Sales Order Analysis")
{
ApplicationArea = Suite;
Caption = 'Analyze Sales Orders';
Image = Sales;
RunObject = Query "Sales Order Analysis";
ToolTip = 'Analyze (group, summarize, pivot) your Sales Order performance against customers and goods/services sold, including outstanding vs. posted quantities and amounts.';
}
#if not CLEAN28
action("Sales Reservation Avail.")
{
ApplicationArea = Reservation;
Caption = 'Sales Reservation Avail.';
Image = "Report";
RunObject = Report "Sales Reservation Avail.";
ToolTip = 'View, print, or save an overview of availability of items for shipment on sales documents, filtered on shipment status.';
ObsoleteState = Pending;
ObsoleteReason = 'This report is obsolete and will be removed in a future version.';
ObsoleteTag = '28.0';
}
#endif
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';
actionref("Create &Warehouse Shipment_Promoted"; "Create &Warehouse Shipment")
{
}
actionref("Create Inventor&y Put-away/Pick_Promoted"; "Create Inventor&y Put-away/Pick")
{
}
}
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(PostAndSend_Promoted; PostAndSend)
{
}
actionref("Post &Batch_Promoted"; "Post &Batch")
{
}
actionref("Preview Posting_Promoted"; "Preview Posting")
{
}
}
group(Category_Category8)
{
Caption = 'Print/Send', Comment = 'Generated from the PromotedActionCategories property index 7.';
actionref("Print Confirmation_Promoted"; "Print Confirmation")
{
}
actionref("Pick Instruction_Promoted"; "Pick Instruction")
{
}
actionref("Email Confirmation_Promoted"; "Email Confirmation")
{
}
actionref("Work Order_Promoted"; "Work Order")
{
}
actionref(AttachAsPDF_Promoted; AttachAsPDF)
{
}
}
group(Category_Category4)
{
Caption = 'Request Approval', Comment = 'Generated from the PromotedActionCategories property index 3.';
}
group(Category_Category5)
{
Caption = 'Order', Comment = 'Generated from the PromotedActionCategories property index 4.';
actionref(Dimensions_Promoted; Dimensions)
{
}
actionref(SalesOrderStatistics_Promoted; SalesOrderStatistics)
{
}
actionref("Co&mments_Promoted"; "Co&mments")
{
}
actionref(Approvals_Promoted; Approvals)
{
}
separator(Navigate_Separator)
{
}
actionref("S&hipments_Promoted"; "S&hipments")
{
}
actionref(PostedSalesInvoices_Promoted; PostedSalesInvoices)
{
}
}
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.';
}
group(Category_Synchronize)
{
Caption = 'Synchronize';
Visible = CRMIntegrationEnabled;
actionref(CRMGoToSalesOrderListInNAV_Promoted; CRMGoToSalesOrderListInNAV)
{
}
}
}
}
views
{
view(ShippedNotInvoiced)
{
Caption = 'Shipped Not Invoiced';
Filters = where("Document Type" = const(Order), "Shipped Not Invoiced" = const(true));
}
view(SalesOrdersOpen)
{
Caption = 'Open Sales Orders';
Filters = where("Document Type" = const(Order), Status = const(Open));
}
view(ReadyToShip)
{
Caption = 'Ready to Ship';
Filters = where("Document Type" = const(Order), Status = const(Released), "Completely Shipped" = const(false), "Shipment Date" = filter(<= '%workdate'));
}
view(PartiallyShipped)
{
Caption = 'Partially Shipped';
Filters = where("Document Type" = const(Order), Status = const(Released), "Completely Shipped" = const(false), Shipped = const(true));
}
view(Delayed)
{
Caption = 'Delayed';
Filters = where("Document Type" = const(Order), Status = const(Released), "Completely Shipped" = const(false), "Date Filter" = filter(<= '%workdate'), "Late Order Shipping" = const(true));
}
view(Released)
{
Caption = 'Released';
Filters = where("Document Type" = const(Order), Status = const(Released));
}
}
analysisviews
{
analysisview("Expected sales volume")
{
Caption = 'Expected sales volume';
DefinitionFile = './Sales/Document/Expected sales volume.analysis.json';
ToolTip = 'Analyse your expected sales volume.';
}
}
trigger OnAfterGetCurrRecord()
var
FilteredSalesHeader: Record "Sales Header";
CRMCouplingManagement: Codeunit "CRM Coupling Management";
begin
SetControlVisibility();
CurrPage.IncomingDocAttachFactBox.PAGE.LoadDataFromRecord(Rec);
if CRMIntegrationEnabled then
CRMIsCoupledToRecord := CRMCouplingManagement.IsRecordCoupledToCRM(Rec.RecordId);
CurrPage.SetSelectionFilter(FilteredSalesHeader);
CurrPage.PowerBIEmbeddedReportPart.PAGE.SetFilterToMultipleValues(FilteredSalesHeader, FilteredSalesHeader.FieldNo("No."));
end;
trigger OnAfterGetRecord()
begin
StatusStyleTxt := Rec.GetStatusStyleText();
end;
trigger OnInit()
begin
CurrPage.PowerBIEmbeddedReportPart.PAGE.SetPageContext(CurrPage.ObjectId(false));
end;
trigger OnOpenPage()
var
SalesSetup: Record "Sales & Receivables Setup";
CRMConnectionSetup: Record "CRM Connection Setup";
CRMIntegrationManagement: Codeunit "CRM Integration Management";
OfficeMgt: Codeunit "Office Management";
begin
Rec.SetSecurityFilterOnRespCenter();
Rec.SetRange("Date Filter", 0D, WorkDate());
JobQueueActive := SalesSetup.JobQueueActive();
CRMIntegrationEnabled := CRMIntegrationManagement.IsCRMIntegrationEnabled();
BidirectionalSalesOrderIntEnabled := CRMConnectionSetup.IsBidirectionalSalesOrderIntEnabled();
IsOfficeAddin := OfficeMgt.IsAvailable();
Rec.CopySellToCustomerFilter();
if OnlyShowHeadersWithVat then
SetFilterOnPositiveVatPostingGroups();
end;
var
DocPrint: Codeunit "Document-Print";
ReportPrint: Codeunit "Test Report-Print";
Usage: Option "Order Confirmation","Work Order","Pick Instruction";
JobQueueActive: Boolean;
OnlyShowHeadersWithVat: Boolean;
OpenApprovalEntriesExist: Boolean;
CRMIntegrationEnabled: Boolean;
BidirectionalSalesOrderIntEnabled: Boolean;
CRMIsCoupledToRecord: Boolean;
IsOfficeAddin: Boolean;
CanCancelApprovalForRecord: Boolean;
StatusStyleTxt: Text;
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;
/// <summary>
/// Shows a preview of the posting result for the selected order.
/// </summary>
procedure ShowPreview()
var
SelectedSalesHeader: Record "Sales Header";
SalesPostYesNo: Codeunit "Sales-Post (Yes/No)";
begin
CurrPage.SetSelectionFilter(SelectedSalesHeader);
SalesPostYesNo.MessageIfPostingPreviewMultipleDocuments(SelectedSalesHeader, Rec."No.");
SalesPostYesNo.Preview(Rec);
end;
local procedure SetControlVisibility()
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;
protected procedure PostDocument(PostingCodeunitID: Integer)
var
LinesInstructionMgt: Codeunit "Lines Instruction Mgt.";
begin
LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(Rec);
Rec.SendToPosting(PostingCodeunitID);
CurrPage.Update(false);
end;
/// <summary>
/// Sets a flag to only show orders with VAT lines.
/// </summary>
procedure SkipShowingLinesWithoutVAT()
begin
OnlyShowHeadersWithVat := true;
end;
local procedure PrintForUsage(UsageParam: Option)
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforePrintForUsage(Rec, UsageParam, IsHandled);
if IsHandled then
exit;
DocPrint.PrintSalesOrder(Rec, UsageParam);
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;
[IntegrationEvent(true, false)]
local procedure OnBeforePrintForUsage(var SalesHeader: Record "Sales Header"; UsageParam: Option; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnBeforePostActionWithMoreThanOneDoc(var SalesHeader: Record "Sales Header"; var BatchProcessingMgt: Codeunit "Batch Processing Mgt."; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterPostingSetSelectionFilter(var SalesHeaderToPost: Record "Sales Header"; CurrPageSalesHeader: Record "Sales Header")
begin
end;
}