Report 210 Blanket Sales Order
src/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Report.al1,038 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.BankAccount;using Microsoft.CRM.Contact;using Microsoft.CRM.Interaction;using Microsoft.CRM.Segment;using Microsoft.CRM.Team;using Microsoft.Finance.Currency;using Microsoft.Finance.Dimension;using Microsoft.Finance.GeneralLedger.Setup;using Microsoft.Finance.VAT.Calculation;using Microsoft.Foundation.Address;using Microsoft.Foundation.Company;using Microsoft.Foundation.PaymentTerms;using Microsoft.Foundation.Shipping;using Microsoft.Inventory.Location;using Microsoft.Sales.Customer;using Microsoft.Sales.Posting;using Microsoft.Sales.Setup;using Microsoft.Utilities;using System.Email;using System.Globalization;using System.Utilities;/// <summary>/// Generates a printable document for blanket sales orders to send to customers./// </summary>report 210 "Blanket Sales Order"{ Caption = 'Blanket Sales Order'; PreviewMode = PrintLayout; WordMergeDataItem = "Sales Header"; DefaultRenderingLayout = RDLCLayout; dataset { dataitem("Sales Header"; "Sales Header") { DataItemTableView = sorting("Document Type", "No.") where("Document Type" = const("Blanket Order")); RequestFilterFields = "No.", "Sell-to Customer No.", "No. Printed"; RequestFilterHeading = 'Blanket Sales Order'; column(ShipmentMethodDescription; ShipmentMethod.Description) { } column(PaymentTermsDescription; PaymentTerms.Description) { } column(No_SalesHeader; "No.") { } column(PaymentTermsCaption; PaymentTermsCaptionLbl) { } column(ShipmentMethodCaption; ShipmentMethodCaptionLbl) { } column(InvDiscAmountCaption; InvDiscAmountCaptionLbl) { } column(VATPercentCaption; VATPercentCaptionLbl) { } column(VATBaseCaption; VATBaseCaptionLbl) { } column(VATAmountCaption; VATAmountCaptionLbl) { } column(TotalCaption; TotalCaptionLbl) { } column(SellToContactPhoneNoLbl; SellToContactPhoneNoLbl) { } column(SellToContactMobilePhoneNoLbl; SellToContactMobilePhoneNoLbl) { } column(SellToContactEmailLbl; SellToContactEmailLbl) { } column(BillToContactPhoneNoLbl; BillToContactPhoneNoLbl) { } column(BillToContactMobilePhoneNoLbl; BillToContactMobilePhoneNoLbl) { } column(BillToContactEmailLbl; BillToContactEmailLbl) { } column(SellToContactPhoneNo; SellToContact."Phone No.") { } column(SellToContactMobilePhoneNo; SellToContact."Mobile Phone No.") { } column(SellToContactEmail; SellToContact."E-Mail") { } column(BillToContactPhoneNo; BillToContact."Phone No.") { } column(BillToContactMobilePhoneNo; BillToContact."Mobile Phone No.") { } column(BillToContactEmail; BillToContact."E-Mail") { } dataitem(CopyLoop; "Integer") { DataItemTableView = sorting(Number); dataitem(PageLoop; "Integer") { DataItemTableView = sorting(Number) where(Number = const(1)); column(BlanketSalesOrderCopyText; StrSubstNo(Text004, CopyText)) { } column(CustAddr1; CustAddr[1]) { } column(CompanyAddr1; CompanyAddr[1]) { } column(CustAddr2; CustAddr[2]) { } column(CompanyAddr2; CompanyAddr[2]) { } column(CustAddr3; CustAddr[3]) { } column(CompanyAddr3; CompanyAddr[3]) { } column(CustAddr4; CustAddr[4]) { } column(CompanyAddr4; CompanyAddr[4]) { } column(CustAddr5; CustAddr[5]) { } column(CompanyInfo3Picture; CompanyInfo3.Picture) { } column(CompanyInfo2Picture; CompanyInfo2.Picture) { } column(CompanyInfo1Picture; CompanyInfo1.Picture) { } column(CompanyInfoHomePage; CompanyInfo."Home Page") { } column(CompanyInfoEmail; CompanyInfo."E-Mail") { } column(CompanyInfoPhoneNo; CompanyInfo."Phone No.") { } column(CustAddr6; CustAddr[6]) { } column(CompanyInfoVATRegNo; CompanyInfo."VAT Registration No.") { } column(CompanyInfoGiroNo; CompanyInfo."Giro No.") { } column(CompanyInfoBankName; CompanyBankAccount.Name) { } column(CompanyInfoBankAccountNo; CompanyBankAccount."Bank Account No.") { } column(BilltoCustNo_SalesHeader; "Sales Header"."Bill-to Customer No.") { } column(DocDate_SalesHeader; Format("Sales Header"."Document Date", 0, 4)) { } column(VATNoText; VATNoText) { } column(VATRegNo_SalesHeader; "Sales Header"."VAT Registration No.") { } column(ShipmentDate_SalesHeader; Format("Sales Header"."Shipment Date")) { } column(SalesPersonText; SalesPersonText) { } column(SalesPurchPersonName; SalesPurchPerson.Name) { } column(ReferenceText; ReferenceText) { } column(YourReference_SalesHeader; "Sales Header"."Your Reference") { } column(CustAddr7; CustAddr[7]) { } column(CustAddr8; CustAddr[8]) { } column(CompanyAddr5; CompanyAddr[5]) { } column(CompanyAddr6; CompanyAddr[6]) { } column(CompanyAddr7; CompanyAddr[7]) { } column(CompanyAddr8; CompanyAddr[8]) { } column(PricesIncVAT_SalesHeader; "Sales Header"."Prices Including VAT") { } column(PageCaption; StrSubstNo(Text005, '')) { } column(OutputNo; OutputNo) { } column(PricesIncVAT1_SalesHeader; Format("Sales Header"."Prices Including VAT")) { } column(PhoneNoCaption; PhoneNoCaptionLbl) { } column(AmountCaption; AmountCaptionLbl) { } column(UnitPriceCaption; UnitPriceCaptionLbl) { } column(VATRegNoCaption; VATRegNoCaptionLbl) { } column(GiroNoCaption; GiroNoCaptionLbl) { } column(BankNameCaption; BankNameCaptionLbl) { } column(BankAcctNoCaption; BankAcctNoCaptionLbl) { } column(ShipmentDateCaption; ShipmentDateCaptionLbl) { } column(BlanketSalesOrderNoCaption; BlanketSalesOrderNoCaptionLbl) { } column(HomePageCaption; HomePageCaptionLbl) { } column(EmailCaption; EmailCaptionLbl) { } column(DocumentDateCaption; DocumentDateCaptionLbl) { } column(BilltoCustNo_SalesHeaderCaption; "Sales Header".FieldCaption("Bill-to Customer No.")) { } column(PricesIncVAT_SalesHeaderCaption; "Sales Header".FieldCaption("Prices Including VAT")) { } dataitem(DimensionLoop1; "Integer") { DataItemLinkReference = "Sales Header"; DataItemTableView = sorting(Number) where(Number = filter(1 ..)); column(DimText; DimText) { } column(Number_IntegerLine; Number) { } column(HeaderDimensionsCaption; HeaderDimensionsCaptionLbl) { } trigger OnAfterGetRecord() begin if Number = 1 then begin if not DimSetEntry1.FindSet() then CurrReport.Break(); end else if not Continue then CurrReport.Break(); Clear(DimText); Continue := false; repeat OldDimText := DimText; if DimText = '' then DimText := StrSubstNo('%1 %2', DimSetEntry1."Dimension Code", DimSetEntry1."Dimension Value Code") else DimText := StrSubstNo( '%1, %2 %3', DimText, DimSetEntry1."Dimension Code", DimSetEntry1."Dimension Value Code"); if StrLen(DimText) > MaxStrLen(OldDimText) then begin DimText := OldDimText; Continue := true; exit; end; until DimSetEntry1.Next() = 0; end; trigger OnPreDataItem() begin if not ShowInternalInfo then CurrReport.Break(); end; } dataitem("Sales Line"; "Sales Line") { DataItemLink = "Document Type" = field("Document Type"), "Document No." = field("No."); DataItemLinkReference = "Sales Header"; DataItemTableView = sorting("Document Type", "Document No.", "Line No."); trigger OnPreDataItem() begin CurrReport.Break(); end; } dataitem(RoundLoop; "Integer") { DataItemTableView = sorting(Number); column(SalesLineTypeInt; SalesLineTypeInt) { } column(VATBaseDisc_SalesHeader; "Sales Header"."VAT Base Discount %") { } column(TotalSalesInvDiscAmount; TotalSalesInvDiscAmount) { } column(TotalSalesLineAmount; TotalSalesLineAmount) { } column(LineNo_SalesLine; "Sales Line"."Line No.") { } column(SalesLineDescription; TempSalesLine.Description) { } column(No_SalesLine; "Sales Line"."No.") { } column(No_SalesLineCaption; "Sales Line".FieldCaption("No.")) { } column(DescriptionRL_SalesLine; "Sales Line".Description) { } column(Quantity_SalesLine; "Sales Line".Quantity) { } column(UnitofMeasure_SalesLine; "Sales Line"."Unit of Measure") { } column(LineAmountRL_SalesLine; "Sales Line"."Line Amount") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(UnitPrice_SalesLine; "Sales Line"."Unit Price") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 2; } column(ShipmentDate_SalesLine; Format("Sales Line"."Shipment Date")) { AutoFormatType = 1; } column(VATIdentifier_SalesLine; "Sales Line"."VAT Identifier") { } column(SalesLineInvDiscountAmt; -TempSalesLine."Inv. Discount Amount") { AutoFormatExpression = "Sales Line"."Currency Code"; AutoFormatType = 1; } column(TotalText; TotalText) { } column(SalesLineLnAmtInvDiscAmt; TempSalesLine."Line Amount" - TempSalesLine."Inv. Discount Amount") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATAmtLineVATAmountText; TempVATAmountLine.VATAmountText()) { } column(TotalExclVATText; TotalExclVATText) { } column(TotalInclVATText; TotalInclVATText) { } column(VATAmount; VATAmount) { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(SlLnLnAmtInvDiscAmtVATAmt; TempSalesLine."Line Amount" - TempSalesLine."Inv. Discount Amount" + VATAmount) { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATDiscountAmount; -VATDiscountAmount) { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(TotalAmountInclVAT; TotalAmountInclVAT) { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATBaseAmount; VATBaseAmount) { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(SubtotalCaption; SubtotalCaptionLbl) { } column(PaymentDiscountCaption; PaymentDiscountCaptionLbl) { } column(DescriptionRL_SalesLineCaption; "Sales Line".FieldCaption(Description)) { } column(Quantity_SalesLineCaption; "Sales Line".FieldCaption(Quantity)) { } column(UnitofMeasure_SalesLineCaption; "Sales Line".FieldCaption("Unit of Measure")) { } column(VATIdentifier_SalesLineCaption; "Sales Line".FieldCaption("VAT Identifier")) { } dataitem(DimensionLoop2; "Integer") { DataItemTableView = sorting(Number) where(Number = filter(1 ..)); column(DimText1; DimText) { } column(LineDimensionsCaption; LineDimensionsCaptionLbl) { } trigger OnAfterGetRecord() begin if Number = 1 then begin if not DimSetEntry2.Find('-') then CurrReport.Break(); end else if not Continue then CurrReport.Break(); Clear(DimText); Continue := false; repeat OldDimText := DimText; if DimText = '' then DimText := StrSubstNo('%1 %2', DimSetEntry2."Dimension Code", DimSetEntry2."Dimension Value Code") else DimText := StrSubstNo( '%1, %2 %3', DimText, DimSetEntry2."Dimension Code", DimSetEntry2."Dimension Value Code"); if StrLen(DimText) > MaxStrLen(OldDimText) then begin DimText := OldDimText; Continue := true; exit; end; until DimSetEntry2.Next() = 0; end; trigger OnPreDataItem() begin if not ShowInternalInfo then CurrReport.Break(); DimSetEntry2.SetRange("Dimension Set ID", "Sales Line"."Dimension Set ID"); end; } trigger OnAfterGetRecord() begin if Number = 1 then TempSalesLine.Find('-') else TempSalesLine.Next(); "Sales Line" := TempSalesLine; if not "Sales Header"."Prices Including VAT" and (TempSalesLine."VAT Calculation Type" = TempSalesLine."VAT Calculation Type"::"Full VAT") then TempSalesLine."Line Amount" := 0; if (TempSalesLine.Type = TempSalesLine.Type::"G/L Account") and (not ShowInternalInfo) then "Sales Line"."No." := ''; SalesLineTypeInt := TempSalesLine.Type.AsInteger(); TotalSalesLineAmount += TempSalesLine."Line Amount"; TotalSalesInvDiscAmount += TempSalesLine."Inv. Discount Amount"; end; trigger OnPostDataItem() begin TempSalesLine.DeleteAll(); end; trigger OnPreDataItem() begin MoreLines := TempSalesLine.Find('+'); while MoreLines and (TempSalesLine.Description = '') and (TempSalesLine."Description 2" = '') and (TempSalesLine."No." = '') and (TempSalesLine.Quantity = 0) and (TempSalesLine.Amount = 0) do MoreLines := TempSalesLine.Next(-1) <> 0; if not MoreLines then CurrReport.Break(); TempSalesLine.SetRange("Line No.", 0, TempSalesLine."Line No."); SetRange(Number, 1, TempSalesLine.Count); TotalSalesLineAmount := 0; TotalSalesInvDiscAmount := 0; end; } dataitem(VATCounter; "Integer") { DataItemTableView = sorting(Number); column(VATAmountLineVATBase; TempVATAmountLine."VAT Base") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATAmountLineVATAmount; TempVATAmountLine."VAT Amount") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATAmountLineLineAmount; TempVATAmountLine."Line Amount") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATAmtLineInvDiscBaseAmt; TempVATAmountLine."Inv. Disc. Base Amount") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATAmtLineInvDiscountAmt; TempVATAmountLine."Invoice Discount Amount") { AutoFormatExpression = "Sales Header"."Currency Code"; AutoFormatType = 1; } column(VATAmountLineVAT; TempVATAmountLine."VAT %") { DecimalPlaces = 0 : 5; } column(VATAmtLineVATIdentifier; TempVATAmountLine."VAT Identifier") { } column(VATAmtSpecificationCaption; VATAmtSpecificationCaptionLbl) { } column(VATIdentifierCaption; VATIdentifierCaptionLbl) { } column(InvDiscBaseAmountCaption; InvDiscBaseAmountCaptionLbl) { } column(LineAmountCaption; LineAmountCaptionLbl) { } trigger OnAfterGetRecord() begin TempVATAmountLine.GetLine(Number); end; trigger OnPreDataItem() begin if VATAmount = 0 then CurrReport.Break(); SetRange(Number, 1, TempVATAmountLine.Count); end; } dataitem(VATCounterLCY; "Integer") { DataItemTableView = sorting(Number); column(VALExchRate; VALExchRate) { } column(VALSpecLCYHeader; VALSpecLCYHeader) { } column(VALVATAmountLCY; VALVATAmountLCY) { AutoFormatType = 1; } column(VALVATBaseLCY; VALVATBaseLCY) { AutoFormatType = 1; } column(VATAmtLineVATPercentage; TempVATAmountLine."VAT %") { DecimalPlaces = 0 : 5; } column(VATAmtLineVATIdentifierVCL; TempVATAmountLine."VAT Identifier") { } column(VATIdentifierVCLCaption; VATIdentifierVCLCaptionLbl) { } trigger OnAfterGetRecord() begin TempVATAmountLine.GetLine(Number); VALVATBaseLCY := TempVATAmountLine.GetBaseLCY( "Sales Header"."Posting Date", "Sales Header"."Currency Code", "Sales Header"."Currency Factor"); VALVATAmountLCY := TempVATAmountLine.GetAmountLCY( "Sales Header"."Posting Date", "Sales Header"."Currency Code", "Sales Header"."Currency Factor"); end; trigger OnPreDataItem() begin if (not GLSetup."Print VAT specification in LCY") or ("Sales Header"."Currency Code" = '') or (TempVATAmountLine.GetTotalVATAmount() = 0) then CurrReport.Break(); SetRange(Number, 1, TempVATAmountLine.Count); Clear(VALVATBaseLCY); Clear(VALVATAmountLCY); if GLSetup."LCY Code" = '' then VALSpecLCYHeader := Text007 + Text008 else VALSpecLCYHeader := Text007 + Format(GLSetup."LCY Code"); CurrExchRate.FindCurrency(WorkDate(), "Sales Header"."Currency Code", 1); VALExchRate := StrSubstNo(Text009, CurrExchRate."Relational Exch. Rate Amount", CurrExchRate."Exchange Rate Amount"); end; } dataitem(Total; "Integer") { DataItemTableView = sorting(Number) where(Number = const(1)); } dataitem(Total2; "Integer") { DataItemTableView = sorting(Number) where(Number = const(1)); column(SelltoCustNo_SalesHeader; "Sales Header"."Sell-to Customer No.") { } column(ShipToAddr1; ShipToAddr[1]) { } column(ShipToAddr2; ShipToAddr[2]) { } column(ShipToAddr3; ShipToAddr[3]) { } column(ShipToAddr4; ShipToAddr[4]) { } column(ShipToAddr5; ShipToAddr[5]) { } column(ShipToAddr6; ShipToAddr[6]) { } column(ShipToAddr7; ShipToAddr[7]) { } column(ShipToAddr8; ShipToAddr[8]) { } column(ShiptoAddressCaption; ShiptoAddressCaptionLbl) { } column(ShipToPhoneNo; "Sales Header"."Ship-to Phone No.") { } column(SelltoCustNo_SalesHeaderCaption; "Sales Header".FieldCaption("Sell-to Customer No.")) { } trigger OnPreDataItem() begin if not ShowShippingAddr then CurrReport.Break(); end; } } trigger OnAfterGetRecord() var SalesPost: Codeunit "Sales-Post"; begin Clear(TempSalesLine); Clear(SalesPost); TempSalesLine.DeleteAll(); TempVATAmountLine.DeleteAll(); SalesPost.GetSalesLines("Sales Header", TempSalesLine, 0); TempSalesLine.CalcVATAmountLines(0, "Sales Header", TempSalesLine, TempVATAmountLine); TempSalesLine.UpdateVATOnLines(0, "Sales Header", TempSalesLine, TempVATAmountLine); VATAmount := TempVATAmountLine.GetTotalVATAmount(); VATBaseAmount := TempVATAmountLine.GetTotalVATBase(); VATDiscountAmount := TempVATAmountLine.GetTotalVATDiscount("Sales Header"."Currency Code", "Sales Header"."Prices Including VAT"); TotalAmountInclVAT := TempVATAmountLine.GetTotalAmountInclVAT(); if Number > 1 then begin CopyText := FormatDocument.GetCOPYText(); OutputNo += 1; end; end; trigger OnPostDataItem() begin if not IsReportInPreviewMode() then CODEUNIT.Run(CODEUNIT::"Sales-Printed", "Sales Header"); end; trigger OnPreDataItem() begin NoOfLoops := Abs(NoOfCopies) + 1; CopyText := ''; SetRange(Number, 1, NoOfLoops); OutputNo := 1; end; } trigger OnAfterGetRecord() begin CurrReport.Language := LanguageMgt.GetLanguageIdOrDefault("Language Code"); CurrReport.FormatRegion := LanguageMgt.GetFormatRegionOrDefault("Format Region"); FormatAddr.SetLanguageCode("Language Code"); FormatAddressFields("Sales Header"); FormatDocumentFields("Sales Header"); if SellToContact.Get("Sell-to Contact No.") then; if BillToContact.Get("Bill-to Contact No.") then; if not CompanyBankAccount.Get("Sales Header"."Company Bank Account Code") then CompanyBankAccount.CopyBankFieldsFromCompanyInfo(CompanyInfo); DimSetEntry1.SetRange("Dimension Set ID", "Dimension Set ID"); if not IsReportInPreviewMode() then if ArchiveDocument then ArchiveManagement.StoreSalesDocument("Sales Header", LogInteraction); end; } } requestpage { SaveValues = true; layout { area(content) { group(Options) { Caption = 'Options'; field(NoOfCopies; NoOfCopies) { ApplicationArea = Suite; Caption = 'No. of Copies'; ToolTip = 'Specifies how many copies of the document to print.'; } field(ShowInternalInfo; ShowInternalInfo) { ApplicationArea = Suite; Caption = 'Show Internal Information'; ToolTip = 'Specifies if you want the printed report to show information that is only for internal use.'; } field(ArchiveDocument; ArchiveDocument) { ApplicationArea = Suite; Caption = 'Archive Document'; ToolTip = 'Specifies whether to archive the order.'; trigger OnValidate() begin if not ArchiveDocument then LogInteraction := false; end; } field(LogInteraction; LogInteraction) { ApplicationArea = Suite; Caption = 'Log Interaction'; Enabled = LogInteractionEnable; ToolTip = 'Specifies if you want the program to log this interaction.'; } } } } actions { } trigger OnInit() begin InitLogInteraction(); LogInteractionEnable := LogInteraction; ArchiveDocument := SalesSetup."Archive Blanket Orders"; end; } rendering { layout(RDLCLayout) { Type = RDLC; LayoutFile = './Sales/Document/BlanketSalesOrder.rdlc'; Summary = 'Report layout made in the legacy RDLC format. Use an RDLC editor to modify the layout.'; } } labels { } trigger OnInitReport() begin GLSetup.Get(); CompanyInfo.Get(); SalesSetup.Get(); FormatDocument.SetLogoPosition(SalesSetup."Logo Position on Documents", CompanyInfo1, CompanyInfo2, CompanyInfo3); end; trigger OnPostReport() begin if LogInteraction and not IsReportInPreviewMode() then if "Sales Header".FindSet() then repeat "Sales Header".CalcFields("No. of Archived Versions"); if "Sales Header"."Bill-to Contact No." <> '' then SegManagement.LogDocument( 2, "Sales Header"."No.", "Sales Header"."Doc. No. Occurrence", "Sales Header"."No. of Archived Versions", Database::Contact, "Sales Header"."Bill-to Contact No.", "Sales Header"."Salesperson Code", "Sales Header"."Campaign No.", "Sales Header"."Posting Description", "Sales Header"."Opportunity No.") else SegManagement.LogDocument( 2, "Sales Header"."No.", "Sales Header"."Doc. No. Occurrence", "Sales Header"."No. of Archived Versions", Database::Customer, "Sales Header"."Bill-to Customer No.", "Sales Header"."Salesperson Code", "Sales Header"."Campaign No.", "Sales Header"."Posting Description", "Sales Header"."Opportunity No."); until "Sales Header".Next() = 0; end; var GLSetup: Record "General Ledger Setup"; SalesSetup: Record "Sales & Receivables Setup"; CompanyBankAccount: Record "Bank Account"; TempSalesLine: Record "Sales Line" temporary; DimSetEntry1: Record "Dimension Set Entry"; DimSetEntry2: Record "Dimension Set Entry"; RespCenter: Record "Responsibility Center"; CurrExchRate: Record "Currency Exchange Rate"; SellToContact: Record Contact; BillToContact: Record Contact; LanguageMgt: Codeunit Language; FormatAddr: Codeunit "Format Address"; FormatDocument: Codeunit "Format Document"; SegManagement: Codeunit SegManagement; ArchiveManagement: Codeunit ArchiveManagement; VATNoText: Text[80]; ReferenceText: Text[80]; MoreLines: Boolean; NoOfCopies: Integer; NoOfLoops: Integer; SalesLineTypeInt: Integer; OutputNo: Integer; CopyText: Text[30]; DimText: Text[120]; OldDimText: Text[75]; ShowInternalInfo: Boolean; Continue: Boolean; LogInteraction: Boolean; VALSpecLCYHeader: Text[80]; VALExchRate: Text[50];#pragma warning disable AA0074 Text007: Label 'VAT Amount Specification in '; Text008: Label 'Local Currency';#pragma warning disable AA0470 Text009: Label 'Exchange rate: %1/%2';#pragma warning restore AA0470#pragma warning restore AA0074 ArchiveDocument: Boolean; LogInteractionEnable: Boolean;#pragma warning disable AA0074 Text004: Label 'Blanket Sales Order %1', Comment = '%1 = Document No.';#pragma warning disable AA0470 Text005: Label 'Page %1';#pragma warning restore AA0470#pragma warning restore AA0074 PaymentTermsCaptionLbl: Label 'Payment Terms'; ShipmentMethodCaptionLbl: Label 'Shipment Method'; PhoneNoCaptionLbl: Label 'Phone No.'; AmountCaptionLbl: Label 'Amount'; UnitPriceCaptionLbl: Label 'Unit Price'; VATRegNoCaptionLbl: Label 'VAT Registration No.'; GiroNoCaptionLbl: Label 'Giro No.'; BankNameCaptionLbl: Label 'Bank'; BankAcctNoCaptionLbl: Label 'Account No.'; ShipmentDateCaptionLbl: Label 'Shipment Date'; BlanketSalesOrderNoCaptionLbl: Label 'Blanket Sales Order No.'; HomePageCaptionLbl: Label 'Home Page'; EmailCaptionLbl: Label 'Email'; DocumentDateCaptionLbl: Label 'Document Date'; HeaderDimensionsCaptionLbl: Label 'Header Dimensions'; SubtotalCaptionLbl: Label 'Subtotal'; PaymentDiscountCaptionLbl: Label 'Payment Discount on VAT'; LineDimensionsCaptionLbl: Label 'Line Dimensions'; VATAmtSpecificationCaptionLbl: Label 'VAT Amount Specification'; VATIdentifierCaptionLbl: Label 'VAT Identifier'; InvDiscBaseAmountCaptionLbl: Label 'Invoice Discount Base Amount'; LineAmountCaptionLbl: Label 'Line Amount'; VATIdentifierVCLCaptionLbl: Label 'VAT Identifier'; ShiptoAddressCaptionLbl: Label 'Ship-to Address'; InvDiscAmountCaptionLbl: Label 'Invoice Discount Amount'; VATPercentCaptionLbl: Label 'VAT %'; VATBaseCaptionLbl: Label 'VAT Base'; VATAmountCaptionLbl: Label 'VAT Amount'; TotalCaptionLbl: Label 'Total'; SellToContactPhoneNoLbl: Label 'Sell-to Contact Phone No.'; SellToContactMobilePhoneNoLbl: Label 'Sell-to Contact Mobile Phone No.'; SellToContactEmailLbl: Label 'Sell-to Contact E-Mail'; BillToContactPhoneNoLbl: Label 'Bill-to Contact Phone No.'; BillToContactMobilePhoneNoLbl: Label 'Bill-to Contact Mobile Phone No.'; BillToContactEmailLbl: Label 'Bill-to Contact E-Mail'; protected var ShipmentMethod: Record "Shipment Method"; PaymentTerms: Record "Payment Terms"; SalesPurchPerson: Record "Salesperson/Purchaser"; CompanyInfo: Record "Company Information"; CompanyInfo3: Record "Company Information"; CompanyInfo2: Record "Company Information"; CompanyInfo1: Record "Company Information"; TempVATAmountLine: Record "VAT Amount Line" temporary; CustAddr: array[8] of Text[100]; ShipToAddr: array[8] of Text[100]; CompanyAddr: array[8] of Text[100]; SalesPersonText: Text[50]; TotalText: Text[50]; TotalExclVATText: Text[50]; TotalInclVATText: Text[50]; ShowShippingAddr: Boolean; TotalAmountInclVAT: Decimal; TotalSalesLineAmount: Decimal; TotalSalesInvDiscAmount: Decimal; VATAmount: Decimal; VATBaseAmount: Decimal; VATDiscountAmount: Decimal; VALVATBaseLCY: Decimal; VALVATAmountLCY: Decimal; /// <summary> /// Initializes the report request with the specified parameters. /// </summary> /// <param name="NewNoOfCopies">The number of copies to print.</param> /// <param name="NewShowInternalInfo">Whether to show internal information.</param> /// <param name="NewArchiveDocument">Whether to archive the document.</param> /// <param name="NewLogInteraction">Whether to log interaction.</param> procedure InitializeRequest(NewNoOfCopies: Integer; NewShowInternalInfo: Boolean; NewArchiveDocument: Boolean; NewLogInteraction: Boolean) begin NoOfCopies := NewNoOfCopies; ShowInternalInfo := NewShowInternalInfo; ArchiveDocument := NewArchiveDocument; LogInteraction := NewLogInteraction; end; local procedure IsReportInPreviewMode(): Boolean var MailManagement: Codeunit "Mail Management"; begin exit(CurrReport.Preview or MailManagement.IsHandlingGetEmailBody()); end; local procedure InitLogInteraction() begin LogInteraction := SegManagement.FindInteractionTemplateCode(Enum::"Interaction Log Entry Document Type"::"Sales Blnkt. Ord") <> ''; end; local procedure FormatAddressFields(var SalesHeader: Record "Sales Header") begin FormatAddr.GetCompanyAddr(SalesHeader."Responsibility Center", RespCenter, CompanyInfo, CompanyAddr); FormatAddr.SalesHeaderBillTo(CustAddr, SalesHeader); ShowShippingAddr := FormatAddr.SalesHeaderShipTo(ShipToAddr, CustAddr, SalesHeader); end; local procedure FormatDocumentFields(SalesHeader: Record "Sales Header") begin FormatDocument.SetTotalLabels(SalesHeader."Currency Code", TotalText, TotalInclVATText, TotalExclVATText); FormatDocument.SetSalesPerson(SalesPurchPerson, SalesHeader."Salesperson Code", SalesPersonText); FormatDocument.SetPaymentTerms(PaymentTerms, SalesHeader."Payment Terms Code", SalesHeader."Language Code"); FormatDocument.SetShipmentMethod(ShipmentMethod, SalesHeader."Shipment Method Code", SalesHeader."Language Code"); ReferenceText := FormatDocument.SetText(SalesHeader."Your Reference" <> '', SalesHeader.FieldCaption("Your Reference")); VATNoText := FormatDocument.SetText(SalesHeader."VAT Registration No." <> '', SalesHeader.FieldCaption("VAT Registration No.")); end;}