diff --git a/src/Layers/IT/Tests/ApplicationTestLibrary/LibraryERM.Codeunit.al b/src/Layers/IT/Tests/ApplicationTestLibrary/LibraryERM.Codeunit.al index 9c2d2459e9..b27dd42b23 100644 --- a/src/Layers/IT/Tests/ApplicationTestLibrary/LibraryERM.Codeunit.al +++ b/src/Layers/IT/Tests/ApplicationTestLibrary/LibraryERM.Codeunit.al @@ -1421,9 +1421,6 @@ codeunit 131300 "Library - ERM" end; procedure CreateVATBusinessPostingGroup(var VATBusinessPostingGroup: Record "VAT Business Posting Group") - var - NoSeries: Record "No. Series"; - NoSeriesCode: Code[20]; begin VATBusinessPostingGroup.Init(); VATBusinessPostingGroup.Validate( @@ -1434,20 +1431,8 @@ codeunit 131300 "Library - ERM" // Validating Code as Name because value is not important. VATBusinessPostingGroup.Validate(Description, VATBusinessPostingGroup.Code); - // Set "Default Sales/Purchase operation"s - select first appropriate from "No. Series" - NoSeries.SetRange("No. Series Type", NoSeries."No. Series Type"::Sales); - if NoSeries.FindFirst() then - NoSeriesCode := NoSeries.Code - else - NoSeriesCode := CreateNoSeriesSalesCode(); - VATBusinessPostingGroup."Default Sales Operation Type" := NoSeriesCode; - - NoSeries.SetRange("No. Series Type", NoSeries."No. Series Type"::Purchase); - if NoSeries.FindFirst() then - NoSeriesCode := NoSeries.Code - else - NoSeriesCode := CreateNoSeriesPurchaseCode(); - VATBusinessPostingGroup."Default Purch. Operation Type" := NoSeriesCode; + VATBusinessPostingGroup."Default Sales Operation Type" := CreateNoSeriesSalesCode(); + VATBusinessPostingGroup."Default Purch. Operation Type" := CreateNoSeriesPurchaseCode(); VATBusinessPostingGroup.Insert(true); end; diff --git a/src/Layers/IT/Tests/Local/ITNonDedVAT.Codeunit.al b/src/Layers/IT/Tests/Local/ITNonDedVAT.Codeunit.al index edbd696f67..f786708fd2 100644 --- a/src/Layers/IT/Tests/Local/ITNonDedVAT.Codeunit.al +++ b/src/Layers/IT/Tests/Local/ITNonDedVAT.Codeunit.al @@ -595,6 +595,7 @@ codeunit 144001 "IT - Non Ded. VAT" // [THEN] There are several VAT entries having in total: Base = 670.28, Amount = 147.46, Nondeductible Base = 1005.43, Nondeductible Amount = 221.20 FindVATEntry(VATEntry, PostedInvoiceNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); VATEntry.CalcSums(Base, Amount, "Nondeductible Base", "Nondeductible Amount"); VATEntry.TestField(Base, 670.28); VATEntry.TestField(Amount, 147.46); @@ -651,6 +652,7 @@ codeunit 144001 "IT - Non Ded. VAT" // [THEN] There are several VAT entries having in total: Base = 363.67, Amount = 80.01, Nondeductible Base = 545.51, Nondeductible Amount = 120.01 FindVATEntry(VATEntry, PostedInvoiceNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); Assert.RecordCount(VATEntry, 6); VATEntry.CalcSums(Base, Amount, "Nondeductible Base", "Nondeductible Amount"); VATEntry.TestField(Base, 363.67); @@ -1174,6 +1176,8 @@ codeunit 144001 "IT - Non Ded. VAT" VATEntry: Record "VAT Entry"; begin FindVATEntry(VATEntry, DocumentNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); + VATEntry.FindLast(); VATEntry.TestField("Nondeductible Base", NonDeductibleBase); VATEntry.TestField("Nondeductible Amount", NonDeductibleAmount); end; diff --git a/src/Layers/IT/Tests/Local/NonDedVATMiscIT.Codeunit.al b/src/Layers/IT/Tests/Local/NonDedVATMiscIT.Codeunit.al index 8431a2d843..449ab77452 100644 --- a/src/Layers/IT/Tests/Local/NonDedVATMiscIT.Codeunit.al +++ b/src/Layers/IT/Tests/Local/NonDedVATMiscIT.Codeunit.al @@ -1096,6 +1096,7 @@ codeunit 144251 "Non Ded. VAT Misc. IT" begin VATEntry.SetRange("Document No.", DocumentNo); VATEntry.SetRange("Document Type", VATEntry."Document Type"::Invoice); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); VATEntry.FindLast(); end; diff --git a/src/Layers/IT/Tests/VAT/NonDedVATMisc.Codeunit.al b/src/Layers/IT/Tests/VAT/NonDedVATMisc.Codeunit.al index aa388c20a9..1e0eee9709 100644 --- a/src/Layers/IT/Tests/VAT/NonDedVATMisc.Codeunit.al +++ b/src/Layers/IT/Tests/VAT/NonDedVATMisc.Codeunit.al @@ -551,6 +551,7 @@ codeunit 134284 "Non Ded. VAT Misc." // [THEN] There are several VAT entries having in total: Base = 670.28, Amount = 147.46, Nondeductible Base = 1005.43, Nondeductible Amount = 221.20 FindVATEntry(VATEntry, PostedInvoiceNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); VATEntry.CalcSums(Base, Amount, "Non-Deductible VAT Base", "Non-Deductible VAT Amount"); VATEntry.TestField(Base, 670.28); VATEntry.TestField(Amount, 147.46); @@ -603,6 +604,7 @@ codeunit 134284 "Non Ded. VAT Misc." // [THEN] There are several VAT entries having in total: Base = 363.67, Amount = 80.01, Nondeductible Base = 545.51, Nondeductible Amount = 120.01 FindVATEntry(VATEntry, PostedInvoiceNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); Assert.RecordCount(VATEntry, 6); VATEntry.CalcSums(Base, Amount, "Non-Deductible VAT Base", "Non-Deductible VAT Amount"); VATEntry.TestField(Base, 363.67); diff --git a/src/Layers/IT/Tests/VAT/NonDeductiblePurchPosting.Codeunit.al b/src/Layers/IT/Tests/VAT/NonDeductiblePurchPosting.Codeunit.al index 1df5fdeec1..d35009e98f 100644 --- a/src/Layers/IT/Tests/VAT/NonDeductiblePurchPosting.Codeunit.al +++ b/src/Layers/IT/Tests/VAT/NonDeductiblePurchPosting.Codeunit.al @@ -928,6 +928,7 @@ codeunit 134283 "Non-Deductible Purch. Posting" begin VATEntry.SetRange("Document No.", DocumentNo); VATEntry.SetRange("Posting Date", WorkDate()); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); VATEntry.FindFirst(); end; diff --git a/src/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al b/src/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al index ee98b13f29..e8a48011f8 100644 --- a/src/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al +++ b/src/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al @@ -551,6 +551,7 @@ codeunit 134284 "Non Ded. VAT Misc." // [THEN] There are several VAT entries having in total: Base = 670.28, Amount = 147.46, Nondeductible Base = 1005.43, Nondeductible Amount = 221.20 FindVATEntry(VATEntry, PostedInvoiceNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); VATEntry.CalcSums(Base, Amount, "Non-Deductible VAT Base", "Non-Deductible VAT Amount"); VATEntry.TestField(Base, 670.28); VATEntry.TestField(Amount, 147.46); @@ -603,6 +604,7 @@ codeunit 134284 "Non Ded. VAT Misc." // [THEN] There are several VAT entries having in total: Base = 363.67, Amount = 80.01, Nondeductible Base = 545.51, Nondeductible Amount = 120.01 FindVATEntry(VATEntry, PostedInvoiceNo); + VATEntry.SetRange(Type, VATEntry.Type::Purchase); Assert.RecordCount(VATEntry, 6); VATEntry.CalcSums(Base, Amount, "Non-Deductible VAT Base", "Non-Deductible VAT Amount"); VATEntry.TestField(Base, 363.67);