Page 41 Sales Quote
src/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al2,003 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.Bank.Setup;using Microsoft.CRM.Contact;using Microsoft.CRM.Outlook;using Microsoft.EServices.EDocument;using Microsoft.Finance.Currency;using Microsoft.Finance.Dimension;using Microsoft.Finance.GeneralLedger.Setup;using Microsoft.Foundation.Address;using Microsoft.Foundation.Attachment;using Microsoft.Foundation.Reporting;using Microsoft.Inventory.Item;using Microsoft.Inventory.Location;using Microsoft.Projects.Resources.Resource;using Microsoft.Sales.Archive;using Microsoft.Sales.Comment;using Microsoft.Sales.Customer;using Microsoft.Sales.Pricing;using Microsoft.Utilities;using System.Automation;using System.Environment;using System.Privacy;using System.Security.User;/// <summary>/// Displays and manages a single sales quote document for customer proposals./// </summary>page 41 "Sales Quote"{ Caption = 'Sales Quote'; PageType = Document; RefreshOnActivate = true; SourceTable = "Sales Header"; SourceTableView = where("Document Type" = filter(Quote)); AboutTitle = 'About sales quote details'; AboutText = 'You can update, send, and resend a quote as needed. If the quote is accepted, the details will transfer to the sales order or invoice you create from it.'; layout { area(content) { group(General) { Caption = 'General'; field("No."; Rec."No.") { ApplicationArea = All; Importance = Standard; ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.'; Visible = DocNoVisible; trigger OnAssistEdit() begin if Rec.AssistEdit(xRec) then CurrPage.Update(); end; } field("Sell-to Customer No."; Rec."Sell-to Customer No.") { ApplicationArea = All; Caption = 'Customer No.'; Importance = Additional; NotBlank = true; ToolTip = 'Specifies the number of the customer who will receive the products and be billed by default.'; AboutTitle = 'Who is the quote for?'; AboutText = 'You can choose existing customers, or add new customers when you create quotes. Quotes can automatically choose special prices and discounts that you have set for each customer.'; trigger OnValidate() begin Rec.SelltoCustomerNoOnAfterValidate(Rec, xRec); IsSalesLinesEditable := Rec.SalesLinesEditable(); CurrPage.Update(); end; } field("Sell-to Customer Name"; Rec."Sell-to Customer Name") { ApplicationArea = All; Caption = 'Customer Name'; Importance = Promoted; ShowMandatory = true; ToolTip = 'Specifies the name of the customer who will receive the products and be billed by default.'; trigger OnAfterLookup(Selected: RecordRef) var Customer: Record Customer; begin Selected.SetTable(Customer); if Rec."Sell-to Customer No." <> Customer."No." then begin Rec.Validate("Sell-to Customer No.", Customer."No."); if Rec."Sell-to Customer No." <> Customer."No." then error(''); IsSalesLinesEditable := Rec.SalesLinesEditable(); CurrPage.Update(); end; end; trigger OnValidate() begin Rec.SelltoCustomerNoOnAfterValidate(Rec, xRec); IsSalesLinesEditable := Rec.SalesLinesEditable(); CurrPage.Update(); end; } field("Sell-to Customer Name 2"; Rec."Sell-to Customer Name 2") { ApplicationArea = Basic, Suite; Caption = 'Name 2'; QuickEntry = false; Visible = false; } field("External Document No."; Rec."External Document No.") { ApplicationArea = Basic, Suite; } group("Sell-to") { Caption = 'Sell-to'; field("Sell-to Address"; Rec."Sell-to Address") { ApplicationArea = Basic, Suite; Caption = 'Address'; Importance = Additional; QuickEntry = false; } field("Sell-to Address 2"; Rec."Sell-to Address 2") { ApplicationArea = Basic, Suite; Caption = 'Address 2'; Importance = Additional; QuickEntry = false; } field("Sell-to City"; Rec."Sell-to City") { ApplicationArea = Basic, Suite; Caption = 'City'; Importance = Additional; QuickEntry = false; } group(Control105) { ShowCaption = false; Visible = IsSellToCountyVisible; field("Sell-to County"; Rec."Sell-to County") { ApplicationArea = Basic, Suite; CaptionClass = '5,1,' + Rec."Sell-to Country/Region Code"; Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the county of the address.'; } } field("Sell-to Post Code"; Rec."Sell-to Post Code") { ApplicationArea = Basic, Suite; Caption = 'Post Code'; Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the postal code.'; } field("Sell-to Country/Region Code"; Rec."Sell-to Country/Region Code") { ApplicationArea = Basic, Suite; Caption = 'Country/Region'; Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the country or region of the address.'; trigger OnValidate() begin IsSellToCountyVisible := FormatAddress.UseCounty(Rec."Sell-to Country/Region Code"); end; } field("Sell-to Contact No."; Rec."Sell-to Contact No.") { ApplicationArea = Basic, Suite; Caption = 'Contact No.'; Importance = Additional; trigger OnLookup(var Text: Text): Boolean begin if not Rec.SelltoContactLookup() then exit(false); Text := Rec."Sell-to Contact No."; CurrPage.Update(); exit(true); end; trigger OnValidate() begin ClearSellToFilter(); ActivateFields(); CurrPage.Update(); end; } field(SellToPhoneNo; SellToContact."Phone No.") { ApplicationArea = Basic, Suite; Caption = 'Phone No.'; Importance = Additional; Editable = false; ExtendedDatatype = PhoneNo; ToolTip = 'Specifies the telephone number of the contact person that the sales document will be sent to.'; } field(SellToMobilePhoneNo; SellToContact."Mobile Phone No.") { ApplicationArea = Basic, Suite; Caption = 'Mobile Phone No.'; Importance = Additional; Editable = false; ExtendedDatatype = PhoneNo; ToolTip = 'Specifies the mobile telephone number of the contact person that the sales document will be sent to.'; } field(SellToEmail; SellToContact."E-Mail") { ApplicationArea = Basic, Suite; Caption = 'Email'; Importance = Additional; Editable = false; ExtendedDatatype = EMail; ToolTip = 'Specifies the email address of the contact person that the sales document will be sent to.'; } } field("Sell-to Contact"; Rec."Sell-to Contact") { ApplicationArea = Basic, Suite; Caption = 'Contact'; Editable = Rec."Sell-to Customer No." <> ''; ToolTip = 'Specifies the name of the person to contact at the customer.'; trigger OnLookup(var Text: Text): Boolean var Contact: Record Contact; begin Contact.FilterGroup(2); Rec.LookupContact(Rec."Sell-to Customer No.", Rec."Sell-to Contact No.", Contact); if PAGE.RunModal(0, Contact) = ACTION::LookupOK then Rec.Validate("Sell-to Contact No.", Contact."No."); if ShipToOptions = ShipToOptions::"Default (Sell-to Address)" then Rec.Validate("Ship-to Contact", Rec."Sell-to Contact"); Contact.FilterGroup(0); Text := Rec."Sell-to Contact"; CurrPage.Update(); end; } field("Sell-to Customer Templ. Code"; Rec."Sell-to Customer Templ. Code") { ApplicationArea = Basic, Suite; Caption = 'Customer Template Code'; Enabled = EnableNewSellToCustomerTemplateCode; Importance = Additional; trigger OnValidate() begin ActivateFields(); CurrPage.Update(); end; } field("No. of Archived Versions"; Rec."No. of Archived Versions") { ApplicationArea = Basic, Suite; Importance = Additional; trigger OnDrillDown() begin CurrPage.SaveRecord(); Commit(); SalesHeaderArchive.SetRange("Document Type", Rec."Document Type"::Quote); SalesHeaderArchive.SetRange("No.", Rec."No."); SalesHeaderArchive.SetRange("Doc. No. Occurrence", Rec."Doc. No. Occurrence"); if SalesHeaderArchive.Get(Rec."Document Type"::Quote, Rec."No.", Rec."Doc. No. Occurrence", Rec."No. of Archived Versions") then; PAGE.RunModal(PAGE::"Sales List Archive", SalesHeaderArchive); CurrPage.Update(false); end; } field("Order Date"; Rec."Order Date") { ApplicationArea = Basic, Suite; Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the date when the related order was created.'; } field("Document Date"; Rec."Document Date") { ApplicationArea = Basic, Suite; Importance = Promoted; } field("Quote Valid Until Date"; Rec."Quote Valid Until Date") { ApplicationArea = Suite; } field("Quote Accepted"; Rec."Quote Accepted") { ApplicationArea = Suite; } field("Quote Accepted Date"; Rec."Quote Accepted Date") { ApplicationArea = Suite; } field("Due Date"; Rec."Due Date") { ApplicationArea = Basic, Suite; Importance = Promoted; ToolTip = 'Specifies when the related sales invoice must be paid.'; } field("Requested Delivery Date"; Rec."Requested Delivery Date") { ApplicationArea = Basic, Suite; } field("Your Reference"; Rec."Your Reference") { ApplicationArea = Suite; Importance = Additional; } field("Salesperson Code"; Rec."Salesperson Code") { ApplicationArea = Suite; Importance = Additional; trigger OnValidate() begin CurrPage.SalesLines.PAGE.UpdateForm(true) end; } field("Campaign No."; Rec."Campaign No.") { ApplicationArea = RelationshipMgmt; Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the number of the campaign that the document is linked to.'; trigger OnValidate() begin if Rec."Campaign No." <> xRec."Campaign No." then CurrPage.Update(); end; } field("Opportunity No."; Rec."Opportunity No.") { ApplicationArea = RelationshipMgmt; Importance = Additional; QuickEntry = false; } field("Responsibility Center"; Rec."Responsibility Center") { AccessByPermission = TableData "Responsibility Center" = R; ApplicationArea = Suite; Importance = Additional; } field("Assigned User ID"; Rec."Assigned User ID") { ApplicationArea = Basic, Suite; Importance = Additional; } field(Status; Rec.Status) { ApplicationArea = Suite; Importance = Promoted; StyleExpr = StatusStyleTxt; AboutTitle = 'Check the quote status'; AboutText = 'While preparing a quote it''s status is *Open*. When it''s ready, you can change the status to *Released* to reserve the items or services you''re selling. To change a released quote you''ll need to reopen it.'; } group("Work Description") { Caption = 'Work Description'; field(WorkDescription; WorkDescription) { ApplicationArea = Basic, Suite; Importance = Additional; MultiLine = true; ShowCaption = false; ToolTip = 'Specifies the products or service being offered'; trigger OnValidate() begin Rec.SetWorkDescription(WorkDescription); end; } } } part(SalesLines; "Sales Quote Subform") { ApplicationArea = Basic, Suite; Editable = IsSalesLinesEditable; Enabled = IsSalesLinesEditable; SubPageLink = "Document No." = field("No."); UpdatePropagation = Both; } group("Invoice Details") { Caption = 'Invoice Details'; field("Currency Code"; Rec."Currency Code") { ApplicationArea = Suite; Importance = Promoted; trigger OnAssistEdit() begin Clear(ChangeExchangeRate); ChangeExchangeRate.SetParameter(Rec."Currency Code", Rec."Currency Factor", WorkDate()); if ChangeExchangeRate.RunModal() = ACTION::OK then begin Rec.Validate("Currency Factor", ChangeExchangeRate.GetParameter()); SaveInvoiceDiscountAmount(); end; Clear(ChangeExchangeRate); end; trigger OnValidate() begin CurrPage.Update(); end; } field("Company Bank Account Code"; Rec."Company Bank Account Code") { ApplicationArea = Suite; Importance = Promoted; } field("Prices Including VAT"; Rec."Prices Including VAT") { ApplicationArea = VAT; trigger OnValidate() begin CurrPage.SalesLines.Page.ForceTotalsCalculation(); CurrPage.Update(); end; } field("VAT Bus. Posting Group"; Rec."VAT Bus. Posting Group") { ApplicationArea = Basic, Suite; trigger OnValidate() begin CurrPage.Update(); end; } field("Payment Terms Code"; Rec."Payment Terms Code") { ApplicationArea = Basic, Suite; Importance = Promoted; } field("Payment Method Code"; Rec."Payment Method Code") { ApplicationArea = Basic, Suite; Importance = Additional; Visible = IsPaymentMethodCodeVisible; } field("Tax Liable"; Rec."Tax Liable") { ApplicationArea = SalesTax; } field("Tax Area Code"; Rec."Tax Area Code") { ApplicationArea = SalesTax; trigger OnValidate() var SalesHeader: Record "Sales Header"; begin if SalesHeader.Get(Rec."Document Type", Rec."No.") then CurrPage.SalesLines.PAGE.RedistributeTotalsOnAfterValidate(); end; } group(Control47) { ShowCaption = false; Visible = PaymentServiceVisible; field(SelectedPayments; Rec.GetSelectedPaymentServicesText()) { ApplicationArea = All; Caption = 'Payment Service'; Editable = false; Enabled = PaymentServiceEnabled; MultiLine = true; ToolTip = 'Specifies the online payment service, such as PayPal, that customers can use to pay the sales document.'; trigger OnAssistEdit() begin Rec.ChangePaymentServiceSetting(); end; } } field("Transaction Type"; Rec."Transaction Type") { ApplicationArea = BasicEU, BasicNO; } field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code") { ApplicationArea = Dimensions; trigger OnValidate() begin CurrPage.Update(); end; } field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code") { ApplicationArea = Dimensions; trigger OnValidate() begin CurrPage.Update(); end; } field("Payment Discount %"; Rec."Payment Discount %") { ApplicationArea = Basic, Suite; } field("Pmt. Discount Date"; Rec."Pmt. Discount Date") { ApplicationArea = Basic, Suite; Importance = Additional; } field("Journal Templ. Name"; Rec."Journal Templ. Name") { ApplicationArea = Basic, Suite; Visible = IsJournalTemplNameVisible; } field("Location Code"; Rec."Location Code") { ApplicationArea = Location; Importance = Additional; } } group("Shipping and Billing") { Caption = 'Shipping and Billing'; group(Control60) { ShowCaption = false; group(Control53) { ShowCaption = false; field(ShippingOptions; ShipToOptions) { ApplicationArea = Basic, Suite; Caption = 'Ship-to'; ToolTip = 'Specifies the address that the products on the sales document are shipped to. Default (Sell-to Address): The same as the customer''s sell-to address. Alternate Ship-to Address: One of the customer''s alternate ship-to addresses. Custom Address: Any ship-to address that you specify in the fields below.'; trigger OnValidate() var ShipToAddress: Record "Ship-to Address"; ShipToAddressList: Page "Ship-to Address List"; IsHandled: Boolean; begin IsHandled := false; OnBeforeValidateShipToOptions(Rec, ShipToOptions.AsInteger(), IsHandled); if IsHandled then exit; case ShipToOptions of ShipToOptions::"Default (Sell-to Address)": begin Rec.Validate("Ship-to Code", ''); Rec.CopySellToAddressToShipToAddress(); end; ShipToOptions::"Alternate Shipping Address": begin ShipToAddress.SetRange("Customer No.", Rec."Sell-to Customer No."); ShipToAddressList.LookupMode := true; ShipToAddressList.SetTableView(ShipToAddress); if ShipToAddressList.RunModal() = ACTION::LookupOK then begin ShipToAddressList.GetRecord(ShipToAddress); Rec.Validate("Ship-to Code", ShipToAddress.Code); IsShipToCountyVisible := FormatAddress.UseCounty(ShipToAddress."Country/Region Code"); end else ShipToOptions := ShipToOptions::"Custom Address"; end; ShipToOptions::"Custom Address": begin Rec.Validate("Ship-to Code", ''); IsShipToCountyVisible := FormatAddress.UseCounty(Rec."Ship-to Country/Region Code"); end; end; OnAfterValidateShipToOptions(Rec, ShipToOptions.AsInteger()); end; } group(Control72) { ShowCaption = false; Visible = not (ShipToOptions = ShipToOptions::"Default (Sell-to Address)"); field("Ship-to Code"; Rec."Ship-to Code") { ApplicationArea = Basic, Suite; Caption = 'Code'; Editable = ShipToOptions = ShipToOptions::"Alternate Shipping Address"; Importance = Promoted; ToolTip = 'Specifies the code for another shipment address than the customer''s own address, which is entered by default.'; trigger OnValidate() var ShipToAddress: Record "Ship-to Address"; begin if (xRec."Ship-to Code" <> '') and (Rec."Ship-to Code" = '') then Error(EmptyShipToCodeErr); if Rec."Ship-to Code" <> '' then begin ShipToAddress.Get(Rec."Sell-to Customer No.", Rec."Ship-to Code"); IsShipToCountyVisible := FormatAddress.UseCounty(ShipToAddress."Country/Region Code"); end else IsShipToCountyVisible := false; end; } field("Ship-to Name"; Rec."Ship-to Name") { ApplicationArea = Basic, Suite; Caption = 'Name'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; ToolTip = 'Specifies the name that products on the sales document will be shipped to.'; } field("Ship-to Name 2"; Rec."Ship-to Name 2") { ApplicationArea = Basic, Suite; Caption = 'Name 2'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; Importance = Additional; QuickEntry = false; Visible = false; } field("Ship-to Address"; Rec."Ship-to Address") { ApplicationArea = Basic, Suite; Caption = 'Address'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; QuickEntry = false; ToolTip = 'Specifies the address that products on the sales document will be shipped to. By default, the field is filled with the value in the Address field on the customer card or with the value in the Address field in the Ship-to Address window.'; } field("Ship-to Address 2"; Rec."Ship-to Address 2") { ApplicationArea = Basic, Suite; Caption = 'Address 2'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; QuickEntry = false; } field("Ship-to City"; Rec."Ship-to City") { ApplicationArea = Basic, Suite; Caption = 'City'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; QuickEntry = false; } group(Control107) { ShowCaption = false; Visible = IsShipToCountyVisible; field("Ship-to County"; Rec."Ship-to County") { ApplicationArea = Basic, Suite; CaptionClass = '5,1,' + Rec."Ship-to Country/Region Code"; Editable = ShipToOptions = ShipToOptions::"Custom Address"; QuickEntry = false; ToolTip = 'Specifies the county of the address.'; } } field("Ship-to Post Code"; Rec."Ship-to Post Code") { ApplicationArea = Basic, Suite; Caption = 'Post Code'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; QuickEntry = false; ToolTip = 'Specifies the postal code.'; } field("Ship-to Country/Region Code"; Rec."Ship-to Country/Region Code") { ApplicationArea = Basic, Suite; Caption = 'Country/Region'; Editable = ShipToOptions = ShipToOptions::"Custom Address"; Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the customer''s country/region.'; trigger OnValidate() begin IsShipToCountyVisible := FormatAddress.UseCounty(Rec."Ship-to Country/Region Code"); end; } } field("Ship-to Phone No."; Rec."Ship-to Phone No.") { ApplicationArea = Basic, Suite; Caption = 'Phone No.'; } field("Ship-to Contact"; Rec."Ship-to Contact") { ApplicationArea = Basic, Suite; Caption = 'Contact'; ToolTip = 'Specifies the name of the contact person at the address that products on the sales document will be shipped to.'; } field("Shipment Date"; Rec."Shipment Date") { ApplicationArea = Basic, Suite; Importance = Promoted; } } group("Shipment Method") { Caption = 'Shipment Method'; field("Shipment Method Code"; Rec."Shipment Method Code") { ApplicationArea = Basic, Suite; Caption = 'Code'; Importance = Additional; ToolTip = 'Specifies how items on the sales document are shipped to the customer.'; } field("Shipping Agent Code"; Rec."Shipping Agent Code") { ApplicationArea = Suite; Caption = 'Agent'; Importance = Additional; ToolTip = 'Specifies which shipping agent is used to transport the items on the sales document to the customer.'; } field("Shipping Agent Service Code"; Rec."Shipping Agent Service Code") { ApplicationArea = Suite; Caption = 'Agent service'; Importance = Additional; ToolTip = 'Specifies which shipping agent service is used to transport the items on the sales document to the customer.'; } field("Package Tracking No."; Rec."Package Tracking No.") { ApplicationArea = Suite; Importance = Additional; } } } group(Control49) { Enabled = not EnableSellToCustomerTemplateCode; ShowCaption = false; field(BillToOptions; BillToOptions) { ApplicationArea = Basic, Suite; Caption = 'Bill-to'; ToolTip = 'Specifies the customer that the sales invoice will be sent to. Default (Customer): The same as the customer on the sales invoice. Another Customer: Any customer that you specify in the fields below.'; trigger OnValidate() begin if BillToOptions = BillToOptions::"Default (Customer)" then begin Rec.Validate("Bill-to Customer No.", Rec."Sell-to Customer No."); Rec.RecallModifyAddressNotification(Rec.GetModifyBillToCustomerAddressNotificationId()); end; Rec.CopySellToAddressToBillToAddress(); end; } group(Control41) { ShowCaption = false; Visible = not (BillToOptions = BillToOptions::"Default (Customer)"); field("Bill-to Name"; Rec."Bill-to Name") { ApplicationArea = Basic, Suite; Caption = 'Name'; Editable = BillToOptions = BillToOptions::"Another Customer"; Enabled = EnableBillToCustomerNo; Importance = Promoted; ToolTip = 'Specifies the customer to whom you will send the sales invoice, when different from the customer that you are selling to.'; trigger OnValidate() begin if Rec.GetFilter("Bill-to Customer No.") = xRec."Bill-to Customer No." then if Rec."Bill-to Customer No." <> xRec."Bill-to Customer No." then Rec.SetRange("Bill-to Customer No."); CurrPage.Update(); end; trigger OnLookup(var Text: Text): Boolean var Customer: Record Customer; begin OnBeforeLookupBillToName(Customer, Rec); if Customer.SelectCustomer(Customer) then begin xRec := Rec; Rec."Bill-to Name" := Customer.Name; Rec.Validate("Bill-to Customer No.", Customer."No."); end; if Rec.GetFilter("Bill-to Customer No.") = xRec."Bill-to Customer No." then if Rec."Bill-to Customer No." <> xRec."Bill-to Customer No." then Rec.SetRange("Bill-to Customer No."); CurrPage.Update(); end; } field("Bill-to Name 2"; Rec."Bill-to Name 2") { ApplicationArea = Basic, Suite; Caption = 'Name 2'; Editable = BillToOptions = BillToOptions::"Another Customer"; Enabled = BillToOptions = BillToOptions::"Another Customer"; Importance = Additional; QuickEntry = false; Visible = false; } field("Bill-to Address"; Rec."Bill-to Address") { ApplicationArea = Basic, Suite; Caption = 'Address'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Importance = Additional; QuickEntry = false; } field("Bill-to Address 2"; Rec."Bill-to Address 2") { ApplicationArea = Basic, Suite; Caption = 'Address 2'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Importance = Additional; QuickEntry = false; } field("Bill-to City"; Rec."Bill-to City") { ApplicationArea = Basic, Suite; Caption = 'City'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Importance = Additional; QuickEntry = false; } group(Control109) { ShowCaption = false; Visible = IsBillToCountyVisible; field("Bill-to County"; Rec."Bill-to County") { ApplicationArea = Basic, Suite; CaptionClass = '5,1,' + Rec."Bill-to Country/Region Code"; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the county of the address.'; } } field("Bill-to Post Code"; Rec."Bill-to Post Code") { ApplicationArea = Basic, Suite; Caption = 'Post Code'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Importance = Additional; QuickEntry = false; ToolTip = 'Specifies the postal code.'; } field("Bill-to Country/Region Code"; Rec."Bill-to Country/Region Code") { ApplicationArea = Basic, Suite; Caption = 'Country/Region'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); QuickEntry = false; ToolTip = 'Specifies the customer''s country/region.'; trigger OnValidate() begin IsBillToCountyVisible := FormatAddress.UseCounty(Rec."Bill-to Country/Region Code"); end; } field("Bill-to Contact No."; Rec."Bill-to Contact No.") { ApplicationArea = Basic, Suite; Caption = 'Contact No.'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Importance = Additional; } field("Bill-to Contact"; Rec."Bill-to Contact") { ApplicationArea = Basic, Suite; Caption = 'Contact'; Editable = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); Enabled = (BillToOptions = BillToOptions::"Custom Address") or (Rec."Bill-to Customer No." <> Rec."Sell-to Customer No."); ToolTip = 'Specifies the name of the person you should contact at the customer who you are sending the invoice to.'; } field(BillToContactPhoneNo; BillToContact."Phone No.") { ApplicationArea = Basic, Suite; Caption = 'Phone No.'; Editable = false; Importance = Additional; ExtendedDatatype = PhoneNo; ToolTip = 'Specifies the telephone number of the person you should contact at the customer you are sending the invoice to.'; } field(BillToContactMobilePhoneNo; BillToContact."Mobile Phone No.") { ApplicationArea = Basic, Suite; Caption = 'Mobile Phone No.'; Editable = false; Importance = Additional; ExtendedDatatype = PhoneNo; ToolTip = 'Specifies the mobile telephone number of the person you should contact at the customer you are sending the invoice to.'; } field(BillToContactEmail; BillToContact."E-Mail") { ApplicationArea = Basic, Suite; Caption = 'Email'; Editable = false; Importance = Additional; ExtendedDatatype = EMail; ToolTip = 'Specifies the email address of the person you should contact at the customer you are sending the invoice to.'; } } } } group("Foreign Trade") { Caption = 'Foreign Trade'; field("EU 3-Party Trade"; Rec."EU 3-Party Trade") { ApplicationArea = BasicEU, BasicNO; } field("Transaction Specification"; Rec."Transaction Specification") { ApplicationArea = BasicEU, BasicNO; } field("Transport Method"; Rec."Transport Method") { ApplicationArea = BasicEU, BasicNO; } field("Exit Point"; Rec."Exit Point") { ApplicationArea = BasicEU, BasicNO; } field("Area"; Rec.Area) { ApplicationArea = BasicEU, BasicNO; } field("Language Code"; Rec."Language Code") { ApplicationArea = Basic, Suite; Visible = false; } field("Format Region"; Rec."Format Region") { ApplicationArea = Basic, Suite; Visible = false; } } } 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(IncomingDocAttachFactBox; "Incoming Doc. Attach. FactBox") { ApplicationArea = Basic, Suite; ShowFilter = false; Visible = false; } part(Control11; "Pending Approval FactBox") { ApplicationArea = All; SubPageLink = "Table ID" = const(36), "Document Type" = field("Document Type"), "Document No." = field("No."), Status = const(Open); Visible = OpenApprovalEntriesExistForCurrUser; } part(Control1903720907; "Sales Hist. Sell-to FactBox") { ApplicationArea = Basic, Suite; SubPageLink = "No." = field("Sell-to Customer No."), "Date Filter" = field("Date Filter"); } part(Control1907234507; "Sales Hist. Bill-to FactBox") { ApplicationArea = Basic, Suite; SubPageLink = "No." = field("Bill-to Customer No."), "Date Filter" = field("Date Filter"); Visible = false; } part(Control1902018507; "Customer Statistics FactBox") { ApplicationArea = Basic, Suite; SubPageLink = "No." = field("Bill-to Customer No."), "Date Filter" = field("Date Filter"); Visible = false; } part(Control1900316107; "Customer Details FactBox") { ApplicationArea = Basic, Suite; SubPageLink = "No." = field("Sell-to Customer No."), "Date Filter" = field("Date Filter"); Visible = false; } part(Control1906127307; "Sales Line FactBox") { ApplicationArea = Suite; Provider = SalesLines; SubPageLink = "Document Type" = field("Document Type"), "Document No." = field("Document No."), "Line No." = field("Line No."); } part(Control1901314507; "Item Invoicing FactBox") { ApplicationArea = Basic, Suite; Provider = SalesLines; SubPageLink = "No." = field("No."); Visible = false; } part(ApprovalFactBox; "Approval FactBox") { ApplicationArea = Suite; Visible = false; } part(Control1907012907; "Resource Details FactBox") { ApplicationArea = Basic, Suite; Provider = SalesLines; SubPageLink = "No." = field("No."); Visible = false; } part(WorkflowStatus; "Workflow Status FactBox") { ApplicationArea = All; Editable = false; Enabled = false; ShowFilter = false; Visible = ShowWorkflowStatus; } systempart(Control1900383207; Links) { ApplicationArea = RecordLinks; Visible = false; } systempart(Control1905767507; Notes) { ApplicationArea = Notes; } } } actions { area(navigation) { group("&Quote") { Caption = '&Quote'; Image = Quote; 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.OpenApprovalsSales(Rec); end; } action(Dimensions) { AccessByPermission = TableData Dimension = R; ApplicationArea = Dimensions; Caption = 'Dimensions'; Enabled = Rec."No." <> ''; 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(); CurrPage.SaveRecord(); end; } } group("&View") { Caption = '&View'; action(Customer) { ApplicationArea = Basic, Suite; Caption = 'Customer'; Enabled = IsCustomerOrContactNotEmpty; Image = Customer; RunObject = Page "Customer Card"; RunPageLink = "No." = field("Sell-to Customer No."), "Date Filter" = field("Date Filter"); ShortCutKey = 'Shift+F7'; ToolTip = 'View or edit detailed information about the customer on the sales document.'; } action("C&ontact") { ApplicationArea = Basic, Suite; Caption = 'C&ontact'; Image = Card; RunObject = Page "Contact Card"; RunPageLink = "No." = field("Sell-to Contact No."); ToolTip = 'View or edit detailed information about the contact person at the customer.'; } } group(History) { Caption = 'History'; action(PageInteractionLogEntries) { ApplicationArea = Suite; Caption = 'Interaction Log E&ntries'; Image = InteractionLog; //The property 'PromotedCategory' can only be set if the property 'Promoted' is set to 'true' //PromotedCategory = Category8; ShortCutKey = 'Ctrl+F7'; ToolTip = 'View a list of interaction log entries related to this document.'; trigger OnAction() begin Rec.ShowInteractionLogEntries(); end; } } } area(processing) { group(Action59) { Caption = '&Quote'; Image = Quote; action(SalesStatistics) { 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 Statistics"; RunPageOnRec = true; } action(CustomerStatistics) { ApplicationArea = Basic, Suite; Caption = 'Customer Statistics'; Enabled = IsCustomerOrContactNotEmpty; 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("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.'; } action(Print) { ApplicationArea = Basic, Suite; Caption = '&Print'; Ellipsis = true; Enabled = IsCustomerOrContactNotEmpty; 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() begin CheckSalesCheckAllLinesHaveQuantityAssigned(); DocPrint.PrintSalesHeader(Rec); end; } action(Email) { ApplicationArea = Basic, Suite; Caption = 'Send by &Email'; Enabled = IsCustomerOrContactNotEmpty; Image = Email; ToolTip = 'Prepare to mail the document. The Send Email window opens prefilled with the customer''s email address so you can add or edit information.'; trigger OnAction() begin CheckSalesCheckAllLinesHaveQuantityAssigned(); if not Rec.Find() then Rec.Insert(true); DocPrint.EmailSalesHeader(Rec); end; } action(AttachAsPDF) { ApplicationArea = Basic, Suite; Caption = 'Attach as PDF'; Enabled = IsCustomerOrContactNotEmpty; Image = PrintAttachment; ToolTip = 'Create a PDF file and attach it to the document.'; trigger OnAction() var SalesHeader: Record "Sales Header"; begin SalesHeader := Rec; SalesHeader.SetRecFilter(); DocPrint.PrintSalesHeaderToDocumentAttachment(SalesHeader); end; } action(GetRecurringSalesLines) { ApplicationArea = Suite; Caption = 'Get Recurring Sales Lines'; Ellipsis = true; Enabled = IsSellToCustomerNotEmpty; Image = CustomerCode; ToolTip = 'Get standard sales lines that are available to assign to customers.'; trigger OnAction() var StdCustSalesCode: Record "Standard Customer Sales Code"; begin StdCustSalesCode.InsertSalesLines(Rec); end; } action(CopyDocument) { ApplicationArea = Suite; Caption = 'Copy Document'; Ellipsis = true; Enabled = Rec."No." <> ''; Image = CopyDocument; ToolTip = 'Copy document lines and header information from another sales document to this document. You can copy a posted sales invoice into a new sales invoice to quickly create a similar document.'; trigger OnAction() begin if not Rec.Find() then begin Rec.Insert(true); Commit(); end; Rec.CopyDocument(); if Rec.Get(Rec."Document Type", Rec."No.") then; CurrPage.SalesLines.Page.ForceTotalsCalculation(); CurrPage.Update(); end; } action(DocAttach) { ApplicationArea = All; Caption = 'Attachments'; Image = Attach; ToolTip = 'Add a file as an attachment. You can attach images as well as documents.'; trigger OnAction() var DocumentAttachmentDetails: Page "Document Attachment Details"; RecRef: RecordRef; begin RecRef.GetTable(Rec); DocumentAttachmentDetails.OpenForRecRef(RecRef); DocumentAttachmentDetails.RunModal(); end; } } group(Approval) { Caption = 'Approval'; action(Approve) { ApplicationArea = All; Caption = 'Approve'; Image = Approve; ToolTip = 'Approve the requested changes.'; Visible = OpenApprovalEntriesExistForCurrUser; trigger OnAction() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; begin ApprovalsMgmt.ApproveRecordApprovalRequest(Rec.RecordId); end; } action(Reject) { ApplicationArea = All; Caption = 'Reject'; Image = Reject; ToolTip = 'Reject the approval request.'; Visible = OpenApprovalEntriesExistForCurrUser; trigger OnAction() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; begin ApprovalsMgmt.RejectRecordApprovalRequest(Rec.RecordId); end; } action(Delegate) { ApplicationArea = All; Caption = 'Delegate'; Image = Delegate; ToolTip = 'Delegate the approval to a substitute approver.'; Visible = OpenApprovalEntriesExistForCurrUser; trigger OnAction() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; begin ApprovalsMgmt.DelegateRecordApprovalRequest(Rec.RecordId); end; } action(Comment) { ApplicationArea = All; Caption = 'Comments'; Image = ViewComments; ToolTip = 'View or add comments for the record.'; Visible = OpenApprovalEntriesExistForCurrUser; trigger OnAction() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; begin ApprovalsMgmt.GetApprovalComment(Rec); end; } } group(Create) { Caption = 'Create'; Image = NewCustomer; action(MakeOrder) { ApplicationArea = Basic, Suite; Caption = 'Make &Order'; Enabled = IsCustomerOrContactNotEmpty; Image = MakeOrder; ToolTip = 'Convert the sales quote to a sales order.'; AboutTitle = 'When a quote gets accepted'; AboutText = 'When your customer is ready to buy, you can turn quotes into orders. Or, unless you need partial shipments, skip the order and create an invoice instead.'; trigger OnAction() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; begin if ApprovalsMgmt.PrePostApprovalCheckSales(Rec) then CODEUNIT.Run(CODEUNIT::"Sales-Quote to Order (Yes/No)", Rec); end; } action(MakeInvoice) { ApplicationArea = Basic, Suite; Caption = 'Make Invoice'; Enabled = IsCustomerOrContactNotEmpty; Image = MakeOrder; ToolTip = 'Convert the sales quote to a sales invoice.'; trigger OnAction() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; begin if ApprovalsMgmt.PrePostApprovalCheckSales(Rec) then begin CheckSalesCheckAllLinesHaveQuantityAssigned(); CODEUNIT.Run(CODEUNIT::"Sales-Quote to Invoice Yes/No", Rec); end; end; } action("C&reate Customer") { ApplicationArea = Basic, Suite; Caption = 'C&reate Customer'; Image = NewCustomer; ToolTip = 'Create a new customer card for the contact.'; trigger OnAction() begin if Rec.CheckCustomerCreated(false) then CurrPage.Update(true); end; } action("Create &Task") { AccessByPermission = TableData Contact = R; ApplicationArea = Basic, Suite; Caption = 'Create &Task'; Image = NewToDo; ToolTip = 'Create a new marketing task for the contact.'; trigger OnAction() begin Rec.CreateTask(); end; } } group(Action3) { Caption = 'Release'; Image = ReleaseDoc; action(Release) { ApplicationArea = Suite; Caption = 'Re&lease'; Enabled = Rec.Status <> Rec.Status::Released; 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 ReleaseSalesDoc: Codeunit "Release Sales Document"; begin ReleaseSalesDoc.PerformManualRelease(Rec); CurrPage.SalesLines.PAGE.ClearTotalSalesHeader(); end; } action(Reopen) { ApplicationArea = Suite; Caption = 'Re&open'; Enabled = Rec.Status <> Rec.Status::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 ReleaseSalesDoc: Codeunit "Release Sales Document"; begin ReleaseSalesDoc.PerformManualReopen(Rec); CurrPage.SalesLines.PAGE.ClearTotalSalesHeader(); end; } } group("Request Approval") { Caption = 'Request Approval'; Image = 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."; WorkflowWebhookMgt: Codeunit "Workflow Webhook Management"; begin ApprovalsMgmt.OnCancelSalesApprovalRequest(Rec); WorkflowWebhookMgt.FindAndCancel(Rec.RecordId); end; } group(Flow) { Caption = 'Power Automate'; Image = Flow; customaction(CreateFlowFromTemplate) { ApplicationArea = Basic, Suite; Caption = 'Create approval flow'; ToolTip = 'Create a new flow in Power Automate from a list of relevant flow templates.'; Visible = IsSaaS and IsPowerAutomatePrivacyNoticeApproved; CustomActionType = FlowTemplateGallery; FlowTemplateCategoryName = 'd365bc_approval_salesQuote'; } } } group("F&unctions") { Caption = 'F&unctions'; Image = "Action"; action(CalculateInvoiceDiscount) { AccessByPermission = TableData "Cust. Invoice Disc." = R; ApplicationArea = Basic, Suite; Caption = 'Calculate &Invoice Discount'; Enabled = IsCustomerOrContactNotEmpty; Image = CalculateInvoiceDiscount; ToolTip = 'Calculate the invoice discount that applies to the sales quote.'; trigger OnAction() begin ApproveCalcInvDisc(); SalesCalcDiscByType.ResetRecalculateInvoiceDisc(Rec); end; } separator(Action139) { } action("Archive Document") { ApplicationArea = Suite; Caption = 'Archi&ve Document'; Image = Archive; ToolTip = 'Send the document to the archive, for example because it is too soon to delete it. Later, you delete or reprocess the archived document.'; trigger OnAction() begin ArchiveManagement.ArchiveSalesDocument(Rec); CurrPage.Update(false); end; } group(IncomingDocument) { Caption = 'Incoming Document'; Image = Documents; action(IncomingDocCard) { ApplicationArea = Basic, Suite; Caption = 'View Incoming Document'; Enabled = HasIncomingDocument; Image = ViewOrder; ToolTip = 'View any incoming document records and file attachments that exist for the entry or document.'; trigger OnAction() var IncomingDocument: Record "Incoming Document"; begin IncomingDocument.ShowCardFromEntryNo(Rec."Incoming Document Entry No."); end; } action(SelectIncomingDoc) { AccessByPermission = TableData "Incoming Document" = R; ApplicationArea = Basic, Suite; Caption = 'Select Incoming Document'; Image = SelectLineToApply; ToolTip = 'Select an incoming document record and file attachment that you want to link to the entry or document.'; trigger OnAction() var IncomingDocument: Record "Incoming Document"; begin Rec.Validate("Incoming Document Entry No.", IncomingDocument.SelectIncomingDocument(Rec."Incoming Document Entry No.", Rec.RecordId)); end; } action(IncomingDocAttachFile) { ApplicationArea = Basic, Suite; Caption = 'Create Incoming Document from File'; Ellipsis = true; Enabled = not HasIncomingDocument; Image = Attach; ToolTip = 'Create an incoming document record by selecting a file to attach, and then link the incoming document record to the entry or document.'; trigger OnAction() var IncomingDocumentAttachment: Record "Incoming Document Attachment"; begin IncomingDocumentAttachment.NewAttachmentFromSalesDocument(Rec); end; } action(RemoveIncomingDoc) { ApplicationArea = Basic, Suite; Caption = 'Remove Incoming Document'; Enabled = HasIncomingDocument; Image = RemoveLine; ToolTip = 'Remove any incoming document records and file attachments.'; trigger OnAction() var IncomingDocument: Record "Incoming Document"; begin if IncomingDocument.Get(Rec."Incoming Document Entry No.") then IncomingDocument.RemoveLinkToRelatedRecord(); Rec."Incoming Document Entry No." := 0; Rec.Modify(true); end; } } } } area(Promoted) { group(Category_Process) { Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.'; actionref(MakeOrder_Promoted; MakeOrder) { } actionref(MakeInvoice_Promoted; MakeInvoice) { } group(Category_Category10) { Caption = 'Release', Comment = 'Generated from the PromotedActionCategories property index 9.'; ShowAs = SplitButton; actionref(Release_Promoted; Release) { } actionref(Reopen_Promoted; Reopen) { } } actionref("Archive Document_Promoted"; "Archive Document") { } } group(Category_Prepare) { Caption = 'Prepare'; actionref(CopyDocument_Promoted; CopyDocument) { } actionref(GetRecurringSalesLines_Promoted; GetRecurringSalesLines) { } actionref(CalculateInvoiceDiscount_Promoted; CalculateInvoiceDiscount) { } group("Category_Incoming Document") { Caption = 'Incoming Document'; actionref(IncomingDocAttachFile_Promoted; IncomingDocAttachFile) { } actionref(IncomingDocCard_Promoted; IncomingDocCard) { } actionref(SelectIncomingDoc_Promoted; SelectIncomingDoc) { } actionref(RemoveIncomingDoc_Promoted; RemoveIncomingDoc) { } } } group(Category_Category6) { Caption = 'Approve', Comment = 'Generated from the PromotedActionCategories property index 5.'; actionref(Approve_Promoted; Approve) { } actionref(Reject_Promoted; Reject) { } actionref(Comment_Promoted; Comment) { } actionref(Delegate_Promoted; Delegate) { } } group(Category_Category9) { Caption = 'Print/Send', Comment = 'Generated from the PromotedActionCategories property index 8.'; actionref(Email_Promoted; Email) { } actionref(Print_Promoted; Print) { } actionref(AttachAsPDF_Promoted; AttachAsPDF) { } } group(Category_Category7) { Caption = 'Request Approval', Comment = 'Generated from the PromotedActionCategories property index 6.'; actionref(SendApprovalRequest_Promoted; SendApprovalRequest) { } actionref(CancelApprovalRequest_Promoted; CancelApprovalRequest) { } } group(Category_Category4) { Caption = 'Quote', Comment = 'Generated from the PromotedActionCategories property index 3.'; actionref(Dimensions_Promoted; Dimensions) { } actionref(SalesStatistics_Promoted; SalesStatistics) { } actionref("Co&mments_Promoted"; "Co&mments") { } actionref(DocAttach_Promoted; DocAttach) { } actionref(Approvals_Promoted; Approvals) { } separator(Navigate_Separator) { } actionref(Customer_Promoted; Customer) { } actionref("C&ontact_Promoted"; "C&ontact") { } } group(Category_Category5) { Caption = 'View', Comment = 'Generated from the PromotedActionCategories property index 4.'; } group(Category_Category8) { Caption = 'History', Comment = 'Generated from the PromotedActionCategories property index 7.'; } group(Category_Category11) { Caption = 'Navigate', Comment = 'Generated from the PromotedActionCategories property index 10.'; } group(Category_Report) { Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.'; } } } trigger OnAfterGetCurrRecord() begin ActivateFields(); CurrPage.IncomingDocAttachFactBox.PAGE.LoadDataFromRecord(Rec); CurrPage.ApprovalFactBox.PAGE.UpdateApprovalEntriesFromSourceRecord(Rec.RecordId); ShowWorkflowStatus := CurrPage.WorkflowStatus.PAGE.SetFilterOnWorkflowRecord(Rec.RecordId); StatusStyleTxt := Rec.GetStatusStyleText(); UpdatePaymentService(); SetControlAppearance(); end; trigger OnAfterGetRecord() begin ActivateFields(); SetControlAppearance(); WorkDescription := Rec.GetWorkDescription(); UpdateShipToBillToGroupVisibility(); SellToContact.GetOrClear(Rec."Sell-to Contact No."); BillToContact.GetOrClear(Rec."Bill-to Contact No."); CurrPage.IncomingDocAttachFactBox.Page.SetCurrentRecordID(Rec.RecordId); OnAfterOnAfterGetRecord(Rec); end; trigger OnDeleteRecord(): Boolean begin CurrPage.SaveRecord(); exit(Rec.ConfirmDeletion()); end; trigger OnInit() begin EnableBillToCustomerNo := true; EnableSellToCustomerTemplateCode := true; IsPowerAutomatePrivacyNoticeApproved := PrivacyNotice.GetPrivacyNoticeApprovalState(FlowServiceManagement.GetPowerAutomatePrivacyNoticeId()) = "Privacy Notice Approval State"::Agreed; end; trigger OnInsertRecord(BelowxRec: Boolean): Boolean begin if DocNoVisible then Rec.CheckCreditMaxBeforeInsert(); if (Rec."Sell-to Customer No." = '') and (Rec.GetFilter("Sell-to Customer No.") <> '') then CurrPage.Update(false); end; trigger OnNewRecord(BelowxRec: Boolean) begin xRec.Init(); Rec."Responsibility Center" := UserMgt.GetSalesFilter(); OnOnNewRecordOnAfterSetResponsibilityCenter(Rec); if (not DocNoVisible) and (Rec."No." = '') then Rec.SetSellToCustomerFromFilter(); Rec.SetDefaultPaymentServices(); SetControlAppearance(); UpdateShipToBillToGroupVisibility(); end; trigger OnOpenPage() var PaymentServiceSetup: Record "Payment Service Setup"; OfficeMgt: Codeunit "Office Management"; EnvironmentInfo: Codeunit "Environment Information"; begin Rec.SetSecurityFilterOnRespCenter(); OnOpenPageOnAfterSetSecurityFilterOnRespCenter(Rec); Rec.SetRange("Date Filter", 0D, WorkDate()); ActivateFields(); SetDocNoVisible(); IsOfficeAddin := OfficeMgt.IsAvailable(); SetControlAppearance(); IsSaaS := EnvironmentInfo.IsSaaS(); PaymentServiceVisible := PaymentServiceSetup.IsPaymentServiceVisible(); SetEnableSellToCustomerTemplateCode(); end; var SalesHeaderArchive: Record "Sales Header Archive"; SellToContact: Record Contact; BillToContact: Record Contact; GLSetup: Record "General Ledger Setup"; DocPrint: Codeunit "Document-Print"; UserMgt: Codeunit "User Setup Management"; ArchiveManagement: Codeunit ArchiveManagement; SalesCalcDiscByType: Codeunit "Sales - Calc Discount By Type"; CustomerMgt: Codeunit "Customer Mgt."; FormatAddress: Codeunit "Format Address"; PrivacyNotice: Codeunit "Privacy Notice"; FlowServiceManagement: Codeunit "Flow Service Management"; ChangeExchangeRate: Page "Change Exchange Rate"; EnableSellToCustomerTemplateCode: Boolean; HasIncomingDocument: Boolean; DocNoVisible: Boolean; OpenApprovalEntriesExistForCurrUser: Boolean; IsPowerAutomatePrivacyNoticeApproved: Boolean; OpenApprovalEntriesExist: Boolean; ShowWorkflowStatus: Boolean; IsOfficeAddin: Boolean; CanCancelApprovalForRecord: Boolean; PaymentServiceVisible: Boolean; PaymentServiceEnabled: Boolean; IsCustomerOrContactNotEmpty: Boolean; WorkDescription: Text; StatusStyleTxt: Text; EmptyShipToCodeErr: Label 'The Code field can only be empty if you select Custom Address in the Ship-to field.'; CanRequestApprovalForFlow: Boolean; CanCancelApprovalForFlow: Boolean; IsSaaS: Boolean; IsBillToCountyVisible: Boolean; IsSellToCountyVisible: Boolean; IsShipToCountyVisible: Boolean; IsSellToCustomerNotEmpty: Boolean; EnableNewSellToCustomerTemplateCode: Boolean; IsJournalTemplNameVisible: Boolean; IsPaymentMethodCodeVisible: Boolean; IsSalesLinesEditable: Boolean; protected var ShipToOptions: Enum "Sales Ship-to Options"; BillToOptions: Enum "Sales Bill-to Options"; EnableBillToCustomerNo: Boolean; local procedure ActivateFields() begin EnableBillToCustomerNo := Rec."Bill-to Customer Templ. Code" = ''; EnableSellToCustomerTemplateCode := Rec."Sell-to Customer No." = ''; IsBillToCountyVisible := FormatAddress.UseCounty(Rec."Bill-to Country/Region Code"); IsSellToCountyVisible := FormatAddress.UseCounty(Rec."Sell-to Country/Region Code"); IsShipToCountyVisible := FormatAddress.UseCounty(Rec."Ship-to Country/Region Code"); GLSetup.Get(); IsJournalTemplNameVisible := GLSetup."Journal Templ. Name Mandatory"; IsPaymentMethodCodeVisible := not GLSetup."Hide Payment Method Code"; SetEnableSellToCustomerTemplateCode(); IsSalesLinesEditable := Rec.SalesLinesEditable(); end; local procedure ApproveCalcInvDisc() begin CurrPage.SalesLines.PAGE.ApproveCalcInvDisc(); end; local procedure SaveInvoiceDiscountAmount() var DocumentTotals: Codeunit "Document Totals"; begin CurrPage.SaveRecord(); DocumentTotals.SalesRedistributeInvoiceDiscountAmountsOnDocument(Rec); CurrPage.Update(false); end; local procedure ClearSellToFilter() begin if Rec.GetFilter("Sell-to Customer No.") = xRec."Sell-to Customer No." then if Rec."Sell-to Customer No." <> xRec."Sell-to Customer No." then Rec.SetRange("Sell-to Customer No."); if Rec.GetFilter("Sell-to Contact No.") = xRec."Sell-to Contact No." then if Rec."Sell-to Contact No." <> xRec."Sell-to Contact No." then Rec.SetRange("Sell-to Contact No."); end; local procedure SetDocNoVisible() var DocumentNoVisibility: Codeunit DocumentNoVisibility; DocType: Option Quote,"Order",Invoice,"Credit Memo","Blanket Order","Return Order",Reminder,FinChMemo; begin DocNoVisible := DocumentNoVisibility.SalesDocumentNoIsVisible(DocType::Quote, Rec."No."); end; local procedure SetControlAppearance() var ApprovalsMgmt: Codeunit "Approvals Mgmt."; WorkflowWebhookMgt: Codeunit "Workflow Webhook Management"; begin HasIncomingDocument := Rec."Incoming Document Entry No." <> 0; OpenApprovalEntriesExistForCurrUser := ApprovalsMgmt.HasOpenApprovalEntriesForCurrentUser(Rec.RecordId); OpenApprovalEntriesExist := ApprovalsMgmt.HasOpenApprovalEntries(Rec.RecordId); CanCancelApprovalForRecord := ApprovalsMgmt.CanCancelApprovalForRecord(Rec.RecordId); IsCustomerOrContactNotEmpty := (Rec."Sell-to Customer No." <> '') or (Rec."Sell-to Contact No." <> ''); IsSellToCustomerNotEmpty := (Rec."Sell-to Customer No." <> ''); WorkflowWebhookMgt.GetCanRequestAndCanCancel(Rec.RecordId, CanRequestApprovalForFlow, CanCancelApprovalForFlow); end; local procedure CheckSalesCheckAllLinesHaveQuantityAssigned() var LinesInstructionMgt: Codeunit "Lines Instruction Mgt."; begin LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(Rec); end; local procedure UpdatePaymentService() var PaymentServiceSetup: Record "Payment Service Setup"; begin PaymentServiceEnabled := PaymentServiceSetup.CanChangePaymentService(Rec); end; local procedure UpdateShipToBillToGroupVisibility() begin CustomerMgt.CalculateShipBillToOptions(ShipToOptions, BillToOptions, Rec); end; local procedure SetEnableSellToCustomerTemplateCode() begin EnableNewSellToCustomerTemplateCode := Rec."Sell-to Customer No." = ''; end; [IntegrationEvent(false, false)] local procedure OnBeforeValidateShipToOptions(var SalesHeader: Record "Sales Header"; ShipToOptions: Option; var IsHandled: Boolean) begin end; [IntegrationEvent(false, false)] local procedure OnAfterValidateShipToOptions(var SalesHeader: Record "Sales Header"; ShipToOptions: Option) begin end; [IntegrationEvent(false, false)] local procedure OnOpenPageOnAfterSetSecurityFilterOnRespCenter(var SalesHeader: Record "Sales Header") begin end; [IntegrationEvent(false, false)] local procedure OnBeforeLookupBillToName(var Customer: Record Customer; SalesHeader: Record "Sales Header") begin end; [IntegrationEvent(false, false)] local procedure OnOnNewRecordOnAfterSetResponsibilityCenter(var SalesHeader: Record "Sales Header") begin end; [IntegrationEvent(true, false)] local procedure OnAfterOnAfterGetRecord(var SalesHeader: Record "Sales Header") begin end;}