Closed Frmog closed 3 years ago
we found out that this error is related to the Word layout of our report. When the Word layout is disabled, we can publish our App!
Hi @Frmog, thank you for the information. Could you please provide a code sample that will reproduce the issue? Please, also test with other document. Thank you! :)
I have attached the AL code, and the Word layout. The word layout is corrupted somehow. If we delete all the elements in the layout,publishing will still fail. The file is 4 Mb big,I think it contains the XML definition/mapping somehow, and that is the part that is failing.. for now its just a guess.
NewDateConfirmationNCO.docx report 50110 "New Date Confirmation NCO" { //based on report 1305 ApplicationArea = All; UsageCategory = Administration; WordLayout = './src/Report/WordLayouts/NewDateConfirmationNCO.docx'; Caption = 'New Date Confirmation'; DefaultLayout = Word; PreviewMode = PrintLayout; WordMergeDataItem = Header;
dataset
{
dataitem(Header; "Sales Header")
{
DataItemTableView = SORTING("Document Type", "No.") WHERE("Document Type" = CONST(Order));
RequestFilterFields = "No.", "Sell-to Customer No.", "No. Printed";
RequestFilterHeading = 'New Date Confirmation';
column(CompanyAddress1; CompanyAddr[1])
{
}
column(CompanyAddress2; CompanyAddr[2])
{
}
column(CompanyAddress3; CompanyAddr[3])
{
}
column(CompanyAddress4; CompanyAddr[4])
{
}
column(CompanyAddress5; CompanyAddr[5])
{
}
column(CompanyAddress6; CompanyAddr[6])
{
}
column(CompanyHomePage; CompanyInfo."Home Page")
{
}
column(CompanyEMail; CompanyInfo."E-Mail")
{
}
column(CompanyPicture; DummyCompanyInfo.Picture)
{
}
column(CompanyPhoneNo; CompanyInfo."Phone No.")
{
}
column(CompanyPhoneNo_Lbl; CompanyInfoPhoneNoLbl)
{
}
column(CompanyGiroNo; CompanyInfo."Giro No.")
{
}
column(CompanyGiroNo_Lbl; CompanyInfoGiroNoLbl)
{
}
column(CompanyBankName; CompanyInfo."Bank Name")
{
}
column(CompanyBankName_Lbl; CompanyInfoBankNameLbl)
{
}
column(CompanyBankBranchNo; CompanyInfo."Bank Branch No.")
{
}
column(CompanyBankBranchNo_Lbl; CompanyInfo.FieldCaption("Bank Branch No."))
{
}
column(CompanyBankAccountNo; CompanyInfo."Bank Account No.")
{
}
column(CompanyBankAccountNo_Lbl; CompanyInfoBankAccNoLbl)
{
}
column(CompanyIBAN; CompanyInfo.IBAN)
{
}
column(CompanyIBAN_Lbl; CompanyInfo.FieldCaption(IBAN))
{
}
column(CompanySWIFT; CompanyInfo."SWIFT Code")
{
}
column(CompanySWIFT_Lbl; CompanyInfo.FieldCaption("SWIFT Code"))
{
}
column(CompanyLogoPosition; CompanyLogoPosition)
{
}
column(CompanyRegistrationNumber; CompanyInfo.GetRegistrationNumber)
{
}
column(CompanyRegistrationNumber_Lbl; CompanyInfo.GetRegistrationNumberLbl)
{
}
column(CompanyVATRegNo; CompanyInfo.GetVATRegistrationNumber)
{
}
column(CompanyVATRegNo_Lbl; CompanyInfo.GetVATRegistrationNumberLbl)
{
}
column(CompanyVATRegistrationNo; CompanyInfo.GetVATRegistrationNumber)
{
}
column(CompanyVATRegistrationNo_Lbl; OurVATRegistrationNumberLbl)
{
}
column(CompanyLegalOffice; CompanyInfo.GetLegalOffice)
{
}
column(CompanyLegalOffice_Lbl; CompanyInfo.GetLegalOfficeLbl)
{
}
column(CompanyCustomGiro; CompanyInfo.GetCustomGiro)
{
}
column(CompanyCustomGiro_Lbl; CompanyInfo.GetCustomGiroLbl)
{
}
column(CompanyLegalStatement; GetLegalStatement)
{
}
column(CustomerAddress1; CustAddr[1])
{
}
column(CustomerAddress2; CustAddr[2])
{
}
column(CustomerAddress3; CustAddr[3])
{
}
column(CustomerAddress4; CustAddr[4])
{
}
column(CustomerAddress5; CustAddr[5])
{
}
column(CustomerAddress6; CustAddr[6])
{
}
column(CustomerAddress7; CustAddr[7])
{
}
column(CustomerAddress8; CustAddr[8])
{
}
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")
{
}
column(CustomerPostalBarCode; FormatAddr.PostalBarCode(1))
{
}
column(YourReference; "Your Reference")
{
}
column(YourReference_Lbl; FieldCaption("Your Reference"))
{
}
column(ShipmentMethodDescription; ShipmentMethod.Description)
{
}
column(ShipmentMethodDescription_Lbl; ShptMethodDescLbl)
{
}
column(Shipment_Lbl; ShipmentLbl)
{
}
column(ShipmentDate; Format("Shipment Date", 0, 4))
{
}
column(ShipmentDate_Lbl; FieldCaption("Shipment Date"))
{
}
column(ShowShippingAddress; ShowShippingAddr)
{
}
column(ShipToAddress_Lbl; ShiptoAddrLbl)
{
}
column(ShipToAddress1; ShipToAddr[1])
{
}
column(ShipToAddress2; ShipToAddr[2])
{
}
column(ShipToAddress3; ShipToAddr[3])
{
}
column(ShipToAddress4; ShipToAddr[4])
{
}
column(ShipToAddress5; ShipToAddr[5])
{
}
column(ShipToAddress6; ShipToAddr[6])
{
}
column(ShipToAddress7; ShipToAddr[7])
{
}
column(ShipToAddress8; ShipToAddr[8])
{
}
column(PaymentTermsDescription; PaymentTerms.Description)
{
}
column(PaymentTermsDescription_Lbl; PaymentTermsDescLbl)
{
}
column(PaymentMethodDescription; PaymentMethod.Description)
{
}
column(PaymentMethodDescription_Lbl; PaymentMethodDescLbl)
{
}
column(DocumentCopyText; StrSubstNo(DocumentCaption, CopyText))
{
}
column(BilltoCustumerNo; "Bill-to Customer No.")
{
}
column(BilltoCustomerNo_Lbl; FieldCaption("Bill-to Customer No."))
{
}
column(DocumentDate; Format("Document Date", 0, 4))
{
}
column(DocumentDate_Lbl; FieldCaption("Document Date"))
{
}
column(DueDate; Format("Due Date", 0, 4))
{
}
column(DueDate_Lbl; FieldCaption("Due Date"))
{
}
column(DocumentNo; "No.")
{
}
column(DocumentNo_Lbl; InvNoLbl)
{
}
column(QuoteNo; "Quote No.")
{
}
column(QuoteNo_Lbl; FieldCaption("Quote No."))
{
}
column(PricesIncludingVAT; "Prices Including VAT")
{
}
column(PricesIncludingVAT_Lbl; FieldCaption("Prices Including VAT"))
{
}
column(PricesIncludingVATYesNo; Format("Prices Including VAT"))
{
}
column(SalesPerson_Lbl; SalespersonLbl)
{
}
column(SalesPersonText_Lbl; SalesPersonText)
{
}
column(SalesPersonName; SalespersonPurchaser.Name)
{
}
column(SelltoCustomerNo; "Sell-to Customer No.")
{
}
column(SelltoCustomerNo_Lbl; CustomerNoLbl) //NCO
{
}
column(VATRegistrationNo; GetCustomerVATRegistrationNumber)
{
}
column(VATRegistrationNo_Lbl; GetCustomerVATRegistrationNumberLbl_NCO(Header)) //NCO
{
}
column(GlobalLocationNumber; GetCustomerGlobalLocationNumber)
{
}
column(GlobalLocationNumber_Lbl; GetCustomerGlobalLocationNumberLbl)
{
}
column(SellToFaxNo; GetSellToCustomerFaxNo)
{
}
column(SellToPhoneNo; "Sell-to Phone No.")
{
}
column(LegalEntityType; Cust.GetLegalEntityType)
{
}
column(LegalEntityType_Lbl; Cust.GetLegalEntityTypeLbl)
{
}
column(Copy_Lbl; CopyLbl)
{
}
column(EMail_Lbl; EMailLbl)
{
}
column(HomePage_Lbl; HomePageLbl)
{
}
column(InvoiceDiscountBaseAmount_Lbl; InvDiscBaseAmtLbl)
{
}
column(InvoiceDiscountAmount_Lbl; InvDiscountAmtLbl)
{
}
column(LineAmountAfterInvoiceDiscount_Lbl; LineAmtAfterInvDiscLbl)
{
}
column(LocalCurrency_Lbl; LocalCurrencyLbl)
{
}
column(ExchangeRateAsText; ExchangeRateText)
{
}
column(Page_Lbl; PageLbl)
{
}
column(SalesInvoiceLineDiscount_Lbl; SalesInvLineDiscLbl)
{
}
column(NewDateConfirmationLbl; NewDateConfirmationLbl)
{
}
column(Subtotal_Lbl; SubtotalLbl)
{
}
column(Total_Lbl; TotalLbl)
{
}
column(VATAmount_Lbl; VATAmtLbl)
{
}
column(VATBase_Lbl; VATBaseLbl)
{
}
column(VATAmountSpecification_Lbl; VATAmtSpecificationLbl)
{
}
column(VATClauses_Lbl; VATClausesLbl)
{
}
column(VATIdentifier_Lbl; VATIdentifierLbl)
{
}
column(VATPercentage_Lbl; VATPercentageLbl)
{
}
column(VATClause_Lbl; VATClause.TableCaption)
{
}
column(ExtDocNo_SalesHeader; "External Document No.")
{
}
column(ExtDocNo_SalesHeader_Lbl; FieldCaption("External Document No."))
{
}
column(ShowWorkDescription; ShowWorkDescription)
{
}
dataitem(Line; "Sales Line")
{
DataItemLink = "Document No." = FIELD("No.");
DataItemLinkReference = Header;
DataItemTableView = SORTING("Document No.", "Line No.");
UseTemporary = true;
column(LineNo_Line; "Line No.")
{
}
column(AmountExcludingVAT_Line; Amount)
{
AutoFormatExpression = "Currency Code";
AutoFormatType = 1;
}
column(AmountExcludingVAT_Line_Lbl; FieldCaption(Amount))
{
}
column(AmountIncludingVAT_Line; "Amount Including VAT")
{
AutoFormatExpression = "Currency Code";
AutoFormatType = 1;
}
column(AmountIncludingVAT_Line_Lbl; FieldCaption("Amount Including VAT"))
{
AutoFormatExpression = "Currency Code";
AutoFormatType = 1;
}
column(Description_Line; Description)
{
}
column(Description_Line_Lbl; FieldCaption(Description))
{
}
column(LineDiscountPercent_Line; "Line Discount %")
{
}
column(LineDiscountPercentText_Line; LineDiscountPctText)
{
}
column(LineAmount_Line; FormattedLineAmount)
{
AutoFormatExpression = "Currency Code";
AutoFormatType = 1;
}
column(LineAmount_Line_Lbl; FieldCaption("Line Amount"))
{
}
column(ItemNo_Line; "No.")
{
}
column(ItemNo_Line_Lbl; FieldCaption("No."))
{
}
column(ShipmentDate_Line; Format("Shipment Date"))
{
}
column(ShipmentDate_Line_Lbl; PostedShipmentDateLbl)
{
}
column(PlannedShipmentDate_Line; Format("Planned Shipment Date"))
{
}
column(PlannedShipmentDate_Line_Lbl; FieldCaption("Planned Shipment Date"))
{
}
column(Quantity_Line; FormattedQuantity)
{
}
column(Quantity_Line_Lbl; FieldCaption(Quantity))
{
}
column(Type_Line; Format(Type))
{
}
column(UnitPrice; FormattedUnitPrice)
{
AutoFormatExpression = "Currency Code";
AutoFormatType = 2;
}
column(UnitPrice_Lbl; FieldCaption("Unit Price"))
{
}
column(UnitOfMeasure; "Unit of Measure")
{
}
column(UnitOfMeasure_Lbl; FieldCaption("Unit of Measure"))
{
}
column(VATIdentifier_Line; "VAT Identifier")
{
}
column(VATIdentifier_Line_Lbl; FieldCaption("VAT Identifier"))
{
}
column(VATPct_Line; FormattedVATPct)
{
}
column(VATPct_Line_Lbl; FieldCaption("VAT %"))
{
}
column(TransHeaderAmount; TransHeaderAmount)
{
AutoFormatExpression = "Currency Code";
AutoFormatType = 1;
}
column(CrossReferenceNo; "Item Reference No.")
{
ObsoleteState = Pending;
ObsoleteReason = 'Replaced by Item Reference No.';
ObsoleteTag = '17.0';
}
column(CrossReferenceNo_Lbl; FieldCaption("Item Reference No."))
{
ObsoleteState = Pending;
ObsoleteReason = 'Replaced by Item Reference No.';
ObsoleteTag = '17.0';
}
column(ItemReferenceNo; "Item Reference No.")
{
}
column(ItemReferenceNo_Lbl; FieldCaption("Item Reference No."))
{
}
column(OrderRefLbl; OrderRefLbl) //NCO
{
}
column(BackOrderLbl; BackOrderLbl) //NCO
{
}
column(OrderRefText; OrderRefText) //NCO
{
}
dataitem(AssemblyLine; "Assembly Line")
{
DataItemTableView = SORTING("Document No.", "Line No.");
column(LineNo_AssemblyLine; "No.")
{
}
column(Description_AssemblyLine; Description)
{
}
column(Quantity_AssemblyLine; Quantity)
{
DecimalPlaces = 0 : 5;
}
column(UnitOfMeasure_AssemblyLine; GetUOMText("Unit of Measure Code"))
{
}
column(VariantCode_AssemblyLine; "Variant Code")
{
}
trigger OnPreDataItem()
begin
if not DisplayAssemblyInformation then
CurrReport.Break();
if not AsmInfoExistsForLine then
CurrReport.Break();
SetRange("Document Type", AsmHeader."Document Type");
SetRange("Document No.", AsmHeader."No.");
end;
}
trigger OnAfterGetRecord()
begin
if Type = Type::"G/L Account" then
"No." := '';
if "Line Discount %" = 0 then
LineDiscountPctText := ''
else
LineDiscountPctText := StrSubstNo('%1%', -Round("Line Discount %", 0.1));
if DisplayAssemblyInformation then
AsmInfoExistsForLine := AsmToOrderExists(AsmHeader);
TransHeaderAmount += PrevLineAmount;
PrevLineAmount := "Line Amount";
TotalSubTotal += "Line Amount";
TotalInvDiscAmount -= "Inv. Discount Amount";
TotalAmount += Amount;
TotalAmountVAT += "Amount Including VAT" - Amount;
TotalAmountInclVAT += "Amount Including VAT";
TotalPaymentDiscOnVAT += -("Line Amount" - "Inv. Discount Amount" - "Amount Including VAT");
TotalQuantity += Quantity; //NCO
FormatDocument.SetSalesLine(Line, FormattedQuantity, FormattedUnitPrice, FormattedVATPct, FormattedLineAmount);
if (Type = Type::"Item") then begin
if ("External Notes NCO" <> '') then //NCO
OrderRefText := OrderRefLbl + ': ' + "External Notes NCO"
else
OrderRefText := '';
end;
if FirstLineHasBeenOutput then
Clear(DummyCompanyInfo.Picture);
FirstLineHasBeenOutput := true;
end;
trigger OnPreDataItem()
begin
MoreLines := Find('+');
while MoreLines and (Description = '') and ("No." = '') and (Quantity = 0) and (Amount = 0) do
MoreLines := Next(-1) <> 0;
if not MoreLines then
CurrReport.Break();
SetRange("Line No.", 0, "Line No.");
TransHeaderAmount := 0;
PrevLineAmount := 0;
FirstLineHasBeenOutput := false;
DummyCompanyInfo.Picture := CompanyInfo.Picture;
end;
}
dataitem(WorkDescriptionLines; "Integer")
{
DataItemTableView = SORTING(Number) WHERE(Number = FILTER(1 .. 99999));
column(WorkDescriptionLineNumber; Number)
{
}
column(WorkDescriptionLine; WorkDescriptionLine)
{
}
trigger OnAfterGetRecord()
begin
if WorkDescriptionInstream.EOS then
CurrReport.Break();
WorkDescriptionInstream.ReadText(WorkDescriptionLine);
end;
trigger OnPostDataItem()
begin
Clear(WorkDescriptionInstream)
end;
trigger OnPreDataItem()
begin
if not ShowWorkDescription then
CurrReport.Break();
Header."Work Description".CreateInStream(WorkDescriptionInstream, TEXTENCODING::UTF8);
end;
}
dataitem(VATAmountLine; "VAT Amount Line")
{
DataItemTableView = SORTING("VAT Identifier", "VAT Calculation Type", "Tax Group Code", "Use Tax", Positive);
UseTemporary = true;
column(InvoiceDiscountAmount_VATAmountLine; "Invoice Discount Amount")
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(InvoiceDiscountAmount_VATAmountLine_Lbl; FieldCaption("Invoice Discount Amount"))
{
}
column(InvoiceDiscountBaseAmount_VATAmountLine; "Inv. Disc. Base Amount")
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(InvoiceDiscountBaseAmount_VATAmountLine_Lbl; FieldCaption("Inv. Disc. Base Amount"))
{
}
column(LineAmount_VatAmountLine; "Line Amount")
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(LineAmount_VatAmountLine_Lbl; FieldCaption("Line Amount"))
{
}
column(VATAmount_VatAmountLine; "VAT Amount")
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(VATAmount_VatAmountLine_Lbl; FieldCaption("VAT Amount"))
{
}
column(VATAmountLCY_VATAmountLine; VATAmountLCY)
{
}
column(VATAmountLCY_VATAmountLine_Lbl; VATAmountLCYLbl)
{
}
column(VATBase_VatAmountLine; "VAT Base")
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(VATBase_VatAmountLine_Lbl; FieldCaption("VAT Base"))
{
}
column(VATBaseLCY_VATAmountLine; VATBaseLCY)
{
}
column(VATBaseLCY_VATAmountLine_Lbl; VATBaseLCYLbl)
{
}
column(VATIdentifier_VatAmountLine; "VAT Identifier")
{
}
column(VATIdentifier_VatAmountLine_Lbl; FieldCaption("VAT Identifier"))
{
}
column(VATPct_VatAmountLine; "VAT %")
{
DecimalPlaces = 0 : 5;
}
column(VATPct_VatAmountLine_Lbl; FieldCaption("VAT %"))
{
}
column(NoOfVATIdentifiers; Count)
{
}
trigger OnAfterGetRecord()
begin
VATBaseLCY :=
GetBaseLCY(
Header."Posting Date", Header."Currency Code",
Header."Currency Factor");
VATAmountLCY :=
GetAmountLCY(
Header."Posting Date", Header."Currency Code",
Header."Currency Factor");
TotalVATBaseLCY += VATBaseLCY;
TotalVATAmountLCY += VATAmountLCY;
if "VAT Clause Code" <> '' then begin
VATClauseLine := VATAmountLine;
if VATClauseLine.Insert() then;
end;
end;
trigger OnPreDataItem()
begin
Clear(VATBaseLCY);
Clear(VATAmountLCY);
TotalVATBaseLCY := 0;
TotalVATAmountLCY := 0;
VATClauseLine.DeleteAll();
end;
}
dataitem(VATClauseLine; "VAT Amount Line")
{
DataItemTableView = SORTING("VAT Identifier", "VAT Calculation Type", "Tax Group Code", "Use Tax", Positive);
UseTemporary = true;
column(VATIdentifier_VATClauseLine; "VAT Identifier")
{
}
column(Code_VATClauseLine; VATClause.Code)
{
}
column(Code_VATClauseLine_Lbl; VATClause.FieldCaption(Code))
{
}
column(Description_VATClauseLine; VATClause.Description)
{
}
column(Description2_VATClauseLine; VATClause."Description 2")
{
}
column(VATAmount_VATClauseLine; "VAT Amount")
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(NoOfVATClauses; Count)
{
}
trigger OnAfterGetRecord()
begin
if "VAT Clause Code" = '' then
CurrReport.Skip();
if not VATClause.Get("VAT Clause Code") then
CurrReport.Skip();
VATClause.GetDescription(Header);
end;
}
dataitem(ReportTotalsLine; "Report Totals Buffer")
{
DataItemTableView = SORTING("Line No.");
UseTemporary = true;
column(Description_ReportTotalsLine; Description)
{
}
column(Amount_ReportTotalsLine; Amount)
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(AmountFormatted_ReportTotalsLine; "Amount Formatted")
{
}
column(FontBold_ReportTotalsLine; "Font Bold")
{
}
column(FontUnderline_ReportTotalsLine; "Font Underline")
{
}
trigger OnPreDataItem()
begin
CreateReportTotalLines;
end;
}
dataitem(LetterText; "Integer")
{
DataItemTableView = SORTING(Number) WHERE(Number = CONST(1));
column(GreetingText; GreetingLbl)
{
}
column(BodyText; BodyLbl)
{
}
column(ClosingText; ClosingLbl)
{
}
column(PmtDiscText; PmtDiscText)
{
}
trigger OnPreDataItem()
begin
PmtDiscText := '';
if Header."Payment Discount %" <> 0 then
PmtDiscText := StrSubstNo(PmtDiscTxt, Header."Pmt. Discount Date", Header."Payment Discount %");
end;
}
dataitem(Totals; "Integer")
{
DataItemTableView = SORTING(Number) WHERE(Number = CONST(1));
column(TotalNetAmount; TotalAmount)
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(TotalVATBaseLCY; TotalVATBaseLCY)
{
}
column(TotalAmountIncludingVAT; Format(TotalAmountInclVAT))
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(TotalVATAmount; TotalAmountVAT)
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(TotalVATAmountLCY; TotalVATAmountLCY)
{
}
column(TotalInvoiceDiscountAmount; TotalInvDiscAmount)
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(TotalPaymentDiscountOnVAT; TotalPaymentDiscOnVAT)
{
}
column(TotalVATAmountText; VATAmountLine.VATAmountText)
{
}
column(TotalExcludingVATText; TotalExclVATText)
{
}
column(TotalIncludingVATText; TotalInclVATText)
{
}
column(TotalSubTotal; TotalSubTotal)
{
AutoFormatExpression = Header."Currency Code";
AutoFormatType = 1;
}
column(TotalSubTotalMinusInvoiceDiscount; TotalSubTotal + TotalInvDiscAmount)
{
}
column(TotalText; TotalText)
{
}
column(TotalQuantity; TotalQuantity)
{
}
column(TotalQuantityLbl; TotalQuantityLbl)
{
}
}
trigger OnAfterGetRecord()
var
CurrencyExchangeRate: Record "Currency Exchange Rate";
ArchiveManagement: Codeunit ArchiveManagement;
SalesPost: Codeunit "Sales-Post";
begin
FirstLineHasBeenOutput := false;
Clear(Line);
Clear(SalesPost);
VATAmountLine.DeleteAll();
Line.DeleteAll();
SalesPost.GetSalesLines(Header, Line, 0);
Line.CalcVATAmountLines(0, Header, Line, VATAmountLine);
Line.UpdateVATOnLines(0, Header, Line, VATAmountLine);
if not IsReportInPreviewMode then
CODEUNIT.Run(CODEUNIT::"Sales-Printed", Header);
CurrReport.Language := Language.GetLanguageIdOrDefault("Language Code");
CalcFields("Work Description");
ShowWorkDescription := "Work Description".HasValue;
FormatAddr.GetCompanyAddr("Responsibility Center", RespCenter, CompanyInfo, CompanyAddr);
FormatAddr.SalesHeaderBillTo(CustAddr, Header);
ShowShippingAddr := FormatAddr.SalesHeaderShipTo(ShipToAddr, CustAddr, Header);
if not Cust.Get("Bill-to Customer No.") then
Clear(Cust);
if "Currency Code" <> '' then begin
CurrencyExchangeRate.FindCurrency("Posting Date", "Currency Code", 1);
CalculatedExchRate :=
Round(1 / "Currency Factor" * CurrencyExchangeRate."Exchange Rate Amount", 0.000001);
ExchangeRateText := StrSubstNo(ExchangeRateTxt, CalculatedExchRate, CurrencyExchangeRate."Exchange Rate Amount");
end;
FormatDocumentFields(Header);
if SellToContact.Get("Sell-to Contact No.") then;
if BillToContact.Get("Bill-to Contact No.") then;
if not IsReportInPreviewMode and
(CurrReport.UseRequestPage and ArchiveDocument or
not CurrReport.UseRequestPage and SalesSetup."Archive Orders")
then
ArchiveManagement.StoreSalesDocument(Header, LogInteraction);
TotalSubTotal := 0;
TotalInvDiscAmount := 0;
TotalAmount := 0;
TotalAmountVAT := 0;
TotalAmountInclVAT := 0;
TotalPaymentDiscOnVAT := 0;
TotalQuantity := 0; //NCO
end;
}
}
requestpage
{
SaveValues = true;
layout
{
area(content)
{
group(Options)
{
Caption = 'Options';
field(LogInteraction; LogInteraction)
{
ApplicationArea = Basic, Suite;
Caption = 'Log Interaction';
Enabled = LogInteractionEnable;
ToolTip = 'Specifies that interactions with the contact are logged.';
}
field(DisplayAsmInformation; DisplayAssemblyInformation)
{
ApplicationArea = Assembly;
Caption = 'Show Assembly Components';
ToolTip = 'Specifies if you want the report to include information about components that were used in linked assembly orders that supplied the item(s) being sold. (Only possible for RDLC report layout.)';
}
field(ArchiveDocument; ArchiveDocument)
{
ApplicationArea = Basic, Suite;
Caption = 'Archive Document';
ToolTip = 'Specifies if the document is archived after you print it.';
trigger OnValidate()
begin
if not ArchiveDocument then
LogInteraction := false;
end;
}
}
}
}
actions
{
}
trigger OnInit()
begin
LogInteractionEnable := true;
ArchiveDocument := SalesSetup."Archive Orders";
end;
trigger OnOpenPage()
begin
InitLogInteraction;
LogInteractionEnable := LogInteraction;
end;
}
labels
{
}
trigger OnInitReport()
begin
GLSetup.Get();
CompanyInfo.SetAutoCalcFields(Picture);
CompanyInfo.Get();
SalesSetup.Get();
CompanyInfo.VerifyAndSetPaymentInfo;
end;
trigger OnPostReport()
begin
if LogInteraction and not IsReportInPreviewMode then
if Header.FindSet then
repeat
Header.CalcFields("No. of Archived Versions");
if Header."Bill-to Contact No." <> '' then
SegManagement.LogDocument(
3, Header."No.", Header."Doc. No. Occurrence",
Header."No. of Archived Versions", DATABASE::Contact, Header."Bill-to Contact No."
, Header."Salesperson Code", Header."Campaign No.", Header."Posting Description", Header."Opportunity No.")
else
SegManagement.LogDocument(
3, Header."No.", Header."Doc. No. Occurrence",
Header."No. of Archived Versions", DATABASE::Customer, Header."Bill-to Customer No.",
Header."Salesperson Code", Header."Campaign No.", Header."Posting Description", Header."Opportunity No.");
until Header.Next() = 0;
end;
trigger OnPreReport()
begin
if Header.GetFilters = '' then
Error(NoFilterSetErr);
if not CurrReport.UseRequestPage then
InitLogInteraction;
CompanyLogoPosition := SalesSetup."Logo Position on Documents";
end;
var
NewDateConfirmationLbl: Label 'New Date Confirmation';
SalespersonLbl: Label 'Sales person';
CompanyInfoBankAccNoLbl: Label 'Account No.';
CompanyInfoBankNameLbl: Label 'Bank';
CompanyInfoGiroNoLbl: Label 'Giro No.';
CompanyInfoPhoneNoLbl: Label 'Phone No.';
CopyLbl: Label 'Copy';
EMailLbl: Label 'Email';
HomePageLbl: Label 'Home Page';
InvDiscBaseAmtLbl: Label 'Invoice Discount Base Amount';
InvDiscountAmtLbl: Label 'Invoice Discount';
InvNoLbl: Label 'Order No.';
LineAmtAfterInvDiscLbl: Label 'Payment Discount on VAT';
LocalCurrencyLbl: Label 'Local Currency';
PageLbl: Label 'Page';
PaymentTermsDescLbl: Label 'Payment Terms';
PaymentMethodDescLbl: Label 'Payment Method';
PostedShipmentDateLbl: Label 'Shipment Date';
SalesInvLineDiscLbl: Label 'Discount %';
ShipmentLbl: Label 'Shipment';
ShiptoAddrLbl: Label 'Ship-to Address';
ShptMethodDescLbl: Label 'Shipment Method';
SubtotalLbl: Label 'Subtotal';
TotalLbl: Label 'Total';
VATAmtSpecificationLbl: Label 'VAT Amount Specification';
VATAmtLbl: Label 'VAT Amount';
VATAmountLCYLbl: Label 'VAT Amount (LCY)';
VATBaseLbl: Label 'VAT Base';
VATBaseLCYLbl: Label 'VAT Base (LCY)';
VATClausesLbl: Label 'VAT Clause';
VATIdentifierLbl: Label 'VAT Identifier';
VATPercentageLbl: Label 'VAT %';
YourVATNumberLbl: Label 'Your VAT No.';
OurVATNumberLbl: Label 'Our VAT No.';
GLSetup: Record "General Ledger Setup";
ShipmentMethod: Record "Shipment Method";
PaymentTerms: Record "Payment Terms";
PaymentMethod: Record "Payment Method";
SalespersonPurchaser: Record "Salesperson/Purchaser";
CompanyInfo: Record "Company Information";
DummyCompanyInfo: Record "Company Information";
SalesSetup: Record "Sales & Receivables Setup";
Cust: Record Customer;
RespCenter: Record "Responsibility Center";
VATClause: Record "VAT Clause";
AsmHeader: Record "Assembly Header";
SellToContact: Record Contact;
BillToContact: Record Contact;
Language: Codeunit Language;
FormatAddr: Codeunit "Format Address";
FormatDocument: Codeunit "Format Document";
SegManagement: Codeunit SegManagement;
WorkDescriptionInstream: InStream;
CustAddr: array[8] of Text[100];
ShipToAddr: array[8] of Text[100];
CompanyAddr: array[8] of Text[100];
SalesPersonText: Text[30];
TotalText: Text[50];
TotalExclVATText: Text[50];
TotalInclVATText: Text[50];
LineDiscountPctText: Text;
FormattedVATPct: Text;
FormattedUnitPrice: Text;
FormattedQuantity: Text;
FormattedLineAmount: Text;
MoreLines: Boolean;
CopyText: Text[30];
NewKeyInSalesLine: Boolean;
ShowShippingAddr: Boolean;
ArchiveDocument: Boolean;
LogInteraction: Boolean;
TotalSubTotal: Decimal;
TotalAmount: Decimal;
TotalAmountInclVAT: Decimal;
TotalAmountVAT: Decimal;
TotalInvDiscAmount: Decimal;
TotalPaymentDiscOnVAT: Decimal;
TransHeaderAmount: Decimal;
[InDataSet]
LogInteractionEnable: Boolean;
DisplayAssemblyInformation: Boolean;
AsmInfoExistsForLine: Boolean;
CompanyLogoPosition: Integer;
TotalQuantity: Integer;
FirstLineHasBeenOutput: Boolean;
CalculatedExchRate: Decimal;
ExchangeRateText: Text;
ExchangeRateTxt: Label 'Exchange rate: %1/%2', Comment = '%1 and %2 are both amounts.';
VATBaseLCY: Decimal;
VATAmountLCY: Decimal;
TotalVATBaseLCY: Decimal;
TotalVATAmountLCY: Decimal;
PrevLineAmount: Decimal;
NoFilterSetErr: Label 'You must specify one or more filters to avoid accidently printing all documents.';
GreetingLbl: Label 'Hello';
ClosingLbl: Label 'Sincerely';
PmtDiscTxt: Label 'If we receive the payment before %1, you are eligible for a %2% payment discount.', Comment = '%1 Discount Due Date %2 = value of Payment Discount % ';
BodyLbl: Label 'Thank you for your business. Your order confirmation is attached to this message.';
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';
TotalQuantityLbl: Label 'Total Quantity'; //NCO
OurVATRegistrationNumberLbl: Label 'Our VAT No.'; //NCO
YourVATRegistrationNumberLbl: Label 'Your VAT No.'; //NCO
CustomerNoLbl: Label 'Customer No.'; //NCO
OrderRefLbl: Label 'Order ref.'; //NCO
BackOrderLbl: Label 'Back Order'; //NCO
OrderRefText: Text[50]; //NCO
PmtDiscText: Text;
ShowWorkDescription: Boolean;
WorkDescriptionLine: Text;
local procedure InitLogInteraction()
begin
LogInteraction := SegManagement.FindInteractTmplCode(3) <> '';
end;
local procedure DocumentCaption(): Text[250]
begin
exit(NewDateConfirmationLbl);
end;
procedure InitializeRequest(NewLogInteraction: Boolean; DisplayAsmInfo: Boolean)
begin
LogInteraction := NewLogInteraction;
DisplayAssemblyInformation := DisplayAsmInfo;
end;
local procedure IsReportInPreviewMode(): Boolean
var
MailManagement: Codeunit "Mail Management";
begin
exit(CurrReport.Preview or MailManagement.IsHandlingGetEmailBody);
end;
local procedure FormatDocumentFields(SalesHeader: Record "Sales Header")
begin
FormatDocument.SetTotalLabels(SalesHeader."Currency Code", TotalText, TotalInclVATText, TotalExclVATText);
FormatDocument.SetSalesPerson(SalespersonPurchaser, SalesHeader."Salesperson Code", SalesPersonText);
FormatDocument.SetPaymentTerms(PaymentTerms, SalesHeader."Payment Terms Code", SalesHeader."Language Code");
FormatDocument.SetPaymentMethod(PaymentMethod, SalesHeader."Payment Method Code", SalesHeader."Language Code");
FormatDocument.SetShipmentMethod(ShipmentMethod, SalesHeader."Shipment Method Code", SalesHeader."Language Code");
end;
local procedure GetUOMText(UOMCode: Code[10]): Text[50]
var
UnitOfMeasure: Record "Unit of Measure";
begin
if not UnitOfMeasure.Get(UOMCode) then
exit(UOMCode);
exit(UnitOfMeasure.Description);
end;
local procedure CreateReportTotalLines()
begin
ReportTotalsLine.DeleteAll();
//if (TotalInvDiscAmount <> 0) or (TotalAmountVAT <> 0) then
ReportTotalsLine.Add(SubtotalLbl, TotalSubTotal, true, false, false);
if TotalInvDiscAmount <> 0 then begin
ReportTotalsLine.Add(InvDiscountAmtLbl, TotalInvDiscAmount, false, false, false);
if TotalAmountVAT <> 0 then
ReportTotalsLine.Add(TotalExclVATText, TotalAmount, true, false, false);
end;
//if TotalAmountVAT <> 0 then
ReportTotalsLine.Add(VATAmountLine.VATAmountText, TotalAmountVAT, false, true, false);
end;
//NCO begin
local procedure GetCustomerVATRegistrationNumberLbl_NCO(Header: Record "Sales Header"): Text
begin
if Header."VAT Registration No." = '' then
exit('');
exit(YourVATRegistrationNumberLbl);
end;
//NCO end
}
Update: we have problems with 3 different Word layout at the moment. If we remove the "Embed fonts in the file" (see picture attached, then we can deploy again without error. So the "Internal server error" seems to be connected to the embedded fonts in Word layout. Any suggestions?
Update 2: If we use the option "Embed only the characters used in the document (best for reducing file size)" , we can also publish successfully.
@Frmog do you see any errors in the event log? I assume you are running locally.
Nope, we are running on cloud based solution. On the first screenshot, you can see the request ID, and session ID.
Hi again @Frmog, this one was tricky. I couldn't find your request in the server telemetry, your payload is too large, so the proxy stopped your request.
Let me see what we can do about it, both regarding improving the error message and how to help you. For now you can try and reduce the size of the package you are sending.
This error message might help you: The request's Content-Length 39541504 is larger than the request body size limit 30000000.
Thanks Johan! The size of the Word Layout is controlled by the "Embed fonts in the file" (> 4 Mb) . Using the other option ("Embed only the characters used in the document" reduces the size of the Word Layout considerably, and still works for us. It would be great to know what Payload Limit we have on the Layout. Is it something we can change ourselves in server options? Under all circumstances, it would be great to have a more explicit error message ;-)
Unfortunately the size limit is for the HTTP request to our cloud services. So you can't really calculate it like that. It looks at the full package. But I think we will only adjust the error message. The size is quite large already so unless there's a big use case we don't want to increase it.
Hi again @Frmog. I talked to the responsible engineers. So, for now you can just keep the ~30MB limit in the back of your mind when developing. We will not as part of this issue fix any error message.
But, we have an internal bug to align configuration values across our services and add a proper error message. When this is fixed, I will ping you in this issue thread. Thanks
Ok, I think I understand.. the HTTP request is generated when we publish our APP. I assume that the size of the request is for the whole APP, and not for each report in the App. I guess this is going to be an issue, if you publish an APP with many reports using Word Layout and embeded fonts. What can we do to reduce the size of our request? (Apart from changing the Word save option). Do we need to start develop a separat APP then?
@Frmog it's one HTTP request for the full app. As I see it you have two options. Either you open a support case, or you can add an idea here: https://aka.ms/bcideas. Neither of these options guarantee that we can help you.
If you want to unblock yourself I would create different apps. Thanks
Thanks a lot for your help.
@Frmog I have now recieved information that there should be a special error code implemented aligned across our services indicating that the package is too large. If you want, you could retry your scenario and see if this now can help you in the future to faster understand what's the issue. Thanks again
Hi, we experience, "Internal Server Error" when we try to deploye. Where can we get help to find out whats wrong? Best Regards.
[2021-06-21 13:16:59.30] Error: An error occured while processing the request. Request ID: 6b926081-9997-41d4-a9e4-d8997b0a65a7 Session ID: 883940b8-5226-474e-bfb1-8805ddd3f5bd
If you are targeting a cloud instance, supply these IDs if contacting Microsoft support. [2021-06-21 13:16:59.31] The request for path /v2.0/ferm_LIVING_Development/dev/apps?SchemaUpdateMode=forcesync&DependencyPublishingOption=default failed with code InternalServerError. Reason: Internal Server Error