@@ -672,7 +672,7 @@ codeunit 13918 "XRechnung XML Document Tests"
672672 begin
673673 LibrarySales. SetCalcInvDiscount( true) ;
674674 SalesHeader. CalcFields( Amount) ;
675- SalesCalcDiscountByType. ApplyInvDiscBasedOnAmt( SalesHeader. Amount / 2 , SalesHeader) ;
675+ SalesCalcDiscountByType. ApplyInvDiscBasedOnAmt( SalesHeader. Amount * LibraryRandom . RandDecInRange ( 40 , 60 , 5 ) / 100 , SalesHeader) ;
676676 end ;
677677
678678 local procedure CreateSalesHeader( var SalesHeader: Record "Sales Header"; DocumentType: Enum "Sales Document Type") ;
@@ -722,7 +722,7 @@ codeunit 13918 "XRechnung XML Document Tests"
722722 SalesLine. Validate( "Unit of Measure", UnitOfMeasure. Code ) ;
723723 SalesLine. Validate( "Tax Category", LibraryRandom. RandText( 2 )) ;
724724 if LineDiscount then
725- SalesLine. Validate( "Line Discount %", LibraryRandom. RandDecInRange( 10 , 20 , 2 )) ;
725+ SalesLine. Validate( "Line Discount %", LibraryRandom. RandDecInRange( 10 , 20 , 5 )) ;
726726 SalesLine. Modify ( true) ;
727727 end ;
728728
@@ -970,7 +970,7 @@ codeunit 13918 "XRechnung XML Document Tests"
970970 Path := DocumentTok + ' /cbc:AllowanceChargeReason' ;
971971 Assert. AreEqual( ' LineDiscount' , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
972972 Path := DocumentTok + ' /cbc:MultiplierFactorNumeric' ;
973- Assert. AreEqual( FormatDecimal ( SalesInvoiceLine. "Line Discount %") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
973+ Assert. AreEqual( FormatFiveDecimal ( SalesInvoiceLine. "Line Discount %") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
974974 Path := DocumentTok + ' /cbc:Amount' ;
975975 Assert. AreEqual( FormatDecimal( SalesInvoiceLine. "Line Discount Amount") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
976976 Path := DocumentTok + ' /cbc:BaseAmount' ;
@@ -986,7 +986,7 @@ codeunit 13918 "XRechnung XML Document Tests"
986986 Path := DocumentTok + ' /cbc:AllowanceChargeReason' ;
987987 Assert. AreEqual( ' Document discount' , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
988988 Path := DocumentTok + ' /cbc:MultiplierFactorNumeric' ;
989- Assert. AreEqual( FormatDecimal ( 100 * SalesInvoiceHeader. "Invoice Discount Amount" / ( SalesInvoiceHeader. "Invoice Discount Amount" + SalesInvoiceHeader. Amount)) , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
989+ Assert. AreEqual( FormatFiveDecimal ( 100 * SalesInvoiceHeader. "Invoice Discount Amount" / ( SalesInvoiceHeader. "Invoice Discount Amount" + SalesInvoiceHeader. Amount)) , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
990990 Path := DocumentTok + ' /cbc:Amount' ;
991991 Assert. AreEqual( FormatDecimal( SalesInvoiceHeader. "Invoice Discount Amount") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
992992 Path := DocumentTok + ' /cbc:BaseAmount' ;
@@ -1056,7 +1056,7 @@ codeunit 13918 "XRechnung XML Document Tests"
10561056 Path := DocumentTok + ' /cbc:AllowanceChargeReason' ;
10571057 Assert. AreEqual( ' LineDiscount' , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
10581058 Path := DocumentTok + ' /cbc:MultiplierFactorNumeric' ;
1059- Assert. AreEqual( FormatDecimal ( SalesCrMemoLine. "Line Discount %") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
1059+ Assert. AreEqual( FormatFiveDecimal ( SalesCrMemoLine. "Line Discount %") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
10601060 Path := DocumentTok + ' /cbc:Amount' ;
10611061 Assert. AreEqual( FormatDecimal( SalesCrMemoLine. "Line Discount Amount") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
10621062 Path := DocumentTok + ' /cbc:BaseAmount' ;
@@ -1072,7 +1072,7 @@ codeunit 13918 "XRechnung XML Document Tests"
10721072 Path := DocumentTok + ' /cbc:AllowanceChargeReason' ;
10731073 Assert. AreEqual( ' Document discount' , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
10741074 Path := DocumentTok + ' /cbc:MultiplierFactorNumeric' ;
1075- Assert. AreEqual( FormatDecimal ( 100 * SalesCrMemoHeader. "Invoice Discount Amount" / ( SalesCrMemoHeader. "Invoice Discount Amount" + SalesCrMemoHeader. Amount)) , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
1075+ Assert. AreEqual( FormatFiveDecimal ( 100 * SalesCrMemoHeader. "Invoice Discount Amount" / ( SalesCrMemoHeader. "Invoice Discount Amount" + SalesCrMemoHeader. Amount)) , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
10761076 Path := DocumentTok + ' /cbc:Amount' ;
10771077 Assert. AreEqual( FormatDecimal( SalesCrMemoHeader. "Invoice Discount Amount") , GetNodeByPathWithError( TempXMLBuffer, Path) , StrSubstNo( IncorrectValueErr, Path)) ;
10781078 Path := DocumentTok + ' /cbc:BaseAmount' ;
@@ -1232,6 +1232,11 @@ codeunit 13918 "XRechnung XML Document Tests"
12321232 exit ( Format( Round( VarDecimal, 0.0001 ) , 0 , 9 )) ;
12331233 end ;
12341234
1235+ procedure FormatFiveDecimal( VarDecimal: Decimal ) : Text [30 ];
1236+ begin
1237+ exit ( Format( Round( VarDecimal, 0.00001 ) , 0 , 9 )) ;
1238+ end ;
1239+
12351240 local procedure Initialize() ;
12361241 begin
12371242 LibraryTestInitialize. OnTestInitialize( Codeunit ::"XRechnung XML Document Tests") ;
0 commit comments