diff --git a/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFADepreciationBookFR.Codeunit.al b/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFADepreciationBookFR.Codeunit.al
index d10eb13a5e..02449cc447 100644
--- a/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFADepreciationBookFR.Codeunit.al
+++ b/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFADepreciationBookFR.Codeunit.al
@@ -38,16 +38,39 @@ codeunit 10875 "Create FA Depreciation Book FR"
DepreciationBook.Validate(Description, DepreciationDesc);
DepreciationBook.Validate("Disposal Calculation Method", DisposalCalc);
DepreciationBook.Validate("Use Rounding in Periodic Depr.", UseRoundingInPerodic);
- DepreciationBook.Validate("G/L Integration - Derogatory", GLIntegrationDerogatory);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ DepreciationBook.Validate("Integration G/L - Derogatory", GLIntegrationDerogatory)
+ else
+#pragma warning disable AL0432
+ DepreciationBook.Validate("G/L Integration - Derogatory", GLIntegrationDerogatory);
+#pragma warning restore AL0432
+#else
+ DepreciationBook.Validate("Integration G/L - Derogatory", GLIntegrationDerogatory);
+#endif
end;
local procedure ValidateFADepreciationBook(var DepreciationBook: Record "Depreciation Book"; DisposalCalc: Option; DerogatoryCalc: Code[10])
begin
DepreciationBook.Validate("Disposal Calculation Method", DisposalCalc);
- DepreciationBook.Validate("Derogatory Calculation", DerogatoryCalc);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ DepreciationBook.Validate("Derogatory Calc.", DerogatoryCalc)
+ else
+#pragma warning disable AL0432
+ DepreciationBook.Validate("Derogatory Calculation", DerogatoryCalc);
+#pragma warning restore AL0432
+#else
+ DepreciationBook.Validate("Derogatory Calc.", DerogatoryCalc);
+#endif
end;
var
+#if not CLEAN28
+#pragma warning disable AL0432
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#pragma warning restore AL0432
+#endif
TaxTok: Label 'TAX', MaxLength = 10, Locked = true;
CompanyDescLbl: Label 'Accounting Book', MaxLength = 100;
DerogatoryBookLbl: Label 'Derogatory Book', MaxLength = 100;
diff --git a/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFAPostingGrpFR.Codeunit.al b/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFAPostingGrpFR.Codeunit.al
index 2010da8a25..f0ac2bfd33 100644
--- a/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFAPostingGrpFR.Codeunit.al
+++ b/src/Apps/FR/ContosoCoffeeDemoDatasetFR/app/DemoData/FixedAsset/1. Setup Data/CreateFAPostingGrpFR.Codeunit.al
@@ -6,6 +6,9 @@
namespace Microsoft.DemoData.FixedAsset;
using Microsoft.DemoData.Finance;
+#if not CLEAN28
+using Microsoft.FixedAssets.Depreciation;
+#endif
using Microsoft.FixedAssets.FixedAsset;
codeunit 10876 "Create FA Posting Grp. FR"
@@ -29,6 +32,12 @@ codeunit 10876 "Create FA Posting Grp. FR"
end;
local procedure ValidateFAPostingGroup(var FAPostingGroup: Record "FA Posting Group"; AcquisitionCostAccount: Code[20]; AccumDepreciationAccount: Code[20]; AcqCostAccOnDisposal: Code[20]; AccumDeprAccOnDisposal: Code[20]; GainsAccOnDisposal: Code[20]; LossesAccOnDisposal: Code[20]; BookValueGainAcc: Code[20]; SaleAccDisposalGain: Code[20]; MaintenanceExpenseAccount: Code[20]; DepreciationExpenseAcc: Code[20]; AcquisitionCostBalAcc: Code[20]; SalesAccDisposalLoss: Code[20]; BookValueLossAcc: Code[20]; DerogatoryAccount: Code[20]; DerogatoryAccountDecrease: Code[20]; DerogatoryBalDecreaseAcc: Code[20]; DerogatoryExpenseAcc: Code[20])
+#if not CLEAN28
+ var
+#pragma warning disable AL0432
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#pragma warning restore AL0432
+#endif
begin
FAPostingGroup.Validate("Acquisition Cost Account", AcquisitionCostAccount);
FAPostingGroup.Validate("Accum. Depreciation Account", AccumDepreciationAccount);
@@ -42,10 +51,27 @@ codeunit 10876 "Create FA Posting Grp. FR"
FAPostingGroup.Validate("Book Val. Acc. on Disp. (Gain)", BookValueGainAcc);
FAPostingGroup.Validate("Sales Acc. on Disp. (Loss)", SalesAccDisposalLoss);
FAPostingGroup.Validate("Book Val. Acc. on Disp. (Loss)", BookValueLossAcc);
- FAPostingGroup.Validate("Derogatory Account", DerogatoryAccount);
- FAPostingGroup.Validate("Derogatory Acc. (Decrease)", DerogatoryAccountDecrease);
- FAPostingGroup.Validate("Derog. Bal. Acc. (Decrease)", DerogatoryBalDecreaseAcc);
- FAPostingGroup.Validate("Derogatory Expense Account", DerogatoryExpenseAcc);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ FAPostingGroup.Validate("Derogatory Acc.", DerogatoryAccount);
+ FAPostingGroup.Validate("Derogatory Account (Decrease)", DerogatoryAccountDecrease);
+ FAPostingGroup.Validate("Derog. Bal. Account (Decrease)", DerogatoryBalDecreaseAcc);
+ FAPostingGroup.Validate("Derogatory Expense Acc.", DerogatoryExpenseAcc);
+ end
+ else begin
+#pragma warning disable AL0432
+ FAPostingGroup.Validate("Derogatory Account", DerogatoryAccount);
+ FAPostingGroup.Validate("Derogatory Acc. (Decrease)", DerogatoryAccountDecrease);
+ FAPostingGroup.Validate("Derog. Bal. Acc. (Decrease)", DerogatoryBalDecreaseAcc);
+ FAPostingGroup.Validate("Derogatory Expense Account", DerogatoryExpenseAcc);
+#pragma warning restore AL0432
+ end;
+#else
+ FAPostingGroup.Validate("Derogatory Acc.", DerogatoryAccount);
+ FAPostingGroup.Validate("Derogatory Account (Decrease)", DerogatoryAccountDecrease);
+ FAPostingGroup.Validate("Derog. Bal. Account (Decrease)", DerogatoryBalDecreaseAcc);
+ FAPostingGroup.Validate("Derogatory Expense Acc.", DerogatoryExpenseAcc);
+#endif
FAPostingGroup.Validate("Acquisition Cost Bal. Acc.", AcquisitionCostBalAcc);
end;
}
diff --git a/src/Apps/FR/FAReportsFR/app/src/Codeunits/FAReportsFR.Codeunit.al b/src/Apps/FR/FAReportsFR/app/src/Codeunits/FAReportsFR.Codeunit.al
index e019927a6a..e3a4c1d4fb 100644
--- a/src/Apps/FR/FAReportsFR/app/src/Codeunits/FAReportsFR.Codeunit.al
+++ b/src/Apps/FR/FAReportsFR/app/src/Codeunits/FAReportsFR.Codeunit.al
@@ -17,7 +17,7 @@ codeunit 10803 "FA Reports FR"
ObsoleteTag = '28.0';
var
- FeatureKeyIdTok: Label 'FAReportsGB', Locked = true;
+ FeatureKeyIdTok: Label 'FAReportsFR', Locked = true;
procedure IsEnabled() Enabled: Boolean
var
diff --git a/src/Apps/FR/FAReportsFR/app/src/Reports/FAProjValueDerogatoryFR.Report.al b/src/Apps/FR/FAReportsFR/app/src/Reports/FAProjValueDerogatoryFR.Report.al
index 45d01e2a93..8f5bb332f8 100644
--- a/src/Apps/FR/FAReportsFR/app/src/Reports/FAProjValueDerogatoryFR.Report.al
+++ b/src/Apps/FR/FAReportsFR/app/src/Reports/FAProjValueDerogatoryFR.Report.al
@@ -218,7 +218,16 @@ report 10817 "FA-Proj. Value (Derogatory) FR"
begin
SetRange("FA No.", "Fixed Asset"."No.");
SetRange("Depreciation Book Code", DeprBookCode);
- SetRange("Exclude Derogatory", false);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ SetRange("Derogatory Excluded", false)
+ else
+#pragma warning disable AL0432
+ SetRange("Exclude Derogatory", false);
+#pragma warning restore AL0432
+#else
+ SetRange("Derogatory Excluded", false);
+#endif
BookValue := 0;
FALedgerEntryDerogBookValue := 0;
if (IncludePostedFromFilter = 0D) or not PrintDetails then
@@ -769,6 +778,11 @@ report 10817 "FA-Proj. Value (Derogatory) FR"
CalculateDepr: Codeunit "Calculate Depreciation";
FADateCalculation: Codeunit "FA Date Calculation";
DepreciationCalculation: Codeunit "Depreciation Calculation";
+#if not CLEAN28
+#pragma warning disable AL0432
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#pragma warning restore AL0432
+#endif
DeprBookCode: Code[10];
DerogDeprBookCode: Code[10];
FAFilter: Text;
@@ -881,13 +895,34 @@ report 10817 "FA-Proj. Value (Derogatory) FR"
local procedure TransferValues()
begin
// set base amount for the standard depreciation calculation (without Derogatory)
- FADeprBook.CalcFields("Book Value", Depreciation, "Custom 1", Derogatory);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ FADeprBook.CalcFields("Book Value", Depreciation, "Custom 1", "Derogatory Amount")
+ else
+#pragma warning disable AL0432
+ FADeprBook.CalcFields("Book Value", Depreciation, "Custom 1", Derogatory);
+#pragma warning restore AL0432
+#else
+ FADeprBook.CalcFields("Book Value", Depreciation, "Custom 1", "Derogatory Amount");
+#endif
DateFromProjection := 0D;
// if the asset has depreciations already, derogatory must be substracted from book value to avoid wrong derogatory calculation
// no problem for standard assets because derogatory is then zero
EntryAmounts[1] := FADeprBook."Book Value";
- if HasDerogatorySetup then
- EntryAmounts[1] -= FADeprBook.Derogatory;
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if HasDerogatorySetup then
+ EntryAmounts[1] -= FADeprBook."Derogatory Amount";
+ end
+ else
+ if HasDerogatorySetup then
+#pragma warning disable AL0432
+ EntryAmounts[1] -= FADeprBook.Derogatory;
+#pragma warning restore AL0432
+#else
+ if HasDerogatorySetup then
+ EntryAmounts[1] -= FADeprBook."Derogatory Amount";
+#endif
EntryAmounts[2] := FADeprBook."Custom 1";
EntryAmounts[3] := DepreciationCalculation.DeprInFiscalYear("Fixed Asset"."No.", DeprBookCode, StartingDate);
TotalBookValue[1] := TotalBookValue[1] + FADeprBook."Book Value";
@@ -1326,7 +1361,16 @@ report 10817 "FA-Proj. Value (Derogatory) FR"
begin
TotalDerogAssetsIncluded := false;
DerogDepreciationBookCode := '';
- DerogDepreciationBook.SetRange("Derogatory Calculation", DepreciationBookCode);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBookCode)
+ else
+#pragma warning disable AL0432
+ DerogDepreciationBook.SetRange("Derogatory Calculation", DepreciationBookCode);
+#pragma warning restore AL0432
+#else
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBookCode);
+#endif
if DerogDepreciationBook.FindFirst() then
DerogDepreciationBookCode := DerogDepreciationBook.Code;
end;
diff --git a/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFADerogatoryDepreciation.Codeunit.al b/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFADerogatoryDepreciation.Codeunit.al
index 7c8119a5a1..b4aceb7396 100644
--- a/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFADerogatoryDepreciation.Codeunit.al
+++ b/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFADerogatoryDepreciation.Codeunit.al
@@ -109,11 +109,25 @@ codeunit 148000 "ERM FA Derogatory Depreciation"
local procedure CreateDepreciationBook(): Code[10]
var
DepreciationBook: Record "Depreciation Book";
+#if not CLEAN28
+#pragma warning disable AL0432
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#pragma warning restore AL0432
+#endif
begin
LibraryFixedAsset.CreateDepreciationBook(DepreciationBook);
DepreciationBook.Validate("G/L Integration - Acq. Cost", true);
DepreciationBook.Validate("G/L Integration - Depreciation", true);
- DepreciationBook.Validate("G/L Integration - Derogatory", true);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ DepreciationBook.Validate("Integration G/L - Derogatory", true)
+ else
+#pragma warning disable AL0432
+ DepreciationBook.Validate("G/L Integration - Derogatory", true);
+#pragma warning restore AL0432
+#else
+ DepreciationBook.Validate("Integration G/L - Derogatory", true);
+#endif
DepreciationBook.Modify(true);
exit(DepreciationBook.Code);
end;
diff --git a/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFixedAssetsLocal.Codeunit.al b/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFixedAssetsLocal.Codeunit.al
index 2a10c0ce54..68671a8cbf 100644
--- a/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFixedAssetsLocal.Codeunit.al
+++ b/src/Apps/FR/FAReportsFR/test/src/Codeunits/ERMFixedAssetsLocal.Codeunit.al
@@ -27,6 +27,11 @@ codeunit 148001 "ERM Fixed Assets - Local"
LibraryReportDataset: Codeunit "Library - Report Dataset";
LibraryRandom: Codeunit "Library - Random";
Assert: Codeunit Assert;
+#if not CLEAN28
+#pragma warning disable AL0432
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#pragma warning restore AL0432
+#endif
CompletionStatsTok: Label 'The depreciation has been calculated.';
[Test]
@@ -310,7 +315,16 @@ codeunit 148001 "ERM Fixed Assets - Local"
begin
CreateAndSetupDeprBook(DeprBook);
DeprBook.Validate("Use Same FA+G/L Posting Dates", false);
- DeprBook.Validate("Derogatory Calculation", DerogDeprBookCode);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ DeprBook.Validate("Derogatory Calc.", DerogDeprBookCode)
+ else
+#pragma warning disable AL0432
+ DeprBook.Validate("Derogatory Calculation", DerogDeprBookCode);
+#pragma warning restore AL0432
+#else
+ DeprBook.Validate("Derogatory Calc.", DerogDeprBookCode);
+#endif
DeprBook.Modify(true);
exit(DeprBook.Code);
end;
@@ -375,7 +389,16 @@ codeunit 148001 "ERM Fixed Assets - Local"
DeprBook.Get(DeprBookCode);
DeprBook.Validate("G/L Integration - Acq. Cost", Value);
DeprBook.Validate("G/L Integration - Depreciation", Value);
- DeprBook.Validate("G/L Integration - Derogatory", Value);
+#if not CLEAN28
+ if AcceleratedDeprFeature.IsEnabled() then
+ DeprBook.Validate("Integration G/L - Derogatory", Value)
+ else
+#pragma warning disable AL0432
+ DeprBook.Validate("G/L Integration - Derogatory", Value);
+#pragma warning restore AL0432
+#else
+ DeprBook.Validate("Integration G/L - Derogatory", Value);
+#endif
DeprBook.Modify(true);
end;
@@ -690,4 +713,4 @@ codeunit 148001 "ERM Fixed Assets - Local"
else
Reply := true;
end;
-}
\ No newline at end of file
+}
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Common/1.Setup Data/CreateCommonGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Common/1.Setup Data/CreateCommonGLAccount.Codeunit.al
index ba511ead45..a29dab01af 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Common/1.Setup Data/CreateCommonGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Common/1.Setup Data/CreateCommonGLAccount.Codeunit.al
@@ -16,7 +16,7 @@ codeunit 5135 "Create Common GL Account"
trigger OnRun()
var
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
begin
AddGLAccountsForLocalization();
@@ -42,6 +42,7 @@ codeunit 5135 "Create Common GL Account"
GLAccountIndent.Indent();
end;
+
local procedure AddGLAccountsForLocalization()
var
InventorySetup: Record "Inventory Setup";
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Finance/1.Setup data/CreateGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Finance/1.Setup data/CreateGLAccount.Codeunit.al
index f30ae2e123..2272eb414e 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Finance/1.Setup data/CreateGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Finance/1.Setup data/CreateGLAccount.Codeunit.al
@@ -18,7 +18,7 @@ codeunit 5208 "Create G/L Account"
var
GLAccountCategory: Record "G/L Account Category";
FinanceModuleSetup: Record "Finance Module Setup";
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
CreatePostingGroup: Codeunit "Create Posting Groups";
CreateVATPostingGroups: Codeunit "Create VAT Posting Groups";
GLAccountCategoryMgt: Codeunit "G/L Account Category Mgt.";
@@ -137,6 +137,7 @@ codeunit 5208 "Create G/L Account"
ContosoGLAccount.InsertGLAccount(NetIncomefortheYear(), NetIncomefortheYearName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Equity, SubCategory, Enum::"G/L Account Type"::Total, '', '', 0, IncomeStatement() + '..' + NetIncome(), Enum::"General Posting Type"::" ", '', '', false, false, false);
ContosoGLAccount.InsertGLAccount(TotalStockholder(), TotalStockholderName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Equity, SubCategory, Enum::"G/L Account Type"::Total, '', '', 0, Stockholder() + '..' + TotalStockholder() + '|' + IncomeStatement() + '..' + NetIncome(), Enum::"General Posting Type"::" ", '', '', false, false, false);
ContosoGLAccount.InsertGLAccount(Allowances(), AllowancesName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Equity, SubCategory, Enum::"G/L Account Type"::"Begin-Total", '', '', 1, '', Enum::"General Posting Type"::" ", '', '', false, false, false);
+ ContosoGLAccount.InsertGLAccount(DerogatoryAccount(), DerogatoryAccountName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Equity, SubCategory, Enum::"G/L Account Type"::Posting, '', '', 0, '', Enum::"General Posting Type"::" ", '', '', true, false, false);
SubCategory := Format(GLAccountCategoryMgt.GetCurrentLiabilities(), 80);
ContosoGLAccount.InsertGLAccount(DeferredTaxes(), DeferredTaxesName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Liabilities, SubCategory, Enum::"G/L Account Type"::Posting, '', '', 0, '', Enum::"General Posting Type"::" ", '', '', false, false, false);
@@ -212,6 +213,7 @@ codeunit 5208 "Create G/L Account"
SubCategory := Format(GLAccountCategory."Account Category"::Income, 80);
ContosoGLAccount.InsertGLAccount(Revenue(), RevenueName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Income, SubCategory, Enum::"G/L Account Type"::"Begin-Total", '', '', 1, '', Enum::"General Posting Type"::" ", '', '', false, false, false);
+ ContosoGLAccount.InsertGLAccount(DerogExpenseAccForCredit(), DerogExpenseAccForCreditName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Income, SubCategory, Enum::"G/L Account Type"::Posting, '', '', 0, '', Enum::"General Posting Type"::" ", '', '', true, false, false);
SubCategory := Format(GLAccountCategoryMgt.GetIncomeProdSales(), 80);
ContosoGLAccount.InsertGLAccount(SalesofRetail(), SalesofRetailName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Income, SubCategory, Enum::"G/L Account Type"::"Begin-Total", '', '', 0, '', Enum::"General Posting Type"::" ", '', '', false, false, false);
@@ -338,6 +340,7 @@ codeunit 5208 "Create G/L Account"
ContosoGLAccount.InsertGLAccount(LegalandAccountingServices(), LegalandAccountingServicesName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Expense, SubCategory, Enum::"G/L Account Type"::Posting, CreateVATPostingGroups.Domestic(), CreatePostingGroup.MiscPostingGroup(), 0, '', Enum::"General Posting Type"::Purchase, CreateVATPostingGroups.Domestic(), FinanceModuleSetup."VAT Prod. Post Grp. Standard", true, false, false);
ContosoGLAccount.InsertGLAccount(Miscellaneous(), MiscellaneousName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Expense, SubCategory, Enum::"G/L Account Type"::Posting, CreateVATPostingGroups.Domestic(), CreatePostingGroup.MiscPostingGroup(), 0, '', Enum::"General Posting Type"::Purchase, CreateVATPostingGroups.Domestic(), FinanceModuleSetup."VAT Prod. Post Grp. Standard", true, false, false);
ContosoGLAccount.InsertGLAccount(OtherOperatingExpTotal(), OtherOperatingExpTotalName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Expense, SubCategory, Enum::"G/L Account Type"::"End-Total", '', '', 0, OtherOperatingExpenses() + '..' + OtherOperatingExpTotal(), Enum::"General Posting Type"::" ", '', '', false, false, false);
+ ContosoGLAccount.InsertGLAccount(DerogExpenseAccForDebit(), DerogExpenseAccForDebitName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Expense, SubCategory, Enum::"G/L Account Type"::Posting, '', '', 0, '', Enum::"General Posting Type"::" ", '', '', true, false, false);
SubCategory := Format(GLAccountCategory."Account Category"::Expense, 80);
ContosoGLAccount.InsertGLAccount(TotalOperatingExpenses(), TotalOperatingExpensesName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Expense, SubCategory, Enum::"G/L Account Type"::"End-Total", '', '', 0, OperatingExpenses() + '..' + TotalOperatingExpenses(), Enum::"General Posting Type"::" ", '', '', false, false, false);
@@ -412,7 +415,6 @@ codeunit 5208 "Create G/L Account"
ContosoGLAccount.InsertGLAccount(CorporateTax(), CorporateTaxName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::Expense, SubCategory, Enum::"G/L Account Type"::Posting, '', '', 1, '', Enum::"General Posting Type"::" ", '', '', true, false, false);
ContosoGLAccount.InsertGLAccount(NetIncome(), NetIncomeName(), Enum::"G/L Account Income/Balance"::"Income Statement", Enum::"G/L Account Category"::" ", Enum::"G/L Account Type"::Total, '', '', 1, IncomeStatement() + '..' + NetIncome(), Enum::"General Posting Type"::" ", '', '', false, false, false);
-
GLAccountIndent.Indent();
end;
@@ -685,10 +687,28 @@ codeunit 5208 "Create G/L Account"
ContosoGLAccount.AddAccountForLocalization(NetIncomeBeforeTaxesName(), '9495');
ContosoGLAccount.AddAccountForLocalization(CorporateTaxName(), '9510');
ContosoGLAccount.AddAccountForLocalization(NetIncomeName(), '9999');
+ ContosoGLAccount.AddAccountForLocalization(DerogatoryAccountName(), '145000');
+ ContosoGLAccount.AddAccountForLocalization(DerogExpenseAccForCreditName(), '787250');
+ ContosoGLAccount.AddAccountForLocalization(DerogExpenseAccForDebitName(), '687250');
OnAfterAddGLAccountsForLocalization();
end;
+ procedure DerogatoryAccountName(): Text[100]
+ begin
+ exit(DerogatoryAccountLbl);
+ end;
+
+ procedure DerogExpenseAccForCreditName(): Text[100]
+ begin
+ exit(DerogExpenseAccForCreditLbl);
+ end;
+
+ procedure DerogExpenseAccForDebitName(): Text[100]
+ begin
+ exit(DerogExpenseAccForDebitLbl);
+ end;
+
procedure BalanceSheet(): Code[20]
begin
exit(ContosoGLAccount.GetAccountNo(BalanceSheetName()));
@@ -3360,6 +3380,22 @@ codeunit 5208 "Create G/L Account"
exit(NetIncomeLbl);
end;
+ procedure DerogatoryAccount(): Code[20]
+ begin
+ exit(ContosoGLAccount.GetAccountNo(DerogatoryAccountName()));
+ end;
+
+ procedure DerogExpenseAccForCredit(): Code[20]
+ begin
+ exit(ContosoGLAccount.GetAccountNo(DerogExpenseAccForCreditName()));
+ end;
+
+ procedure DerogExpenseAccForDebit(): Code[20]
+ begin
+ exit(ContosoGLAccount.GetAccountNo(DerogExpenseAccForDebitName()));
+ end;
+
+
[IntegrationEvent(false, false)]
@@ -3636,4 +3672,7 @@ codeunit 5208 "Create G/L Account"
NetIncomeBeforeTaxesLbl: Label 'NET INCOME BEFORE TAXES', MaxLength = 100;
CorporateTaxLbl: Label 'Corporate Tax', MaxLength = 100;
NetIncomeLbl: Label 'NET INCOME', MaxLength = 100;
+ DerogExpenseAccForDebitLbl: Label 'Derog. Expense Acc. for Debit', MaxLength = 100;
+ DerogatoryAccountLbl: Label 'Derogatory Account', MaxLength = 100;
+ DerogExpenseAccForCreditLbl: Label 'Derog. Expense Acc. for Credit', MaxLength = 100;
}
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAGLAccount.Codeunit.al
index be99cd4400..799452b31d 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAGLAccount.Codeunit.al
@@ -15,7 +15,7 @@ codeunit 4773 "Create FA GL Account"
trigger OnRun()
var
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
begin
AddGLAccountsForLocalization();
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAPostingGroup.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAPostingGroup.Codeunit.al
index 27688c2158..cc2a0f5f6f 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAPostingGroup.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/FixedAsset/1.Setup Data/CreateFAPostingGroup.Codeunit.al
@@ -5,6 +5,7 @@
namespace Microsoft.DemoData.FixedAsset;
+using Microsoft.DemoData.Finance;
using Microsoft.DemoTool.Helpers;
codeunit 5115 "Create FA Posting Group"
@@ -16,12 +17,13 @@ codeunit 5115 "Create FA Posting Group"
var
ContosoFixedAsset: Codeunit "Contoso Fixed Asset";
CreateFAGlAccount: Codeunit "Create FA GL Account";
+ CreateGlAccount: Codeunit "Create G/L Account";
begin
- ContosoFixedAsset.InsertFAPostingGroup(Equipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear());
- ContosoFixedAsset.InsertFAPostingGroup(Goodwill(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear());
- ContosoFixedAsset.InsertFAPostingGroup(Plant(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear());
- ContosoFixedAsset.InsertFAPostingGroup(Property(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear());
- ContosoFixedAsset.InsertFAPostingGroup(Vehicles(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear());
+ ContosoFixedAsset.InsertFAPostingGroup(Equipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogExpenseAccForCredit(), CreateGlAccount.DerogExpenseAccForDebit());
+ ContosoFixedAsset.InsertFAPostingGroup(Goodwill(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogExpenseAccForCredit(), CreateGlAccount.DerogExpenseAccForDebit());
+ ContosoFixedAsset.InsertFAPostingGroup(Plant(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogExpenseAccForCredit(), CreateGlAccount.DerogExpenseAccForDebit());
+ ContosoFixedAsset.InsertFAPostingGroup(Property(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogExpenseAccForCredit(), CreateGlAccount.DerogExpenseAccForDebit());
+ ContosoFixedAsset.InsertFAPostingGroup(Vehicles(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.DecreasesDuringTheYear(), CreateFAGlAccount.AccumDepreciationBuildings(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.GainsAndLosses(), CreateFAGlAccount.Miscellaneous(), CreateFAGlAccount.DepreciationEquipment(), CreateFAGlAccount.IncreasesDuringTheYear(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogatoryAccount(), CreateGlAccount.DerogExpenseAccForCredit(), CreateGlAccount.DerogExpenseAccForDebit());
end;
procedure Goodwill(): Code[20]
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/HumanResources/1. SetupData/CreateHRGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/HumanResources/1. SetupData/CreateHRGLAccount.Codeunit.al
index 4a2c743910..0e20b89b7f 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/HumanResources/1. SetupData/CreateHRGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/HumanResources/1. SetupData/CreateHRGLAccount.Codeunit.al
@@ -15,7 +15,7 @@ codeunit 5161 "Create HR GL Account"
trigger OnRun()
var
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
begin
AddGLAccountsForLocalization();
ContosoGLAccount.InsertGLAccount(EmployeesPayable(), EmployeesPayableName(), Enum::"G/L Account Income/Balance"::"Balance Sheet", Enum::"G/L Account Category"::Liabilities, Enum::"G/L Account Type"::Posting);
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Jobs/1.Setup Data/CreateJobGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Jobs/1.Setup Data/CreateJobGLAccount.Codeunit.al
index 70966401a5..98aee76643 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Jobs/1.Setup Data/CreateJobGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Jobs/1.Setup Data/CreateJobGLAccount.Codeunit.al
@@ -15,7 +15,7 @@ codeunit 5199 "Create Job GL Account"
trigger OnRun()
var
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
begin
AddGLAccountsForLocalization();
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Manufacturing/1.Setup data/CreateMfgGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Manufacturing/1.Setup data/CreateMfgGLAccount.Codeunit.al
index 273c7dbb33..16ca22deef 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Manufacturing/1.Setup data/CreateMfgGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Manufacturing/1.Setup data/CreateMfgGLAccount.Codeunit.al
@@ -17,7 +17,7 @@ codeunit 4762 "Create Mfg GL Account"
trigger OnRun()
var
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
begin
AddGLAccountsForLocalization();
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Service/1.Setup Data/CreateSvcGLAccount.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Service/1.Setup Data/CreateSvcGLAccount.Codeunit.al
index 590e4c9439..7cbcd0f5a3 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Service/1.Setup Data/CreateSvcGLAccount.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoData/Service/1.Setup Data/CreateSvcGLAccount.Codeunit.al
@@ -16,7 +16,7 @@ codeunit 5102 "Create Svc GL Account"
trigger OnRun()
var
- GLAccountIndent: Codeunit "G/L Account-Indent";
+ GLAccountIndent: Codeunit "W1 G/L Account Indent";
CommonPostingGroup: Codeunit "Create Common Posting Group";
begin
AddGLAccountsForLocalization();
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/ContosoFixedAsset.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/ContosoFixedAsset.Codeunit.al
index 15bd5b9c70..d48b24d13b 100644
--- a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/ContosoFixedAsset.Codeunit.al
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/ContosoFixedAsset.Codeunit.al
@@ -4,6 +4,7 @@
// ------------------------------------------------------------------------------------------------
namespace Microsoft.DemoTool.Helpers;
+using Microsoft.DemoData.FixedAsset;
using Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.FixedAsset;
@@ -44,7 +45,7 @@ codeunit 4776 "Contoso Fixed Asset"
procedure InsertDepreciationBook(BookCode: Code[10]; Description: Text[100]; AcqCost: Boolean; Depreciation: Boolean; WriteDown: Boolean; Appreciation: Boolean; Custom1: Boolean; Custom2: Boolean; Disposal: Boolean; Maintenance: Boolean; UseRoundingInPeriodicDepr: Boolean; DefaultFinalRoundingAmount: Decimal)
begin
- InsertDepreciationBook(BookCode, Description, AcqCost, Depreciation, WriteDown, Appreciation, Custom1, Custom2, Disposal, Maintenance, UseRoundingInPeriodicDepr, DefaultFinalRoundingAmount, 0, false, false, false, false, false);
+ InsertDepreciationBook(BookCode, Description, AcqCost, Depreciation, WriteDown, Appreciation, Custom1, Custom2, Disposal, Maintenance, UseRoundingInPeriodicDepr, DefaultFinalRoundingAmount, 0, false, false, false, false, false, true);
end;
procedure InsertDepreciationBook(BookCode: Code[10]; Description: Text[100]; AcqCost: Boolean; Depreciation: Boolean; WriteDown: Boolean; Appreciation: Boolean; Custom1: Boolean; Custom2: Boolean; Disposal: Boolean; Maintenance: Boolean; UseRoundingInPeriodicDepr: Boolean; DefaultFinalRoundingAmount: Decimal; DisposalCalculationMethod: Option; AllowIndexation: Boolean; MarkErrorsAsCorrections: Boolean; SubtractDiscInPurchInv: Boolean; AllowCorrectionOfDisposal: Boolean; AllowIdenticalDocumentNo: Boolean)
@@ -85,9 +86,49 @@ codeunit 4776 "Contoso Fixed Asset"
DepreciationBook.Insert(true);
end;
+ procedure InsertDepreciationBook(BookCode: Code[10]; Description: Text[100]; AcqCost: Boolean; Depreciation: Boolean; WriteDown: Boolean; Appreciation: Boolean; Custom1: Boolean; Custom2: Boolean; Disposal: Boolean; Maintenance: Boolean; UseRoundingInPeriodicDepr: Boolean; DefaultFinalRoundingAmount: Decimal; DisposalCalculationMethod: Option; AllowIndexation: Boolean; MarkErrorsAsCorrections: Boolean; SubtractDiscInPurchInv: Boolean; AllowCorrectionOfDisposal: Boolean; AllowIdenticalDocumentNo: Boolean; GLIntegrationDerogatory: Boolean)
+ var
+ DepreciationBook: Record "Depreciation Book";
+ Exists: Boolean;
+ begin
+ if DepreciationBook.Get(BookCode) then begin
+ Exists := true;
+
+ if not OverwriteData then
+ exit;
+ end;
+
+ DepreciationBook.Validate(Code, BookCode);
+ DepreciationBook.Validate(Description, Description);
+ DepreciationBook.Validate("G/L Integration - Acq. Cost", AcqCost);
+ DepreciationBook.Validate("G/L Integration - Depreciation", Depreciation);
+ DepreciationBook.Validate("G/L Integration - Write-Down", WriteDown);
+ DepreciationBook.Validate("G/L Integration - Appreciation", Appreciation);
+ DepreciationBook.Validate("G/L Integration - Custom 1", Custom1);
+ DepreciationBook.Validate("G/L Integration - Custom 2", Custom2);
+ DepreciationBook.Validate("G/L Integration - Disposal", Disposal);
+ DepreciationBook.Validate("G/L Integration - Maintenance", Maintenance);
+ DepreciationBook.Validate("Use Rounding in Periodic Depr.", UseRoundingInPeriodicDepr);
+ DepreciationBook.Validate("Integration G/L - Derogatory", GLIntegrationDerogatory);
+ DepreciationBook.Validate("Default Final Rounding Amount", DefaultFinalRoundingAmount);
+ DepreciationBook.Validate("Disposal Calculation Method", DisposalCalculationMethod);
+ DepreciationBook.Validate("Allow Indexation", AllowIndexation);
+ DepreciationBook.Validate("Mark Errors as Corrections", MarkErrorsAsCorrections);
+ DepreciationBook.Validate("Subtract Disc. in Purch. Inv.", SubtractDiscInPurchInv);
+ DepreciationBook.Validate("Allow Correction of Disposal", AllowCorrectionOfDisposal);
+ DepreciationBook.Validate("Allow Identical Document No.", AllowIdenticalDocumentNo);
+
+ if Exists then
+ DepreciationBook.Modify(true)
+ else
+ DepreciationBook.Insert(true);
+ end;
+
procedure InsertFADepreciationBook(FixedAssetNo: Code[20]; DepreciationBookCode: Code[20]; DepreciationStartingDate: Date; NoOfDepreciationYears: Decimal)
var
FADepreciationBook: Record "FA Depreciation Book";
+ DepreciationBook: Record "Depreciation Book";
+ CreateFADepreciationBook: Codeunit "Create FA Depreciation Book";
Exists: Boolean;
begin
if FADepreciationBook.Get(FixedAssetNo, DepreciationBookCode) then begin
@@ -101,6 +142,7 @@ codeunit 4776 "Contoso Fixed Asset"
FADepreciationBook.Validate("Depreciation Book Code", DepreciationBookCode);
FADepreciationBook.Validate("Depreciation Starting Date", DepreciationStartingDate);
FADepreciationBook.Validate("No. of Depreciation Years", NoOfDepreciationYears);
+ DepreciationBook.Validate("Derogatory Calc.", CreateFADepreciationBook.Company());
if Exists then
FADepreciationBook.Modify(true)
@@ -111,6 +153,8 @@ codeunit 4776 "Contoso Fixed Asset"
procedure InsertFADepreciationBook(FixedAssetNo: Code[20]; DepreciationBookCode: Code[20]; DepreciationStartingDate: Date; NoOfDepreciationYears: Decimal; FAPostingGroup: Code[20])
var
FADepreciationBook: Record "FA Depreciation Book";
+ DepreciationBook: Record "Depreciation Book";
+ CreateFADepreciationBook: Codeunit "Create FA Depreciation Book";
Exists: Boolean;
begin
if FADepreciationBook.Get(FixedAssetNo, DepreciationBookCode) then begin
@@ -124,6 +168,7 @@ codeunit 4776 "Contoso Fixed Asset"
FADepreciationBook.Validate("Depreciation Book Code", DepreciationBookCode);
FADepreciationBook.Validate("Depreciation Starting Date", DepreciationStartingDate);
FADepreciationBook.Validate("No. of Depreciation Years", NoOfDepreciationYears);
+ DepreciationBook.Validate("Derogatory Calc.", CreateFADepreciationBook.Company());
FADepreciationBook.Validate("FA Posting Group", FAPostingGroup);
if Exists then
@@ -226,6 +271,39 @@ codeunit 4776 "Contoso Fixed Asset"
FAPostingGroup.Insert(true);
end;
+ procedure InsertFAPostingGroup(GroupCode: Code[20]; AcquisitionCostAccount: Code[20]; AccumDepreciationAccount: Code[20]; AcqCostAccOnDisposal: Code[20]; AccumDeprAccOnDisposal: Code[20]; GainsAccOnDisposal: Code[20]; LossesAccOnDisposal: Code[20]; MaintenanceExpenseAccount: Code[20]; DepreciationExpenseAcc: Code[20]; AcquisitionCostBalAcc: Code[20]; DerogatoryAccount: Code[20]; DerogatoryAccountDecrease: Code[20]; DerogatoryBalDecreaseAcc: Code[20]; DerogatoryExpenseAcc: Code[20])
+ var
+ FAPostingGroup: Record "FA Posting Group";
+ Exists: Boolean;
+ begin
+ if FAPostingGroup.Get(GroupCode) then begin
+ Exists := true;
+
+ if not OverwriteData then
+ exit;
+ end;
+
+ FAPostingGroup.Validate(Code, GroupCode);
+ FAPostingGroup.Validate("Acquisition Cost Account", AcquisitionCostAccount);
+ FAPostingGroup.Validate("Accum. Depreciation Account", AccumDepreciationAccount);
+ FAPostingGroup.Validate("Acq. Cost Acc. on Disposal", AcqCostAccOnDisposal);
+ FAPostingGroup.Validate("Accum. Depr. Acc. on Disposal", AccumDeprAccOnDisposal);
+ FAPostingGroup.Validate("Gains Acc. on Disposal", GainsAccOnDisposal);
+ FAPostingGroup.Validate("Losses Acc. on Disposal", LossesAccOnDisposal);
+ FAPostingGroup.Validate("Maintenance Expense Account", MaintenanceExpenseAccount);
+ FAPostingGroup.Validate("Depreciation Expense Acc.", DepreciationExpenseAcc);
+ FAPostingGroup.Validate("Acquisition Cost Bal. Acc.", AcquisitionCostBalAcc);
+ FAPostingGroup.Validate("Derogatory Acc.", DerogatoryAccount);
+ FAPostingGroup.Validate("Derogatory Account (Decrease)", DerogatoryAccountDecrease);
+ FAPostingGroup.Validate("Derog. Bal. Account (Decrease)", DerogatoryBalDecreaseAcc);
+ FAPostingGroup.Validate("Derogatory Expense Acc.", DerogatoryExpenseAcc);
+
+ if Exists then
+ FAPostingGroup.Modify(true)
+ else
+ FAPostingGroup.Insert(true);
+ end;
+
procedure InsertFixedAsset(FANo: Code[20]; Description: Text[100]; FAClassCode: Code[10]; FASubclassCode: Code[20]; FALocationCode: Code[10]; MainAssetComponent: Enum "FA Component Type"; SerialNo: Text[30];
NextServiceDate: Date;
VendorNo: Code[20];
diff --git a/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/W1GlAccountIndent.Codeunit.al b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/W1GlAccountIndent.Codeunit.al
new file mode 100644
index 0000000000..3bcaddcc63
--- /dev/null
+++ b/src/Apps/W1/ContosoCoffeeDemoDataset/app/DemoTool/Contoso Helpers/W1GlAccountIndent.Codeunit.al
@@ -0,0 +1,177 @@
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+namespace Microsoft.Finance.GeneralLedger.Account;
+
+using Microsoft.Intercompany.GLAccount;
+using System.Utilities;
+
+///
+/// Manages hierarchical indentation of general ledger accounts in the chart of accounts structure.
+/// Provides functionality to automatically indent accounts based on Begin-Total and End-Total relationships and update totaling ranges.
+///
+///
+/// Key functions: Chart of accounts indentation, totaling range calculation, hierarchical structure validation.
+/// Updates account indentation levels and totaling fields based on Begin-Total/End-Total account structure.
+/// Validates proper nesting of account hierarchies and prevents invalid indentation configurations.
+///
+codeunit 4786 "W1 G/L Account Indent"
+{
+
+ trigger OnRun()
+ var
+ ConfirmManagement: Codeunit "Confirm Management";
+ begin
+ if not ConfirmManagement.GetResponseOrDefault(GLAccIndentQst, true) then
+ exit;
+
+ Indent();
+ end;
+
+ var
+ GLAcc: Record "G/L Account";
+ Window: Dialog;
+ AccNo: array[10] of Code[20];
+ i: Integer;
+
+ GLAccIndentQst: Label 'This function updates the indentation of all the G/L accounts in the chart of accounts. All accounts between a Begin-Total and the matching End-Total are indented one level. The Totaling for each End-total is also updated.\\Do you want to indent the chart of accounts?';
+ ICAccIndentQst: Label 'This function updates the indentation of all the G/L accounts in the chart of accounts. All accounts between a Begin-Total and the matching End-Total are indented one level. \\Do you want to indent the chart of accounts?';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text004: Label 'Indenting the Chart of Accounts #1##########';
+ Text005: Label 'End-Total %1 is missing a matching Begin-Total.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
+ ArrayExceededErr: Label 'You can only indent %1 levels for accounts of the type Begin-Total.', Comment = '%1 = A number bigger than 1';
+
+ ///
+ /// Processes all general ledger accounts to update indentation levels and totaling ranges based on account hierarchy.
+ /// Automatically calculates indentation for accounts between Begin-Total and End-Total markers and updates totaling fields.
+ ///
+ ///
+ /// Validates proper nesting of Begin-Total and End-Total account pairs.
+ /// Updates indentation field and totaling ranges for End-Total accounts.
+ /// Supports up to 10 levels of account hierarchy indentation.
+ /// Displays progress window during processing of large chart of accounts.
+ ///
+ procedure Indent()
+ var
+ IsHandled: Boolean;
+ begin
+ IsHandled := false;
+ OnBeforeIndent(GLAcc, IsHandled);
+ if IsHandled then
+ exit;
+
+ Window.Open(Text004);
+
+ if GLAcc.Find('-') then
+ repeat
+ Window.Update(1, GLAcc."No.");
+
+ if GLAcc."Account Type" = GLAcc."Account Type"::"End-Total" then begin
+ if i < 1 then
+ Error(
+ Text005,
+ GLAcc."No.");
+ GLAcc.Totaling := AccNo[i] + '..' + GLAcc."No.";
+ i := i - 1;
+ end;
+
+ GLAcc.Validate(Indentation, i);
+ GLAcc.Modify();
+
+ if GLAcc."Account Type" = GLAcc."Account Type"::"Begin-Total" then begin
+ i := i + 1;
+ if i > ArrayLen(AccNo) then
+ Error(ArrayExceededErr, ArrayLen(AccNo));
+ AccNo[i] := GLAcc."No.";
+ end;
+ until GLAcc.Next() = 0;
+
+ Window.Close();
+
+ OnAfterIndent();
+ end;
+
+ ///
+ /// Runs the indentation process for Intercompany G/L Accounts with user confirmation.
+ /// Updates the indentation levels based on account hierarchy structure.
+ ///
+ procedure RunICAccountIndent()
+ var
+ ConfirmManagement: Codeunit "Confirm Management";
+ begin
+ if not ConfirmManagement.GetResponseOrDefault(ICAccIndentQst, true) then
+ exit;
+
+ IndentICAccount();
+ end;
+
+ local procedure IndentICAccount()
+ var
+ ICGLAcc: Record "IC G/L Account";
+ IsHandled: Boolean;
+ begin
+ IsHandled := false;
+ OnBeforeIndentICAccount(GLAcc, IsHandled);
+ if IsHandled then
+ exit;
+
+ Window.Open(Text004);
+ if ICGLAcc.Find('-') then
+ repeat
+ Window.Update(1, ICGLAcc."No.");
+
+ if ICGLAcc."Account Type" = ICGLAcc."Account Type"::"End-Total" then begin
+ if i < 1 then
+ Error(
+ Text005,
+ ICGLAcc."No.");
+ i := i - 1;
+ end;
+
+ ICGLAcc.Validate(Indentation, i);
+ ICGLAcc.Modify();
+
+ if ICGLAcc."Account Type" = ICGLAcc."Account Type"::"Begin-Total" then begin
+ i := i + 1;
+ AccNo[i] := ICGLAcc."No.";
+ end;
+ until ICGLAcc.Next() = 0;
+ Window.Close();
+ end;
+
+ ///
+ /// Integration event raised after completing the chart of accounts indentation process.
+ /// Allows extensions to perform additional processing after indentation is complete.
+ ///
+ [IntegrationEvent(false, false)]
+ local procedure OnAfterIndent()
+ begin
+ end;
+
+ ///
+ /// Integration event raised before starting the chart of accounts indentation process.
+ /// Allows extensions to override or supplement the indentation logic.
+ ///
+ /// General ledger account record being processed
+ /// Set to true to skip default indentation logic
+ [IntegrationEvent(false, false)]
+ local procedure OnBeforeIndent(var GLAcc: Record "G/L Account"; var IsHandled: Boolean)
+ begin
+ end;
+
+ ///
+ /// Integration event raised before indenting intercompany accounts during the indentation process.
+ /// Allows extensions to customize intercompany account indentation behavior.
+ ///
+ /// Intercompany general ledger account being processed
+ /// Set to true to skip default intercompany indentation logic
+ [IntegrationEvent(false, false)]
+ local procedure OnBeforeIndentICAccount(var GLAcc: Record "G/L Account"; var IsHandled: Boolean)
+ begin
+ end;
+}
+
diff --git a/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 04c8f2a724..96b9054959 100644
--- a/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -216,6 +216,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -590,6 +591,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3350,6 +3352,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3365,6 +3368,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3577,6 +3581,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4351,6 +4360,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
BASManagement: Codeunit "BAS Management";
DocDate: Date;
CustBankAcc: Record "Customer Bank Account";
@@ -6198,6 +6209,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
[Scope('OnPrem')]
procedure ValidateAdjmtAppliesTo()
begin
@@ -8553,6 +8579,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index b16aca1a35..694adce7c1 100644
--- a/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1647,6 +1647,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index ac7900d6fa..ca46753535 100644
--- a/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/APAC/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -23,6 +23,7 @@ using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
using Microsoft.Finance.WithholdingTax;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -130,6 +131,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
WHTManagement: Codeunit WHTManagement;
TaxManagement: Codeunit TaxInvoiceManagement;
DeferralUtilities: Codeunit "Deferral Utilities";
@@ -206,6 +208,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1194,7 +1199,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1842,7 +1846,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1869,6 +1873,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -8253,6 +8264,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -8393,6 +8447,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
[Scope('OnPrem')]
procedure InsertWHTPostingBufferPosted(var WHTEntryGL: Record "WHT Entry"; var GenJnlLine: Record "Gen. Journal Line"; Apply: Boolean; Source: Option Sales,Purchase)
var
@@ -13563,4 +13677,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/AU/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/AU/DemoTool/CreateFAPostingGroup.Codeunit.al
index 4e1b0220de..15c85b88d5 100644
--- a/src/Layers/AU/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/AU/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -31,6 +31,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 3f3407a23d..ae68b09e47 100644
--- a/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -583,6 +584,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3354,6 +3356,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3369,6 +3372,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3581,6 +3585,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4099,6 +4108,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -5944,6 +5955,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8072,6 +8098,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index ae97825e33..ceecd31cbb 100644
--- a/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/BE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1645,6 +1645,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/BE/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/BE/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index b5d43e7bde..3f12bdff44 100644
--- a/src/Layers/BE/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/BE/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -21,6 +21,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -125,6 +126,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -188,6 +190,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1125,7 +1130,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1736,7 +1740,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1763,6 +1767,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -7688,6 +7699,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -7828,6 +7882,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
@@ -11164,4 +11278,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/CA/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/CA/DemoTool/CreateFAPostingGroup.Codeunit.al
index c7caf35012..0c0328292f 100644
--- a/src/Layers/CA/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/CA/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -32,6 +32,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert(MaintenanceExpenseAccount));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert(DepreciationExpenseAcc));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert(AcquisitionCostBalAcc));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index b36cde8278..c2990b057b 100644
--- a/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -597,6 +598,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3373,6 +3375,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3388,6 +3391,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3600,6 +3604,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4169,6 +4178,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
Text11500: Label 'This change may affect payment discounts. Please verify the payment discount amount.';
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
@@ -6010,6 +6021,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
[Scope('OnPrem')]
procedure ChangePostingDateWarning()
var
@@ -8176,6 +8202,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index 970e8a5a56..8ee055cc07 100644
--- a/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/CH/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1646,6 +1646,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/CH/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/CH/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index a2186d6c0e..fbf92d01ca 100644
--- a/src/Layers/CH/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/CH/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -22,6 +22,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -126,6 +127,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -189,6 +191,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1127,7 +1132,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1731,7 +1735,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1758,6 +1762,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -7713,6 +7724,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -7853,6 +7907,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
@@ -11186,4 +11300,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/CZ/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/CZ/DemoTool/CreateFAPostingGroup.Codeunit.al
index 2d5531a9d6..b16fa8c34a 100644
--- a/src/Layers/CZ/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/CZ/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -38,6 +38,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
// NAVCZ
"FA Posting Group".Validate("Acq. Cost Bal. Acc. Disp. CZF", CA.Convert("Accum. Depreciation Account"));
"FA Posting Group".Validate("Write-Down Account", CA.Convert("Acquisition Cost Account"));
diff --git a/src/Layers/DACH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/DACH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 0ddcec9a18..faf87c1280 100644
--- a/src/Layers/DACH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/DACH/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -582,6 +583,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3350,6 +3352,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3365,6 +3368,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3577,6 +3581,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4079,6 +4088,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
Text11500: Label 'This change may affect payment discounts. Please verify the payment discount amount.';
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
@@ -5908,6 +5919,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
[Scope('OnPrem')]
procedure ChangePostingDateWarning()
var
@@ -8063,6 +8089,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index d174decde4..b4df94729d 100644
--- a/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -37,41 +37,81 @@ table 5611 "Depreciation Book"
{
Caption = 'G/L Integration - Acq. Cost';
ToolTip = 'Specifies whether acquisition cost entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(4; "G/L Integration - Depreciation"; Boolean)
{
Caption = 'G/L Integration - Depreciation';
ToolTip = 'Specifies whether depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(5; "G/L Integration - Write-Down"; Boolean)
{
Caption = 'G/L Integration - Write-Down';
ToolTip = 'Specifies whether write-down entries posted to this depreciation book should be posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(6; "G/L Integration - Appreciation"; Boolean)
{
Caption = 'G/L Integration - Appreciation';
ToolTip = 'Specifies whether appreciation entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(7; "G/L Integration - Custom 1"; Boolean)
{
Caption = 'G/L Integration - Custom 1';
ToolTip = 'Specifies whether custom 1 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(8; "G/L Integration - Custom 2"; Boolean)
{
Caption = 'G/L Integration - Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(9; "G/L Integration - Disposal"; Boolean)
{
Caption = 'G/L Integration - Disposal';
ToolTip = 'Specifies whether disposal entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(10; "G/L Integration - Maintenance"; Boolean)
{
Caption = 'G/L Integration - Maintenance';
ToolTip = 'Specifies whether maintenance entries that are posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(11; "Disposal Calculation Method"; Option)
{
@@ -328,6 +368,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -420,7 +520,17 @@ table 5611 "Depreciation Book"
var
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
+ GLIntegration: array[13] of Boolean;
MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
+ Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
+ Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
+ Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
+ Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
#pragma warning disable AA0074
Text000: Label 'The book cannot be deleted because it is in use.';
@@ -433,7 +543,9 @@ table 5611 "Depreciation Book"
protected var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- procedure IndexGLIntegration(var GLIntegration: array[9] of Boolean)
+#pragma warning disable AA0244
+ procedure IndexGLIntegration(var GLIntegration: array[13] of Boolean)
+#pragma warning restore AA0244
begin
GLIntegration[1] := "G/L Integration - Acq. Cost";
GLIntegration[2] := "G/L Integration - Depreciation";
@@ -444,6 +556,26 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
+ GLIntegration[13] := "Integration G/L - Derogatory";
+ end;
+
+ [Scope('OnPrem')]
+ procedure CheckIntegrationFields()
+ var
+ i: Integer;
+ begin
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end;
+ end;
+
+ [Scope('OnPrem')]
+ procedure IsDerogatoryBook(): Boolean
+ begin
+ exit("Derogatory Calc." <> '');
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index d96b1898fa..ea73045a3c 100644
--- a/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -64,6 +64,16 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ }
field("Allow Correction of Disposal"; Rec."Allow Correction of Disposal")
{
ApplicationArea = FixedAssets;
@@ -158,11 +168,17 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Maintenance';
}
- field("G/L Integration - Bonus Depr."; Rec."G/L Integration - Bonus Depr.")
+ field("G/L Integration - Bonus Depr."; Rec."G/L Integration - Bonus Depr.")
{
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Bonus Depreciation';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ }
}
}
group(Duplication)
@@ -320,5 +336,6 @@ page 5610 "Depreciation Book Card"
}
}
}
+
}
diff --git a/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al b/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
index 97c6190092..1a66ecdaf1 100644
--- a/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
+++ b/src/Layers/DACH/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
@@ -347,7 +347,8 @@ table 5612 "FA Depreciation Book"
CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
"Depreciation Book Code" = field("Depreciation Book Code"),
"Part of Book Value" = const(true),
- "FA Posting Date" = field("FA Posting Date Filter")));
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
Caption = 'Book Value';
ToolTip = 'Specifies the book value for the fixed asset.';
Editable = false;
@@ -880,6 +881,24 @@ table 5612 "FA Depreciation Book"
FieldError("Default FA Depreciation Book", OnlyOneDefaultDeprBookErr);
end;
}
+ field(5865; "Derogatory Amount"; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = GetCurrencyCode();
+ CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
+ "Depreciation Book Code" = field("Depreciation Book Code"),
+ "FA Posting Category" = const(" "),
+ "FA Posting Type" = const(Derogatory),
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
+ Caption = 'Derogatory';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5866; "Last Derogatory"; Date)
+ {
+ Caption = 'Last Derogatory Date';
+ }
}
keys
@@ -1322,12 +1341,13 @@ table 5612 "FA Depreciation Book"
CalcFields("Book Value");
end;
- procedure SetBookValueFiltersOnFALedgerEntry(var FALedgerEntry: Record "FA Ledger Entry")
+ procedure SetBookValueFiltersOnFALedgerEntry(var FALedgerEntry: Record "FA Ledger Entry")
begin
FALedgerEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date");
FALedgerEntry.SetRange("FA No.", "FA No.");
FALedgerEntry.SetRange("Depreciation Book Code", "Depreciation Book Code");
FALedgerEntry.SetRange("Part of Book Value", true);
+ FALedgerEntry.SetRange("Derogatory Excluded", false);
OnAfterSetBookValueFiltersOnFALedgerEntry(FALedgerEntry);
end;
diff --git a/src/Layers/DACH/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al b/src/Layers/DACH/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
index a35fbc82fd..6bdbc88aa0 100644
--- a/src/Layers/DACH/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
+++ b/src/Layers/DACH/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
@@ -19,6 +19,8 @@ codeunit 5626 "FA General Report"
FADeprBook: Record "FA Depreciation Book";
FALedgEntry: Record "FA Ledger Entry";
DepreciationCalc: Codeunit "Depreciation Calculation";
+ UseCreditAmounts: Boolean;
+ UseDebitAmounts: Boolean;
ExclReclEntries: Boolean;
#pragma warning disable AA0074
@@ -64,6 +66,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Last Custom 1 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Last Derogatory"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Last Custom 2 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Last Salvage Value Date"):
@@ -93,6 +97,20 @@ codeunit 5626 "FA General Report"
procedure CalcFAPostedAmount(FANo: Code[20]; PostingType: Integer; Period: Option "Before Starting Date","Net Change","at Ending Date"; StartingDate: Date; EndingDate: Date; DeprBookCode: Code[10]; BeforeAmount: Decimal; UntilAmount: Decimal; OnlyReclassified: Boolean; OnlyBookValue: Boolean) Result: Decimal
begin
+ case true of
+ UseCreditAmounts:
+ begin
+ ClearAll();
+ UseCreditAmounts := true;
+ end;
+ UseDebitAmounts:
+ begin
+ ClearAll();
+ UseDebitAmounts := true
+ end;
+ else
+ ClearAll();
+ end;
if PostingType = 0 then
exit(0);
if EndingDate = 0D then
@@ -130,6 +148,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -152,7 +172,10 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.SetRange("FA Posting Date", 0D, EndingDate);
end;
- FALedgEntry.CalcSums(Amount);
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then
+ FALedgEntry.CalcSums(Amount, "Debit Amount", "Credit Amount")
+ else
+ FALedgEntry.CalcSums(Amount);
if (PostingType = FADeprBook.FieldNo("Book Value")) or
(PostingType = FADeprBook.FieldNo(Depreciation))
@@ -165,7 +188,17 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.Amount := FALedgEntry.Amount + UntilAmount;
end;
- Result := FALedgEntry.Amount;
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then begin
+ if UseCreditAmounts then begin
+ Clear(UseCreditAmounts);
+ Result := FALedgEntry."Credit Amount";
+ end;
+ if UseDebitAmounts then begin
+ Clear(UseDebitAmounts);
+ Result := FALedgEntry."Debit Amount";
+ end;
+ end else
+ Result := FALedgEntry.Amount;
OnAfterCalcFAPostedAmount(FALedgEntry, PostingType, Period, BeforeAmount, UntilAmount, Result);
end;
@@ -193,6 +226,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -291,6 +326,18 @@ codeunit 5626 "FA General Report"
ExclReclEntries := ExclReclEntries1;
end;
+ [Scope('OnPrem')]
+ procedure SetSign(Sign: Boolean)
+ begin
+ if Sign = true then begin
+ UseCreditAmounts := true;
+ UseDebitAmounts := false
+ end else begin
+ UseCreditAmounts := false;
+ UseDebitAmounts := true;
+ end;
+ end;
+
[IntegrationEvent(false, false)]
local procedure OnAfterCalcFAPostedAmount(var FALedgerEntry: Record "FA Ledger Entry"; PostingType: Integer; Period: Option "Before Starting Date","Net Change","at Ending Date"; BeforeAmount: Decimal; UntilAmount: Decimal; var Result: Decimal)
begin
diff --git a/src/Layers/DE/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/DE/DemoTool/CreateFAPostingGroup.Codeunit.al
index 9c4421719b..772085c05a 100644
--- a/src/Layers/DE/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/DE/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -50,6 +50,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/DK/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/DK/DemoTool/CreateFAPostingGroup.Codeunit.al
index c5edd634d2..43ad52a7fb 100644
--- a/src/Layers/DK/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/DK/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -37,6 +37,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index c7801ce282..db66c160a6 100644
--- a/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -1,4 +1,4 @@
-// ------------------------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
@@ -211,6 +211,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -582,6 +583,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3371,6 +3373,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3386,6 +3389,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3598,6 +3602,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4214,6 +4223,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ElectPmtMgmt: Codeunit "Elect. Pmts Management";
Text1100100: Label '% cannot be applied, since it is included in a payment order.';
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
@@ -6062,6 +6073,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
[Scope('OnPrem')]
procedure AdjustDueDate(MaxDate: Date)
var
@@ -8239,6 +8265,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
@@ -12975,4 +13002,4 @@ table 81 "Gen. Journal Line"
local procedure OnBeforeGetAccCurrencyCode(var GenJnlLine: Record "Gen. Journal Line"; var CurrencyCode: Code[10]; var IsHandled: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index 5961f99990..269051e9d3 100644
--- a/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/ES/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1645,6 +1645,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/ES/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/ES/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index 8af45f13e4..25cb0b76de 100644
--- a/src/Layers/ES/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/ES/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -22,6 +22,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -130,6 +131,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
CarteraSetup: Record "Cartera Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -234,6 +236,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1167,7 +1172,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1851,7 +1855,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1878,6 +1882,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -8382,6 +8393,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -9216,6 +9270,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
local procedure CheckCarteraAccessPermissions(DocumentSituation: Enum "ES Document Situation")
begin
if (DocumentSituation <> DocumentSituation::" ") and (not CarteraSetup.ReadPermission) then
@@ -12912,4 +13026,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 613a1d681f..dc1a2f382c 100644
--- a/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -211,6 +211,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -581,6 +582,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3355,6 +3357,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3370,6 +3373,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3582,6 +3586,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4137,6 +4146,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -5971,6 +5982,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8107,6 +8133,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index 90e72f9b37..f0b69dd99b 100644
--- a/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/FI/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1646,6 +1646,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/FI/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/FI/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index d33b355668..c1392179ef 100644
--- a/src/Layers/FI/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/FI/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -22,6 +22,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -127,6 +128,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -190,6 +192,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1110,7 +1115,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1721,7 +1725,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1748,6 +1752,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -7681,6 +7692,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
[Scope('OnPrem')]
procedure UpdateImportedRefPayment(GenJnlLine: Record "Gen. Journal Line"; var CustLedgEntry: Record "Cust. Ledger Entry")
var
@@ -7862,6 +7916,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
@@ -11187,4 +11301,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
index ad3a3ed21c..5452fbf5d6 100644
--- a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
+++ b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
@@ -503,6 +503,11 @@ table 5601 "FA Ledger Entry"
CalcFormula = lookup("Dimension Set Entry"."Dimension Value Code" where("Dimension Set ID" = field("Dimension Set ID"),
"Global Dimension No." = const(8)));
}
+ field(5865; "Derogatory Excluded"; Boolean)
+ {
+ Caption = 'Exclude Derogatory';
+ Editable = false;
+ }
field(6210; "Non-Ded. VAT FA Cost"; Boolean)
{
Caption = 'Non-Deductible VAT FA Cost';
@@ -529,7 +534,7 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount;
}
- key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date")
+ key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date", "Derogatory Excluded")
{
SumIndexFields = Amount;
}
@@ -537,7 +542,7 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount;
}
- key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date")
+ key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date", "Derogatory Excluded")
{
SumIndexFields = Amount;
}
@@ -681,8 +686,10 @@ table 5601 "FA Ledger Entry"
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::Disposal;
"FA Posting Type"::"Salvage Value":
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::"Salvage Value";
- "FA Posting Type"::"Bonus Depreciation":
+ "FA Posting Type"::"Bonus Depreciation":
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::"Bonus Depreciation";
+ "FA Posting Type"::Derogatory:
+ FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::Derogatory;
else
OnAfterConvertPostingTypeElse(FAJnlLine, Rec);
end;
diff --git a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
index fd946cbd0f..58b91339b2 100644
--- a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
+++ b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
@@ -489,6 +489,57 @@ table 5606 "FA Posting Group"
CheckGLAcc("Book Val. Acc. on Disp. (Loss)", false);
end;
}
+ field(5865; "Derogatory Acc."; Code[20])
+ {
+ Caption = 'Derogatory Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Acc.", false);
+ end;
+ }
+ field(5866; "Derogatory Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derogatory Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Account (Decrease)", false);
+ end;
+ }
+ field(5867; "Derog. Bal. Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derog. Bal. Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derog. Bal. Account (Decrease)", true);
+ end;
+ }
+ field(5868; "Derogatory Expense Acc."; Code[20])
+ {
+ Caption = 'Derogatory Expense Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Expense Acc.", true);
+ end;
+ }
+ field(5869; "Allocated Derogatory Pct."; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ CalcFormula = sum("FA Allocation"."Allocation %" where(Code = field(Code),
+ "Allocation Type" = const(Derogatory)));
+ Caption = 'Allocated Derogatory %';
+ DecimalPlaces = 1 : 1;
+ Editable = false;
+ FieldClass = FlowField;
+ }
field(13400; "Depr. Difference Acc."; Code[20])
{
Caption = 'Depr. Difference Acc.';
@@ -537,7 +588,7 @@ table 5606 "FA Posting Group"
if DirectPosting then
GLAcc.TestField("Direct Posting");
- OnAfterCheckGLAcc(AccNo, DirectPosting, Rec);
+ OnAfterCheckGLAcc(AccNo, DirectPosting, Rec);
end;
procedure IsReadyForAcqusition(): Boolean
@@ -800,6 +851,30 @@ table 5606 "FA Posting Group"
OnAfterGetPostingGroup(Rec, DepreciationBookCode, Result);
end;
+ procedure GetDerogatoryAccount(): Code[20]
+ begin
+ TestField("Derogatory Acc.");
+ exit("Derogatory Acc.");
+ end;
+
+ procedure GetDerogatoryAccountDecrease(): Code[20]
+ begin
+ TestField("Derogatory Account (Decrease)");
+ exit("Derogatory Account (Decrease)");
+ end;
+
+ procedure GetDerogatoryBalAccountDecrease(): Code[20]
+ begin
+ TestField("Derog. Bal. Account (Decrease)");
+ exit("Derog. Bal. Account (Decrease)");
+ end;
+
+ procedure GetDerogatoryExpenseAccount(): Code[20]
+ begin
+ TestField("Derogatory Expense Acc.");
+ exit("Derogatory Expense Acc.");
+ end;
+
[IntegrationEvent(false, false)]
local procedure OnAfterGetPostingGroup(var FAPostingGroup: Record "FA Posting Group"; DepreciationBookCode: Code[10]; var Result: Boolean)
begin
diff --git a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
index 6de9923a2f..34ed647e88 100644
--- a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
+++ b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
@@ -54,6 +54,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
field("Depr. Difference Acc."; Rec."Depr. Difference Acc.")
{
ApplicationArea = FixedAssets;
@@ -91,6 +96,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ }
}
group("Balancing Account")
{
@@ -129,6 +139,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
field("Depr. Difference Bal. Acc."; Rec."Depr. Difference Bal. Acc.")
{
ApplicationArea = FixedAssets;
@@ -150,6 +165,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ }
}
group("Gross Disposal")
{
@@ -261,6 +281,14 @@ page 5612 "FA Posting Group Card"
Caption = 'Book Value (Loss)';
ToolTip = 'Specifies the sum that applies to book value gains.';
}
+ field("Allocated Derogatory Pct."; Rec."Allocated Derogatory Pct.")
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies the total percentage of derogatory depreciation allocated, when derogatory depreciation is posted for fixed assets.';
+ }
}
}
area(factboxes)
@@ -370,6 +398,16 @@ page 5612 "FA Posting Group Card"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ }
}
}
}
diff --git a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
index ef4a8027c7..3e7abfe6aa 100644
--- a/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
+++ b/src/Layers/FI/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
@@ -55,6 +55,26 @@ page 5613 "FA Posting Groups"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ }
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ }
field("Depr. Difference Acc."; Rec."Depr. Difference Acc.")
{
ApplicationArea = FixedAssets;
@@ -336,6 +356,16 @@ page 5613 "FA Posting Groups"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ }
}
}
}
diff --git a/src/Layers/FI/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/FI/DemoTool/CreateFAPostingGroup.Codeunit.al
index eb5df4a281..c9f454a5a7 100644
--- a/src/Layers/FI/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/FI/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -40,6 +40,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Validate("Depr. Difference Acc.", CA.Convert("Depr. Difference Acc."));
"FA Posting Group".Validate("Depr. Difference Bal. Acc.", CA.Convert("Depr. Difference Bal. Acc."));
diff --git a/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 0a3460455e..73f0ed9890 100644
--- a/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -3593,6 +3593,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -3867,11 +3872,22 @@ table 81 "Gen. Journal Line"
Caption = 'Entry No.';
Editable = false;
}
+#if not CLEANSCHEMA31
field(10861; "Derogatory Line"; Boolean)
{
Caption = 'Derogatory Line';
Editable = false;
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#endif
}
+#endif
field(10862; "Delayed Unrealized VAT"; Boolean)
{
Caption = 'Delayed Unrealized VAT';
@@ -4041,6 +4057,9 @@ table 81 "Gen. Journal Line"
end;
var
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
#pragma warning disable AA0074
Text000: Label '%1 or %2 must be a G/L Account or Bank Account.', Comment = '%1=Account Type,%2=Balance Account Type';
#pragma warning disable AA0470
@@ -5956,15 +5975,36 @@ table 81 "Gen. Journal Line"
[Scope('OnPrem')]
procedure GetDerogatorySetup()
begin
- "Derogatory Line" := false;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ "Is Derogatory" := false
+ else
+ "Derogatory Line" := false;
+#else
+ "Is Derogatory" := false;
+#endif
if ("Account Type" = "Account Type"::"Fixed Asset") and
("Account No." <> '') and
("Depreciation Book Code" <> '')
then begin
- DerogDeprBook.SetRange("Derogatory Calculation", "Depreciation Book Code");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code")
+ else
+ DerogDeprBook.SetRange("Derogatory Calculation", "Depreciation Book Code");
+#else
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+#endif
if DerogDeprBook.FindFirst() then
if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
- "Derogatory Line" := true;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ "Is Derogatory" := true
+ else
+ "Derogatory Line" := true;
+#else
+ "Is Derogatory" := true;
+#endif
end;
end;
diff --git a/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index b4eda8a3cd..258bcda88f 100644
--- a/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/FR/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1645,6 +1645,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
@@ -1796,11 +1801,22 @@ table 181 "Posted Gen. Journal Line"
Caption = 'Entry No.';
Editable = false;
}
+#if not CLEANSCHEMA31
field(10861; "Derogatory Line"; Boolean)
{
Caption = 'Derogatory Line';
Editable = false;
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#endif
}
+#endif
field(10862; "Delayed Unrealized VAT"; Boolean)
{
Caption = 'Delayed Unrealized VAT';
diff --git a/src/Layers/FR/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/FR/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index 640474c6f0..06fe4dd329 100644
--- a/src/Layers/FR/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/FR/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -197,7 +197,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1118,7 +1120,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1725,6 +1726,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
VATPostingSetup: Record "VAT Posting Setup";
FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
OriginalGLAccNo: Code[20];
@@ -1750,13 +1754,33 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
- if GenJnlLine."Derogatory Line" then begin
- MakeDerogFAJnlLine(FAJnlLine, GenJnlLine);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
+ end
+ else
+ if GenJnlLine."Derogatory Line" then begin
+ MakeDerogFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogatoryEntry(GenJnlLine);
+ end;
+#else
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
if GenJnlLine."FA Error Entry No." <> 0 then
FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
- CreateAndPostDerogatoryEntry(GenJnlLine);
+ CreateAndPostDerogEntry(GenJnlLine);
end;
+#endif
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -7709,15 +7733,15 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
-#if not CLEAN27
+#if not CLEAN29
local procedure RealizeDelayedUnrealizedVAT(GenJnlLine: Record "Gen. Journal Line")
begin
if GenJnlLine."Delayed Unrealized VAT" and GenJnlLine."Realize VAT" then
if (GenJnlLine."Applies-to Doc. No." <> '') or (GenJnlLine."Applies-to ID" <> '') then
PostDelayedUnrealizedVAT(GenJnlLine);
end;
-#endif
-
+
+ [Obsolete('Moved to W1 Base Application', '28.0')]
local procedure MakeDerogFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
var
DeprBook: Record "Depreciation Book";
@@ -7760,6 +7784,50 @@ codeunit 12 "Gen. Jnl.-Post Line"
FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
end;
+#endif
+
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
#if not CLEAN28
[Scope('OnPrem')]
@@ -8105,6 +8173,8 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+#if not CLEAN29
+ [Obsolete('Moved to W1 Base Application', '28.0')]
local procedure CreateAndPostDerogatoryEntry(SourceGenJournalLine: Record "Gen. Journal Line")
var
DepreciationBook: Record "Depreciation Book";
@@ -8155,6 +8225,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
end;
+ [Obsolete('Moved to W1 Base Application', '28.0')]
local procedure MakeGenJnlLineOfTypeDerogatory(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
begin
DerogGenJnlLine.TransferFields(GenJnlLine);
@@ -8164,6 +8235,67 @@ codeunit 12 "Gen. Jnl.-Post Line"
DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
DerogGenJnlLine.Validate("System-Created Entry", true);
end;
+#endif
+
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
@@ -11490,4 +11622,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/AcceleratedDeprFeature.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/AcceleratedDeprFeature.Codeunit.al
new file mode 100644
index 0000000000..b0ac77d536
--- /dev/null
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/AcceleratedDeprFeature.Codeunit.al
@@ -0,0 +1,197 @@
+#if not CLEAN29
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+namespace Microsoft.FixedAssets.Depreciation;
+
+using Microsoft.Finance.GeneralLedger.Journal;
+using Microsoft.FixedAssets.FixedAsset;
+using Microsoft.FixedAssets.Journal;
+using Microsoft.FixedAssets.Ledger;
+using Microsoft.Foundation.Navigate;
+using System.Environment.Configuration;
+using System.Upgrade;
+
+codeunit 5866 "Accelerated Depr. Feature" implements "Feature Data Update"
+{
+ InherentEntitlements = X;
+ InherentPermissions = X;
+ ObsoleteState = Pending;
+ ObsoleteReason = 'Accelerated depreciation feature will be always enabled in version 31.0';
+ ObsoleteTag = '29.0';
+
+ var
+ TempDocumentEntry: Record "Document Entry" temporary;
+ FeatureDataUpdateMgt: Codeunit "Feature Data Update Mgt.";
+ FeatureMgtFacade: Codeunit "Feature Management Facade";
+ DescriptionTxt: Label 'Existing records in FR BaseApp fields will be copied to W1 BaseApp fields';
+ AcceleratedDepreciationLbl: Label 'AcceleratedDepreciation', Locked = true;
+
+ procedure IsEnabled() Enabled: Boolean
+ begin
+ Enabled := FeatureMgtFacade.IsEnabled(AcceleratedDepreciationLbl);
+ end;
+
+ procedure IsDefaultsFeatureEnabled(): Boolean
+ begin
+ exit(FeatureMgtFacade.IsEnabled(GetAcceleratedDepreciationFeatureKey()));
+ end;
+
+ procedure GetAcceleratedDepreciationFeatureKey(): Text[50]
+ begin
+ exit(AcceleratedDepreciationLbl);
+ end;
+
+ procedure IsDataUpdateRequired(): Boolean
+ begin
+ CountRecords();
+ if TempDocumentEntry.IsEmpty() then begin
+ SetUpgradeTag(false);
+ exit(false);
+ end;
+ exit(true);
+ end;
+
+ procedure ReviewData()
+ var
+ DataUpgradeOverview: Page "Data Upgrade Overview";
+ begin
+ Commit();
+ Clear(DataUpgradeOverview);
+ DataUpgradeOverview.Set(TempDocumentEntry);
+ DataUpgradeOverview.RunModal();
+ end;
+
+ procedure UpdateData(FeatureDataUpdateStatus: Record "Feature Data Update Status")
+ var
+ StartDateTime: DateTime;
+ EndDateTime: DateTime;
+ begin
+ StartDateTime := CurrentDateTime;
+ FeatureDataUpdateMgt.LogTask(FeatureDataUpdateStatus, 'Upgrade Accelerated depreciation', StartDateTime);
+ UpgradeAcceleratedDepreciation();
+ EndDateTime := CurrentDateTime;
+ FeatureDataUpdateMgt.LogTask(FeatureDataUpdateStatus, 'Upgrade Accelerated depreciation', EndDateTime);
+ end;
+
+ procedure AfterUpdate(FeatureDataUpdateStatus: Record "Feature Data Update Status")
+ var
+ UpdateFeatureDataUpdateStatus: Record "Feature Data Update Status";
+ begin
+ UpdateFeatureDataUpdateStatus.SetRange("Feature Key", FeatureDataUpdateStatus."Feature Key");
+ UpdateFeatureDataUpdateStatus.SetFilter("Company Name", '<>%1', FeatureDataUpdateStatus."Company Name");
+ UpdateFeatureDataUpdateStatus.ModifyAll("Feature Status", FeatureDataUpdateStatus."Feature Status");
+
+ SetUpgradeTag(true);
+ end;
+
+ procedure GetTaskDescription(): Text
+ begin
+ exit(DescriptionTxt);
+ end;
+
+ local procedure CountRecords()
+ var
+ GenJournalLine: Record "Gen. Journal Line";
+ PostedGenJournalLine: Record "Posted Gen. Journal Line";
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ FALedgEntry: Record "FA Ledger Entry";
+ FAPostingGr: Record "FA Posting Group";
+ FAReclassJnlLine: Record "FA Reclass. Journal Line";
+ begin
+ InsertDocumentEntry(Database::"Gen. Journal Line", GenJournalLine.TableCaption(), GenJournalLine.Count());
+ InsertDocumentEntry(Database::"Posted Gen. Journal Line", PostedGenJournalLine.TableCaption(), PostedGenJournalLine.Count());
+ InsertDocumentEntry(Database::"Depreciation Book", DeprBook.TableCaption(), DeprBook.Count());
+ InsertDocumentEntry(Database::"FA Depreciation Book", FADeprBook.TableCaption(), FADeprBook.Count());
+ InsertDocumentEntry(Database::"FA Ledger Entry", FALedgEntry.TableCaption(), FALedgEntry.Count());
+ InsertDocumentEntry(Database::"FA Posting Group", FAPostingGr.TableCaption(), FAPostingGr.Count());
+ InsertDocumentEntry(Database::"FA Reclass. Journal Line", FAReclassJnlLine.TableCaption(), FAReclassJnlLine.Count());
+ end;
+
+ local procedure InsertDocumentEntry(TableID: Integer; TableName: Text; RecordCount: Integer)
+ begin
+ if RecordCount = 0 then
+ exit;
+ TempDocumentEntry.Init();
+ TempDocumentEntry."Entry No." += 1;
+ TempDocumentEntry."Table ID" := TableID;
+ TempDocumentEntry."Table Name" := CopyStr(TableName, 1, MaxStrLen(TempDocumentEntry."Table Name"));
+ TempDocumentEntry."No. of Records" := RecordCount;
+ TempDocumentEntry.Insert();
+ end;
+
+ local procedure UpgradeAcceleratedDepreciation()
+ var
+ GenJournalLine: Record "Gen. Journal Line";
+ PostedGenJournalLine: Record "Posted Gen. Journal Line";
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ FALedgEntry: Record "FA Ledger Entry";
+ FAPostingGr: Record "FA Posting Group";
+ FAReclassJnlLine: Record "FA Reclass. Journal Line";
+ begin
+ if GenJournalLine.FindSet() then
+ repeat
+ GenJournalLine."Is Derogatory" := GenJournalLine."Derogatory Line";
+ GenJournalLine.Modify();
+ until GenJournalLine.Next() = 0;
+
+ if PostedGenJournalLine.FindSet() then
+ repeat
+ PostedGenJournalLine."Is Derogatory" := PostedGenJournalLine."Derogatory Line";
+ PostedGenJournalLine.Modify();
+ until PostedGenJournalLine.Next() = 0;
+
+ if DeprBook.FindSet() then
+ repeat
+ DeprBook."Derogatory Calc." := DeprBook."Derogatory Calculation";
+ DeprBook."Integration G/L - Derogatory" := DeprBook."G/L Integration - Derogatory";
+ DeprBook.Modify();
+ until DeprBook.Next() = 0;
+
+ if FADeprBook.FindSet() then
+ repeat
+ FADeprBook."Last Derogatory" := FADeprBook."Last Derogatory Date";
+ FADeprBook.Modify();
+ until FADeprBook.Next() = 0;
+
+ if FALedgEntry.FindSet() then
+ repeat
+ FALedgEntry."Derogatory Excluded" := FALedgEntry."Exclude Derogatory";
+ FALedgEntry.Modify();
+ until FALedgEntry.Next() = 0;
+
+ if FAPostingGr.FindSet() then
+ repeat
+ FAPostingGr."Derogatory Acc." := FAPostingGr."Derogatory Account";
+ FAPostingGr."Derogatory Account (Decrease)" := FAPostingGr."Derogatory Acc. (Decrease)";
+ FAPostingGr."Derog. Bal. Account (Decrease)" := FAPostingGr."Derog. Bal. Acc. (Decrease)";
+ FAPostingGr."Derogatory Expense Acc." := FAPostingGr."Derogatory Expense Account";
+ FAPostingGr.Modify();
+ until FAPostingGr.Next() = 0;
+
+ if FAReclassJnlLine.FindSet() then
+ repeat
+ FAReclassJnlLine."Reclass. Derogatory" := FAReclassJnlLine."Reclassify Derogatory";
+ FAReclassJnlLine.Modify();
+ until FAReclassJnlLine.Next() = 0;
+ end;
+
+ local procedure SetUpgradeTag(DataUpgradeExecuted: Boolean)
+ var
+ UpgradeTag: Codeunit "Upgrade Tag";
+ UpgTagAcceleratedDepr: Codeunit "Upg. Tag Accelerated Depr.";
+ begin
+ // Set the upgrade tag to indicate that the data update is executed/skipped and the feature is enabled.
+ // This is needed when the feature is enabled by default in a future version, to skip the data upgrade.
+ if UpgradeTag.HasUpgradeTag(UpgTagAcceleratedDepr.GetAcceleratedDepreciationUpgradeTag()) then
+ exit;
+
+ UpgradeTag.SetUpgradeTag(UpgTagAcceleratedDepr.GetAcceleratedDepreciationUpgradeTag());
+ if not DataUpgradeExecuted then
+ UpgradeTag.SetSkippedUpgrade(UpgTagAcceleratedDepr.GetAcceleratedDepreciationUpgradeTag(), true);
+ end;
+}
+#endif
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al
index 45912eb156..0caa2879c5 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al
@@ -63,6 +63,8 @@ codeunit 5613 "Calculate Acq. Cost Depr."
end;
end;
+#if not CLEAN29
+ [Obsolete('Moved to W1 Base Application', '28.0')]
[Scope('OnPrem')]
procedure DerogatoryCalc(var DeprAmount: Decimal; FANo: Code[20]; DeprBookCode: Code[10]; LocalDerogatoryBasis: Decimal)
var
@@ -84,6 +86,29 @@ codeunit 5613 "Calculate Acq. Cost Depr."
DepreciationCalc.CalcRounding(
DeprBookCode, (FADeprBook.Derogatory * LocalDerogatoryBasis) / DerogBasis);
end;
+#endif
+
+ [Scope('OnPrem')]
+ procedure DerogatoryCalculation(var DeprAmount: Decimal; FANo: Code[20]; DeprBookCode: Code[10]; LocalDerogatoryBasis: Decimal)
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ DepreciationCalc: Codeunit "Depreciation Calculation";
+ DerogBasis: Decimal;
+ begin
+ DeprAmount := 0;
+ DeprBook.Get(DeprBookCode);
+ if not FADeprBook.Get(FANo, DeprBookCode) then
+ exit;
+ FADeprBook.CalcFields("Derogatory Amount", "Acquisition Cost", "Depreciable Basis");
+ DerogBasis := FADeprBook."Depreciable Basis" - LocalDerogatoryBasis;
+ if DerogBasis <= 0 then
+ CreateError(FANo, DeprBookCode);
+ if DerogBasis > 0 then
+ DeprAmount :=
+ DepreciationCalc.CalcRounding(
+ DeprBookCode, (FADeprBook."Derogatory Amount" * LocalDerogatoryBasis) / DerogBasis);
+ end;
local procedure CreateError(FANo: Code[20]; DeprBookCode: Code[20])
var
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
index 2adf258275..ec50853527 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
@@ -33,6 +33,62 @@ report 5692 "Calculate Depreciation"
trigger OnAfterGetRecord()
begin
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if not HasDerogatorySetup then
+ CurrReport.Skip();
+
+ CalculateDepr.Calculate(
+ DeprAmount, Custom1Amount, NumberOfDays, Custom1NumberOfDays,
+ "No.", DeprBook2.Code, DeprUntilDate, EntryAmounts, 0D, DaysInPeriod);
+
+ if DeprAmount2 <> 0 then
+ if not DeprBook."Integration G/L - Derogatory" or "Budgeted Asset" then begin
+ TempFAJnlLine."FA No." := "No.";
+ TempFAJnlLine."FA Posting Type" := TempFAJnlLine."FA Posting Type"::Derogatory;
+ TempFAJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempFAJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempFAJnlLine."FA Error Entry No." := ErrorNo;
+ TempFAJnlLine."Line No." := TempFAJnlLine."Line No." + 1;
+ TempFAJnlLine.Insert();
+ end else begin
+ TempGenJnlLine."Account No." := "No.";
+ TempGenJnlLine."FA Posting Type" := TempGenJnlLine."FA Posting Type"::Derogatory;
+ TempGenJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempGenJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempGenJnlLine."FA Error Entry No." := ErrorNo;
+ TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
+ TempGenJnlLine.Insert();
+ end;
+ end
+ else begin
+ if not HasDerogatorySetup then
+ CurrReport.Skip();
+
+ CalculateDepr.Calculate(
+ DeprAmount, Custom1Amount, NumberOfDays, Custom1NumberOfDays,
+ "No.", DeprBook2.Code, DeprUntilDate, EntryAmounts, 0D, DaysInPeriod);
+
+ if DeprAmount2 <> 0 then
+ if not DeprBook."G/L Integration - Derogatory" or "Budgeted Asset" then begin
+ TempFAJnlLine."FA No." := "No.";
+ TempFAJnlLine."FA Posting Type" := TempFAJnlLine."FA Posting Type"::Derogatory;
+ TempFAJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempFAJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempFAJnlLine."FA Error Entry No." := ErrorNo;
+ TempFAJnlLine."Line No." := TempFAJnlLine."Line No." + 1;
+ TempFAJnlLine.Insert();
+ end else begin
+ TempGenJnlLine."Account No." := "No.";
+ TempGenJnlLine."FA Posting Type" := TempGenJnlLine."FA Posting Type"::Derogatory;
+ TempGenJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempGenJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempGenJnlLine."FA Error Entry No." := ErrorNo;
+ TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
+ TempGenJnlLine.Insert();
+ end;
+ end;
+#else
if not HasDerogatorySetup then
CurrReport.Skip();
@@ -41,7 +97,7 @@ report 5692 "Calculate Depreciation"
"No.", DeprBook2.Code, DeprUntilDate, EntryAmounts, 0D, DaysInPeriod);
if DeprAmount2 <> 0 then
- if not DeprBook."G/L Integration - Derogatory" or "Budgeted Asset" then begin
+ if not DeprBook."Integration G/L - Derogatory" or "Budgeted Asset" then begin
TempFAJnlLine."FA No." := "No.";
TempFAJnlLine."FA Posting Type" := TempFAJnlLine."FA Posting Type"::Derogatory;
TempFAJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
@@ -58,6 +114,7 @@ report 5692 "Calculate Depreciation"
TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
TempGenJnlLine.Insert();
end;
+#endif
end;
}
@@ -410,10 +467,25 @@ report 5692 "Calculate Depreciation"
Clear(DeprBook2);
DeprBook.Get(DeprBookCode);
- if DeprBook."Derogatory Calculation" <> '' then
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if DeprBook."Derogatory Calc." <> '' then
+ Error(Text10800, DeprBook.Code);
+ DeprBook2.SetRange("Derogatory Calc.", DeprBookCode);
+ if DeprBook2.Find('-') then;
+ end
+ else begin
+ if DeprBook."Derogatory Calculation" <> '' then
+ Error(Text10800, DeprBook.Code);
+ DeprBook2.SetRange("Derogatory Calculation", DeprBookCode);
+ if DeprBook2.Find('-') then;
+ end;
+#else
+ if DeprBook."Derogatory Calc." <> '' then
Error(Text10800, DeprBook.Code);
- DeprBook2.SetRange("Derogatory Calculation", DeprBookCode);
+ DeprBook2.SetRange("Derogatory Calc.", DeprBookCode);
if DeprBook2.Find('-') then;
+#endif
if DeprUntilDate = 0D then
Error(Text000, FAJnlLine.FieldCaption("FA Posting Date"));
@@ -445,11 +517,16 @@ report 5692 "Calculate Depreciation"
DeprBook: Record "Depreciation Book";
FAJnlSetup: Record "FA Journal Setup";
GeneralLedgerSetup: Record "General Ledger Setup";
+ DeprBook2: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
CalculateDepr: Codeunit "Calculate Depreciation";
FAInsertGLAcc: Codeunit "FA Insert G/L Account";
ErrorMessageMgt: Codeunit "Error Message Management";
ErrorContextElement: Codeunit "Error Context Element";
ErrorMessageHandler: Codeunit "Error Message Handler";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
Window: Dialog;
DeprAmount: Decimal;
Custom1Amount: Decimal;
@@ -463,8 +540,6 @@ report 5692 "Calculate Depreciation"
GenJnlNextLineNo: Integer;
EntryAmounts: array[4] of Decimal;
LineNo: Integer;
- DeprBook2: Record "Depreciation Book";
- FADeprBook: Record "FA Depreciation Book";
DeprAmount2: Decimal;
HasDerogatorySetup: Boolean;
FAJnlLineCreatedCount: Integer;
@@ -482,9 +557,9 @@ report 5692 "Calculate Depreciation"
Text003: Label 'Depreciating fixed asset #1##########\';
Text004: Label 'Not depreciating fixed asset #2##########\';
Text005: Label 'Inserting journal lines #3##########';
-#pragma warning restore AA0470
Text006: Label 'Use Force No. of Days must be activated.';
Text10800: Label 'Depreciation cannot be posted on depreciation book %1 because it is set up as derogatory.';
+#pragma warning restore AA0470
#pragma warning restore AA0074
CompletionStatsMsg: Label 'The depreciation has been calculated.\\No journal lines were created.';
#pragma warning disable AA0470
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
index 0d085cfcf7..4e602c03db 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
@@ -527,6 +527,9 @@ codeunit 5611 "Calculate Normal Depreciation"
local procedure TransferValues()
var
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
IsHandled: Boolean;
begin
FADeprBook.TestField("Depreciation Starting Date");
@@ -565,7 +568,14 @@ codeunit 5611 "Calculate Normal Depreciation"
end else
BookValue := EntryAmounts[1];
if DateFromProjection = 0D then begin
- DerogDeprBook.SetRange("Derogatory Calculation", DeprBookCode);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode)
+ else
+ DerogDeprBook.SetRange("Derogatory Calculation", DeprBookCode);
+#else
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+#endif
if DerogDeprBook.FindFirst() then begin
DerogFALedgEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date");
DerogFALedgEntry.SetRange("FA No.", FADeprBook."FA No.");
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
index 7624810707..02cdd64eec 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
@@ -171,11 +171,26 @@ report 5687 "Copy Depreciation Book"
Caption = 'Disposal';
ToolTip = 'Specifies if related disposal entries are included in the batch job .';
}
+#if not CLEAN29
field(Derogatory; CopyChoices[13])
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies whether to include derogatory depreciation.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+ }
+#endif
+ field("CopyChoices[13]"; CopyChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
}
}
}
@@ -188,6 +203,10 @@ report 5687 "Copy Depreciation Book"
trigger OnOpenPage()
begin
+#if not CLEAN29
+ AcceleratedDeprFeatureEnabled := AcceleratedDeprFeature.IsEnabled();
+#endif
+
if DeprBookCode = '' then begin
FASetup.Get();
DeprBookCode := FASetup."Default Depr. Book";
@@ -227,6 +246,10 @@ report 5687 "Copy Depreciation Book"
FALedgEntry: Record "FA Ledger Entry";
FAJnlSetup: Record "FA Journal Setup";
DepreciationCalc: Codeunit "Depreciation Calculation";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+ AcceleratedDeprFeatureEnabled: Boolean;
+#endif
Window: Dialog;
ExchangeRate: Decimal;
CopyChoices: array[13] of Boolean;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index f2d03d1f44..a08891e6d7 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -367,6 +367,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -384,10 +444,19 @@ table 5611 "Depreciation Book"
end;
end;
}
+#if not CLEANSCHEMA31
field(10800; "Derogatory Calculation"; Code[10])
{
Caption = 'Derogatory Calculation';
TableRelation = "Depreciation Book";
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnValidate()
var
@@ -425,23 +494,41 @@ table 5611 "Depreciation Book"
CheckIntegrationFields();
end;
+#endif
}
+#endif
+#if not CLEAN29
field(10801; "Used with Derogatory Book"; Code[10])
{
CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calculation" = field(Code)));
Caption = 'Used with Derogatory Book';
Editable = false;
FieldClass = FlowField;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
+#if not CLEANSCHEMA31
field(10802; "G/L Integration - Derogatory"; Boolean)
{
Caption = 'G/L Integration - Derogatory';
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnValidate()
begin
CheckIntegrationFields();
end;
+#endif
}
+#endif
}
keys
@@ -517,13 +604,19 @@ table 5611 "Depreciation Book"
var
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
GLIntegration: array[13] of Boolean;
- MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.',Comment ='%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+ MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
BonusDepreciationOnboardingMsg: Label 'This change will take effect only for the fixed asset depreciation books that are newly created with this depreciation book.';
#pragma warning disable AA0074
@@ -547,7 +640,14 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
- GLIntegration[13] := "G/L Integration - Derogatory";
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ GLIntegration[13] := "Integration G/L - Derogatory"
+ else
+ GLIntegration[13] := "G/L Integration - Derogatory";
+#else
+ GLIntegration[13] := "Integration G/L - Derogatory";
+#endif
end;
[Scope('OnPrem')]
@@ -555,18 +655,43 @@ table 5611 "Depreciation Book"
var
i: Integer;
begin
- if "Derogatory Calculation" <> '' then begin
- IndexGLIntegration(GLIntegration);
- for i := 1 to 13 do
- if GLIntegration[i] then
- Error(Text10803);
- end;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if "Derogatory Calculation" <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end
+ end
+ else
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end
+#else
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end
+#endif
end;
[Scope('OnPrem')]
procedure IsDerogatoryBook(): Boolean
begin
- exit("Derogatory Calculation" <> '');
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ exit("Derogatory Calc." <> '')
+ else
+ exit("Derogatory Calculation" <> '');
+#else
+ exit("Derogatory Calc." <> '');
+#endif
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index 6638e47b71..1ffcec03f0 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -63,16 +63,42 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Derogatory Calculation"; Rec."Derogatory Calculation")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
field("Used with Derogatory Book"; Rec."Used with Derogatory Book")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Allow Identical Document No."; Rec."Allow Identical Document No.")
{
ApplicationArea = FixedAssets;
@@ -162,12 +188,28 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Maintenance';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("G/L Integration - Derogatory"; Rec."G/L Integration - Derogatory")
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
+
field("G/L Integration - Bonus Depr."; Rec."G/L Integration - Bonus Depr.")
{
ApplicationArea = FixedAssets;
@@ -330,5 +372,16 @@ page 5610 "Depreciation Book Card"
}
}
}
+
+#if not CLEAN29
+ trigger OnOpenPage()
+ begin
+ AcceleratedDeprFeatureEnabled := AcceleratedDeprFeature.IsEnabled();
+ end;
+
+ var
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+ AcceleratedDeprFeatureEnabled: Boolean;
+#endif
}
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
index b676bb568d..b2579ecba2 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
@@ -514,7 +514,7 @@ codeunit 5616 "Depreciation Calculation"
FiscalYearBegin := FADateCalc.GetFiscalYear(DeprBookCode, StartingDate);
SetFAFilter(FALedgEntry, FANo, DeprBookCode, true);
FALedgEntry.SetFilter("FA Posting Date", '%1..', FiscalYearBegin);
- FALedgEntry.SetFilter("FA Posting Type", '%1|%2', FALedgEntry."FA Posting Type"::Depreciation, FALedgEntry."FA Posting Type"::Derogatory);
+ FALedgEntry.SetFilter("FA Posting Type", '%1|%2', FALedgEntry."FA Posting Type"::Depreciation, FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("Part of Book Value", true);
FALedgEntry.SetRange("Reclassification Entry", false);
FALedgEntry.CalcSums(Amount);
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADateType.Table.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADateType.Table.al
index c3fa6b094f..241a5e7384 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADateType.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADateType.Table.al
@@ -53,6 +53,9 @@ table 5645 "FA Date Type"
procedure CreateTypes()
var
FADepreciationBook: Record "FA Depreciation Book";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
begin
LockTable();
if not Find('-') then begin
@@ -71,8 +74,17 @@ table 5645 "FA Date Type"
"FA Entry" := false;
"G/L Entry" := true;
InsertRec(10, FADepreciationBook.FieldNo("G/L Acquisition Date"), FADepreciationBook.FieldCaption("G/L Acquisition Date"));
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory"), FADepreciationBook.FieldCaption("Last Derogatory"))
+ else begin
+ "FA Entry" := true;
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory Date"), FADepreciationBook.FieldCaption("Last Derogatory Date"));
+ end;
+#else
"FA Entry" := true;
- InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory Date"), FADepreciationBook.FieldCaption("Last Derogatory Date"));
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory"), FADepreciationBook.FieldCaption("Last Derogatory"));
+#endif
end else begin
SetCurrentKey("Entry No.");
Find('-');
@@ -147,13 +159,33 @@ table 5645 "FA Date Type"
Delete();
InsertRec(10, FADepreciationBook.FieldNo("G/L Acquisition Date"), FADepreciationBook.FieldCaption("G/L Acquisition Date"));
end;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if "Entry No." = 11 then
+ if ("FA Date Type No." <> FADepreciationBook.FieldNo("Last Derogatory")) or
+ ("FA Date Type Name" <> FADepreciationBook.FieldCaption("Last Derogatory"))
+ then begin
+ Delete();
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory"), FADepreciationBook.FieldCaption("Last Derogatory"));
+ end
+ end
+ else
+ if "Entry No." = 11 then
+ if ("FA Date Type No." <> FADepreciationBook.FieldNo("Last Derogatory Date")) or
+ ("FA Date Type Name" <> FADepreciationBook.FieldCaption("Last Derogatory Date"))
+ then begin
+ Delete();
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory Date"), FADepreciationBook.FieldCaption("Last Derogatory Date"));
+ end;
+#else
if "Entry No." = 11 then
- if ("FA Date Type No." <> FADepreciationBook.FieldNo("Last Derogatory Date")) or
- ("FA Date Type Name" <> FADepreciationBook.FieldCaption("Last Derogatory Date"))
+ if ("FA Date Type No." <> FADepreciationBook.FieldNo("Last Derogatory")) or
+ ("FA Date Type Name" <> FADepreciationBook.FieldCaption("Last Derogatory"))
then begin
Delete();
- InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory Date"), FADepreciationBook.FieldCaption("Last Derogatory Date"));
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory"), FADepreciationBook.FieldCaption("Last Derogatory"));
end;
+#endif
until Next() = 0;
end;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
index 0672161940..d84be9f14e 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
@@ -348,8 +348,13 @@ table 5612 "FA Depreciation Book"
CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
"Depreciation Book Code" = field("Depreciation Book Code"),
"Part of Book Value" = const(true),
+#if not CLEAN29
"FA Posting Date" = field("FA Posting Date Filter"),
"Exclude Derogatory" = const(false)));
+#else
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
+#endif
Caption = 'Book Value';
ToolTip = 'Specifies the book value for the fixed asset.';
Editable = false;
@@ -882,6 +887,25 @@ table 5612 "FA Depreciation Book"
FieldError("Default FA Depreciation Book", OnlyOneDefaultDeprBookErr);
end;
}
+ field(5865; "Derogatory Amount"; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = GetCurrencyCode();
+ CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
+ "Depreciation Book Code" = field("Depreciation Book Code"),
+ "FA Posting Category" = const(" "),
+ "FA Posting Type" = const(Derogatory),
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
+ Caption = 'Derogatory';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5866; "Last Derogatory"; Date)
+ {
+ Caption = 'Last Derogatory Date';
+ }
+#if not CLEAN29
field(10800; Derogatory; Decimal)
{
AutoFormatType = 1;
@@ -895,11 +919,26 @@ table 5612 "FA Depreciation Book"
Caption = 'Derogatory';
Editable = false;
FieldClass = FlowField;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
+#if not CLEANSCHEMA31
field(10801; "Last Derogatory Date"; Date)
{
Caption = 'Last Derogatory Date';
- }
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#endif
+ }
+#endif
}
keys
@@ -1343,12 +1382,23 @@ table 5612 "FA Depreciation Book"
end;
procedure SetBookValueFiltersOnFALedgerEntry(var FALedgerEntry: Record "FA Ledger Entry")
+#if not CLEAN29
+ var
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
begin
FALedgerEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date");
FALedgerEntry.SetRange("FA No.", "FA No.");
FALedgerEntry.SetRange("Depreciation Book Code", "Depreciation Book Code");
FALedgerEntry.SetRange("Part of Book Value", true);
- FALedgerEntry.SetRange("Exclude Derogatory", false);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ FALedgerEntry.SetRange("Derogatory Excluded", false)
+ else
+ FALedgerEntry.SetRange("Exclude Derogatory", false);
+#else
+ FALedgerEntry.SetRange("Derogatory Excluded", false);
+#endif
OnAfterSetBookValueFiltersOnFALedgerEntry(FALedgerEntry);
end;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FeatureAcceleratedDepr.EnumExt.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FeatureAcceleratedDepr.EnumExt.al
new file mode 100644
index 0000000000..ad899195bc
--- /dev/null
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/FeatureAcceleratedDepr.EnumExt.al
@@ -0,0 +1,20 @@
+#if not CLEAN29
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+namespace Microsoft.FixedAssets.Depreciation;
+
+using System.Environment.Configuration;
+
+enumextension 5869 "Feature - Accelerated Depr." extends "Feature To Update"
+{
+ value(5865; AcceleratedDepreciation)
+ {
+ Implementation = "Feature Data Update" = "Accelerated Depr. Feature";
+ ObsoleteState = Pending;
+ ObsoleteReason = 'Feature Accelerated depreciation will be enabled by default in version 31.0.';
+ ObsoleteTag = '29.0';
+ }
+}
+#endif
\ No newline at end of file
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/UpgTagAcceleratedDepr.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/UpgTagAcceleratedDepr.Codeunit.al
new file mode 100644
index 0000000000..8899beb7a4
--- /dev/null
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/UpgTagAcceleratedDepr.Codeunit.al
@@ -0,0 +1,23 @@
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+namespace Microsoft.FixedAssets.Depreciation;
+
+using System.Upgrade;
+
+codeunit 5867 "Upg. Tag Accelerated Depr."
+{
+ Access = Internal;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Upgrade Tag", 'OnGetPerCompanyUpgradeTags', '', false, false)]
+ local procedure RegisterPerCompanyTags(var PerCompanyUpgradeTags: List of [Code[250]])
+ begin
+ PerCompanyUpgradeTags.Add(GetAcceleratedDepreciationUpgradeTag());
+ end;
+
+ internal procedure GetAcceleratedDepreciationUpgradeTag(): Code[250]
+ begin
+ exit('MS-581204-AcceleratedDepreciationUpgradeTag-20260206');
+ end;
+}
\ No newline at end of file
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Depreciation/UpgradeAcceleratedDepr.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/UpgradeAcceleratedDepr.Codeunit.al
new file mode 100644
index 0000000000..d30dd6c1f6
--- /dev/null
+++ b/src/Layers/FR/BaseApp/FixedAssets/Depreciation/UpgradeAcceleratedDepr.Codeunit.al
@@ -0,0 +1,72 @@
+#if CLEAN29
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+namespace Microsoft.FixedAssets.Depreciation;
+
+using Microsoft.Finance.GeneralLedger.Journal;
+using Microsoft.FixedAssets.FixedAsset;
+using Microsoft.FixedAssets.Journal;
+using Microsoft.FixedAssets.Ledger;
+using System.Upgrade;
+
+codeunit 5868 "Upgrade Accelerated Depr."
+{
+ Access = Internal;
+ Subtype = Upgrade;
+
+ var
+ UpgradeTag: Codeunit "Upgrade Tag";
+ UpgTagAcceleratedDepr: Codeunit "Upg. Tag Accelerated Depr.";
+
+ trigger OnUpgradePerCompany()
+ var
+ CurrentModuleInfo: ModuleInfo;
+ begin
+ NavApp.GetCurrentModuleInfo(CurrentModuleInfo);
+ if CurrentModuleInfo.AppVersion().Major() < 31 then
+ exit;
+
+ UpgradeAcceleratedDepr();
+ end;
+
+ local procedure UpgradeAcceleratedDepr()
+ begin
+ if UpgradeTag.HasUpgradeTag(UpgTagAcceleratedDepr.GetAcceleratedDepreciationUpgradeTag()) then
+ exit;
+
+ TransferFields(Database::"Gen. Journal Line", 10861, 5865); // 10861 - the existing field "Derogatory Line", 5865 - the new field "Is Derogatory";
+ TransferFields(Database::"Posted Gen. Journal Line", 10861, 5865); // 10861 - the existing field "Derogatory Line", 5865 - the new field "Is Derogatory";
+ TransferFields(Database::"Depreciation Book", 10800, 5865); // 10800 - the existing field "Derogatory Calculation", 5865 - the new field "Derogatory Calc.";
+ TransferFields(Database::"Depreciation Book", 10802, 5867); // 10802 - the existing field "G/L Integration - Derogatory", 5867 - the new field "Integration G/L - Derogatory";
+ TransferFields(Database::"FA Depreciation Book", 10801, 5865); // 10801 - the existing field "Last Derogatory Date", 5865 - the new field "Derogatory Amount";
+ TransferFields(Database::"FA Ledger Entry", 10800, 5865); // 10800 - the existing field "Derogatory Excluded", 5865 - the new field "Exclude Derogatory";
+ TransferFields(Database::"FA Posting Group", 10800, 5865); // 10800 - the existing field "Derogatory Account", 5865 - the new field "Derogatory Acc.";
+ TransferFields(Database::"FA Posting Group", 10801, 5866); // 10801 - the existing field "Derogatory Acc. (Decrease)", 5866 - the new field "Derogatory Account (Decrease)";
+ TransferFields(Database::"FA Posting Group", 10802, 5867); // 10802 - the existing field "Derog. Bal. Acc. (Decrease)", 5867 - the new field "Derog. Bal. Account (Decrease)";
+ TransferFields(Database::"FA Posting Group", 10803, 5868); // 10803 - the existing field "Derogatory Expense Account", 5868 - the new field "Derogatory Expense Acc.";
+ TransferFields(Database::"FA Reclass. Journal Line", 10800, 5865); // 10800 - the existing field "Reclassify Derogatory", 5865 - the new field "Reclass. Derogatory";
+
+ UpgradeTag.SetUpgradeTag(UpgTagAcceleratedDepr.GetAcceleratedDepreciationUpgradeTag());
+ end;
+
+ local procedure TransferFields(TableId: Integer; SourceFieldNo: Integer; TargetFieldNo: Integer)
+ var
+ RecRef: RecordRef;
+ TargetFieldRef: FieldRef;
+ SourceFieldRef: FieldRef;
+ begin
+ RecRef.Open(TableId, false);
+ SourceFieldRef := RecRef.Field(SourceFieldNo);
+ SourceFieldRef.SetFilter('<>%1', '');
+
+ if RecRef.FindSet() then
+ repeat
+ TargetFieldRef := RecRef.Field(TargetFieldNo);
+ TargetFieldRef.VALUE := SourceFieldRef.VALUE;
+ RecRef.Modify(false);
+ until RecRef.Next() = 0;
+ end;
+}
+#endif
\ No newline at end of file
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
index d134abea8b..344cd5268c 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
@@ -26,6 +26,9 @@ codeunit 5605 "Calculate Disposal"
procedure CalcGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[15] of Decimal)
var
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
EntryAmounts2: array[4] of Decimal;
GainLoss: Decimal;
I: Integer;
@@ -40,12 +43,29 @@ codeunit 5605 "Calculate Disposal"
for I := 1 to 4 do
EntryAmounts[I + 4] := -EntryAmounts2[I];
FADeprBook.Get(FANo, DeprBookCode);
- FADeprBook.CalcFields(
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ FADeprBook.CalcFields(
+ "Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation, "Derogatory Amount")
+ else
+ FADeprBook.CalcFields(
"Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation, Derogatory);
+#else
+ FADeprBook.CalcFields(
+ "Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation, "Derogatory Amount");
+
+#endif
EntryAmounts[3] := -FADeprBook."Acquisition Cost";
EntryAmounts[4] := -FADeprBook.Depreciation;
EntryAmounts[9] := -FADeprBook."Salvage Value";
- EntryAmounts[15] := -FADeprBook.Derogatory;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ EntryAmounts[15] := -FADeprBook."Derogatory Amount"
+ else
+ EntryAmounts[15] := -FADeprBook.Derogatory;
+#else
+ EntryAmounts[15] := -FADeprBook."Derogatory Amount";
+#endif
OnCalcGainLossOnAfterSetEntryAmounts(FANo, DeprBookCode, EntryAmounts);
if DeprBook."Disposal Calculation Method" = DeprBook."Disposal Calculation Method"::Gross then
EntryAmounts[10] := FADeprBook."Book Value";
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al
index 3649db896d..c9b0eba564 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al
@@ -51,8 +51,24 @@ report 5686 "Cancel FA Entries"
}
trigger OnPreReport()
+#if not CLEAN29
+ var
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
begin
- DerogDeprBook.SetRange(Code, FALedgEntry."Depreciation Book Code");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ DerogDeprBook.SetRange(Code, FALedgEntry."Depreciation Book Code");
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then begin
+ DerogFALedgEntry.Copy(FALedgEntry);
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1', DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ if DerogFALedgEntry.Find('-') then
+ Error(Text10800);
+ end
+ end
+ else
+ DerogDeprBook.SetRange(Code, FALedgEntry."Depreciation Book Code");
if DerogDeprBook.Find('-') then
if DerogDeprBook."Derogatory Calculation" <> '' then begin
DerogFALedgEntry.Copy(FALedgEntry);
@@ -60,6 +76,16 @@ report 5686 "Cancel FA Entries"
if DerogFALedgEntry.Find('-') then
Error(Text10800);
end;
+#else
+ DerogDeprBook.SetRange(Code, FALedgEntry."Depreciation Book Code");
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then begin
+ DerogFALedgEntry.Copy(FALedgEntry);
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1', DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ if DerogFALedgEntry.Find('-') then
+ Error(Text10800);
+ end;
+#endif
if UseNewPosting then
if NewPostingDate = 0D then
Error(Text000);
@@ -75,12 +101,12 @@ report 5686 "Cancel FA Entries"
var
FALedgEntry: Record "FA Ledger Entry";
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFALedgEntry: Record "FA Ledger Entry";
CancelFALedgEntries: Codeunit "Cancel FA Ledger Entries";
UseNewPosting: Boolean;
NewPostingDate: Date;
- DerogDeprBook: Record "Depreciation Book";
Text10800: Label 'You cannot cancel FA entries that were posted to a derogatory depreciation book. Instead you must\cancel the FA entries posted to the depreciation book integrated with G/L.';
- DerogFALedgEntry: Record "FA Ledger Entry";
#pragma warning disable AA0074
Text000: Label 'You must specify New Posting Date.';
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al
index c386bdb12d..a46f7eed24 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al
@@ -143,12 +143,23 @@ report 5688 "Cancel FA Ledger Entries"
Caption = 'Appreciation';
ToolTip = 'Specifies if related appreciation entries are included in the batch job .';
}
+ field("Derogatory"; CancelChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+ }
+#if not CLEAN29
field("CancelChoices[13]"; CancelChoices[13])
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies whether to include derogatory depreciation.';
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("CancelChoices[5]"; CancelChoices[5])
{
ApplicationArea = FixedAssets;
@@ -197,10 +208,25 @@ report 5688 "Cancel FA Ledger Entries"
trigger OnPreReport()
begin
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ DerogDeprBook.SetRange(Code, DeprBookCode);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then
+ Error(Text10800);
+ end
+ else begin
+ DerogDeprBook.SetRange(Code, DeprBookCode);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calculation" <> '' then
+ Error(Text10800);
+ end;
+#else
DerogDeprBook.SetRange(Code, DeprBookCode);
if DerogDeprBook.Find('-') then
- if DerogDeprBook."Derogatory Calculation" <> '' then
+ if DerogDeprBook."Derogatory Calc." <> '' then
Error(Text10800);
+#endif
if (EndingDate > 0D) and (StartingDate > EndingDate) then
Error(Text000);
if UseNewPostingDate then
@@ -235,6 +261,9 @@ report 5688 "Cancel FA Ledger Entries"
FAJnlSetup: Record "FA Journal Setup";
DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
Window: Dialog;
CancelChoices: array[13] of Boolean;
GLIntegration: array[13] of Boolean;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al
index bac32bd172..ff8573cabe 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al
@@ -140,12 +140,23 @@ report 5684 "Copy FA Entries to G/L Budget"
Caption = 'Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
}
+ field("TransferType[7]"; TransferType[7])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether derogatory depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+ }
+#if not CLEAN29
field(Derogatory; TransferType[7])
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies whether derogatory depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
}
}
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
index 1c72276682..bdaceeef8f 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
@@ -298,8 +298,13 @@ codeunit 5606 "FA Check Consistency"
FADeprBook."Last Appreciation Date" := MaxDate;
FALedgEntry2."FA Posting Type"::"Custom 1":
FADeprBook."Last Custom 1 Date" := MaxDate;
+#if not CLEAN29
FALedgEntry2."FA Posting Type"::Derogatory:
FADeprBook."Last Derogatory Date" := MaxDate;
+#else
+ FALedgEntry2."FA Posting Type"::Derogatory:
+ FADeprBook."Last Derogatory" := MaxDate;
+#endif
FALedgEntry2."FA Posting Type"::"Custom 2":
FADeprBook."Last Custom 2 Date" := MaxDate;
FALedgEntry2."FA Posting Type"::"Proceeds on Disposal":
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
index 06073f711f..2be303e71a 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
@@ -65,8 +65,13 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Last Custom 1 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+#if not CLEAN29
FADeprBook.FieldNo("Last Derogatory Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+#else
+ FADeprBook.FieldNo("Last Derogatory"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+#endif
FADeprBook.FieldNo("Last Custom 2 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Last Salvage Value Date"):
@@ -143,8 +148,13 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+#if not CLEAN29
FADeprBook.FieldNo(Derogatory):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+#else
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+#endif
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -167,7 +177,11 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.SetRange("FA Posting Date", 0D, EndingDate);
end;
+#if not CLEAN29
if (PostingType = FADeprBook.FieldNo(Derogatory)) then
+#else
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then
+#endif
FALedgEntry.CalcSums(Amount, "Debit Amount", "Credit Amount")
else
FALedgEntry.CalcSums(Amount);
@@ -183,7 +197,11 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.Amount := FALedgEntry.Amount + UntilAmount;
end;
+#if not CLEAN29
if (PostingType = FADeprBook.FieldNo(Derogatory)) then begin
+#else
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then begin
+#endif
if UseCreditAmounts then begin
Clear(UseCreditAmounts);
Result := FALedgEntry."Credit Amount";
@@ -221,8 +239,13 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+#if not CLEAN29
FADeprBook.FieldNo(Derogatory):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+#else
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+#endif
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
index df4e8d5807..dbdb75f034 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
@@ -135,8 +135,13 @@ codeunit 5639 "FA Get Journal"
exit(DeprBook."G/L Integration - Maintenance");
FAPostingType::"Salvage Value":
exit(false);
+#if not CLEAN29
FAPostingType::Derogatory:
exit(DeprBook."G/L Integration - Derogatory");
+#else
+ FAPostingType::Derogatory:
+ exit(DeprBook."Integration G/L - Derogatory");
+#endif
end;
OnAfterCalcGLIntegration(DeprBook, FAPostingType, Result);
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
index 443a12fbb7..651483b08d 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
@@ -459,6 +459,7 @@ codeunit 5601 "FA Insert G/L Account"
if FAPostingGr."Allocated Book Value % (Loss)" > 100 then
FAPostingGr.FieldError("Allocated Book Value % (Loss)", FieldErrorText);
end;
+#if not CLEAN29
FAPostingType::Derogatory:
begin
if AllocAmount > 0 then begin
@@ -472,6 +473,21 @@ codeunit 5601 "FA Insert G/L Account"
if FAPostingGr."Allocated Derogatory %" > 100 then
FAPostingGr.FieldError("Allocated Derogatory %", FieldErrorText);
end;
+#else
+ FAPostingType::Derogatory:
+ begin
+ if AllocAmount > 0 then begin
+ FAPostingGr.TestField("Derogatory Expense Acc.");
+ GLAccNo := FAPostingGr."Derogatory Expense Acc."
+ end else begin
+ FAPostingGr.TestField("Derog. Bal. Account (Decrease)");
+ GLAccNo := FAPostingGr."Derog. Bal. Account (Decrease)";
+ end;
+ FAPostingGr.CalcFields("Allocated Derogatory Pct.");
+ if FAPostingGr."Allocated Derogatory Pct." > 100 then
+ FAPostingGr.FieldError("Allocated Derogatory Pct.", FieldErrorText);
+ end;
+#endif
end;
OnAfterGetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType, GLAccNo);
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
index 50934d95a3..0687415517 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
@@ -47,6 +47,9 @@ codeunit 5600 "FA Insert Ledger Entry"
FAJnlLine: Record "FA Journal Line";
FAInsertGLAcc: Codeunit "FA Insert G/L Account";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
DeprBookCode: Code[10];
ErrorEntryNo: Integer;
NextEntryNo: Integer;
@@ -115,7 +118,14 @@ codeunit 5600 "FA Insert Ledger Entry"
(LastEntryNo > 0)
then
CheckFADocNo(FALedgEntry);
- FALedgEntry."Exclude Derogatory" := CalcExcludeDerogatory(FALedgEntry);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ FALedgEntry."Derogatory Excluded" := CalcExcludeDerogatory(FALedgEntry)
+ else
+ FALedgEntry."Exclude Derogatory" := CalcExcludeDerogatory(FALedgEntry);
+#else
+ FALedgEntry."Derogatory Excluded" := CalcExcludeDerogatory(FALedgEntry);
+#endif
FALedgEntry.Insert(true);
FeatureTelemetry.LogUsage('0000H4F', 'Fixed Asset', 'Insert FA Ledger Entry');
OnInsertFAOnAfterInsertFALedgEntry(FALedgEntry, FALedgEntry3);
@@ -496,13 +506,29 @@ codeunit 5600 "FA Insert Ledger Entry"
NewFAEntryNo := NextEntryNo;
IsHandled := false;
OnInsertReverseEntryOnBeforeInsertTempFALedgEntry(FALedgEntry3, IsHandled);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ if not IsHandled then begin
+ DeprBook.Get(FALedgEntry3."Depreciation Book Code");
+ if DeprBook."Derogatory Calc." = '' then begin
+ TempFALedgEntry := FALedgEntry3;
+ TempFALedgEntry.Insert();
+ end
+ end
+ else
+ if not IsHandled then begin
+ TempFALedgEntry := FALedgEntry3;
+ TempFALedgEntry.Insert();
+ end;
+#else
if not IsHandled then begin
DeprBook.Get(FALedgEntry3."Depreciation Book Code");
- if DeprBook."Derogatory Calculation" = '' then begin
+ if DeprBook."Derogatory Calc." = '' then begin
TempFALedgEntry := FALedgEntry3;
TempFALedgEntry.Insert();
end;
end;
+#endif
SetFAReversalMark(FALedgEntry3, NextEntryNo);
FALedgEntry3."Entry No." := NextEntryNo;
FALedgEntry3."G/L Entry No." := NewGLEntryNo;
@@ -550,7 +576,14 @@ codeunit 5600 "FA Insert Ledger Entry"
OnInsertReverseEntryOnBeforeInsertMaintenanceLedgerEntryBuffer(MaintenanceLedgEntry3, SkipInsertOfMaintenanceLedgerEntry);
DeprBook.Get(MaintenanceLedgEntry3."Depreciation Book Code");
- SkipInsertOfMaintenanceLedgerEntry := SkipInsertOfMaintenanceLedgerEntry or (DeprBook."Derogatory Calculation" <> '');
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ SkipInsertOfMaintenanceLedgerEntry := SkipInsertOfMaintenanceLedgerEntry or (DeprBook."Derogatory Calc." <> '')
+ else
+ SkipInsertOfMaintenanceLedgerEntry := SkipInsertOfMaintenanceLedgerEntry or (DeprBook."Derogatory Calculation" <> '');
+#else
+ SkipInsertOfMaintenanceLedgerEntry := SkipInsertOfMaintenanceLedgerEntry or (DeprBook."Derogatory Calc." <> '');
+#endif
if not SkipInsertOfMaintenanceLedgerEntry then begin
TempMaintenanceLedgEntry := MaintenanceLedgEntry3;
TempMaintenanceLedgEntry.Insert();
@@ -685,7 +718,14 @@ codeunit 5600 "FA Insert Ledger Entry"
var
FALedgEntryForDerog: Record "FA Ledger Entry";
begin
- DeprBook.SetRange("Derogatory Calculation", FALedgEntry."Depreciation Book Code");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ DeprBook.SetRange("Derogatory Calc.", FALedgEntry."Depreciation Book Code")
+ else
+ DeprBook.SetRange("Derogatory Calculation", FALedgEntry."Depreciation Book Code");
+#else
+ DeprBook.SetRange("Derogatory Calc.", FALedgEntry."Depreciation Book Code");
+#endif
if not DeprBook.FindFirst() then
exit;
FALedgEntryForDerog.Reset();
@@ -704,7 +744,14 @@ codeunit 5600 "FA Insert Ledger Entry"
var
MaintLedgEntryForDerog: Record "Maintenance Ledger Entry";
begin
- DeprBook.SetRange("Derogatory Calculation", MaintenanceLedgEntry."Depreciation Book Code");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ DeprBook.SetRange("Derogatory Calc.", MaintenanceLedgEntry."Depreciation Book Code")
+ else
+ DeprBook.SetRange("Derogatory Calculation", MaintenanceLedgEntry."Depreciation Book Code");
+#else
+ DeprBook.SetRange("Derogatory Calc.", MaintenanceLedgEntry."Depreciation Book Code");
+#endif
if not DeprBook.FindFirst() then
exit;
MaintLedgEntryForDerog.Reset();
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
index 5912f09ad0..04a4439562 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
@@ -347,8 +347,13 @@ codeunit 5631 "FA Jnl.-Check Line"
GLIntegration := DeprBook."G/L Integration - Disposal";
FAPostingType::Maintenance:
GLIntegration := DeprBook."G/L Integration - Maintenance";
+#if not CLEAN29
FAPostingType::Derogatory:
GLIntegration := DeprBook."G/L Integration - Derogatory";
+#else
+ FAPostingType::Derogatory:
+ GLIntegration := DeprBook."Integration G/L - Derogatory";
+#endif
FAPostingType::"Salvage Value":
GLIntegration := false;
FAPostingType::"Bonus Depreciation":
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
index bc00792a22..364e8409b9 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
@@ -264,6 +264,7 @@ codeunit 5633 "FA Jnl.-Post Batch"
FAJnlLine."Salvage Value" := 0;
end;
+#if not CLEAN29
[Scope('OnPrem')]
procedure MakeDerogFAJnlLine(var NewFAJnlLine: Record "FA Journal Line"; FAJnlLine: Record "FA Journal Line"): Boolean
var
@@ -321,6 +322,65 @@ codeunit 5633 "FA Jnl.-Post Batch"
MakeDerogFAJnlLine(DerogFAJnlLine, FAJnlLine);
FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, true);
end;
+#endif
+
+ [Scope('OnPrem')]
+ procedure MakeDerogatoryFAJnlLine(var NewFAJnlLine: Record "FA Journal Line"; FAJnlLine: Record "FA Journal Line"): Boolean
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ NewFAJnlLine.Copy(FAJnlLine);
+ DeprBook.SetRange("Derogatory Calc.", FAJnlLine."Depreciation Book Code");
+ if DeprBook.FindFirst() then
+ if FADeprBook.Get(NewFAJnlLine."FA No.", DeprBook.Code) then begin
+ NewFAJnlLine.Validate("Depreciation Book Code", DeprBook.Code);
+ exit(true);
+ end;
+ exit(false);
+ end;
+
+ local procedure CreateAndPostDerogEntry(SourceFAJournalLine: Record "FA Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFAJnlLine: Record "FA Journal Line";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceFAJournalLine."FA Posting Type" <> SourceFAJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceFAJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceFAJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceFAJournalLine."FA No.", DerogDepreciationBook.Code, SourceFAJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ if DepreciationBook."Integration G/L - Derogatory" then
+ SourceFAJournalLine.FieldError(
+ "Depr. Acquisition Cost", StrSubstNo(SetupCombErr,
+ DepreciationBook.FieldCaption("Integration G/L - Derogatory"), true, DepreciationBook.TableCaption()));
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlLine.TransferFields(SourceFAJournalLine);
+ FAJnlLine.Validate("FA Posting Type", FAJnlLine."FA Posting Type"::Derogatory);
+ FAJnlLine.Validate(Amount, DerogatoryAmount);
+ FAJnlLine.Validate("Depr. until FA Posting Date", false);
+ FAJnlLine.Validate("Depr. Acquisition Cost", false);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+
+ // Post FA ledger entry for secondary book
+ MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJnlLine);
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, true);
+ end;
procedure SetPreviewMode(NewPreviewMode: Boolean)
begin
@@ -335,6 +395,9 @@ codeunit 5633 "FA Jnl.-Post Batch"
local procedure PostLines()
var
DerogFAJnlLine: Record "FA Journal Line";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
IsHandled: Boolean;
begin
LineCount := 0;
@@ -371,13 +434,34 @@ codeunit 5633 "FA Jnl.-Post Batch"
end;
OnPostLinesOnBeforeFAJnlPostLine(FAJnlLine, FAJnlPostLine);
FAJnlPostLine.FAJnlPostLine(FAJnlLine, false);
- if MakeDerogFAJnlLine(DerogFAJnlLine, FAJnlLine) then begin
- if FAJnlLine."FA Error Entry No." <> 0 then
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJnlLine) then begin
+ if FAJnlLine."FA Error Entry No." <> 0 then
+ DerogFAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, FAJnlLine."FA Error Entry No.", DerogFAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, false);
+ OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
+ CreateAndPostDerogEntry(FAJnlLine);
+ end
+ end
+ else
+ if MakeDerogFAJnlLine(DerogFAJnlLine, FAJnlLine) then
+ if MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJnlLine) then begin
+ if FAJnlLine."FA Error Entry No." <> 0 then
+ DerogFAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, FAJnlLine."FA Error Entry No.", DerogFAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, false);
+ OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
+ CreateAndPostDerogatoryEntry(FAJnlLine)
+ end;
+#else
+ if MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJnlLine) then begin
+ if FAJnlLine."FA Error Entry No." <> 0 then
DerogFAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, FAJnlLine."FA Error Entry No.", DerogFAJnlLine."Depreciation Book Code");
FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, false);
OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
- CreateAndPostDerogatoryEntry(FAJnlLine);
- end;
+ CreateAndPostDerogEntry(FAJnlLine);
+ end;
+#endif
until FAJnlLine.Next() = 0;
end;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
index 980057e347..b04ca3f2d5 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
@@ -137,7 +137,7 @@ codeunit 5632 "FA Jnl.-Post Line"
MaintenanceLedgEntry."VAT Amount" := VATAmount;
MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
+ OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
PostMaintenance();
end else begin
MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
index fec9422f06..1f2dc84cf5 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
@@ -503,15 +503,31 @@ table 5601 "FA Ledger Entry"
CalcFormula = lookup("Dimension Set Entry"."Dimension Value Code" where("Dimension Set ID" = field("Dimension Set ID"),
"Global Dimension No." = const(8)));
}
+ field(5865; "Derogatory Excluded"; Boolean)
+ {
+ Caption = 'Exclude Derogatory';
+ Editable = false;
+ }
field(6210; "Non-Ded. VAT FA Cost"; Boolean)
{
Caption = 'Non-Deductible VAT FA Cost';
}
+#if not CLEANSCHEMA31
field(10800; "Exclude Derogatory"; Boolean)
{
Caption = 'Exclude Derogatory';
Editable = false;
- }
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#endif
+ }
+#endif
}
keys
@@ -529,18 +545,32 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount, "Debit Amount", "Credit Amount";
}
+#if not CLEAN29
key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date", "Exclude Derogatory")
{
SumIndexFields = Amount;
}
+#else
+ key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date", "Derogatory Excluded")
+ {
+ SumIndexFields = Amount;
+ }
+#endif
key(Key5; "FA No.", "Depreciation Book Code", "Part of Depreciable Basis", "FA Posting Date")
{
SumIndexFields = Amount;
}
+#if not CLEAN29
key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date", "Exclude Derogatory")
{
SumIndexFields = Amount;
}
+#else
+ key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date", "Derogatory Excluded")
+ {
+ SumIndexFields = Amount;
+ }
+#endif
key(Key7; "Canceled from FA No.", "Depreciation Book Code", "FA Posting Date")
{
}
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al
index 40f41021e6..720f2c3eab 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al
@@ -40,6 +40,9 @@ table 5647 "FA Matrix Posting Type"
procedure CreateTypes()
var
FADepreciationBook: Record "FA Depreciation Book";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
begin
if not FindSet() then begin
InsertRec(1, FADepreciationBook.FieldCaption("Book Value"));
@@ -53,7 +56,14 @@ table 5647 "FA Matrix Posting Type"
InsertRec(9, FADepreciationBook.FieldCaption("Gain/Loss"));
InsertRec(10, FADepreciationBook.FieldCaption("Depreciable Basis"));
InsertRec(11, FADepreciationBook.FieldCaption("Salvage Value"));
- InsertRec(12, FADepreciationBook.FieldCaption(Derogatory));
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ InsertRec(12, FADepreciationBook.FieldCaption("Derogatory Amount"))
+ else
+ InsertRec(12, FADepreciationBook.FieldCaption(Derogatory));
+#else
+ InsertRec(12, FADepreciationBook.FieldCaption("Derogatory Amount"));
+#endif
end else
repeat
if "Entry No." = 1 then
@@ -111,11 +121,27 @@ table 5647 "FA Matrix Posting Type"
Delete();
InsertRec(11, FADepreciationBook.FieldCaption("Salvage Value"));
end;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if "Entry No." = 12 then
+ if "FA Posting Type Name" <> FADepreciationBook.FieldCaption("Derogatory Amount") then begin
+ Delete();
+ InsertRec(12, FADepreciationBook.FieldCaption("Derogatory Amount"));
+ end
+ end
+ else
+ if "Entry No." = 12 then
+ if "FA Posting Type Name" <> FADepreciationBook.FieldCaption(Derogatory) then begin
+ Delete();
+ InsertRec(12, FADepreciationBook.FieldCaption(Derogatory));
+ end;
+#else
if "Entry No." = 12 then
- if "FA Posting Type Name" <> FADepreciationBook.FieldCaption(Derogatory) then begin
- Delete();
- InsertRec(12, FADepreciationBook.FieldCaption(Derogatory));
- end;
+ if "FA Posting Type Name" <> FADepreciationBook.FieldCaption("Derogatory Amount") then begin
+ Delete();
+ InsertRec(12, FADepreciationBook.FieldCaption("Derogatory Amount"));
+ end;
+#endif
until Next() = 0;
OnAfterCreateTypes(Rec);
end;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
index aec0f9c057..7aece2dc0c 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
@@ -6,6 +6,9 @@ namespace Microsoft.FixedAssets.FixedAsset;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.ReceivablesPayables;
+#if not CLEAN29
+using Microsoft.FixedAssets.Depreciation;
+#endif
table 5606 "FA Posting Group"
{
@@ -489,46 +492,137 @@ table 5606 "FA Posting Group"
CheckGLAcc("Book Val. Acc. on Disp. (Loss)", false);
end;
}
+ field(5865; "Derogatory Acc."; Code[20])
+ {
+ Caption = 'Derogatory Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Acc.", false);
+ end;
+ }
+ field(5866; "Derogatory Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derogatory Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Account (Decrease)", false);
+ end;
+ }
+ field(5867; "Derog. Bal. Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derog. Bal. Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derog. Bal. Account (Decrease)", true);
+ end;
+ }
+ field(5868; "Derogatory Expense Acc."; Code[20])
+ {
+ Caption = 'Derogatory Expense Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Expense Acc.", true);
+ end;
+ }
+ field(5869; "Allocated Derogatory Pct."; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ CalcFormula = sum("FA Allocation"."Allocation %" where(Code = field(Code),
+ "Allocation Type" = const(Derogatory)));
+ Caption = 'Allocated Derogatory %';
+ DecimalPlaces = 1 : 1;
+ Editable = false;
+ FieldClass = FlowField;
+
+ }
+#if not CLEANSCHEMA31
field(10800; "Derogatory Account"; Code[20])
{
Caption = 'Derogatory Account';
TableRelation = "G/L Account";
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnValidate()
begin
CheckGLAcc("Derogatory Account", false);
end;
+#endif
}
field(10801; "Derogatory Acc. (Decrease)"; Code[20])
{
Caption = 'Derogatory Acc. (Decrease)';
TableRelation = "G/L Account";
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnValidate()
begin
CheckGLAcc("Derogatory Acc. (Decrease)", false);
end;
+#endif
}
field(10802; "Derog. Bal. Acc. (Decrease)"; Code[20])
{
Caption = 'Derog. Bal. Acc. (Decrease)';
TableRelation = "G/L Account";
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnValidate()
begin
CheckGLAcc("Derog. Bal. Acc. (Decrease)", true);
end;
+#endif
}
field(10803; "Derogatory Expense Account"; Code[20])
{
Caption = 'Derogatory Expense Account';
TableRelation = "G/L Account";
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnValidate()
begin
CheckGLAcc("Derogatory Expense Account", true);
end;
+#endif
}
+#endif
+#if not CLEAN29
field(10804; "Allocated Derogatory %"; Decimal)
{
AutoFormatType = 0;
@@ -538,7 +632,11 @@ table 5606 "FA Posting Group"
DecimalPlaces = 1 : 1;
Editable = false;
FieldClass = FlowField;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
keys
@@ -566,6 +664,9 @@ table 5606 "FA Posting Group"
FAAlloc: Record "FA Allocation";
GLAcc: Record "G/L Account";
PostingSetupMgt: Codeunit PostingSetupManagement;
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
procedure CheckGLAcc(AccNo: Code[20]; DirectPosting: Boolean)
begin
@@ -842,26 +943,70 @@ table 5606 "FA Posting Group"
procedure GetDerogatoryAccount(): Code[20]
begin
- TestField("Derogatory Account");
- exit("Derogatory Account");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ TestField("Derogatory Acc.");
+ exit("Derogatory Acc.");
+ end
+ else begin
+ TestField("Derogatory Account");
+ exit("Derogatory Account");
+ end;
+#else
+ TestField("Derogatory Acc.");
+ exit("Derogatory Acc.");
+#endif
end;
procedure GetDerogatoryAccountDecrease(): Code[20]
begin
- TestField("Derogatory Acc. (Decrease)");
- exit("Derogatory Acc. (Decrease)");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ TestField("Derogatory Account (Decrease)");
+ exit("Derogatory Account (Decrease)")
+ end
+ else begin
+ TestField("Derogatory Acc. (Decrease)");
+ exit("Derogatory Acc. (Decrease)");
+ end;
+#else
+ TestField("Derogatory Account (Decrease)");
+ exit("Derogatory Account (Decrease)");
+#endif
end;
procedure GetDerogatoryBalAccountDecrease(): Code[20]
begin
- TestField("Derog. Bal. Acc. (Decrease)");
- exit("Derog. Bal. Acc. (Decrease)");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ TestField("Derog. Bal. Account (Decrease)");
+ exit("Derog. Bal. Account (Decrease)");
+ end
+ else begin
+ TestField("Derog. Bal. Acc. (Decrease)");
+ exit("Derog. Bal. Acc. (Decrease)");
+ end;
+#else
+ TestField("Derog. Bal. Account (Decrease)");
+ exit("Derog. Bal. Account (Decrease)");
+#endif
end;
procedure GetDerogatoryExpenseAccount(): Code[20]
begin
- TestField("Derogatory Expense Account");
- exit("Derogatory Expense Account");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ TestField("Derogatory Expense Acc.");
+ exit("Derogatory Expense Acc.");
+ end
+ else begin
+ TestField("Derogatory Expense Account");
+ exit("Derogatory Expense Account");
+ end;
+#else
+ TestField("Derogatory Expense Acc.");
+ exit("Derogatory Expense Acc.");
+#endif
end;
[IntegrationEvent(false, false)]
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
index 16c260aedd..0b6e58f46d 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
@@ -3,6 +3,9 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.FixedAssets.FixedAsset;
+#if not CLEAN29
+using Microsoft.FixedAssets.Depreciation;
+#endif
page 5612 "FA Posting Group Card"
{
@@ -54,11 +57,25 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Derogatory Account"; Rec."Derogatory Account")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Acq. Cost Acc. on Disposal"; Rec."Acq. Cost Acc. on Disposal")
{
ApplicationArea = FixedAssets;
@@ -91,11 +108,25 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Derogatory Acc. (Decrease)"; Rec."Derogatory Acc. (Decrease)")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
group("Balancing Account")
{
@@ -134,11 +165,25 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Derogatory Expense Account"; Rec."Derogatory Expense Account")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Write-Down Bal. Acc. on Disp."; Rec."Write-Down Bal. Acc. on Disp.")
{
ApplicationArea = FixedAssets;
@@ -155,11 +200,25 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Derog. Bal. Acc. (Decrease)"; Rec."Derog. Bal. Acc. (Decrease)")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
group("Gross Disposal")
{
@@ -271,12 +330,29 @@ page 5612 "FA Posting Group Card"
Caption = 'Book Value (Loss)';
ToolTip = 'Specifies the sum that applies to book value gains.';
}
+ field("Allocated Derogatory Pct."; Rec."Allocated Derogatory Pct.")
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies the total percentage of derogatory depreciation allocated, when derogatory depreciation is posted for fixed assets.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Allocated Derogatory %"; Rec."Allocated Derogatory %")
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies the total percentage of derogatory depreciation allocated, when derogatory depreciation is posted for fixed assets.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
}
area(factboxes)
@@ -386,6 +462,20 @@ page 5612 "FA Posting Group Card"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
action(Derogatory)
{
ApplicationArea = FixedAssets;
@@ -395,13 +485,29 @@ page 5612 "FA Posting Group Card"
RunPageLink = Code = field(Code),
"Allocation Type" = const(Derogatory);
ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
}
}
}
+#if not CLEAN29
+ trigger OnOpenPage()
+ begin
+ AcceleratedDeprFeatureEnabled := AcceleratedDeprFeature.IsEnabled();
+ end;
+#endif
+
var
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+ AcceleratedDeprFeatureEnabled: Boolean;
+#endif
#pragma warning disable AA0074
Text19064976: Label 'Allocated %';
Text19080001: Label 'Allocated %';
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
index b22606408e..a4b9b60221 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
@@ -3,6 +3,9 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.FixedAssets.FixedAsset;
+#if not CLEAN29
+using Microsoft.FixedAssets.Depreciation;
+#endif
page 5613 "FA Posting Groups"
{
@@ -55,26 +58,76 @@ page 5613 "FA Posting Groups"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Derogatory Account"; Rec."Derogatory Account")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
field("Derogatory Acc. (Decrease)"; Rec."Derogatory Acc. (Decrease)")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
field("Derogatory Expense Account"; Rec."Derogatory Expense Account")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
field("Derog. Bal. Acc. (Decrease)"; Rec."Derog. Bal. Acc. (Decrease)")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Acq. Cost Acc. on Disposal"; Rec."Acq. Cost Acc. on Disposal")
{
ApplicationArea = FixedAssets;
@@ -346,6 +399,20 @@ page 5613 "FA Posting Groups"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
action(Derogatory)
{
ApplicationArea = FixedAssets;
@@ -355,10 +422,26 @@ page 5613 "FA Posting Groups"
RunPageLink = Code = field(Code),
"Allocation Type" = const(Derogatory);
ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
}
}
}
+
+#if not CLEAN29
+ trigger OnOpenPage()
+ begin
+ AcceleratedDeprFeatureEnabled := AcceleratedDeprFeature.IsEnabled();
+ end;
+
+ var
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+ AcceleratedDeprFeatureEnabled: Boolean;
+#endif
}
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al
index 198fd110c0..26b583607b 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al
@@ -55,6 +55,9 @@ table 5644 "FA Posting Type"
procedure CreateTypes()
var
FADepreciationBook: Record "FA Depreciation Book";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
begin
LockTable();
if not Find('-') then begin
@@ -76,11 +79,25 @@ table 5644 "FA Posting Type"
"FA Entry" := false;
"G/L Entry" := true;
InsertRec(12, FADepreciationBook.FieldNo("Book Value on Disposal"), FADepreciationBook.FieldCaption("Book Value on Disposal"));
+#if not CLEAN29
"Entry No." := 13;
"FA Entry" := true;
- "FA Posting Type No." := FADepreciationBook.FieldNo(Derogatory);
- "FA Posting Type Name" := FADepreciationBook.FieldCaption(Derogatory);
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ "FA Posting Type No." := FADepreciationBook.FieldNo("Derogatory Amount");
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption("Derogatory Amount");
+ end
+ else begin
+ "FA Posting Type No." := FADepreciationBook.FieldNo(Derogatory);
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption(Derogatory);
+ end;
Insert();
+#else
+ "Entry No." := 13;
+ "FA Entry" := true;
+ "FA Posting Type No." := FADepreciationBook.FieldNo("Derogatory Amount");
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption("Derogatory Amount");
+ Insert();
+#endif
end else begin
SetCurrentKey("Entry No.");
Find('-');
@@ -169,15 +186,39 @@ table 5644 "FA Posting Type"
Delete();
InsertRec(12, FADepreciationBook.FieldNo("Book Value on Disposal"), FADepreciationBook.FieldCaption("Book Value on Disposal"));
end;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if "Entry No." = 13 then
+ if ("FA Posting Type No." <> FADepreciationBook.FieldNo("Derogatory Amount")) or
+ ("FA Posting Type Name" <> FADepreciationBook.FieldCaption("Derogatory Amount"))
+ then begin
+ Delete();
+ "FA Posting Type No." := FADepreciationBook.FieldNo("Derogatory Amount");
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption("Derogatory Amount");
+ Insert();
+ end
+ end
+ else
+ if "Entry No." = 13 then
+ if ("FA Posting Type No." <> FADepreciationBook.FieldNo(Derogatory)) or
+ ("FA Posting Type Name" <> FADepreciationBook.FieldCaption(Derogatory))
+ then begin
+ Delete();
+ "FA Posting Type No." := FADepreciationBook.FieldNo(Derogatory);
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption(Derogatory);
+ Insert();
+ end;
+#else
if "Entry No." = 13 then
- if ("FA Posting Type No." <> FADepreciationBook.FieldNo(Derogatory)) or
- ("FA Posting Type Name" <> FADepreciationBook.FieldCaption(Derogatory))
+ if ("FA Posting Type No." <> FADepreciationBook.FieldNo("Derogatory Amount")) or
+ ("FA Posting Type Name" <> FADepreciationBook.FieldCaption("Derogatory Amount"))
then begin
Delete();
- "FA Posting Type No." := FADepreciationBook.FieldNo(Derogatory);
- "FA Posting Type Name" := FADepreciationBook.FieldCaption(Derogatory);
+ "FA Posting Type No." := FADepreciationBook.FieldNo("Derogatory Amount");
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption("Derogatory Amount");
Insert();
- end;
+ end;
+#endif
until Next() = 0;
end;
OnAfterCreateTypes(Rec);
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al
index 8cce129e64..fd30adcbb6 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al
@@ -942,12 +942,21 @@ page 9277 "FA Posting Types Overv. Matrix"
FADeprBook.CalcFields("Salvage Value");
MATRIX_CellData[MATRIX_ColumnOrdinal] := MatrixMgt.RoundAmount(FADeprBook."Salvage Value", RoundingFactor);
end;
+#if not CLEAN29
12:// 'Derogatory'
begin
if FADeprBook.FindFirst() then
FADeprBook.CalcFields(Derogatory);
MATRIX_CellData[MATRIX_ColumnOrdinal] := MatrixMgt.RoundAmount(FADeprBook.Derogatory, RoundingFactor);
end;
+#else
+ 12:// 'Derogatory'
+ begin
+ if FADeprBook.FindFirst() then
+ FADeprBook.CalcFields("Derogatory Amount");
+ MATRIX_CellData[MATRIX_ColumnOrdinal] := MatrixMgt.RoundAmount(FADeprBook."Derogatory Amount", RoundingFactor);
+ end;
+#endif
end;
SetVisible();
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
index 455359cec2..dc5bd61962 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
@@ -135,12 +135,23 @@ page 5636 "FA Reclass. Journal"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Reclass. Derogatory"; Rec."Reclass. Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies that you want to reclassify the accumulated derogatory depreciation in the FA No. field to the fixed asset in the New FA No. field.';
+ Visible = false;
+ }
+#if not CLEAN29
field("Reclassify Derogatory"; Rec."Reclassify Derogatory")
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies that you want to reclassify the accumulated derogatory depreciation in the FA No. field to the fixed asset in the New FA No. field.';
Visible = false;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Insert Bal. Account"; Rec."Insert Bal. Account")
{
ApplicationArea = FixedAssets;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
index fdd37f396a..33f4a3bbc1 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
@@ -160,10 +160,25 @@ table 5624 "FA Reclass. Journal Line"
Caption = 'Calc. DB1 Depr. Amount';
ToolTip = 'Specifies that the Reclassify function fills in the Temp. Ending Date and Temp. Fixed Depr. Amount fields on the FA depreciation book.';
}
+ field(5865; "Reclass. Derogatory"; Boolean)
+ {
+ Caption = 'Reclassify Derogatory';
+ }
+#if not CLEANSCHEMA31
field(10800; "Reclassify Derogatory"; Boolean)
{
Caption = 'Reclassify Derogatory';
+#if CLEAN29
+ ObsoleteState = Removed;
+ ObsoleteTag = '31.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#else
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
+#endif
}
+#endif
}
keys
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
index d5509f37ea..15fd3c2967 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
@@ -27,6 +27,9 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAJnlLine: Record "FA Journal Line";
DepreciationCalc: Codeunit "Depreciation Calculation";
FAGetJnl: Codeunit "FA Get Journal";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
FAPostingType: Enum "FA Journal Line FA Posting Type";
TransferToGenJnl: Boolean;
TemplateName: Code[10];
@@ -157,8 +160,18 @@ codeunit 5642 "FA Reclass. Transfer Line"
FADeprBook.CalcFields("Custom 1");
if TransferType[6] then
FADeprBook.CalcFields("Custom 2");
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ if TransferType[7] then
+ FADeprBook.CalcFields("Derogatory Amount")
+ end
+ else
+ if TransferType[7] then
+ FADeprBook.CalcFields(Derogatory);
+#else
if TransferType[7] then
- FADeprBook.CalcFields(Derogatory);
+ FADeprBook.CalcFields("Derogatory Amount");
+#endif
if TransferType[9] then
FADeprBook.CalcFields("Salvage Value");
Amounts[1] := FADeprBook."Acquisition Cost";
@@ -167,7 +180,14 @@ codeunit 5642 "FA Reclass. Transfer Line"
Amounts[4] := FADeprBook.Appreciation;
Amounts[5] := FADeprBook."Custom 1";
Amounts[6] := FADeprBook."Custom 2";
- Amounts[7] := FADeprBook.Derogatory;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ Amounts[7] := FADeprBook."Derogatory Amount"
+ else
+ Amounts[7] := FADeprBook.Derogatory;
+#else
+ Amounts[7] := FADeprBook."Derogatory Amount";
+#endif
Amounts[9] := FADeprBook."Salvage Value";
OnCalcAmountsOnAfterSetAmounts(FADeprBook, Amounts, TransferType);
if Amounts[1] = 0 then
@@ -198,7 +218,14 @@ codeunit 5642 "FA Reclass. Transfer Line"
TransferType[4] := FAReclassJnlLine."Reclassify Appreciation";
TransferType[5] := FAReclassJnlLine."Reclassify Custom 1";
TransferType[6] := FAReclassJnlLine."Reclassify Custom 2";
- TransferType[7] := FAReclassJnlLine."Reclassify Derogatory";
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ TransferType[7] := FAReclassJnlLine."Reclass. Derogatory"
+ else
+ TransferType[7] := FAReclassJnlLine."Reclassify Derogatory";
+#else
+ TransferType[7] := FAReclassJnlLine."Reclass. Derogatory";
+#endif
TransferType[9] := FAReclassJnlLine."Reclassify Salvage Value";
end;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al
index 76232754f3..dafe25920d 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al
@@ -100,12 +100,27 @@ page 5602 "Fixed Asset Statistics"
ApplicationArea = FixedAssets;
Caption = 'Custom 1';
}
+ field("Last Derogatory"; Rec."Last Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies the FA posting date of the last posted derogatory depreciation.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field("Last Derogatory Date"; Rec."Last Derogatory Date")
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies the FA posting date of the last posted derogatory depreciation.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Last Salvage Value Date"; Rec."Last Salvage Value Date")
{
ApplicationArea = FixedAssets;
@@ -140,11 +155,27 @@ page 5602 "Fixed Asset Statistics"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Amount"; Rec."Derogatory Amount")
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the total derogatory depreciation for the fixed asset.';
+#if not CLEAN29
+ Visible = AcceleratedDeprFeatureEnabled;
+#endif
+ }
+#if not CLEAN29
field(Derogatory; Rec.Derogatory)
{
ApplicationArea = FixedAssets;
ToolTip = 'Specifies the total derogatory depreciation for the fixed asset.';
+ Visible = not AcceleratedDeprFeatureEnabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
field("Salvage Value"; Rec."Salvage Value")
{
ApplicationArea = FixedAssets;
@@ -201,7 +232,18 @@ page 5602 "Fixed Asset Statistics"
DisposalValueVisible := true;
end;
+#if not CLEAN29
+ trigger OnOpenPage()
+ begin
+ AcceleratedDeprFeatureEnabled := AcceleratedDeprFeature.IsEnabled();
+ end;
+#endif
+
var
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+ AcceleratedDeprFeatureEnabled: Boolean;
+#endif
Disposed: Boolean;
DisposalValueVisible: Boolean;
ProceedsOnDisposalVisible: Boolean;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al
index 892e5fc934..929a7bc03a 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al
@@ -187,12 +187,23 @@ report 5690 "Index Fixed Assets"
Caption = 'Maintenance';
ToolTip = 'Specifies if you want to index for fixed assets of transaction type Salvage Value in the batch job.';
}
+ field("IndexChoices[13]"; IndexChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+ }
+#if not CLEAN29
field(Derogatory; IndexChoices[13])
{
ApplicationArea = FixedAssets;
Caption = 'Derogatory';
ToolTip = 'Specifies whether to include derogatory depreciation.';
+ ObsoleteState = Pending;
+ ObsoleteTag = '29.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
}
+#endif
}
}
}
@@ -217,10 +228,25 @@ report 5690 "Index Fixed Assets"
trigger OnPreReport()
begin
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ DerogDeprBook.SetRange(Code, DeprBookCode);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then
+ Error(Text10800);
+ end
+ else begin
+ DerogDeprBook.SetRange(Code, DeprBookCode);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calculation" <> '' then
+ Error(Text10800);
+ end;
+#else
DerogDeprBook.SetRange(Code, DeprBookCode);
- if DerogDeprBook.Find('-') then
- if DerogDeprBook."Derogatory Calculation" <> '' then
- Error(Text10800);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then
+ Error(Text10800);
+#endif
if FAPostingDate = 0D then
Error(Text000, FAJnlLine.FieldCaption("FA Posting Date"));
if FAPostingDate <> NormalDate(FAPostingDate) then
@@ -268,7 +294,11 @@ report 5690 "Index Fixed Assets"
FALedgEntry: Record "FA Ledger Entry";
MaintenanceLedgEntry: Record "Maintenance Ledger Entry";
FAJnlSetup: Record "FA Journal Setup";
+ DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
Window: Dialog;
IndexChoices: array[13] of Boolean;
IndexAmount: Decimal;
@@ -285,7 +315,6 @@ report 5690 "Index Fixed Assets"
FAJnlNextLineNo: Integer;
GenJnlNextLineNo: Integer;
i: Integer;
- DerogDeprBook: Record "Depreciation Book";
Text10800: Label 'You cannot index fixed assets in a derogatory depreciation book. Instead you must\index them in the depreciation book integrated with G/L.';
#pragma warning disable AA0074
diff --git a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
index a3766c5e21..39f55f49c3 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
@@ -101,7 +101,7 @@ codeunit 5604 "Make FA Ledger Entry"
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(FAJnlLine.ConvertToLedgEntry(FAJnlLine));
NonDeductibleVAT.CopyNonDedVATFromGenJnlLineToFALedgEntry(FALedgEntry, GenJnlLine);
if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::Derogatory then
- FALedgEntry."Automatic Entry" := GenJnlLine."System-Created Entry";
+ FALedgEntry."Automatic Entry" := GenJnlLine."System-Created Entry";
OnAfterCopyFromGenJnlLine(FALedgEntry, GenJnlLine);
end;
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al b/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al
index 6096fe6a01..0767dcaf18 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al
@@ -328,8 +328,13 @@ report 5605 "Fixed Asset - Book Value 01"
PostingType := FADeprBook.FieldNo("Custom 1");
6:
PostingType := FADeprBook.FieldNo("Custom 2");
+#if not CLEAN29
7:
PostingType := FADeprBook.FieldNo(Derogatory);
+#else
+ 7:
+ PostingType := FADeprBook.FieldNo("Derogatory Amount");
+#endif
end;
if StartingDate <= 00000101D then
StartAmounts[i] := 0
@@ -470,7 +475,7 @@ report 5605 "Fixed Asset - Book Value 01"
Caption = 'Budget Report';
ToolTip = 'Specifies if you want the report to calculate future depreciation and book value. This is valid only if you have selected Depreciation and Book Value for Amount Field 1, 2 or 3.';
}
- field(PrintFASetup; PrintFASetup)
+ field(Print_FASetup; PrintFASetup)
{
ApplicationArea = FixedAssets;
Caption = 'Print FA Setup';
@@ -516,8 +521,19 @@ report 5605 "Fixed Asset - Book Value 01"
NumberOfTypes := 7;
Clear(DerogDeprBook);
DeprBook.Get(DeprBookCode);
- DerogDeprBook.SetRange("Derogatory Calculation", DeprBookCode);
- if DerogDeprBook.Find('-') then;
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.Find('-') then;
+ end
+ else begin
+ DerogDeprBook.SetRange("Derogatory Calculation", DeprBookCode);
+ if DerogDeprBook.Find('-') then;
+ end;
+#else
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.Find('-') then;
+#endif
if GroupTotals = GroupTotals::"FA Posting Group" then
FAGenReport.SetFAPostingGroup("Fixed Asset", DeprBook.Code);
FAGenReport.AppendFAPostingFilter("Fixed Asset", StartingDate, EndingDate);
@@ -543,8 +559,13 @@ report 5605 "Fixed Asset - Book Value 01"
DeprBook: Record "Depreciation Book";
FA: Record "Fixed Asset";
FAPostingTypeSetup: Record "FA Posting Type Setup";
+ DerogDeprBook: Record "Depreciation Book";
+ FADeprBook2: Record "FA Depreciation Book";
FAGenReport: Codeunit "FA General Report";
BudgetDepreciation: Codeunit "Budget Depreciation";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
FAFilter: Text;
MainHeadLineText: Text[100];
DeprBookText: Text[50];
@@ -579,8 +600,6 @@ report 5605 "Fixed Asset - Book Value 01"
DisposalDate: Date;
StartText: Text[30];
EndText: Text[30];
- DerogDeprBook: Record "Depreciation Book";
- FADeprBook2: Record "FA Depreciation Book";
DeprBookInfo: array[5] of Text[30];
DerogDeprBookInfo: array[5] of Text[30];
PrintFASetup: Boolean;
@@ -707,10 +726,25 @@ report 5605 "Fixed Asset - Book Value 01"
HeadLineText[8] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Depreciation), EndText);
HeadLineText[9] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Book Value"), StartText);
HeadLineText[10] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Book Value"), EndText);
- HeadLineText[11] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), StartText);
- HeadLineText[12] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), Text10800);
- HeadLineText[13] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), Text10801);
- HeadLineText[14] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), EndText);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ HeadLineText[11] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), StartText);
+ HeadLineText[12] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), Text10800);
+ HeadLineText[13] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), Text10801);
+ HeadLineText[14] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), EndText);
+ end
+ else begin
+ HeadLineText[11] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), StartText);
+ HeadLineText[12] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), Text10800);
+ HeadLineText[13] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), Text10801);
+ HeadLineText[14] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Derogatory), EndText);
+ end;
+#else
+ HeadLineText[11] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), StartText);
+ HeadLineText[12] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), Text10800);
+ HeadLineText[13] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), Text10801);
+ HeadLineText[14] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), EndText);
+#endif
end;
local procedure MakeGroupHeadLine()
diff --git a/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue02.Report.al b/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue02.Report.al
index 7959f0454e..923c1db02c 100644
--- a/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue02.Report.al
+++ b/src/Layers/FR/BaseApp/FixedAssets/Reports/FixedAssetBookValue02.Report.al
@@ -875,8 +875,13 @@ report 5606 "Fixed Asset - Book Value 02"
PostingType := FADeprBook.FieldNo("Custom 1");
6:
PostingType := FADeprBook.FieldNo("Custom 2");
+#if not CLEAN29
7:
PostingType := FADeprBook.FieldNo(Derogatory);
+#else
+ 7:
+ PostingType := FADeprBook.FieldNo("Derogatory Amount");
+#endif
end;
if StartingDate <= 00000101D then begin
StartAmounts[i] := 0;
@@ -1037,7 +1042,7 @@ report 5606 "Fixed Asset - Book Value 02"
Caption = 'Include Reclassification';
ToolTip = 'Specifies if you want the report to include acquisition cost and depreciation entries that are marked as reclassification entries. These entries are then printed in a separate column.';
}
- field(PrintFASetup; PrintFASetup)
+ field(Print_FASetup; PrintFASetup)
{
ApplicationArea = FixedAssets;
Caption = 'Print FA Setup';
@@ -1083,8 +1088,19 @@ report 5606 "Fixed Asset - Book Value 02"
Clear(DerogDeprBook);
FAGenReport.ValidateDates(StartingDate, EndingDate);
DeprBook.Get(DeprBookCode);
- DerogDeprBook.SetRange("Derogatory Calculation", DeprBookCode);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.Find('-') then;
+ end
+ else begin
+ DerogDeprBook.SetRange("Derogatory Calculation", DeprBookCode);
+ if DerogDeprBook.Find('-') then;
+ end;
+#else
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
if DerogDeprBook.Find('-') then;
+#endif
if GroupTotals = GroupTotals::"FA Posting Group" then
FAGenReport.SetFAPostingGroup("Fixed Asset", DeprBook.Code);
FAGenReport.AppendFAPostingFilter("Fixed Asset", StartingDate, EndingDate);
@@ -1106,8 +1122,13 @@ report 5606 "Fixed Asset - Book Value 02"
DeprBook: Record "Depreciation Book";
FADeprBook: Record "FA Depreciation Book";
FA: Record "Fixed Asset";
+ DerogDeprBook: Record "Depreciation Book";
+ FADeprBook2: Record "FA Depreciation Book";
FAGenReport: Codeunit "FA General Report";
BudgetDepreciation: Codeunit "Budget Depreciation";
+#if not CLEAN29
+ AcceleratedDeprFeature: Codeunit "Accelerated Depr. Feature";
+#endif
DeprBookCode: Code[10];
NumberOfTypes: Integer;
FAFilter: Text;
@@ -1158,8 +1179,6 @@ report 5606 "Fixed Asset - Book Value 02"
EndingAmount: Decimal;
AcquisitionDate: Date;
DisposalDate: Date;
- DerogDeprBook: Record "Depreciation Book";
- FADeprBook2: Record "FA Depreciation Book";
DeprBookInfo: array[5] of Text[30];
DerogDeprBookInfo: array[5] of Text[30];
PrintFASetup: Boolean;
@@ -1241,7 +1260,14 @@ report 5606 "Fixed Asset - Book Value 02"
HeadLineText[7] := StrSubstNo('%1 %2', '', Text005);
HeadLineText[8] := FADeprBook.FieldCaption("Custom 1");
HeadLineText[9] := FADeprBook.FieldCaption("Custom 2");
- HeadLineText[10] := FADeprBook.FieldCaption(Derogatory);
+#if not CLEAN29
+ if AcceleratedDeprFeature.IsEnabled() then
+ HeadLineText[10] := FADeprBook.FieldCaption("Derogatory Amount")
+ else
+ HeadLineText[10] := FADeprBook.FieldCaption(Derogatory);
+#else
+ HeadLineText[10] := FADeprBook.FieldCaption("Derogatory Amount");
+#endif
HeadLineText[11] := StrSubstNo('%1 %2', '', Text10800);
HeadLineText[12] := StrSubstNo('%1 %2', '', Text10801);
end;
diff --git a/src/Layers/FR/DemoTool/CreateFADerogDeprBook.Codeunit.al b/src/Layers/FR/DemoTool/CreateFADerogDeprBook.Codeunit.al
index 763b3cb5fb..526d2411f7 100644
--- a/src/Layers/FR/DemoTool/CreateFADerogDeprBook.Codeunit.al
+++ b/src/Layers/FR/DemoTool/CreateFADerogDeprBook.Codeunit.al
@@ -17,7 +17,11 @@ codeunit 160200 "Create FA Derog. Depr. Book"
"Depreciation Book".Code := Code;
"Depreciation Book".Description := Description;
"Depreciation Book"."Disposal Calculation Method" := "Disposal Calculation Method";
+#if not CLEAN28
"Depreciation Book"."Derogatory Calculation" := "Derogatory Calculation";
+#else
+ "Depreciation Book"."Derogatory Calc." := "Derogatory Calculation";
+#endif
"Depreciation Book".Insert(true);
end;
}
diff --git a/src/Layers/FR/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/FR/DemoTool/CreateFAPostingGroup.Codeunit.al
index 4609d1c603..51efc9ab38 100644
--- a/src/Layers/FR/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/FR/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -41,10 +41,17 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Book Val. Acc. on Disp. (Loss)", CA.Convert("Losses Acc. on Disposal"));
"FA Posting Group".Validate("Sales Acc. on Disp. (Gain)", CA.Convert("Gains Acc. on Disposal"));
"FA Posting Group".Validate("Sales Acc. on Disp. (Loss)", CA.Convert("Gains Acc. on Disposal"));
+#if not CLEAN28
"FA Posting Group".Validate("Derogatory Account", '145000');
"FA Posting Group".Validate("Derogatory Acc. (Decrease)", '145000');
"FA Posting Group".Validate("Derogatory Expense Account", '687250');
"FA Posting Group".Validate("Derog. Bal. Acc. (Decrease)", '787250');
+#else
+ "FA Posting Group".Validate("Derogatory Acc.", '145000');
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", '145000');
+ "FA Posting Group".Validate("Derogatory Expense Acc.", '687250');
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", '787250');
+#endif
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/FR/Tests/Local/ERMFADerogatoryDepreciation.Codeunit.al b/src/Layers/FR/Tests/Local/ERMFADerogatoryDepreciation.Codeunit.al
index 649ccbc80a..ee6aa4de90 100644
--- a/src/Layers/FR/Tests/Local/ERMFADerogatoryDepreciation.Codeunit.al
+++ b/src/Layers/FR/Tests/Local/ERMFADerogatoryDepreciation.Codeunit.al
@@ -1,3 +1,4 @@
+#if not CLEAN28
codeunit 144028 "ERM FA Derogatory Depreciation"
{
// // [FEATURE] [Fixed Asset] [Derogatory]
@@ -41,6 +42,9 @@ codeunit 144028 "ERM FA Derogatory Depreciation"
Subtype = Test;
TestPermissions = Disabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '28.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnRun()
begin
@@ -608,7 +612,7 @@ codeunit 144028 "ERM FA Derogatory Depreciation"
[Scope('OnPrem')]
procedure PrintFASetupFixedAssetBookValue02RequestPageHandler(var FixedAssetBookValue02: TestRequestPage "Fixed Asset - Book Value 02")
begin
- FixedAssetBookValue02.PrintFASetup.SetValue(true);
+ FixedAssetBookValue02.Print_FASetup.SetValue(true);
FixedAssetBookValue02.SaveAsXml(LibraryReportDataset.GetParametersFileName(), LibraryReportDataset.GetFileName());
end;
@@ -623,7 +627,7 @@ codeunit 144028 "ERM FA Derogatory Depreciation"
[Scope('OnPrem')]
procedure PrintFASetupFixedAssetBookValue01RequestPageHandler(var FixedAssetBookValue01: TestRequestPage "Fixed Asset - Book Value 01")
begin
- FixedAssetBookValue01.PrintFASetup.SetValue(true);
+ FixedAssetBookValue01.Print_FASetup.SetValue(true);
FixedAssetBookValue01.SaveAsXml(LibraryReportDataset.GetParametersFileName(), LibraryReportDataset.GetFileName());
end;
@@ -644,4 +648,4 @@ codeunit 144028 "ERM FA Derogatory Depreciation"
Reply := true;
end;
}
-
+#endif
diff --git a/src/Layers/FR/Tests/Local/ERMFRFeatureBugs.Codeunit.al b/src/Layers/FR/Tests/Local/ERMFRFeatureBugs.Codeunit.al
index b31250853a..8bec4c4397 100644
--- a/src/Layers/FR/Tests/Local/ERMFRFeatureBugs.Codeunit.al
+++ b/src/Layers/FR/Tests/Local/ERMFRFeatureBugs.Codeunit.al
@@ -48,10 +48,8 @@ codeunit 144015 "ERM FR Feature Bugs"
var
#if not CLEAN28
LibraryDimension: Codeunit "Library - Dimension";
-#endif
LibraryERM: Codeunit "Library - ERM";
LibraryFixedAsset: Codeunit "Library - Fixed Asset";
-#if not CLEAN28
LibraryFRLocalization: Codeunit "Library - FR Localization";
#endif
LibraryInventory: Codeunit "Library - Inventory";
@@ -65,6 +63,7 @@ codeunit 144015 "ERM FR Feature Bugs"
LibraryVariableStorage: Codeunit "Library - Variable Storage";
LibraryRandom: Codeunit "Library - Random";
+#if not CLEAN28
[Test]
[Scope('OnPrem')]
procedure BookValueAfterPostDepreciationAndDerogatoryFAJnl()
@@ -162,6 +161,7 @@ codeunit 144015 "ERM FR Feature Bugs"
VerifyFALedgerEntries(
FANo, FALedgerEntry."FA Posting Type"::Depreciation, CalcDate('<1Y>', WorkDate()), -AcquisitionCostAmount);
end;
+#endif
[Test]
[HandlerFunctions('ItemTrackingPageHandler')]
@@ -191,6 +191,7 @@ codeunit 144015 "ERM FR Feature Bugs"
VerifyItemLedgerEntry(ItemNo, -TrackingQuantity, Format(TrackingQuantity), SalesHeader."Sell-to Customer No.");
end;
+#if not CLEAN28
[Test]
[HandlerFunctions('CalculateDepreciationRequestPageHandler,DepreciationCalcConfirmHandler')]
[Scope('OnPrem')]
@@ -224,6 +225,7 @@ codeunit 144015 "ERM FR Feature Bugs"
VerifyFALedgerEntries(
FANo, FALedgerEntry."FA Posting Type"::Depreciation, CalcDate('<1Y>', WorkDate()), -AcquisitionCostAmount);
end;
+#endif
[Test]
[HandlerFunctions('GetShipmentLinesPageHandler')]
@@ -444,6 +446,7 @@ codeunit 144015 "ERM FR Feature Bugs"
exit(LibrarySales.PostSalesDocument(SalesHeader, true, false)); // Post as Ship Only.
end;
+#if not CLEAN28
local procedure CreateAndSetupDepreciationBook(var DepreciationBook: Record "Depreciation Book")
var
FAJournalSetup: Record "FA Journal Setup";
@@ -452,6 +455,7 @@ codeunit 144015 "ERM FR Feature Bugs"
LibraryFixedAsset.CreateFAJournalSetup(FAJournalSetup, DepreciationBook.Code, '');
UpdateFAJournalSetup(FAJournalSetup);
end;
+#endif
#if not CLEAN28
[Obsolete('Moved to Payment app', '28.0')]
@@ -483,6 +487,7 @@ codeunit 144015 "ERM FR Feature Bugs"
exit(Item."No.");
end;
+#if not CLEAN28
local procedure CreateDepreciationBookAndModifyDerogatoryCalculation(DerogatoryCalculation: Code[10]): Code[10]
var
DepreciationBook: Record "Depreciation Book";
@@ -564,6 +569,7 @@ codeunit 144015 "ERM FR Feature Bugs"
LibraryERM.CreateGLAccount(GLAccount);
exit(GLAccount."No.");
end;
+#endif
local procedure CreateItem(): Code[20]
var
@@ -643,6 +649,7 @@ codeunit 144015 "ERM FR Feature Bugs"
end;
#endif
+#if not CLEAN28
local procedure CreatePostDepreciationAndDerogatoryFAJournal(FANo: Code[20]; DepreciationBookCode: Code[10]; DepreciationAmount: Decimal; DerogatoryAmount: Decimal)
var
GenJournalLine: Record "Gen. Journal Line";
@@ -654,6 +661,7 @@ codeunit 144015 "ERM FR Feature Bugs"
GenJournalLine, CalcDate('<1M>', WorkDate()), GenJournalLine."FA Posting Type"::Derogatory, FANo,
DepreciationBookCode, -DerogatoryAmount);
end;
+#endif
local procedure CreateSalesDocument(var SalesHeader: Record "Sales Header"; var SalesLine: Record "Sales Line"; DocumentType: Enum "Sales Document Type"; CustomerNo: Code[20]; ItemNo: Code[20]; Quantity: Decimal)
begin
@@ -719,6 +727,7 @@ codeunit 144015 "ERM FR Feature Bugs"
end;
#endif
+#if not CLEAN28
local procedure RunCalculateDepreciationReport(DepreciationBookCode: Code[10])
begin
LibraryVariableStorage.Enqueue(DepreciationBookCode);
@@ -775,6 +784,7 @@ codeunit 144015 "ERM FR Feature Bugs"
FALedgerEntry.TestField(Amount, Amount);
until FALedgerEntry.Next() = 0;
end;
+#endif
local procedure VerifyItemLedgerEntry(ItemNo: Code[20]; Quantity: Decimal; LotNo: Code[20]; SourceNo: Code[20])
var
diff --git a/src/Layers/FR/Tests/Local/ERMFixedAssetsLocal.Codeunit.al b/src/Layers/FR/Tests/Local/ERMFixedAssetsLocal.Codeunit.al
index c05d52b294..c70a530d1c 100644
--- a/src/Layers/FR/Tests/Local/ERMFixedAssetsLocal.Codeunit.al
+++ b/src/Layers/FR/Tests/Local/ERMFixedAssetsLocal.Codeunit.al
@@ -1,3 +1,4 @@
+#if not CLEAN28
codeunit 144002 "ERM Fixed Assets - Local"
{
// // [FEATURE] [Fixed Asset] [Derogatory]
@@ -19,6 +20,9 @@ codeunit 144002 "ERM Fixed Assets - Local"
Subtype = Test;
TestPermissions = Disabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '28.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnRun()
begin
@@ -1552,4 +1556,4 @@ codeunit 144002 "ERM Fixed Assets - Local"
Reply := true;
end;
}
-
+#endif
diff --git a/src/Layers/FR/Tests/Local/UTCODFADerogatoryDepr.Codeunit.al b/src/Layers/FR/Tests/Local/UTCODFADerogatoryDepr.Codeunit.al
index 673aa0cf8c..f1e175b008 100644
--- a/src/Layers/FR/Tests/Local/UTCODFADerogatoryDepr.Codeunit.al
+++ b/src/Layers/FR/Tests/Local/UTCODFADerogatoryDepr.Codeunit.al
@@ -1,9 +1,13 @@
+#if not CLEAN28
codeunit 144027 "UT COD FA Derogatory Depr."
{
// Test for feature FADD - Fixed Asset Derogatory Depreciation.
Subtype = Test;
TestPermissions = Disabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '28.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnRun()
begin
@@ -235,4 +239,4 @@ codeunit 144027 "UT COD FA Derogatory Depr."
CreateFAPostingTypeSetup(FADepreciationBook."Depreciation Book Code", FAPostingTypeSetup."FA Posting Type"::"Custom 2");
end;
}
-
+#endif
diff --git a/src/Layers/FR/Tests/Local/UTREPFADerogatoryDepr.Codeunit.al b/src/Layers/FR/Tests/Local/UTREPFADerogatoryDepr.Codeunit.al
index 63b0bb23e0..1e81052d00 100644
--- a/src/Layers/FR/Tests/Local/UTREPFADerogatoryDepr.Codeunit.al
+++ b/src/Layers/FR/Tests/Local/UTREPFADerogatoryDepr.Codeunit.al
@@ -1,9 +1,13 @@
+#if not CLEAN28
codeunit 144026 "UT REP FA Derogatory Depr."
{
// Test for feature FADD - Fixed Asset Derogatory Depreciation.
Subtype = Test;
TestPermissions = Disabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '28.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnRun()
begin
@@ -211,4 +215,4 @@ codeunit 144026 "UT REP FA Derogatory Depr."
CopyFAEntriesToGLBudget.OK().Invoke();
end;
}
-
+#endif
diff --git a/src/Layers/FR/Tests/Local/UTTABFADerogatoryDepr.Codeunit.al b/src/Layers/FR/Tests/Local/UTTABFADerogatoryDepr.Codeunit.al
index 42ad60249e..5116339b90 100644
--- a/src/Layers/FR/Tests/Local/UTTABFADerogatoryDepr.Codeunit.al
+++ b/src/Layers/FR/Tests/Local/UTTABFADerogatoryDepr.Codeunit.al
@@ -1,9 +1,13 @@
+#if not CLEAN28
codeunit 144025 "UT TAB FA Derogatory Depr."
{
// Test for feature FADD - Fixed Asset Derogatory Depreciation.
Subtype = Test;
TestPermissions = Disabled;
+ ObsoleteState = Pending;
+ ObsoleteTag = '28.0';
+ ObsoleteReason = 'Moved to W1 Base Application';
trigger OnRun()
begin
@@ -365,4 +369,4 @@ codeunit 144025 "UT TAB FA Derogatory Depr."
DepreciationBook.Modify();
end;
}
-
+#endif
diff --git a/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index ec6d01cf50..f0a38e39b2 100644
--- a/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -580,6 +581,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3348,6 +3350,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3363,6 +3366,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3575,6 +3579,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4086,6 +4095,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -5914,6 +5925,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8040,6 +8066,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index dca3c8f421..34be2b0df6 100644
--- a/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/GB/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1645,6 +1645,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
index 8a0a18fd90..ae33af4745 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
@@ -23,6 +23,8 @@ codeunit 5611 "Calculate Normal Depreciation"
FALedgEntry: Record "FA Ledger Entry";
DeprBook: Record "Depreciation Book";
FADeprBook: Record "FA Depreciation Book";
+ DerogFALedgEntry: Record "FA Ledger Entry";
+ DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
DeprBookCode: Code[10];
DaysInFiscalYear: Integer;
@@ -562,6 +564,18 @@ codeunit 5611 "Calculate Normal Depreciation"
BookValue := FADeprBook."Book Value";
end else
BookValue := EntryAmounts[1];
+ if DateFromProjection = 0D then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.FindFirst() then begin
+ DerogFALedgEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date");
+ DerogFALedgEntry.SetRange("FA No.", FADeprBook."FA No.");
+ DerogFALedgEntry.SetRange("Depreciation Book Code", FADeprBook."Depreciation Book Code");
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1&<>%2', DerogFALedgEntry."FA Posting Type"::Derogatory,
+ DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ DerogFALedgEntry.CalcSums(Amount);
+ BookValue := DerogFALedgEntry.Amount;
+ end;
+ end;
MinusBookValue := DepreciationCalc.GetMinusBookValue(FA."No.", DeprBookCode, 0D, 0D) + DepreciationCalc.GetUnpostedBonusDepreciationForCalc(FADeprBook, 0D, 0D);
FADeprBook.CalcFields("Depreciable Basis", "Salvage Value");
DeprBasis := FADeprBook."Depreciable Basis";
diff --git a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
index b44a40657d..77325b1904 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
@@ -59,9 +59,7 @@ report 5687 "Copy Depreciation Book"
begin
DepreciationCalc.SetFAFilter(FALedgEntry, '', DeprBookCode, false);
FALedgEntry.SetRange("FA Posting Category", FALedgEntry."FA Posting Category"::" ");
- FALedgEntry.SetRange(
- "FA Posting Type",
- FALedgEntry."FA Posting Type"::"Acquisition Cost", FALedgEntry."FA Posting Type"::"Salvage Value");
+ FALedgEntry.SetFilter("FA Posting Type", '<=%1|%2', FALedgEntry."FA Posting Type"::"Salvage Value", FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("FA Posting Date", StartingDate, EndingDate2);
end;
}
@@ -173,6 +171,12 @@ report 5687 "Copy Depreciation Book"
Caption = 'Disposal';
ToolTip = 'Specifies if related disposal entries are included in the batch job .';
}
+ field("CopyChoices[13]"; CopyChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+ }
}
}
}
@@ -225,8 +229,8 @@ report 5687 "Copy Depreciation Book"
DepreciationCalc: Codeunit "Depreciation Calculation";
Window: Dialog;
ExchangeRate: Decimal;
- CopyChoices: array[9] of Boolean;
- GLIntegration: array[9] of Boolean;
+ CopyChoices: array[13] of Boolean;
+ GLIntegration: array[13] of Boolean;
DocumentNo: Code[20];
DocumentNo2: Code[20];
DocumentNo3: Code[20];
diff --git a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index a65e9f5b95..af72896333 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -37,41 +37,81 @@ table 5611 "Depreciation Book"
{
Caption = 'G/L Integration - Acq. Cost';
ToolTip = 'Specifies whether acquisition cost entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(4; "G/L Integration - Depreciation"; Boolean)
{
Caption = 'G/L Integration - Depreciation';
ToolTip = 'Specifies whether depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(5; "G/L Integration - Write-Down"; Boolean)
{
Caption = 'G/L Integration - Write-Down';
ToolTip = 'Specifies whether write-down entries posted to this depreciation book should be posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(6; "G/L Integration - Appreciation"; Boolean)
{
Caption = 'G/L Integration - Appreciation';
ToolTip = 'Specifies whether appreciation entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(7; "G/L Integration - Custom 1"; Boolean)
{
Caption = 'G/L Integration - Custom 1';
ToolTip = 'Specifies whether custom 1 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(8; "G/L Integration - Custom 2"; Boolean)
{
Caption = 'G/L Integration - Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(9; "G/L Integration - Disposal"; Boolean)
{
Caption = 'G/L Integration - Disposal';
ToolTip = 'Specifies whether disposal entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(10; "G/L Integration - Maintenance"; Boolean)
{
Caption = 'G/L Integration - Maintenance';
ToolTip = 'Specifies whether maintenance entries that are posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(11; "Disposal Calculation Method"; Option)
{
@@ -327,6 +367,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -419,7 +519,17 @@ table 5611 "Depreciation Book"
var
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
+ GLIntegration: array[13] of Boolean;
MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
+ Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
+ Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
+ Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
+ Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
#pragma warning disable AA0074
Text000: Label 'The book cannot be deleted because it is in use.';
@@ -432,7 +542,9 @@ table 5611 "Depreciation Book"
protected var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- procedure IndexGLIntegration(var GLIntegration: array[9] of Boolean)
+#pragma warning disable AA0244
+ procedure IndexGLIntegration(var GLIntegration: array[13] of Boolean)
+#pragma warning restore AA0244
begin
GLIntegration[1] := "G/L Integration - Acq. Cost";
GLIntegration[2] := "G/L Integration - Depreciation";
@@ -443,6 +555,26 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
+ GLIntegration[13] := "Integration G/L - Derogatory";
+ end;
+
+ [Scope('OnPrem')]
+ procedure CheckIntegrationFields()
+ var
+ i: Integer;
+ begin
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end;
+ end;
+
+ [Scope('OnPrem')]
+ procedure IsDerogatoryBook(): Boolean
+ begin
+ exit("Derogatory Calc." <> '');
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index 04243e16df..b40ab0f04a 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -59,6 +59,21 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("VAT on Net Disposal Entries"; Rec."VAT on Net Disposal Entries")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies whether you sell a fixed asset with the net disposal method.';
+ }
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ }
field("Allow Identical Document No."; Rec."Allow Identical Document No.")
{
ApplicationArea = FixedAssets;
@@ -153,6 +168,12 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Bonus Depreciation';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ }
}
}
group(Duplication)
diff --git a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
index dc86c696e6..1cc2c75858 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
@@ -504,7 +504,7 @@ codeunit 5616 "Depreciation Calculation"
FiscalYearBegin := FADateCalc.GetFiscalYear(DeprBookCode, StartingDate);
SetFAFilter(FALedgEntry, FANo, DeprBookCode, true);
FALedgEntry.SetFilter("FA Posting Date", '%1..', FiscalYearBegin);
- FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Depreciation);
+ FALedgEntry.SetFilter("FA Posting Type", '%1|%2', FALedgEntry."FA Posting Type"::Depreciation, FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("Part of Book Value", true);
FALedgEntry.SetRange("Reclassification Entry", false);
FALedgEntry.CalcSums(Amount);
diff --git a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
index 1456a94d5e..7cb1b4e6bd 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
@@ -346,7 +346,8 @@ table 5612 "FA Depreciation Book"
CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
"Depreciation Book Code" = field("Depreciation Book Code"),
"Part of Book Value" = const(true),
- "FA Posting Date" = field("FA Posting Date Filter")));
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
Caption = 'Book Value';
ToolTip = 'Specifies the book value for the fixed asset.';
Editable = false;
@@ -879,6 +880,24 @@ table 5612 "FA Depreciation Book"
FieldError("Default FA Depreciation Book", OnlyOneDefaultDeprBookErr);
end;
}
+ field(5865; "Derogatory Amount"; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = GetCurrencyCode();
+ CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
+ "Depreciation Book Code" = field("Depreciation Book Code"),
+ "FA Posting Category" = const(" "),
+ "FA Posting Type" = const(Derogatory),
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
+ Caption = 'Derogatory';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5866; "Last Derogatory"; Date)
+ {
+ Caption = 'Last Derogatory Date';
+ }
}
keys
@@ -1327,6 +1346,7 @@ table 5612 "FA Depreciation Book"
FALedgerEntry.SetRange("FA No.", "FA No.");
FALedgerEntry.SetRange("Depreciation Book Code", "Depreciation Book Code");
FALedgerEntry.SetRange("Part of Book Value", true);
+ FALedgerEntry.SetRange("Derogatory Excluded", false);
OnAfterSetBookValueFiltersOnFALedgerEntry(FALedgerEntry);
end;
diff --git a/src/Layers/GB/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al b/src/Layers/GB/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
index 04428fbc40..9bec0e6f3f 100644
--- a/src/Layers/GB/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
+++ b/src/Layers/GB/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
@@ -347,6 +347,8 @@ codeunit 5631 "FA Jnl.-Check Line"
GLIntegration := DeprBook."G/L Integration - Disposal";
FAPostingType::Maintenance:
GLIntegration := DeprBook."G/L Integration - Maintenance";
+ FAPostingType::Derogatory:
+ GLIntegration := DeprBook."Integration G/L - Derogatory";
FAPostingType::"Salvage Value":
GLIntegration := false;
FAPostingType::"Bonus Depreciation":
@@ -489,7 +491,7 @@ codeunit 5631 "FA Jnl.-Check Line"
if GenJnlLine."Depr. until FA Posting Date" then
GenJnlLine.FieldError("Depr. until FA Posting Date", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Derogatory);
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
GenJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
@@ -551,7 +553,7 @@ codeunit 5631 "FA Jnl.-Check Line"
then
FAJnlLine.FieldError("Maintenance Code", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Derogatory);
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
FAJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
diff --git a/src/Layers/GB/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/GB/DemoTool/CreateFAPostingGroup.Codeunit.al
index 3c0d97a38d..feceb55737 100644
--- a/src/Layers/GB/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/GB/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -37,6 +37,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index 08d0665368..99936426f4 100644
--- a/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -37,41 +37,81 @@ table 5611 "Depreciation Book"
{
Caption = 'G/L Integration - Acq. Cost';
ToolTip = 'Specifies whether acquisition cost entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(4; "G/L Integration - Depreciation"; Boolean)
{
Caption = 'G/L Integration - Depreciation';
ToolTip = 'Specifies whether depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(5; "G/L Integration - Write-Down"; Boolean)
{
Caption = 'G/L Integration - Write-Down';
ToolTip = 'Specifies whether write-down entries posted to this depreciation book should be posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(6; "G/L Integration - Appreciation"; Boolean)
{
Caption = 'G/L Integration - Appreciation';
ToolTip = 'Specifies whether appreciation entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(7; "G/L Integration - Custom 1"; Boolean)
{
Caption = 'G/L Integration - Custom 1';
ToolTip = 'Specifies whether custom 1 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(8; "G/L Integration - Custom 2"; Boolean)
{
Caption = 'G/L Integration - Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(9; "G/L Integration - Disposal"; Boolean)
{
Caption = 'G/L Integration - Disposal';
ToolTip = 'Specifies whether disposal entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(10; "G/L Integration - Maintenance"; Boolean)
{
Caption = 'G/L Integration - Maintenance';
ToolTip = 'Specifies whether maintenance entries that are posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(11; "Disposal Calculation Method"; Option)
{
@@ -327,6 +367,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -438,7 +538,17 @@ table 5611 "Depreciation Book"
var
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
+ GLIntegration: array[13] of Boolean;
MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
+ Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
+ Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
+ Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
+ Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
#pragma warning disable AA0074
Text000: Label 'The book cannot be deleted because it is in use.';
@@ -451,7 +561,9 @@ table 5611 "Depreciation Book"
protected var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- procedure IndexGLIntegration(var GLIntegration: array[9] of Boolean)
+#pragma warning disable AA0244
+ procedure IndexGLIntegration(var GLIntegration: array[13] of Boolean)
+#pragma warning restore AA0244
begin
GLIntegration[1] := "G/L Integration - Acq. Cost";
GLIntegration[2] := "G/L Integration - Depreciation";
@@ -462,6 +574,26 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
+ GLIntegration[13] := "Integration G/L - Derogatory";
+ end;
+
+ [Scope('OnPrem')]
+ procedure CheckIntegrationFields()
+ var
+ i: Integer;
+ begin
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end;
+ end;
+
+ [Scope('OnPrem')]
+ procedure IsDerogatoryBook(): Boolean
+ begin
+ exit("Derogatory Calc." <> '');
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index 37c7a8204b..35fbcc17aa 100644
--- a/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/IS/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -63,6 +63,16 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ }
field("Allow Identical Document No."; Rec."Allow Identical Document No.")
{
ApplicationArea = FixedAssets;
@@ -157,6 +167,12 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Bonus Depreciation';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ }
}
}
group(Duplication)
@@ -314,6 +330,6 @@ page 5610 "Depreciation Book Card"
}
}
}
- protected var
+ protected var
}
diff --git a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 8996976dc2..0d3c5e4d59 100644
--- a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -215,6 +215,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -596,6 +597,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3402,6 +3404,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3417,6 +3420,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3629,6 +3633,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4386,6 +4395,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
Day: Integer;
DefDueDates: Record "Deferring Due Dates";
FixedDueDate: Record "Fixed Due Dates";
@@ -6493,6 +6504,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
[Scope('OnPrem')]
procedure ValidateIncludeInDT(): Boolean
begin
@@ -8752,6 +8778,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index aa805a4b87..68f4bcf401 100644
--- a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1649,6 +1649,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index 3c370e6255..b40f9699a9 100644
--- a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -24,6 +24,7 @@ using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Reporting;
using Microsoft.Finance.VAT.Setup;
using Microsoft.Finance.WithholdingTax;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -138,6 +139,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
GLBookEntry: Record "GL Book Entry";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -224,6 +226,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
Text1130001: Label 'Please specify %1 in %2 %3.';
Text1130021: Label 'Unrealized VAT cannot be used with %1 %2 and %3 %4';
Text1130018: Label 'Nondeductible not supported with Sales Tax!!!';
@@ -1305,7 +1310,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -2038,7 +2042,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -2065,6 +2069,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -8096,6 +8107,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
NextTransactionNo := NextTransactionNo + 1;
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
[Scope('OnPrem')]
procedure InitPaymentTerms(GenJnlLine: Record "Gen. Journal Line")
var
@@ -8682,6 +8736,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
@@ -12242,4 +12356,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
index 9351a58a13..021eda902f 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
@@ -26,12 +26,52 @@ report 5692 "Calculate Depreciation"
dataitem("Fixed Asset"; "Fixed Asset")
{
RequestFilterFields = "No.", "FA Class Code", "FA Subclass Code", "Budgeted Asset";
+ dataitem(CalcDerogDepr; "Fixed Asset")
+ {
+ DataItemLink = "No." = field("No.");
+ DataItemTableView = sorting("No.");
+
+ trigger OnAfterGetRecord()
+ begin
+ if not HasDerogatorySetup then
+ CurrReport.Skip();
+
+ CalculateDepr.Calculate(
+ DeprAmount, Custom1Amount, NumberOfDays, Custom1NumberOfDays,
+ "No.", DeprBook2.Code, DeprUntilDate, EntryAmounts, 0D, DaysInPeriod);
+
+ if DeprAmount2 <> 0 then
+ if not DeprBook."Integration G/L - Derogatory" or "Budgeted Asset" then begin
+ TempFAJnlLine."FA No." := "No.";
+ TempFAJnlLine."FA Posting Type" := TempFAJnlLine."FA Posting Type"::Derogatory;
+ TempFAJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempFAJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempFAJnlLine."FA Error Entry No." := ErrorNo;
+ TempFAJnlLine."Line No." := TempFAJnlLine."Line No." + 1;
+ TempFAJnlLine.Insert();
+ end else begin
+ TempGenJnlLine."Account No." := "No.";
+ TempGenJnlLine."FA Posting Type" := TempGenJnlLine."FA Posting Type"::Derogatory;
+ TempGenJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempGenJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempGenJnlLine."FA Error Entry No." := ErrorNo;
+ TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
+ TempGenJnlLine.Insert();
+ end;
+ end;
+ }
trigger OnAfterGetRecord()
begin
if Inactive or Blocked then
CurrReport.Skip();
+ HasDerogatorySetup := false;
+ FADeprBook.SetRange("FA No.", "No.");
+ FADeprBook.SetRange("Depreciation Book Code", DeprBook2.Code);
+ if FADeprBook.Find('-') then
+ HasDerogatorySetup := true;
+
OnBeforeCalculateDepreciation(
"No.", TempGenJnlLine, TempFAJnlLine, DeprAmount, NumberOfDays, DeprBookCode, DeprUntilDate, EntryAmounts, DaysInPeriod);
@@ -112,6 +152,10 @@ report 5692 "Calculate Depreciation"
TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
TempGenJnlLine.Insert();
end;
+
+ if HasDerogatorySetup then
+ DeprAmount2 := DeprAmount;
+
end;
trigger OnPostDataItem()
@@ -470,12 +514,18 @@ report 5692 "Calculate Depreciation"
GeneralLedgerSetup.Get();
FASetup.Get();
+ Clear(DeprBook2);
DeprBook.Get(DeprBookCode);
if UseCustom1 then
DeprBook.TestField("Anticipated Depreciation Calc.");
if UseCustom2 then
DeprBook.TestField("Acc./Red. Depreciation Calc.");
+ if DeprBook."Derogatory Calc." <> '' then
+ Error(Text10800, DeprBook.Code);
+ DeprBook2.SetRange("Derogatory Calc.", DeprBookCode);
+ if DeprBook2.Find('-') then;
+
if DeprUntilDate = 0D then
Error(Text000, FAJnlLine.FieldCaption("FA Posting Date"));
if PostingDate = 0D then
@@ -508,6 +558,8 @@ report 5692 "Calculate Depreciation"
DeprBook: Record "Depreciation Book";
FAJnlSetup: Record "FA Journal Setup";
GeneralLedgerSetup: Record "General Ledger Setup";
+ DeprBook2: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
CalculateDepr: Codeunit "Calculate Depreciation";
FAInsertGLAcc: Codeunit "FA Insert G/L Account";
ErrorMessageMgt: Codeunit "Error Message Management";
@@ -526,6 +578,8 @@ report 5692 "Calculate Depreciation"
GenJnlNextLineNo: Integer;
EntryAmounts: array[4] of Decimal;
LineNo: Integer;
+ DeprAmount2: Decimal;
+ HasDerogatorySetup: Boolean;
Custom2Amount: Decimal;
UseCustom1: Boolean;
UseCustom2: Boolean;
@@ -551,8 +605,9 @@ report 5692 "Calculate Depreciation"
Text003: Label 'Depreciating fixed asset #1##########\';
Text004: Label 'Not depreciating fixed asset #2##########\';
Text005: Label 'Inserting journal lines #3##########';
-#pragma warning restore AA0470
Text006: Label 'Use Force No. of Days must be activated.';
+ Text10800: Label 'Depreciation cannot be posted on depreciation book %1 because it is set up as derogatory.';
+#pragma warning restore AA0470
CompletionStatsMsg: Label 'The depreciation has been calculated.\\No journal lines were created.';
#pragma warning disable AA0470
CompletionStatsFAJnlQst: Label 'The depreciation has been calculated.\\%1 fixed asset journal lines were created.\\Do you want to open the Fixed Asset Journal window?', Comment = 'The depreciation has been calculated.\\5 fixed asset journal lines were created.\\Do you want to open the Fixed Asset Journal window?';
@@ -606,6 +661,12 @@ report 5692 "Calculate Depreciation"
ErrorMessageMgt.Activate(ErrorMessageHandler);
end;
+ [Scope('OnPrem')]
+ procedure CalcDerogDeprAmount(Amount1: Decimal; Amount2: Decimal): Decimal
+ begin
+ exit(Amount1 - Amount2);
+ end;
+
[Scope('OnPrem')]
procedure TestDocumentNo()
begin
diff --git a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
index 7f4845aeed..16c0d0b3d1 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
@@ -23,6 +23,8 @@ codeunit 5611 "Calculate Normal Depreciation"
FALedgEntry: Record "FA Ledger Entry";
DeprBook: Record "Depreciation Book";
FADeprBook: Record "FA Depreciation Book";
+ DerogFALedgEntry: Record "FA Ledger Entry";
+ DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
DeprBookCode: Code[10];
DaysInFiscalYear: Integer;
@@ -623,6 +625,19 @@ codeunit 5611 "Calculate Normal Depreciation"
BookValue := FADeprBook."Book Value";
end else
BookValue := EntryAmounts[1];
+
+ if DateFromProjection = 0D then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.FindFirst() then begin
+ DerogFALedgEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date");
+ DerogFALedgEntry.SetRange("FA No.", FADeprBook."FA No.");
+ DerogFALedgEntry.SetRange("Depreciation Book Code", FADeprBook."Depreciation Book Code");
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1&<>%2', DerogFALedgEntry."FA Posting Type"::Derogatory,
+ DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ DerogFALedgEntry.CalcSums(Amount);
+ BookValue := DerogFALedgEntry.Amount;
+ end;
+ end;
MinusBookValue := DepreciationCalc.GetMinusBookValue(FA."No.", DeprBookCode, 0D, 0D) + DepreciationCalc.GetUnpostedBonusDepreciationForCalc(FADeprBook, 0D, 0D);
FADeprBook.CalcFields("Depreciable Basis", "Salvage Value");
DeprBasis := FADeprBook."Depreciable Basis";
diff --git a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index 42a999ec20..65042444b5 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -38,41 +38,81 @@ table 5611 "Depreciation Book"
{
Caption = 'G/L Integration - Acq. Cost';
ToolTip = 'Specifies whether acquisition cost entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(4; "G/L Integration - Depreciation"; Boolean)
{
Caption = 'G/L Integration - Depreciation';
ToolTip = 'Specifies whether depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(5; "G/L Integration - Write-Down"; Boolean)
{
Caption = 'G/L Integration - Write-Down';
ToolTip = 'Specifies whether write-down entries posted to this depreciation book should be posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(6; "G/L Integration - Appreciation"; Boolean)
{
Caption = 'G/L Integration - Appreciation';
ToolTip = 'Specifies whether appreciation entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(7; "G/L Integration - Custom 1"; Boolean)
{
ToolTip = 'Specifies whether custom 1 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
Caption = 'G/L Integration - Anticipated';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(8; "G/L Integration - Custom 2"; Boolean)
{
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
Caption = 'G/L Integration - Acc./Red.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(9; "G/L Integration - Disposal"; Boolean)
{
Caption = 'G/L Integration - Disposal';
ToolTip = 'Specifies whether disposal entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(10; "G/L Integration - Maintenance"; Boolean)
{
Caption = 'G/L Integration - Maintenance';
ToolTip = 'Specifies whether maintenance entries that are posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(11; "Disposal Calculation Method"; Option)
{
@@ -328,6 +368,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -432,7 +532,17 @@ table 5611 "Depreciation Book"
var
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
+ GLIntegration: array[13] of Boolean;
MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
+ Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
+ Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
+ Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
+ Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
Text1130000: Label 'The function may post in %1.';
Text1130001: Label 'The posting was stopped.';
@@ -447,7 +557,9 @@ table 5611 "Depreciation Book"
protected var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- procedure IndexGLIntegration(var GLIntegration: array[9] of Boolean)
+#pragma warning disable AA0244
+ procedure IndexGLIntegration(var GLIntegration: array[13] of Boolean)
+#pragma warning restore AA0244
begin
GLIntegration[1] := "G/L Integration - Acq. Cost";
GLIntegration[2] := "G/L Integration - Depreciation";
@@ -458,6 +570,26 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
+ GLIntegration[13] := "Integration G/L - Derogatory";
+ end;
+
+ [Scope('OnPrem')]
+ procedure CheckIntegrationFields()
+ var
+ i: Integer;
+ begin
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end;
+ end;
+
+ [Scope('OnPrem')]
+ procedure IsDerogatoryBook(): Boolean
+ begin
+ exit("Derogatory Calc." <> '');
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index 9db25562e5..438d1e30b5 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -68,6 +68,16 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ }
field("Allow Identical Document No."; Rec."Allow Identical Document No.")
{
ApplicationArea = FixedAssets;
@@ -174,6 +184,12 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Bonus Depreciation';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ }
}
}
group(Duplication)
diff --git a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
index 779958930b..25d87328b3 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
@@ -75,7 +75,7 @@ codeunit 5616 "Depreciation Calculation"
begin
if ThisDate = 0D then
exit(0D);
-
+
if Year365Days then
exit(ToMorrow365(ThisDate));
ThisDate := ThisDate + 1;
@@ -517,7 +517,7 @@ codeunit 5616 "Depreciation Calculation"
FiscalYearBegin := FADateCalc.GetFiscalYear(DeprBookCode, StartingDate);
SetFAFilter(FALedgEntry, FANo, DeprBookCode, true);
FALedgEntry.SetFilter("FA Posting Date", '%1..', FiscalYearBegin);
- FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Depreciation);
+ FALedgEntry.SetFilter("FA Posting Type", '%1|%2', FALedgEntry."FA Posting Type"::Depreciation, FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("Part of Book Value", true);
FALedgEntry.SetRange("Reclassification Entry", false);
FALedgEntry.CalcSums(Amount);
diff --git a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
index 4e4b869d68..695b3efea0 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
@@ -19,6 +19,8 @@ codeunit 5626 "FA General Report"
FADeprBook: Record "FA Depreciation Book";
FALedgEntry: Record "FA Ledger Entry";
DepreciationCalc: Codeunit "Depreciation Calculation";
+ UseCreditAmounts: Boolean;
+ UseDebitAmounts: Boolean;
#pragma warning disable AA0074
Text000: Label 'Posting Date Filter';
@@ -63,6 +65,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Last Custom 1 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Last Derogatory"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Last Custom 2 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Last Salvage Value Date"):
@@ -92,7 +96,20 @@ codeunit 5626 "FA General Report"
procedure CalcFAPostedAmount(FANo: Code[20]; PostingType: Integer; Period: Option "Before Starting Date","Net Change","at Ending Date"; StartingDate: Date; EndingDate: Date; DeprBookCode: Code[10]; BeforeAmount: Decimal; UntilAmount: Decimal; OnlyReclassified: Boolean; OnlyBookValue: Boolean) Result: Decimal
begin
- ClearAll();
+ case true of
+ UseCreditAmounts:
+ begin
+ ClearAll();
+ UseCreditAmounts := true;
+ end;
+ UseDebitAmounts:
+ begin
+ ClearAll();
+ UseDebitAmounts := true
+ end;
+ else
+ ClearAll();
+ end;
if PostingType = 0 then
exit(0);
if EndingDate = 0D then
@@ -126,6 +143,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -148,7 +167,10 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.SetRange("FA Posting Date", 0D, EndingDate);
end;
- FALedgEntry.CalcSums(Amount);
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then
+ FALedgEntry.CalcSums(Amount, "Debit Amount", "Credit Amount")
+ else
+ FALedgEntry.CalcSums(Amount);
if (PostingType = FADeprBook.FieldNo("Book Value")) or
(PostingType = FADeprBook.FieldNo(Depreciation))
@@ -161,7 +183,17 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.Amount := FALedgEntry.Amount + UntilAmount;
end;
- Result := FALedgEntry.Amount;
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then begin
+ if UseCreditAmounts then begin
+ Clear(UseCreditAmounts);
+ Result := FALedgEntry."Credit Amount";
+ end;
+ if UseDebitAmounts then begin
+ Clear(UseDebitAmounts);
+ Result := FALedgEntry."Debit Amount";
+ end;
+ end else
+ Result := FALedgEntry.Amount;
OnAfterCalcFAPostedAmount(FALedgEntry, PostingType, Period, BeforeAmount, UntilAmount, Result);
end;
@@ -189,6 +221,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -282,6 +316,18 @@ codeunit 5626 "FA General Report"
Window.Close();
end;
+ [Scope('OnPrem')]
+ procedure SetSign(Sign: Boolean)
+ begin
+ if Sign = true then begin
+ UseCreditAmounts := true;
+ UseDebitAmounts := false
+ end else begin
+ UseCreditAmounts := false;
+ UseDebitAmounts := true;
+ end;
+ end;
+
procedure SetAquisitionDate(var FA2: Record "Fixed Asset"; DeprBookCode: Code[10])
var
FA: Record "Fixed Asset";
diff --git a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
index ba68fd0a56..140f33d949 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
@@ -347,6 +347,8 @@ codeunit 5631 "FA Jnl.-Check Line"
GLIntegration := DeprBook."G/L Integration - Disposal";
FAPostingType::Maintenance:
GLIntegration := DeprBook."G/L Integration - Maintenance";
+ FAPostingType::Derogatory:
+ GLIntegration := DeprBook."Integration G/L - Derogatory";
FAPostingType::"Salvage Value":
GLIntegration := false;
FAPostingType::"Bonus Depreciation":
@@ -489,7 +491,7 @@ codeunit 5631 "FA Jnl.-Check Line"
if GenJnlLine."Depr. until FA Posting Date" then
GenJnlLine.FieldError("Depr. until FA Posting Date", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 2") and (GenJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Derogatory);
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
GenJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
@@ -551,7 +553,7 @@ codeunit 5631 "FA Jnl.-Check Line"
then
FAJnlLine.FieldError("Maintenance Code", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 2") and (FAJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Derogatory);
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
FAJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
diff --git a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
index 6a4efc1169..ad8c86a284 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
@@ -53,8 +53,9 @@ codeunit 5633 "FA Jnl.-Post Batch"
PreviewMode: Boolean;
SuppressCommit: Boolean;
CompressDepr: array[2] of Record "Compress Depreciation" temporary;
+#pragma warning disable AA0470
+ SetupCombErr: Label 'must not be specified when %1 = %2 in %3', Comment = 'must not be specified when G/L Integration - Derogatory = TRUE in Depreciation Book';
#pragma warning disable AA0074
-#pragma warning disable AA0470
Text12100: Label '%1 compressed entries';
Text001: Label 'Journal Batch Name #1##########\\';
Text002: Label 'Checking lines #2######\';
@@ -273,6 +274,64 @@ codeunit 5633 "FA Jnl.-Post Batch"
FAJnlLine."Salvage Value" := 0;
end;
+ [Scope('OnPrem')]
+ procedure MakeDerogatoryFAJnlLine(var NewFAJnlLine: Record "FA Journal Line"; FAJournalLine: Record "FA Journal Line"): Boolean
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ NewFAJnlLine.Copy(FAJournalLine);
+ DeprBook.SetRange("Derogatory Calc.", FAJournalLine."Depreciation Book Code");
+ if DeprBook.FindFirst() then
+ if FADeprBook.Get(NewFAJnlLine."FA No.", DeprBook.Code) then begin
+ NewFAJnlLine.Validate("Depreciation Book Code", DeprBook.Code);
+ exit(true);
+ end;
+ exit(false);
+ end;
+
+ local procedure CreateAndPostDerogEntry(SourceFAJournalLine: Record "FA Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ FAJournalLine: Record "FA Journal Line";
+ DerogFAJnlLine: Record "FA Journal Line";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceFAJournalLine."FA Posting Type" <> SourceFAJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceFAJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceFAJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceFAJournalLine."FA No.", DerogDepreciationBook.Code, SourceFAJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ if DepreciationBook."Integration G/L - Derogatory" then
+ SourceFAJournalLine.FieldError(
+ "Depr. Acquisition Cost", StrSubstNo(SetupCombErr,
+ DepreciationBook.FieldCaption("Integration G/L - Derogatory"), true, DepreciationBook.TableCaption()));
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJournalLine.TransferFields(SourceFAJournalLine);
+ FAJournalLine.Validate("FA Posting Type", FAJournalLine."FA Posting Type"::Derogatory);
+ FAJournalLine.Validate(Amount, DerogatoryAmount);
+ FAJournalLine.Validate("Depr. until FA Posting Date", false);
+ FAJournalLine.Validate("Depr. Acquisition Cost", false);
+ FAJnlPostLine.FAJnlPostLine(FAJournalLine, true);
+
+ // Post FA ledger entry for secondary book
+ MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJournalLine);
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, true);
+ end;
+
[Scope('OnPrem')]
procedure CreateCompressTable(FAJnlLine: Record "FA Journal Line")
var
@@ -453,6 +512,7 @@ codeunit 5633 "FA Jnl.-Post Batch"
local procedure PostLines()
var
+ DerogFAJnlLine: Record "FA Journal Line";
IsHandled: Boolean;
begin
LineCount := 0;
@@ -489,8 +549,13 @@ codeunit 5633 "FA Jnl.-Post Batch"
end;
OnPostLinesOnBeforeFAJnlPostLine(FAJnlLine, FAJnlPostLine);
FAJnlPostLine.FAJnlPostLine(FAJnlLine, false);
- OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
- CreateCompressTable(FAJnlLine);
+ if MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJnlLine) then begin
+ if FAJnlLine."FA Error Entry No." <> 0 then
+ DerogFAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, FAJnlLine."FA Error Entry No.", DerogFAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, false);
+ OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
+ CreateAndPostDerogEntry(FAJnlLine);
+ end;
until FAJnlLine.Next() = 0;
PostCompressTable(FAJnlLine);
end;
diff --git a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
index 8ff6defdef..57fcf9cfc3 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
@@ -105,46 +105,52 @@ codeunit 5632 "FA Jnl.-Post Line"
IsHandled := false;
OnBeforeGenJnlPostLine(GenJnlLine, FAInsertLedgEntry, FAAmount, VATAmount, NextTransactionNo, NextGLEntryNo, GLRegisterNo, IsHandled);
if not IsHandled then begin
- FAInsertLedgEntry.SetGLRegisterNo(GLRegisterNo);
FAInsertLedgEntry.DeleteAllGLAcc();
- if GenJnlLine."Account No." = '' then
- exit;
- if GenJnlLine."FA Posting Date" = 0D then
- GenJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
- if GenJnlLine."Journal Template Name" = '' then
- GenJnlLine.Quantity := 0;
- DuplicateDeprBook.DuplicateGenJnlLine(GenJnlLine, FAAmount);
- FANo := GenJnlLine."Account No.";
- BudgetNo := GenJnlLine."Budgeted FA No.";
- DeprBookCode := GenJnlLine."Depreciation Book Code";
- FAPostingType := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
- FAPostingDate := GenJnlLine."FA Posting Date";
- Amount2 := FAAmount;
- SalvageValue := GenJnlLine.ConvertAmtFCYToLCYForSourceCurrency(GenJnlLine."Salvage Value");
- DeprUntilDate := GenJnlLine."Depr. until FA Posting Date";
- DeprAcqCost := GenJnlLine."Depr. Acquisition Cost";
- ErrorEntryNo := GenJnlLine."FA Error Entry No.";
- if GenJnlLine."FA Posting Type" = GenJnlLine."FA Posting Type"::Maintenance then begin
- MakeMaintenanceLedgEntry.CopyFromGenJnlLine(MaintenanceLedgEntry, GenJnlLine);
- MaintenanceLedgEntry.Amount := FAAmount;
- MaintenanceLedgEntry."VAT Amount" := VATAmount;
- MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
- MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
- PostMaintenance();
- end else begin
- MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
- FALedgEntry.Amount := FAAmount;
- FALedgEntry."VAT Amount" := VATAmount;
- FALedgEntry."Transaction No." := NextTransactionNo;
- FALedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostFixedAssetFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount, GLRegisterNo);
- PostFixedAsset();
- end;
+ GenJnlPostLineContinue(GenJnlLine, FAAmount, VATAmount, NextTransactionNo, NextGLEntryNo, GLRegisterNo);
+ end;
+ end;
- FAInsertLedgEntry.CopyRecordLinksToFALedgEntry(GenJnlLine);
+ [Scope('OnPrem')]
+ procedure GenJnlPostLineContinue(GenJnlLine: Record "Gen. Journal Line"; FAAmount: Decimal; VATAmount: Decimal; NextTransactionNo: Integer; NextGLEntryNo: Integer; GLRegisterNo: Integer)
+ begin
+ FAInsertLedgEntry.SetGLRegisterNo(GLRegisterNo);
+ if GenJnlLine."Account No." = '' then
+ exit;
+ if GenJnlLine."FA Posting Date" = 0D then
+ GenJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ if GenJnlLine."Journal Template Name" = '' then
+ GenJnlLine.Quantity := 0;
+ DuplicateDeprBook.DuplicateGenJnlLine(GenJnlLine, FAAmount);
+ FANo := GenJnlLine."Account No.";
+ BudgetNo := GenJnlLine."Budgeted FA No.";
+ DeprBookCode := GenJnlLine."Depreciation Book Code";
+ FAPostingType := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAPostingDate := GenJnlLine."FA Posting Date";
+ Amount2 := FAAmount;
+ SalvageValue := GenJnlLine.ConvertAmtFCYToLCYForSourceCurrency(GenJnlLine."Salvage Value");
+ DeprUntilDate := GenJnlLine."Depr. until FA Posting Date";
+ DeprAcqCost := GenJnlLine."Depr. Acquisition Cost";
+ ErrorEntryNo := GenJnlLine."FA Error Entry No.";
+ if GenJnlLine."FA Posting Type" = GenJnlLine."FA Posting Type"::Maintenance then begin
+ MakeMaintenanceLedgEntry.CopyFromGenJnlLine(MaintenanceLedgEntry, GenJnlLine);
+ MaintenanceLedgEntry.Amount := FAAmount;
+ MaintenanceLedgEntry."VAT Amount" := VATAmount;
+ MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
+ MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
+ OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
+ PostMaintenance();
+ end else begin
+ MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
+ FALedgEntry.Amount := FAAmount;
+ FALedgEntry."VAT Amount" := VATAmount;
+ FALedgEntry."Transaction No." := NextTransactionNo;
+ FALedgEntry."G/L Entry No." := NextGLEntryNo;
+ OnBeforePostFixedAssetFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount, GLRegisterNo);
+ PostFixedAsset();
end;
+ FAInsertLedgEntry.CopyRecordLinksToFALedgEntry(GenJnlLine);
+
OnAfterGenJnlPostLine(GenJnlLine);
end;
@@ -203,6 +209,14 @@ codeunit 5632 "FA Jnl.-Post Line"
OnAfterPostFixedAsset(FA, FALedgEntry);
end;
+ [Scope('OnPrem')]
+ procedure InsertBalAcc(var FALedgEntry: Record "FA Ledger Entry")
+ begin
+ FAInsertLedgEntry.SetOrgGenJnlLine(true);
+ FAInsertLedgEntry.InsertBalAcc(FALedgEntry);
+ FAInsertLedgEntry.SetOrgGenJnlLine(false);
+ end;
+
local procedure PostMaintenance()
begin
FA.LockTable();
@@ -232,8 +246,8 @@ codeunit 5632 "FA Jnl.-Post Line"
SalesEntryNo: Integer;
DisposalType: Option FirstDisposal,SecondDisposal,ErrorDisposal,LastErrorDisposal;
OldDisposalMethod: Option " ",Net,Gross;
- EntryAmounts: array[14] of Decimal;
- EntryNumbers: array[14] of Integer;
+ EntryAmounts: array[15] of Decimal;
+ EntryNumbers: array[15] of Integer;
i: Integer;
j: Integer;
IsHandled: Boolean;
@@ -276,7 +290,7 @@ codeunit 5632 "FA Jnl.-Post Line"
if DisposalType = DisposalType::FirstDisposal then begin
CalculateDisposal.CalcGainLoss(FANo, DeprBookCode, EntryAmounts);
- for i := 1 to 14 do
+ for i := 1 to 15 do
if EntryAmounts[i] <> 0 then begin
FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i);
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetFAPostingType(i));
@@ -470,14 +484,14 @@ codeunit 5632 "FA Jnl.-Post Line"
procedure PostReverseType(FALedgEntry: Record "FA Ledger Entry")
var
- EntryAmounts: array[4] of Decimal;
+ EntryAmounts: array[5] of Decimal;
i: Integer;
begin
OnBeforePostReverseType(FALedgEntry);
CalculateDisposal.CalcReverseAmounts(FANo, DeprBookCode, EntryAmounts);
FALedgEntry."FA Posting Category" := FALedgEntry."FA Posting Category"::" ";
FALedgEntry."Automatic Entry" := true;
- for i := 1 to 4 do
+ for i := 1 to 5 do
if EntryAmounts[i] <> 0 then begin
FALedgEntry.Amount := EntryAmounts[i];
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetReverseType(i));
@@ -630,6 +644,24 @@ codeunit 5632 "FA Jnl.-Post Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetNextMatchingFALedgEntry(SourceFAJournalLine: Record "FA Journal Line"; FromEntryNo: Integer; DeprBookCode: Code[10]): Integer
+ var
+ FALedgerEntry: Record "FA Ledger Entry";
+ begin
+ FALedgerEntry.SetCurrentKey("Entry No.");
+ FALedgerEntry.SetFilter("Entry No.", '>%1', FromEntryNo);
+ FALedgerEntry.SetRange("Depreciation Book Code", DeprBookCode);
+#pragma warning disable AA0210
+ FALedgerEntry.SetRange(Amount, -SourceFAJournalLine.Amount);
+#pragma warning restore AA0210
+ FALedgerEntry.SetRange("FA Posting Type", SourceFAJournalLine.ConvertToLedgEntry(SourceFAJournalLine));
+ FALedgerEntry.SetRange("FA No.", SourceFAJournalLine."FA No.");
+ FALedgerEntry.SetRange("FA Posting Date", SourceFAJournalLine."FA Posting Date");
+ FALedgerEntry.FindFirst();
+ exit(FALedgerEntry."Entry No.");
+ end;
+
[IntegrationEvent(true, false)]
local procedure OnAfterFAJnlPostLine(var FAJournalLine: Record "FA Journal Line")
begin
diff --git a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
index 27c6cb4f9f..d96cede5ea 100644
--- a/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
+++ b/src/Layers/IT/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
@@ -117,7 +117,10 @@ codeunit 5642 "FA Reclass. Transfer Line"
if j = 7 then
j := 9;
Convert(OldNewFA, j, FAPostingType, Sign, FANo);
- i := FAPostingType.AsInteger() + 1;
+ if FAPostingType = FAPostingType::Derogatory then
+ i := 7
+ else
+ i := FAPostingType.AsInteger() + 1;
TemplateName := '';
BatchName := '';
if TransferType[i] and (Amounts[i] <> 0) then begin
@@ -155,6 +158,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FADeprBook.CalcFields("Custom 1");
if TransferType[6] then
FADeprBook.CalcFields("Custom 2");
+ if TransferType[7] then
+ FADeprBook.CalcFields("Derogatory Amount");
if TransferType[9] then
FADeprBook.CalcFields("Salvage Value");
Amounts[1] := FADeprBook."Acquisition Cost";
@@ -163,6 +168,7 @@ codeunit 5642 "FA Reclass. Transfer Line"
Amounts[4] := FADeprBook.Appreciation;
Amounts[5] := FADeprBook."Custom 1";
Amounts[6] := FADeprBook."Custom 2";
+ Amounts[7] := FADeprBook."Derogatory Amount";
Amounts[9] := FADeprBook."Salvage Value";
OnCalcAmountsOnAfterSetAmounts(FADeprBook, Amounts, TransferType);
if Amounts[1] = 0 then
@@ -193,6 +199,7 @@ codeunit 5642 "FA Reclass. Transfer Line"
TransferType[4] := FAReclassJnlLine."Reclassify Appreciation";
TransferType[5] := FAReclassJnlLine."Reclassify Custom 1";
TransferType[6] := FAReclassJnlLine."Reclassify Custom 2";
+ TransferType[7] := FAReclassJnlLine."Reclass. Derogatory";
TransferType[9] := FAReclassJnlLine."Reclassify Salvage Value";
end;
@@ -233,6 +240,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAPostingType := FAPostingType::"Custom 2";
6:
FAPostingType := FAPostingType::Appreciation;
+ 7:
+ FAPostingType := FAPostingType::Derogatory;
9:
FAPostingType := FAPostingType::"Acquisition Cost";
end;
@@ -250,6 +259,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAPostingType := FAPostingType::"Custom 1";
6:
FAPostingType := FAPostingType::"Custom 2";
+ 7:
+ FAPostingType := FAPostingType::Derogatory;
9:
FAPostingType := FAPostingType::Depreciation;
end;
diff --git a/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index f598f1f262..b77a854854 100644
--- a/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -589,6 +590,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3382,6 +3384,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3397,6 +3400,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3609,6 +3613,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4227,6 +4236,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -6056,6 +6067,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8188,6 +8214,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index ca83d4b7c7..247ba494d5 100644
--- a/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/NA/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1645,6 +1645,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/NA/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/NA/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index d93fec1e70..b5034721a3 100644
--- a/src/Layers/NA/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/NA/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -21,6 +21,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -126,6 +127,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -190,6 +192,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
CannotUnapplyEmptySrcCurrErr: Label 'Cannot unapply an entry when %1 is not equal to zero, and %2 is empty. Please try to unapply from an opposite entry.', Comment = '%1 - Realized Amount caption, %2 - Source Currency Code caption';
///
@@ -1193,7 +1198,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1826,7 +1830,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1853,6 +1857,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -8072,6 +8083,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -8224,6 +8278,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
@@ -11613,4 +11727,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index eacba81f46..8c065f8f2c 100644
--- a/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -580,6 +581,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3348,6 +3350,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3363,6 +3366,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3575,6 +3579,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4123,6 +4132,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
Text1000000: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.';
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
@@ -5952,6 +5963,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8092,6 +8118,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index 9fdf884d46..8edf4dd47b 100644
--- a/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/NL/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1646,6 +1646,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/NL/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/NL/DemoTool/CreateFAPostingGroup.Codeunit.al
index 5766004be5..a151b5e5b6 100644
--- a/src/Layers/NL/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/NL/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -50,6 +50,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index ae5a7ea7f1..89bb1047cb 100644
--- a/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -211,6 +211,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -581,6 +582,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3360,6 +3362,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3375,6 +3378,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3587,6 +3591,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4341,6 +4350,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -6172,6 +6183,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8318,6 +8344,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index d7491883d7..856987288b 100644
--- a/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/NO/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1647,6 +1647,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/NO/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/NO/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index 280d425cb3..5d14a2f837 100644
--- a/src/Layers/NO/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/NO/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -21,6 +21,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -125,6 +126,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
NorwegianVATTools: Codeunit "Norwegian VAT Tools";
RemTools: Codeunit "Remittance Tools";
DeferralUtilities: Codeunit "Deferral Utilities";
@@ -192,6 +194,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1123,7 +1128,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1730,7 +1734,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1761,6 +1765,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -7690,6 +7701,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -7830,6 +7884,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
local procedure GLEntryCalcPropDeduction(GenJnlLine: Record "Gen. Journal Line"; GLEntry: Record "G/L Entry"; VATPostingSetup: Record "VAT Posting Setup")
var
Adjusted: Boolean;
@@ -11224,4 +11338,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 3f7f8e0386..82649948f5 100644
--- a/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -214,6 +214,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -625,6 +626,7 @@ table 81 "Gen. Journal Line"
VATReinstMgt.CheckAmount(Rec);
ValidateAmount();
+ GetDerogatorySetup();
SetExportStatus();
UpdatePaymentVATInfo(true);
@@ -3424,6 +3426,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3439,6 +3442,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3651,6 +3655,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -5080,6 +5089,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -6942,6 +6953,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -9241,6 +9267,8 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
+
if "Employee No." = '' then
"Employee No." := FA."Responsible Employee";
if "FA Location Code" = '' then
diff --git a/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index b9c1dddd80..03d02d920b 100644
--- a/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/RU/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1644,6 +1644,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/RU/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/RU/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index b0ef163bf4..f4290ef1ff 100644
--- a/src/Layers/RU/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/RU/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -132,6 +132,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
VATEntryToRealize: Record "VAT Entry";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
PrepmtDiffMgt: Codeunit PrepmtDiffManagement;
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
@@ -203,9 +204,12 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
-#pragma warning disable AA0470
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'Not a derogatory line.';
MustNotBeAfterErr: Label 'Posting date must not be after %1 in %2 entry no. %3.';
-#pragma warning restore AA0470
+#pragma warning restore AA0470
+#pragma warning restore AA0074
MultipleEntriesApplnErr: Label 'Only application of one entry to several entries is allowed in Russian version.';
#pragma warning disable AA0470
CheckApplnDateCustErr: Label 'Check Application Date is not possible for Customer %1 if Application Method = Apply to Oldest.';
@@ -1386,7 +1390,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -2142,7 +2145,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -2169,6 +2172,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -9480,6 +9490,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -9620,6 +9673,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
@@ -13655,4 +13768,4 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure OnPostUnapplyOnBeforeInsertTempVATEntry(var VATEntry: Record "VAT Entry"; var UnapplyVATEntries: Boolean)
begin
end;
-}
\ No newline at end of file
+}
diff --git a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
index 1d20d6cbae..7a1fb011cf 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
@@ -26,6 +26,40 @@ report 5692 "Calculate Depreciation"
dataitem("Fixed Asset"; "Fixed Asset")
{
RequestFilterFields = "No.", "FA Class Code", "FA Subclass Code", "Budgeted Asset";
+ dataitem(CalcDerogDepr; "Fixed Asset")
+ {
+ DataItemLink = "No." = field("No.");
+ DataItemTableView = sorting("No.");
+
+ trigger OnAfterGetRecord()
+ begin
+ if not HasDerogatorySetup then
+ CurrReport.Skip();
+
+ CalculateDepr.Calculate(
+ DeprAmount, Custom1Amount, NumberOfDays, Custom1NumberOfDays,
+ "No.", DeprBook2.Code, DeprUntilDate, EntryAmounts, 0D, DaysInPeriod);
+
+ if DeprAmount2 <> 0 then
+ if not DeprBook."Integration G/L - Derogatory" or "Budgeted Asset" then begin
+ TempFAJnlLine."FA No." := "No.";
+ TempFAJnlLine."FA Posting Type" := TempFAJnlLine."FA Posting Type"::Derogatory;
+ TempFAJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempFAJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempFAJnlLine."FA Error Entry No." := ErrorNo;
+ TempFAJnlLine."Line No." := TempFAJnlLine."Line No." + 1;
+ TempFAJnlLine.Insert();
+ end else begin
+ TempGenJnlLine."Account No." := "No.";
+ TempGenJnlLine."FA Posting Type" := TempGenJnlLine."FA Posting Type"::Derogatory;
+ TempGenJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempGenJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempGenJnlLine."FA Error Entry No." := ErrorNo;
+ TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
+ TempGenJnlLine.Insert();
+ end;
+ end;
+ }
trigger OnAfterGetRecord()
begin
@@ -34,6 +68,12 @@ report 5692 "Calculate Depreciation"
CalculateDepr.DepreciationBonus(DeprBonus);
+ HasDerogatorySetup := false;
+ FADeprBook.SetRange("FA No.", "No.");
+ FADeprBook.SetRange("Depreciation Book Code", DeprBook2.Code);
+ if FADeprBook.Find('-') then
+ HasDerogatorySetup := true;
+
OnBeforeCalculateDepreciation(
"No.", TempGenJnlLine, TempFAJnlLine, DeprAmount, NumberOfDays, DeprBookCode, DeprUntilDate, EntryAmounts, DaysInPeriod);
@@ -106,6 +146,10 @@ report 5692 "Calculate Depreciation"
TempGenJnlLine."Tax Difference Code" := "Tax Difference Code";
TempGenJnlLine.Insert();
end;
+
+ if HasDerogatorySetup then
+ DeprAmount2 := DeprAmount;
+
end;
trigger OnPostDataItem()
@@ -460,7 +504,14 @@ report 5692 "Calculate Depreciation"
GeneralLedgerSetup.Get();
FASetup.Get();
+ Clear(DeprBook2);
DeprBook.Get(DeprBookCode);
+
+ if DeprBook."Derogatory Calc." <> '' then
+ Error(Text10800, DeprBook.Code);
+ DeprBook2.SetRange("Derogatory Calc.", DeprBookCode);
+ if DeprBook2.Find('-') then;
+
if DeprUntilDate = 0D then
Error(Text000, FAJnlLine.FieldCaption("FA Posting Date"));
if PostingDate = 0D then
@@ -492,6 +543,8 @@ report 5692 "Calculate Depreciation"
FAJnlSetup: Record "FA Journal Setup";
GLSetup: Record "General Ledger Setup";
GeneralLedgerSetup: Record "General Ledger Setup";
+ DeprBook2: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
CalculateDepr: Codeunit "Calculate Depreciation";
FAInsertGLAcc: Codeunit "FA Insert G/L Account";
ErrorMessageMgt: Codeunit "Error Message Management";
@@ -510,6 +563,8 @@ report 5692 "Calculate Depreciation"
GenJnlNextLineNo: Integer;
EntryAmounts: array[4] of Decimal;
LineNo: Integer;
+ DeprAmount2: Decimal;
+ HasDerogatorySetup: Boolean;
FAJnlLineCreatedCount: Integer;
GenJnlLineCreatedCount: Integer;
DeprUntilDateModified: Boolean;
@@ -552,7 +607,10 @@ report 5692 "Calculate Depreciation"
#pragma warning restore AA0074
#pragma warning disable AA0074
Text006: Label 'Use Force No. of Days must be activated.';
-#pragma warning restore AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'Depreciation cannot be posted on depreciation book %1 because it is set up as derogatory.';
+#pragma warning restore AA0074
+#pragma warning restore AA0470
Details: Boolean;
#pragma warning disable AA0074
Text12411: Label 'DP-';
@@ -625,6 +683,12 @@ report 5692 "Calculate Depreciation"
ErrorMessageMgt.Activate(ErrorMessageHandler);
end;
+ [Scope('OnPrem')]
+ procedure CalcDerogDeprAmount(Amount1: Decimal; Amount2: Decimal): Decimal
+ begin
+ exit(Amount1 - Amount2);
+ end;
+
procedure InitializeRequest2(NewDeprBookCode: Code[10]; NewPostingDate: Date; NewDeprUntilDate: Date; NewDocumentNo: Code[20]; NewPostingDescription: Text[100]; NewUseForceNoOfDays: Boolean; NewDaysInPeriod: Integer; NewBalAccount: Boolean; ChangeDetails: Boolean; NewDeprBonus: Boolean)
begin
ClearAll();
diff --git a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
index 15ebed0f1a..e6b1404188 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
@@ -23,6 +23,8 @@ codeunit 5611 "Calculate Normal Depreciation"
FALedgEntry: Record "FA Ledger Entry";
DeprBook: Record "Depreciation Book";
FADeprBook: Record "FA Depreciation Book";
+ DerogFALedgEntry: Record "FA Ledger Entry";
+ DerogDeprBook: Record "Depreciation Book";
DeprGroup: Record "Depreciation Group";
DepreciationCalc: Codeunit "Depreciation Calculation";
DeprBookCode: Code[10];
@@ -704,6 +706,18 @@ codeunit 5611 "Calculate Normal Depreciation"
BookValue := FADeprBook."Book Value" + DeprBonusAmount;
end else
BookValue := EntryAmounts[1];
+ if DateFromProjection = 0D then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.FindFirst() then begin
+ DerogFALedgEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date");
+ DerogFALedgEntry.SetRange("FA No.", FADeprBook."FA No.");
+ DerogFALedgEntry.SetRange("Depreciation Book Code", FADeprBook."Depreciation Book Code");
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1&<>%2', DerogFALedgEntry."FA Posting Type"::Derogatory,
+ DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ DerogFALedgEntry.CalcSums(Amount);
+ BookValue := DerogFALedgEntry.Amount;
+ end;
+ end;
MinusBookValue := DepreciationCalc.GetMinusBookValue(FA."No.", DeprBookCode, 0D, 0D) + DepreciationCalc.GetUnpostedBonusDepreciationForCalc(FADeprBook, 0D, 0D);
FADeprBook.CalcFields("Depreciable Basis", "Salvage Value");
DeprBasis := FADeprBook."Depreciable Basis";
diff --git a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index ece6e4a9ac..692008ffa9 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -43,32 +43,59 @@ table 5611 "Depreciation Book"
if "G/L Integration - Acq. Cost" then
if TaxDeprBook() then
TaxRegisterSetup.TestField("Create Acquis. FA Tax Ledger", false);
+
+ CheckIntegrationFields();
end;
}
field(4; "G/L Integration - Depreciation"; Boolean)
{
Caption = 'G/L Integration - Depreciation';
ToolTip = 'Specifies whether depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(5; "G/L Integration - Write-Down"; Boolean)
{
Caption = 'G/L Integration - Write-Down';
ToolTip = 'Specifies whether write-down entries posted to this depreciation book should be posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(6; "G/L Integration - Appreciation"; Boolean)
{
Caption = 'G/L Integration - Appreciation';
ToolTip = 'Specifies whether appreciation entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(7; "G/L Integration - Custom 1"; Boolean)
{
Caption = 'G/L Integration - Custom 1';
ToolTip = 'Specifies whether custom 1 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(8; "G/L Integration - Custom 2"; Boolean)
{
Caption = 'G/L Integration - Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(9; "G/L Integration - Disposal"; Boolean)
{
@@ -80,12 +107,19 @@ table 5611 "Depreciation Book"
if "G/L Integration - Disposal" then
if TaxDeprBook() then
TaxRegisterSetup.TestField("Create Disposal FA Tax Ledger", false);
+
+ CheckIntegrationFields();
end;
}
field(10; "G/L Integration - Maintenance"; Boolean)
{
Caption = 'G/L Integration - Maintenance';
ToolTip = 'Specifies whether maintenance entries that are posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(11; "Disposal Calculation Method"; Option)
{
@@ -341,6 +375,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -468,7 +562,17 @@ table 5611 "Depreciation Book"
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
TaxRegisterSetup: Record "Tax Register Setup";
+ GLIntegration: array[13] of Boolean;
MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
+ Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
+ Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
+ Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
+ Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
#pragma warning disable AA0074
Text000: Label 'The book cannot be deleted because it is in use.';
@@ -483,7 +587,9 @@ table 5611 "Depreciation Book"
protected var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- procedure IndexGLIntegration(var GLIntegration: array[9] of Boolean)
+#pragma warning disable AA0244
+ procedure IndexGLIntegration(var GLIntegration: array[13] of Boolean)
+#pragma warning restore AA0244
begin
GLIntegration[1] := "G/L Integration - Acq. Cost";
GLIntegration[2] := "G/L Integration - Depreciation";
@@ -494,6 +600,26 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
+ GLIntegration[13] := "Integration G/L - Derogatory";
+ end;
+
+ [Scope('OnPrem')]
+ procedure CheckIntegrationFields()
+ var
+ i: Integer;
+ begin
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end;
+ end;
+
+ [Scope('OnPrem')]
+ procedure IsDerogatoryBook(): Boolean
+ begin
+ exit("Derogatory Calc." <> '');
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index 91092a5c0a..b89d84f3c4 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -63,6 +63,16 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ }
field("Posting Book Type"; Rec."Posting Book Type")
{
ApplicationArea = FixedAssets;
@@ -182,6 +192,12 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Bonus Depreciation';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ }
}
}
group(Duplication)
diff --git a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
index 508d9d6634..eeb2658084 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
@@ -522,7 +522,7 @@ codeunit 5616 "Depreciation Calculation"
FiscalYearBegin := FADateCalc.GetFiscalYear(DeprBookCode, StartingDate);
SetFAFilter(FALedgEntry, FANo, DeprBookCode, true);
FALedgEntry.SetFilter("FA Posting Date", '%1..', FiscalYearBegin);
- FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Depreciation);
+ FALedgEntry.SetFilter("FA Posting Type", '%1|%2', FALedgEntry."FA Posting Type"::Depreciation, FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("Part of Book Value", true);
FALedgEntry.SetRange("Reclassification Entry", false);
FALedgEntry.CalcSums(Amount);
diff --git a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
index c0564a1066..9946f3b3f1 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
@@ -381,7 +381,8 @@ table 5612 "FA Depreciation Book"
"FA Location Code" = field("FA Location Code Filter"),
"Global Dimension 1 Code" = field("Global Dimension 1 Filter"),
"Global Dimension 2 Code" = field("Global Dimension 2 Filter"),
- "Employee No." = field("FA Employee Filter")));
+ "Employee No." = field("FA Employee Filter"),
+ "Derogatory Excluded" = const(false)));
Caption = 'Book Value';
ToolTip = 'Specifies the book value for the fixed asset.';
Editable = false;
@@ -954,6 +955,24 @@ table 5612 "FA Depreciation Book"
FieldError("Default FA Depreciation Book", OnlyOneDefaultDeprBookErr);
end;
}
+ field(5865; "Derogatory Amount"; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = GetCurrencyCode();
+ CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
+ "Depreciation Book Code" = field("Depreciation Book Code"),
+ "FA Posting Category" = const(" "),
+ "FA Posting Type" = const(Derogatory),
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
+ Caption = 'Derogatory';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5866; "Last Derogatory"; Date)
+ {
+ Caption = 'Last Derogatory Date';
+ }
field(12400; "Depreciated Cost"; Decimal)
{
AutoFormatType = 1;
@@ -1581,6 +1600,7 @@ table 5612 "FA Depreciation Book"
FALedgerEntry.SetRange("FA No.", "FA No.");
FALedgerEntry.SetRange("Depreciation Book Code", "Depreciation Book Code");
FALedgerEntry.SetRange("Part of Book Value", true);
+ FALedgerEntry.SetRange("Derogatory Excluded", false);
OnAfterSetBookValueFiltersOnFALedgerEntry(FALedgerEntry);
end;
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
index 43d0e6113e..9c48906457 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
@@ -25,7 +25,7 @@ codeunit 5605 "Calculate Disposal"
FADeprBook: Record "FA Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
- procedure CalcGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[14] of Decimal)
+ procedure CalcGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[15] of Decimal)
var
EntryAmounts2: array[4] of Decimal;
GainLoss: Decimal;
@@ -42,10 +42,11 @@ codeunit 5605 "Calculate Disposal"
EntryAmounts[I + 4] := -EntryAmounts2[I];
FADeprBook.Get(FANo, DeprBookCode);
FADeprBook.CalcFields(
- "Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation);
+ "Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation, "Derogatory Amount");
EntryAmounts[3] := -FADeprBook."Acquisition Cost";
EntryAmounts[4] := -FADeprBook.Depreciation;
EntryAmounts[9] := -FADeprBook."Salvage Value";
+ EntryAmounts[15] := -FADeprBook."Derogatory Amount";
OnCalcGainLossOnAfterSetEntryAmounts(FANo, DeprBookCode, EntryAmounts);
if DeprBook."Disposal Calculation Method" = DeprBook."Disposal Calculation Method"::Gross then
EntryAmounts[10] := FADeprBook."Book Value";
@@ -67,7 +68,7 @@ codeunit 5605 "Calculate Disposal"
EntryAmounts[2] := GainLoss;
end;
- procedure CalcSecondGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; LastDisposalPrice: Decimal; var EntryAmounts: array[14] of Decimal)
+ procedure CalcSecondGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; LastDisposalPrice: Decimal; var EntryAmounts: array[15] of Decimal)
var
NewGainLoss: Decimal;
begin
@@ -92,10 +93,9 @@ codeunit 5605 "Calculate Disposal"
end;
end;
- procedure CalcReverseAmounts(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[4] of Decimal)
+ procedure CalcReverseAmounts(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[5] of Decimal)
var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- FADeprBook: Record "FA Depreciation Book";
BookValueAmounts: array[4] of Decimal;
i: Integer;
IsHandled: Boolean;
@@ -133,6 +133,8 @@ codeunit 5605 "Calculate Disposal"
FAPostingTypeSetup.TestField("Reverse before Disposal", false);
end;
end;
+
+ EntryAmounts[5] := -CalcDerogatoryReverseAmount(FADeprBook);
end;
procedure GetDisposalType(FANo: Code[20]; DeprBookCode: Code[10]; ErrorNo: Integer; var DisposalType: Option FirstDisposal,SecondDisposal,ErrorDisposal,LastErrorDisposal; var DisposalMethod: Option " ",Net,Gross; var MaxDisposalNo: Integer; var SalesEntryNo: Integer)
@@ -190,7 +192,7 @@ codeunit 5605 "Calculate Disposal"
OnAfterGetDisposalMethod(DisposalMethod);
end;
- procedure GetErrorDisposal(FANo: Code[20]; DeprBookCode: Code[10]; OnlyGainLoss: Boolean; MaxDisposalNo: Integer; var EntryAmounts: array[14] of Decimal; var EntryNumbers: array[14] of Integer)
+ procedure GetErrorDisposal(FANo: Code[20]; DeprBookCode: Code[10]; OnlyGainLoss: Boolean; MaxDisposalNo: Integer; var EntryAmounts: array[15] of Decimal; var EntryNumbers: array[15] of Integer)
var
FALedgEntry: Record "FA Ledger Entry";
i: Integer;
@@ -252,6 +254,8 @@ codeunit 5605 "Calculate Disposal"
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Salvage Value";
10:
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Book Value on Disposal";
+ 15:
+ FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Derogatory;
end;
OnAfterSetFAPostingType(i, FALedgEntry);
exit(FALedgEntry."FA Posting Type".AsInteger());
@@ -286,12 +290,27 @@ codeunit 5605 "Calculate Disposal"
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Custom 1";
4:
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Custom 2";
+ 5:
+ FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Derogatory;
end;
exit(FALedgEntry."FA Posting Type".AsInteger());
end;
+ local procedure CalcDerogatoryReverseAmount(FADepreciationBook: Record "FA Depreciation Book"): Decimal
+ var
+ FALedgEntry: Record "FA Ledger Entry";
+ begin
+ FALedgEntry.SetRange("FA No.", FADepreciationBook."FA No.");
+ FALedgEntry.SetRange("Depreciation Book Code", FADepreciationBook."Depreciation Book Code");
+ FALedgEntry.SetRange("FA Posting Category", FALedgEntry."FA Posting Category"::" ");
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+ FALedgEntry.SetFilter("FA Posting Date", FADepreciationBook.GetFilter("FA Posting Date Filter"));
+ FALedgEntry.CalcSums(Amount);
+ exit(FALedgEntry.Amount);
+ end;
+
[Scope('OnPrem')]
- procedure CalcGainLossDisposalLowValueFA(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[14] of Decimal)
+ procedure CalcGainLossDisposalLowValueFA(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[15] of Decimal)
var
GainLoss: Decimal;
begin
@@ -309,7 +328,7 @@ codeunit 5605 "Calculate Disposal"
end;
[Scope('OnPrem')]
- procedure GetErrorDisposalLowValueFA(ErrFALedgEntry: Record "FA Ledger Entry"; ErrorEntryNo: Integer; var EntryAmounts: array[14] of Decimal; var EntryNumbers: array[14] of Integer)
+ procedure GetErrorDisposalLowValueFA(ErrFALedgEntry: Record "FA Ledger Entry"; ErrorEntryNo: Integer; var EntryAmounts: array[15] of Decimal; var EntryNumbers: array[14] of Integer)
var
FALedgEntry: Record "FA Ledger Entry";
TransactionNo: Integer;
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al
index e46527b344..23d87bff47 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al
@@ -22,7 +22,7 @@ codeunit 5624 "Cancel FA Ledger Entries"
GenJnlLine: Record "Gen. Journal Line";
FAJnlLine: Record "FA Journal Line";
FA: Record "Fixed Asset";
- GLIntegration: array[9] of Boolean;
+ GLIntegration: array[13] of Boolean;
FAJnlNextLineNo: Integer;
GenJnlNextLineNo: Integer;
DeprBookCode: Code[10];
@@ -96,7 +96,8 @@ codeunit 5624 "Cancel FA Ledger Entries"
if IsHandled then
exit;
- if (FALedgEntry."FA Posting Type".AsInteger() > FALedgEntry."FA Posting Type"::"Salvage Value".AsInteger()) or
+ if ((FALedgEntry."FA Posting Type".AsInteger() > FALedgEntry."FA Posting Type"::"Salvage Value".AsInteger()) and
+ (FALedgEntry."FA Posting Type".AsInteger() <> FALedgEntry."FA Posting Type"::Derogatory.AsInteger())) or
(FALedgEntry."FA Posting Category" <> FALedgEntry."FA Posting Category"::" ")
then begin
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Proceeds on Disposal";
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
index cedeedb7c5..fb0e36c8e1 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
@@ -87,6 +87,7 @@ codeunit 5606 "FA Check Consistency"
DeprBasis: Decimal;
SalvageValue: Decimal;
NewAmount: Decimal;
+ DerogAmount: Decimal;
#pragma warning disable AA0074
#pragma warning disable AA0470
@@ -160,6 +161,9 @@ codeunit 5606 "FA Check Consistency"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Salvage Value");
FALedgEntry.CalcSums(Amount);
SalvageValue := FALedgEntry.Amount;
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+ FALedgEntry.CalcSums(Amount);
+ DerogAmount := FALedgEntry.Amount;
FALedgEntry.SetRange("FA Posting Type", FALedgEntry2."FA Posting Type");
FALedgEntry.CalcSums(Amount);
NewAmount := FALedgEntry.Amount;
@@ -178,6 +182,8 @@ codeunit 5606 "FA Check Consistency"
if FALedgEntry."Part of Depreciable Basis" then
DeprBasis := DeprBasis + FALedgEntry.Amount;
end;
+ if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::Derogatory then
+ DerogAmount := DerogAmount + FALedgEntry.Amount;
if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::"Salvage Value" then
SalvageValue := SalvageValue + FALedgEntry.Amount;
if FALedgEntry."FA Posting Type" = FALedgEntry2."FA Posting Type" then
@@ -309,6 +315,8 @@ codeunit 5606 "FA Check Consistency"
FADeprBook."Last Appreciation Date" := MaxDate;
FALedgEntry2."FA Posting Type"::"Custom 1":
FADeprBook."Last Custom 1 Date" := MaxDate;
+ FALedgEntry2."FA Posting Type"::Derogatory:
+ FADeprBook."Last Derogatory" := MaxDate;
FALedgEntry2."FA Posting Type"::"Custom 2":
FADeprBook."Last Custom 2 Date" := MaxDate;
FALedgEntry2."FA Posting Type"::"Proceeds on Disposal":
@@ -368,13 +376,14 @@ codeunit 5606 "FA Check Consistency"
CreatePostingTypeError();
end;
end;
- if BookValue + SalvageValue < 0 then
+ if BookValue + SalvageValue - DerogAmount < 0 then
if not DeprBook."Allow Depr. below Zero" or
- (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::Depreciation)
+ ((FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::Depreciation) and
+ (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::Derogatory))
then
if not DeprBook."Allow Acq. Cost below Zero" or
- (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::"Acquisition Cost") or
- not FALedgEntry2."Index Entry"
+ (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::"Acquisition Cost") or
+ not FALedgEntry2."Index Entry"
then
if not FALedgEntry2."Reclassification Entry" then
if not IsFAMovement() then
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al
index 0d1586c060..e370be8497 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al
@@ -44,6 +44,8 @@ codeunit 5602 "FA Get G/L Account No."
GLAccNo := FAPostingGr.GetCustom1Account();
FALedgEntry."FA Posting Type"::"Custom 2":
GLAccNo := FAPostingGr.GetCustom2Account();
+ FALedgEntry."FA Posting Type"::Derogatory:
+ GLAccNo := FAPostingGr.GetDerogatoryAccount();
FALedgEntry."FA Posting Type"::"Proceeds on Disposal":
GLAccNo := FAPostingGr.GetSalesAccountOnDisposalGain();
FALedgEntry."FA Posting Type"::"Gain/Loss":
@@ -75,6 +77,8 @@ codeunit 5602 "FA Get G/L Account No."
GLAccNo := FAPostingGr.GetCustom1AccountOnDisposal();
FALedgEntry."FA Posting Type"::"Custom 2":
GLAccNo := FAPostingGr.GetCustom2AccountOnDisposal();
+ FALedgEntry."FA Posting Type"::Derogatory:
+ GLAccNo := FAPostingGr.GetDerogatoryAccountDecrease();
FALedgEntry."FA Posting Type"::"Book Value on Disposal":
begin
if FALedgEntry."Result on Disposal" = FALedgEntry."Result on Disposal"::Gain then
@@ -95,6 +99,8 @@ codeunit 5602 "FA Get G/L Account No."
GLAccNo := FAPostingGr.GetCustom1BalAccountOnDisposal();
FALedgEntry."FA Posting Type"::"Custom 2":
GLAccNo := FAPostingGr.GetCustom2BalAccountOnDisposal();
+ FALedgEntry."FA Posting Type"::Derogatory:
+ GLAccNo := FAPostingGr.GetDerogatoryBalAccountDecrease();
end;
OnAfterGetAccNo(FALedgEntry, GLAccNo);
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
index 6110c60d05..478268f8a5 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
@@ -146,6 +146,8 @@ codeunit 5639 "FA Get Journal"
exit(DeprBook."G/L Integration - Maintenance");
FAPostingType::"Salvage Value":
exit(false);
+ FAPostingType::Derogatory:
+ exit(DeprBook."Integration G/L - Derogatory");
end;
OnAfterCalcGLIntegration(DeprBook, FAPostingType, Result);
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
index 480b3fe64f..3f5a92b22b 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
@@ -147,7 +147,7 @@ codeunit 5601 "FA Insert G/L Account"
FAPostingGr.Reset();
FAPostingGr.GetPostingGroup(PostingGrCode, DeprBookCode);
OnInsertBufferBalAccOnAfterGetFAPostingGroup(FAPostingGr);
- GLAccNo := GetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType);
+ GLAccNo := GetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType, AllocAmount);
DimensionSetIDArr[1] := DimSetID;
@@ -405,7 +405,7 @@ codeunit 5601 "FA Insert G/L Account"
GenJnlLine.Modify(true);
end;
- local procedure GetGLAccNoFromFAPostingGroup(FAPostingGr: Record "FA Posting Group"; FAPostingType: Enum "FA Posting Group Account Type") GLAccNo: Code[20]
+ local procedure GetGLAccNoFromFAPostingGroup(FAPostingGr: Record "FA Posting Group"; FAPostingType: Enum "FA Posting Group Account Type"; AllocAmount: Decimal) GLAccNo: Code[20]
var
FieldErrorText: Text[50];
IsHandled: Boolean;
@@ -502,6 +502,19 @@ codeunit 5601 "FA Insert G/L Account"
if FAPostingGr."Allocated Book Value % (Loss)" > 100 then
FAPostingGr.FieldError("Allocated Book Value % (Loss)", FieldErrorText);
end;
+ FAPostingType::Derogatory:
+ begin
+ if AllocAmount > 0 then begin
+ FAPostingGr.TestField("Derogatory Expense Acc.");
+ GLAccNo := FAPostingGr."Derogatory Expense Acc."
+ end else begin
+ FAPostingGr.TestField("Derog. Bal. Account (Decrease)");
+ GLAccNo := FAPostingGr."Derog. Bal. Account (Decrease)";
+ end;
+ FAPostingGr.CalcFields("Allocated Derogatory Pct.");
+ if FAPostingGr."Allocated Derogatory Pct." > 100 then
+ FAPostingGr.FieldError("Allocated Derogatory Pct.", FieldErrorText);
+ end;
end;
OnAfterGetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType, GLAccNo);
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
index f1a7322f98..e4ffb6d718 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
@@ -173,6 +173,7 @@ codeunit 5600 "FA Insert Ledger Entry"
(LastEntryNo > 0)
then
CheckFADocNo(FALedgEntry);
+ FALedgEntry."Derogatory Excluded" := CalcExcludeDerogatory(FALedgEntry);
if GLSetup."Enable Russian Accounting" then begin
if FALedgEntry."FA Posting Category" = FALedgEntry."FA Posting Category"::Disposal then
@@ -283,7 +284,9 @@ codeunit 5600 "FA Insert Ledger Entry"
OnInsertFAOnBeforeFACheckConsistency(FALedgEntry, FALedgEntry3);
if FALedgEntry3."FA Posting Category" = FALedgEntry3."FA Posting Category"::" " then
- if FALedgEntry3."FA Posting Type".AsInteger() <= FALedgEntry3."FA Posting Type"::"Salvage Value".AsInteger() then
+ if (FALedgEntry3."FA Posting Type".AsInteger() <= FALedgEntry3."FA Posting Type"::"Salvage Value".AsInteger()) or
+ (FALedgEntry3."FA Posting Type" = FALedgEntry3."FA Posting Type"::Derogatory)
+ then
CODEUNIT.Run(CODEUNIT::"FA Check Consistency", FALedgEntry);
OnBeforeInsertRegister(FALedgEntry, FALedgEntry2, NextEntryNo);
@@ -382,6 +385,7 @@ codeunit 5600 "FA Insert Ledger Entry"
end;
case FALedgerEntry."FA Posting Type" of
"FA Ledger Entry FA Posting Type"::"Acquisition Cost",
+ "FA Ledger Entry FA Posting Type"::Derogatory,
"FA Ledger Entry FA Posting Type"::Depreciation,
"FA Ledger Entry FA Posting Type"::"Bonus Depreciation":
FALedgerEntry."Part of Book Value" := true;
@@ -641,8 +645,11 @@ codeunit 5600 "FA Insert Ledger Entry"
IsHandled := false;
OnInsertReverseEntryOnBeforeInsertTempFALedgEntry(FALedgEntry3, IsHandled);
if not IsHandled then begin
- TempFALedgEntry := FALedgEntry3;
- TempFALedgEntry.Insert();
+ DeprBook.Get(FALedgEntry3."Depreciation Book Code");
+ if DeprBook."Derogatory Calc." = '' then begin
+ TempFALedgEntry := FALedgEntry3;
+ TempFALedgEntry.Insert();
+ end;
end;
SetFAReversalMark(FALedgEntry3, NextEntryNo);
FALedgEntry3."Entry No." := NextEntryNo;
@@ -670,6 +677,7 @@ codeunit 5600 "FA Insert Ledger Entry"
CODEUNIT.Run(CODEUNIT::"FA Check Consistency", FALedgEntry3);
OnInsertReverseEntryOnBeforeInsertRegister(FALedgEntry3);
InsertRegister("FA Register Called From"::"Fixed Asset", NextEntryNo);
+ InsertFARevEntryForDerog(FAEntryType, NewFAEntryNo, FALedgEntry3);
end;
end;
if FAEntryType = FAEntryType::Maintenance then begin
@@ -694,6 +702,8 @@ codeunit 5600 "FA Insert Ledger Entry"
Error(DimMgt.GetDimValuePostingErr());
OnInsertReverseEntryOnBeforeInsertMaintenanceLedgerEntryBuffer(MaintenanceLedgEntry3, SkipInsertOfMaintenanceLedgerEntry);
+ DeprBook.Get(MaintenanceLedgEntry3."Depreciation Book Code");
+ SkipInsertOfMaintenanceLedgerEntry := SkipInsertOfMaintenanceLedgerEntry or (DeprBook."Derogatory Calc." <> '');
if not SkipInsertOfMaintenanceLedgerEntry then begin
TempMaintenanceLedgEntry := MaintenanceLedgEntry3;
TempMaintenanceLedgEntry.Insert()
@@ -823,6 +833,50 @@ codeunit 5600 "FA Insert Ledger Entry"
LastEntryNo := FALedgEntry.GetLastEntryNo();
end;
+ [Scope('OnPrem')]
+ procedure InsertFARevEntryForDerog(FAEntryType: Option " ","Fixed Asset",Maintenance; var NewFAEntryNo: Integer; FALedgEntry: Record "FA Ledger Entry")
+ var
+ FALedgEntryForDerog: Record "FA Ledger Entry";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", FALedgEntry."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ exit;
+ FALedgEntryForDerog.Reset();
+ FALedgEntryForDerog.SetRange("Depreciation Book Code", DeprBook.Code);
+ FALedgEntryForDerog.SetRange("FA No.", FALedgEntry."FA No.");
+ FALedgEntryForDerog.SetRange("FA Posting Type", FALedgEntry."FA Posting Type");
+ FALedgEntryForDerog.SetRange(Amount, -FALedgEntry.Amount);
+ FALedgEntryForDerog.SetRange("Document Type", FALedgEntry."Document Type");
+ FALedgEntryForDerog.SetRange("Document No.", FALedgEntry."Document No.");
+ if FALedgEntryForDerog.FindFirst() then
+ InsertReverseEntry(0, FAEntryType, FALedgEntryForDerog."Entry No.", NewFAEntryNo, 0);
+ end;
+
+ [Scope('OnPrem')]
+ procedure InsertMaintRevEntryForDerog(FAEntryType: Option; var NewFAEntryNo: Integer; MaintenanceLedgEntry: Record "Maintenance Ledger Entry")
+ var
+ MaintLedgEntryForDerog: Record "Maintenance Ledger Entry";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", MaintenanceLedgEntry."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ exit;
+ MaintLedgEntryForDerog.Reset();
+ MaintLedgEntryForDerog.SetRange("Depreciation Book Code", DeprBook.Code);
+ MaintLedgEntryForDerog.SetRange("FA No.", MaintenanceLedgEntry."FA No.");
+ MaintLedgEntryForDerog.SetRange("Document Type", MaintenanceLedgEntry."Document Type");
+ MaintLedgEntryForDerog.SetRange("Document No.", MaintenanceLedgEntry."Document No.");
+ if MaintLedgEntryForDerog.FindFirst() then
+ InsertReverseEntry(0, FAEntryType, MaintLedgEntryForDerog."Entry No.", NewFAEntryNo, 0);
+ end;
+
+ local procedure CalcExcludeDerogatory(FALedgerEntry: Record "FA Ledger Entry"): Boolean
+ var
+ DepreciationBook: Record "Depreciation Book";
+ begin
+ DepreciationBook.Get(FALedgerEntry."Depreciation Book Code");
+ exit((FALedgerEntry."FA Posting Type" = FALedgerEntry."FA Posting Type"::Derogatory) and not DepreciationBook.IsDerogatoryBook());
+ end;
+
[Scope('OnPrem')]
procedure InsertTransfer(var FALedgEntry3: Record "FA Ledger Entry")
begin
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
index a60b8c9990..df3565be88 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
@@ -432,6 +432,8 @@ codeunit 5631 "FA Jnl.-Check Line"
GLIntegration := DeprBook."G/L Integration - Disposal";
FAPostingType::Maintenance:
GLIntegration := DeprBook."G/L Integration - Maintenance";
+ FAPostingType::Derogatory:
+ GLIntegration := DeprBook."Integration G/L - Derogatory";
FAPostingType::"Salvage Value":
GLIntegration := false;
FAPostingType::"Bonus Depreciation":
@@ -580,7 +582,7 @@ codeunit 5631 "FA Jnl.-Check Line"
if GenJnlLine."Depr. until FA Posting Date" then
GenJnlLine.FieldError("Depr. until FA Posting Date", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Derogatory);
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
GenJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
@@ -648,7 +650,7 @@ codeunit 5631 "FA Jnl.-Check Line"
then
FAJnlLine.FieldError("Maintenance Code", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Derogatory);
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
FAJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
index c00230afbc..180bcfb66d 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
@@ -137,68 +137,74 @@ codeunit 5632 "FA Jnl.-Post Line"
IsHandled := false;
OnBeforeGenJnlPostLine(GenJnlLine, FAInsertLedgEntry, FAAmount, VATAmount, NextTransactionNo, NextGLEntryNo, GLRegisterNo, IsHandled);
if not IsHandled then begin
- FAInsertLedgEntry.SetGLRegisterNo(GLRegisterNo);
FAInsertLedgEntry.DeleteAllGLAcc();
- if GenJnlLine."Account No." = '' then
- exit;
- if GenJnlLine."FA Posting Date" = 0D then
- GenJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
- GLSetup.Get();
- if not GLSetup."Enable Russian Accounting" then
- if GenJnlLine."Journal Template Name" = '' then
- GenJnlLine.Quantity := 0;
-
- FA.Get(GenJnlLine."Account No.");
- FASetup.Get();
- if FASetup."FA Location Mandatory" then begin
- if GenJnlLine."FA Location Code" = '' then
- GenJnlLine."FA Location Code" := FA."FA Location Code";
- GenJnlLine.TestField("FA Location Code");
- end;
- if FASetup."Employee No. Mandatory" then begin
- if GenJnlLine."Employee No." = '' then
- GenJnlLine."Employee No." := FA."Responsible Employee";
- GenJnlLine.TestField("Employee No.");
- end;
+ GenJnlPostLineContinue(GenJnlLine, FAAmount, VATAmount, NextTransactionNo, NextGLEntryNo, GLRegisterNo);
+ end;
+ end;
- DuplicateDeprBook.DuplicateGenJnlLine(GenJnlLine, FAAmount);
- FANo := GenJnlLine."Account No.";
- BudgetNo := GenJnlLine."Budgeted FA No.";
- DeprBookCode := GenJnlLine."Depreciation Book Code";
- FAPostingType := "FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
- FAPostingDate := GenJnlLine."FA Posting Date";
- Amount2 := FAAmount;
- SalvageValue := GetLCYSalvageValue(GenJnlLine."Salvage Value", GenJnlLine."Posting Date", GenJnlLine."Source Currency Code");
- DeprUntilDate := GenJnlLine."Depr. until FA Posting Date";
- DeprAcqCost := GenJnlLine."Depr. Acquisition Cost";
- ErrorEntryNo := GenJnlLine."FA Error Entry No.";
- if GenJnlLine."FA Posting Type" = GenJnlLine."FA Posting Type"::Maintenance then begin
- MakeMaintenanceLedgEntry.CopyFromGenJnlLine(MaintenanceLedgEntry, GenJnlLine);
- MaintenanceLedgEntry.Amount := FAAmount;
- MaintenanceLedgEntry."VAT Amount" := VATAmount;
- MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
- MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
- PostMaintenance();
- end else begin
- MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
- FALedgEntry.Amount := FAAmount;
+ [Scope('OnPrem')]
+ procedure GenJnlPostLineContinue(GenJnlLine: Record "Gen. Journal Line"; FAAmount: Decimal; VATAmount: Decimal; NextTransactionNo: Integer; NextGLEntryNo: Integer; GLRegisterNo: Integer)
+ begin
+ FAInsertLedgEntry.SetGLRegisterNo(GLRegisterNo);
+ if GenJnlLine."Account No." = '' then
+ exit;
+ if GenJnlLine."FA Posting Date" = 0D then
+ GenJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ GLSetup.Get();
+ if not GLSetup."Enable Russian Accounting" then
+ if GenJnlLine."Journal Template Name" = '' then
+ GenJnlLine.Quantity := 0;
+
+ FA.Get(GenJnlLine."Account No.");
+ FASetup.Get();
+ if FASetup."FA Location Mandatory" then begin
+ if GenJnlLine."FA Location Code" = '' then
+ GenJnlLine."FA Location Code" := FA."FA Location Code";
+ GenJnlLine.TestField("FA Location Code");
+ end;
+ if FASetup."Employee No. Mandatory" then begin
+ if GenJnlLine."Employee No." = '' then
+ GenJnlLine."Employee No." := FA."Responsible Employee";
+ GenJnlLine.TestField("Employee No.");
+ end;
- if FALedgEntry.Amount > 0 then begin
- FA.Validate("FA Location Code", GenJnlLine."FA Location Code");
- FA."Responsible Employee" := GenJnlLine."Employee No.";
- end;
+ DuplicateDeprBook.DuplicateGenJnlLine(GenJnlLine, FAAmount);
+ FANo := GenJnlLine."Account No.";
+ BudgetNo := GenJnlLine."Budgeted FA No.";
+ DeprBookCode := GenJnlLine."Depreciation Book Code";
+ FAPostingType := "FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAPostingDate := GenJnlLine."FA Posting Date";
+ Amount2 := FAAmount;
+ SalvageValue := GetLCYSalvageValue(GenJnlLine."Salvage Value", GenJnlLine."Posting Date", GenJnlLine."Source Currency Code");
+ DeprUntilDate := GenJnlLine."Depr. until FA Posting Date";
+ DeprAcqCost := GenJnlLine."Depr. Acquisition Cost";
+ ErrorEntryNo := GenJnlLine."FA Error Entry No.";
+ if GenJnlLine."FA Posting Type" = GenJnlLine."FA Posting Type"::Maintenance then begin
+ MakeMaintenanceLedgEntry.CopyFromGenJnlLine(MaintenanceLedgEntry, GenJnlLine);
+ MaintenanceLedgEntry.Amount := FAAmount;
+ MaintenanceLedgEntry."VAT Amount" := VATAmount;
+ MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
+ MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
+ OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
+ PostMaintenance();
+ end else begin
+ MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
+ FALedgEntry.Amount := FAAmount;
- FALedgEntry."VAT Amount" := VATAmount;
- FALedgEntry."Transaction No." := NextTransactionNo;
- FALedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostFixedAssetFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount, GLRegisterNo);
- PostFixedAsset();
+ if FALedgEntry.Amount > 0 then begin
+ FA.Validate("FA Location Code", GenJnlLine."FA Location Code");
+ FA."Responsible Employee" := GenJnlLine."Employee No.";
end;
- UnmarkDeprBonusBaseEntries(GenJnlLine."Depr. Bonus", GenJnlLine."FA Posting Date");
- FAInsertLedgEntry.CopyRecordLinksToFALedgEntry(GenJnlLine);
+ FALedgEntry."VAT Amount" := VATAmount;
+ FALedgEntry."Transaction No." := NextTransactionNo;
+ FALedgEntry."G/L Entry No." := NextGLEntryNo;
+ OnBeforePostFixedAssetFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount, GLRegisterNo);
+ PostFixedAsset();
end;
+ UnmarkDeprBonusBaseEntries(GenJnlLine."Depr. Bonus", GenJnlLine."FA Posting Date");
+
+ FAInsertLedgEntry.CopyRecordLinksToFALedgEntry(GenJnlLine);
OnAfterGenJnlPostLine(GenJnlLine);
end;
@@ -270,6 +276,14 @@ codeunit 5632 "FA Jnl.-Post Line"
OnAfterPostFixedAsset(FA, FALedgEntry);
end;
+ [Scope('OnPrem')]
+ procedure InsertBalAcc(var FALedgEntry: Record "FA Ledger Entry")
+ begin
+ FAInsertLedgEntry.SetOrgGenJnlLine(true);
+ FAInsertLedgEntry.InsertBalAcc(FALedgEntry);
+ FAInsertLedgEntry.SetOrgGenJnlLine(false);
+ end;
+
local procedure PostMaintenance()
begin
FA.LockTable();
@@ -299,8 +313,8 @@ codeunit 5632 "FA Jnl.-Post Line"
SalesEntryNo: Integer;
DisposalType: Option FirstDisposal,SecondDisposal,ErrorDisposal,LastErrorDisposal;
OldDisposalMethod: Option " ",Net,Gross;
- EntryAmounts: array[14] of Decimal;
- EntryNumbers: array[14] of Integer;
+ EntryAmounts: array[15] of Decimal;
+ EntryNumbers: array[15] of Integer;
i: Integer;
j: Integer;
IsHandled: Boolean;
@@ -343,7 +357,7 @@ codeunit 5632 "FA Jnl.-Post Line"
if DisposalType = DisposalType::FirstDisposal then begin
CalculateDisposal.CalcGainLoss(FANo, DeprBookCode, EntryAmounts);
- for i := 1 to 14 do
+ for i := 1 to 15 do
if EntryAmounts[i] <> 0 then begin
FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i);
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetFAPostingType(i));
@@ -539,14 +553,14 @@ codeunit 5632 "FA Jnl.-Post Line"
procedure PostReverseType(FALedgEntry: Record "FA Ledger Entry")
var
- EntryAmounts: array[4] of Decimal;
+ EntryAmounts: array[5] of Decimal;
i: Integer;
begin
OnBeforePostReverseType(FALedgEntry);
CalculateDisposal.CalcReverseAmounts(FANo, DeprBookCode, EntryAmounts);
FALedgEntry."FA Posting Category" := FALedgEntry."FA Posting Category"::" ";
FALedgEntry."Automatic Entry" := true;
- for i := 1 to 4 do
+ for i := 1 to 5 do
if EntryAmounts[i] <> 0 then begin
FALedgEntry.Amount := EntryAmounts[i];
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetReverseType(i));
@@ -701,6 +715,24 @@ codeunit 5632 "FA Jnl.-Post Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetNextMatchingFALedgEntry(SourceFAJournalLine: Record "FA Journal Line"; FromEntryNo: Integer; DeprBookCode: Code[10]): Integer
+ var
+ FALedgerEntry: Record "FA Ledger Entry";
+ begin
+ FALedgerEntry.SetCurrentKey("Entry No.");
+ FALedgerEntry.SetFilter("Entry No.", '>%1', FromEntryNo);
+ FALedgerEntry.SetRange("Depreciation Book Code", DeprBookCode);
+#pragma warning disable AA0210
+ FALedgerEntry.SetRange(Amount, -SourceFAJournalLine.Amount);
+#pragma warning restore AA0210
+ FALedgerEntry.SetRange("FA Posting Type", SourceFAJournalLine.ConvertToLedgEntry(SourceFAJournalLine));
+ FALedgerEntry.SetRange("FA No.", SourceFAJournalLine."FA No.");
+ FALedgerEntry.SetRange("FA Posting Date", SourceFAJournalLine."FA Posting Date");
+ FALedgerEntry.FindFirst();
+ exit(FALedgerEntry."Entry No.");
+ end;
+
local procedure GetLCYSalvageValue(SalvageValue: Decimal; PostingDate: Date; CurrencyCode: Code[10]): Decimal
var
Currency: Record Currency;
@@ -726,8 +758,8 @@ codeunit 5632 "FA Jnl.-Post Line"
SalesEntryNo: Integer;
DisposalType: Option FirstDisposal,SecondDisposal,ErrorDisposal,LastErrorDisposal;
OldDisposalMethod: Option " ",Net,Gross;
- EntryAmounts: array[14] of Decimal;
- EntryNumbers: array[14] of Integer;
+ EntryAmounts: array[15] of Decimal;
+ EntryNumbers: array[15] of Integer;
i: Integer;
InitialCorrection: Boolean;
begin
@@ -781,7 +813,7 @@ codeunit 5632 "FA Jnl.-Post Line"
FALedgEntry.Correction := not InitialCorrection;
CalculateDisposal.GetErrorDisposalLowValueFA(FALedgEntry, ErrorEntryNo, EntryAmounts, EntryNumbers);
ResultOnDisposal := 2;
- for i := 2 to 14 do
+ for i := 2 to 15 do
if EntryNumbers[i] <> 0 then begin
FALedgEntry.Amount := EntryAmounts[i];
FALedgEntry."Entry No." := EntryNumbers[i];
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al
index 79ebda40ab..e9342a453c 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al
@@ -622,6 +622,8 @@ table 5621 "FA Journal Line"
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Transfer;
FAJnlLine."FA Posting Type"::"Bonus Depreciation":
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Bonus Depreciation";
+ FAJnlLine."FA Posting Type"::Derogatory:
+ FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Derogatory;
else
OnConvertToLedgEntryCase(FALedgEntry, FAJnlLine);
end;
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al
index bf52e39719..6e788a6a34 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al
@@ -55,4 +55,8 @@ enum 5602 "FA Journal Line FA Posting Type"
{
Caption = 'Bonus Depreciation';
}
+ value(12; Derogatory)
+ {
+ Caption = 'Derogatory';
+ }
}
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
index f62dbea963..5a70a07fd6 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
@@ -507,6 +507,11 @@ table 5601 "FA Ledger Entry"
CalcFormula = lookup("Dimension Set Entry"."Dimension Value Code" where("Dimension Set ID" = field("Dimension Set ID"),
"Global Dimension No." = const(8)));
}
+ field(5865; "Derogatory Excluded"; Boolean)
+ {
+ Caption = 'Exclude Derogatory';
+ Editable = false;
+ }
field(6210; "Non-Ded. VAT FA Cost"; Boolean)
{
Caption = 'Non-Deductible VAT FA Cost';
@@ -639,7 +644,7 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount, Quantity, "Depr. Amount w/o Normalization";
}
- key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date")
+ key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date", "Derogatory Excluded")
{
SumIndexFields = Amount, Quantity;
}
@@ -647,7 +652,7 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount, Quantity;
}
- key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date")
+ key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date", "Derogatory Excluded")
{
SumIndexFields = Amount, Quantity;
}
@@ -828,6 +833,8 @@ table 5601 "FA Ledger Entry"
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::"Salvage Value";
"FA Posting Type"::"Bonus Depreciation":
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::"Bonus Depreciation";
+ "FA Posting Type"::Derogatory:
+ FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::Derogatory;
else
OnAfterConvertPostingTypeElse(FAJnlLine, Rec);
end;
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al
index 8439b0bc65..a95faf6969 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al
@@ -59,4 +59,8 @@ enum 5601 "FA Ledger Entry FA Posting Type"
{
Caption = 'Bonus Depreciation';
}
+ value(14; Derogatory)
+ {
+ Caption = 'Derogatory';
+ }
}
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
index 00ef10faad..a4a6c84ff5 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
@@ -489,6 +489,57 @@ table 5606 "FA Posting Group"
CheckGLAcc("Book Val. Acc. on Disp. (Loss)", false);
end;
}
+ field(5865; "Derogatory Acc."; Code[20])
+ {
+ Caption = 'Derogatory Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Acc.", false);
+ end;
+ }
+ field(5866; "Derogatory Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derogatory Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Account (Decrease)", false);
+ end;
+ }
+ field(5867; "Derog. Bal. Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derog. Bal. Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derog. Bal. Account (Decrease)", true);
+ end;
+ }
+ field(5868; "Derogatory Expense Acc."; Code[20])
+ {
+ Caption = 'Derogatory Expense Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Expense Acc.", true);
+ end;
+ }
+ field(5869; "Allocated Derogatory Pct."; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ CalcFormula = sum("FA Allocation"."Allocation %" where(Code = field(Code),
+ "Allocation Type" = const(Derogatory)));
+ Caption = 'Allocated Derogatory %';
+ DecimalPlaces = 1 : 1;
+ Editable = false;
+ FieldClass = FlowField;
+ }
field(12400; "Disposal Expense Account"; Code[20])
{
Caption = 'Disposal Expense Account';
@@ -866,6 +917,30 @@ table 5606 "FA Posting Group"
exit("Disposal Expense Account");
end;
+ procedure GetDerogatoryAccount(): Code[20]
+ begin
+ TestField("Derogatory Acc.");
+ exit("Derogatory Acc.");
+ end;
+
+ procedure GetDerogatoryAccountDecrease(): Code[20]
+ begin
+ TestField("Derogatory Account (Decrease)");
+ exit("Derogatory Account (Decrease)");
+ end;
+
+ procedure GetDerogatoryBalAccountDecrease(): Code[20]
+ begin
+ TestField("Derog. Bal. Account (Decrease)");
+ exit("Derog. Bal. Account (Decrease)");
+ end;
+
+ procedure GetDerogatoryExpenseAccount(): Code[20]
+ begin
+ TestField("Derogatory Expense Acc.");
+ exit("Derogatory Expense Acc.");
+ end;
+
[IntegrationEvent(false, false)]
local procedure OnAfterGetPostingGroup(var FAPostingGroup: Record "FA Posting Group"; DepreciationBookCode: Code[10]; var Result: Boolean)
begin
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
index ad88f062c7..be3c31d8b7 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
@@ -59,6 +59,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
field("Acq. Cost Acc. on Disposal"; Rec."Acq. Cost Acc. on Disposal")
{
ApplicationArea = FixedAssets;
@@ -91,6 +96,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ }
}
group("Balancing Account")
{
@@ -129,6 +139,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
field("Write-Down Bal. Acc. on Disp."; Rec."Write-Down Bal. Acc. on Disp.")
{
ApplicationArea = FixedAssets;
@@ -145,6 +160,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ }
field("Disposal Expense Account"; Rec."Disposal Expense Account")
{
ApplicationArea = FixedAssets;
@@ -262,6 +282,14 @@ page 5612 "FA Posting Group Card"
Caption = 'Book Value (Loss)';
ToolTip = 'Specifies the sum that applies to book value gains.';
}
+ field("Allocated Derogatory Pct."; Rec."Allocated Derogatory Pct.")
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies the total percentage of derogatory depreciation allocated, when derogatory depreciation is posted for fixed assets.';
+ }
}
group(Prepayment)
{
@@ -395,6 +423,16 @@ page 5612 "FA Posting Group Card"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ }
}
}
}
@@ -406,6 +444,6 @@ page 5612 "FA Posting Group Card"
#pragma warning restore AA0074
#pragma warning disable AA0074
Text19080001: Label 'Allocated %';
-#pragma warning restore AA0074
+#pragma warning restore AA0074
}
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
index 918f86f90f..7fb4c77e1b 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
@@ -60,6 +60,26 @@ page 5613 "FA Posting Groups"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ }
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ }
field("Acq. Cost Acc. on Disposal"; Rec."Acq. Cost Acc. on Disposal")
{
ApplicationArea = FixedAssets;
@@ -365,6 +385,16 @@ page 5613 "FA Posting Groups"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ }
}
}
}
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
index 8933dc497d..9103a747eb 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
@@ -162,6 +162,12 @@ page 5636 "FA Reclass. Journal"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Reclass. Derogatory"; Rec."Reclass. Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies that you want to reclassify the accumulated derogatory depreciation in the FA No. field to the fixed asset in the New FA No. field.';
+ Visible = false;
+ }
field("Insert Bal. Account"; Rec."Insert Bal. Account")
{
ApplicationArea = FixedAssets;
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
index 7848e73f39..b3c1744742 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
@@ -164,6 +164,10 @@ table 5624 "FA Reclass. Journal Line"
Caption = 'Calc. DB1 Depr. Amount';
ToolTip = 'Specifies that the Reclassify function fills in the Temp. Ending Date and Temp. Fixed Depr. Amount fields on the FA depreciation book.';
}
+ field(5865; "Reclass. Derogatory"; Boolean)
+ {
+ Caption = 'Reclassify Derogatory';
+ }
field(12400; "FA Location Code"; Code[10])
{
Caption = 'FA Location Code';
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
index 0441e4d022..ddc4e3a7c6 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
@@ -228,6 +228,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FADeprBook.CalcFields("Custom 1");
if TransferType[6] then
FADeprBook.CalcFields("Custom 2");
+ if TransferType[7] then
+ FADeprBook.CalcFields("Derogatory Amount");
if TransferType[9] then
FADeprBook.CalcFields("Salvage Value");
Amounts[1] := FADeprBook."Acquisition Cost";
@@ -236,6 +238,7 @@ codeunit 5642 "FA Reclass. Transfer Line"
Amounts[4] := FADeprBook.Appreciation;
Amounts[5] := FADeprBook."Custom 1";
Amounts[6] := FADeprBook."Custom 2";
+ Amounts[7] := FADeprBook."Derogatory Amount";
Amounts[9] := FADeprBook."Salvage Value";
OnCalcAmountsOnAfterSetAmounts(FADeprBook, Amounts, TransferType);
if Amounts[1] = 0 then
@@ -266,6 +269,7 @@ codeunit 5642 "FA Reclass. Transfer Line"
TransferType[4] := FAReclassJnlLine."Reclassify Appreciation";
TransferType[5] := FAReclassJnlLine."Reclassify Custom 1";
TransferType[6] := FAReclassJnlLine."Reclassify Custom 2";
+ TransferType[7] := FAReclassJnlLine."Reclass. Derogatory";
TransferType[9] := FAReclassJnlLine."Reclassify Salvage Value";
end;
@@ -308,6 +312,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAPostingType := FAPostingType::"Custom 2";
6:
FAPostingType := FAPostingType::Appreciation;
+ 7:
+ FAPostingType := FAPostingType::Derogatory;
9:
FAPostingType := FAPostingType::"Acquisition Cost";
end;
@@ -325,6 +331,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAPostingType := FAPostingType::"Custom 1";
6:
FAPostingType := FAPostingType::"Custom 2";
+ 7:
+ FAPostingType := FAPostingType::Derogatory;
9:
FAPostingType := FAPostingType::Depreciation;
end;
diff --git a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
index bd7647f884..9cf95cb88e 100644
--- a/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
+++ b/src/Layers/RU/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
@@ -113,6 +113,8 @@ codeunit 5604 "Make FA Ledger Entry"
FALedgEntry."FA Charge No." := GenJnlLine."FA Charge No.";
FALedgEntry."Depr. Group Elimination" := GenJnlLine."Depr. Group Elimination";
FALedgEntry."Tax Difference Code" := GenJnlLine."Tax Difference Code";
+ if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::Derogatory then
+ FALedgEntry."Automatic Entry" := GenJnlLine."System-Created Entry";
OnAfterCopyFromGenJnlLine(FALedgEntry, GenJnlLine);
end;
diff --git a/src/Layers/RU/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/RU/DemoTool/CreateFAPostingGroup.Codeunit.al
index 1240aee225..8132aab9d6 100644
--- a/src/Layers/RU/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/RU/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -420,6 +420,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Acquisition Cost Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Sales Bal. Acc.", CA.Convert("Sales Balance Account"));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
"FA Posting Group".Description := CopyStr(Description, MaxStrLen("FA Posting Group".Description));
"FA Posting Group".Insert();
diff --git a/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index 64dea0db14..63531513c7 100644
--- a/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -211,6 +211,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -581,6 +582,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3349,6 +3351,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3364,6 +3367,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3576,6 +3580,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4097,6 +4106,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -5925,6 +5936,21 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8051,6 +8077,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index b6929193f2..b0e458a5e7 100644
--- a/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/SE/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1646,6 +1646,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/US/DemoTool/CreateFAPostingGroup.Codeunit.al b/src/Layers/US/DemoTool/CreateFAPostingGroup.Codeunit.al
index 56a07a6412..721a0cc6bf 100644
--- a/src/Layers/US/DemoTool/CreateFAPostingGroup.Codeunit.al
+++ b/src/Layers/US/DemoTool/CreateFAPostingGroup.Codeunit.al
@@ -38,6 +38,10 @@ codeunit 101803 "Create FA Posting Group"
"FA Posting Group".Validate("Maintenance Expense Account", CA.Convert("Maintenance Expense Account"));
"FA Posting Group".Validate("Depreciation Expense Acc.", CA.Convert("Depreciation Expense Acc."));
"FA Posting Group".Validate("Acquisition Cost Bal. Acc.", CA.Convert("Acquisition Cost Bal. Acc."));
+ "FA Posting Group".Validate("Derogatory Acc.", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Account (Decrease)", "FA Posting Group"."Accum. Depreciation Account");
+ "FA Posting Group".Validate("Derogatory Expense Acc.", "FA Posting Group"."Depreciation Expense Acc.");
+ "FA Posting Group".Validate("Derog. Bal. Account (Decrease)", "FA Posting Group"."Acquisition Cost Bal. Acc.");
"FA Posting Group".Insert();
end;
diff --git a/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
index b97ba18918..03c258a46c 100644
--- a/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
+++ b/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al
@@ -210,6 +210,7 @@ table 81 "Gen. Journal Line"
if "Account No." = '' then begin
CleanLine();
+ GetDerogatorySetup();
exit;
end;
@@ -580,6 +581,7 @@ table 81 "Gen. Journal Line"
trigger OnValidate()
begin
ValidateAmount();
+ GetDerogatorySetup();
end;
}
///
@@ -3348,6 +3350,7 @@ table 81 "Gen. Journal Line"
TestField("Maintenance Code", '');
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
end;
}
///
@@ -3363,6 +3366,7 @@ table 81 "Gen. Journal Line"
var
FADeprBook: Record "FA Depreciation Book";
begin
+ GetDerogatorySetup();
if "Depreciation Book Code" = '' then
exit;
@@ -3575,6 +3579,11 @@ table 81 "Gen. Journal Line"
FieldError("Recurring Method");
end;
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for VAT compliance and partial VAT deduction calculations.
///
@@ -4077,6 +4086,8 @@ table 81 "Gen. Journal Line"
#pragma warning restore AA0470
#pragma warning restore AA0074
GLSetupRead: Boolean;
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFADeprBook: Record "FA Depreciation Book";
ExportAgainQst: Label 'One or more of the selected lines have already been exported. Do you want to export them again?';
NothingToExportErr: Label 'There is nothing to export.';
NotExistErr: Label 'Document number %1 does not exist or is already closed.', Comment = '%1=Document number';
@@ -5905,6 +5916,22 @@ table 81 "Gen. Journal Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetDerogatorySetup()
+ begin
+
+ "Is Derogatory" := false;
+ if ("Account Type" = "Account Type"::"Fixed Asset") and
+ ("Account No." <> '') and
+ ("Depreciation Book Code" <> '')
+ then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", "Depreciation Book Code");
+ if DerogDeprBook.FindFirst() then
+ if DerogFADeprBook.Get("Account No.", DerogDeprBook.Code) then
+ "Is Derogatory" := true;
+ end;
+ end;
+
procedure GetCustLedgerEntry()
var
IsHandled: Boolean;
@@ -8031,6 +8058,7 @@ table 81 "Gen. Journal Line"
GetFADeprBook("Account No.");
GetFAVATSetup();
GetFAAddCurrExchRate();
+ GetDerogatorySetup();
OnAfterAccountNoOnValidateGetFAAccount(Rec, FA, CurrFieldNo);
end;
diff --git a/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al b/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
index abe32931c5..17ccc11cb1 100644
--- a/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
+++ b/src/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PostedGenJournalLine.Table.al
@@ -1645,6 +1645,11 @@ table 181 "Posted Gen. Journal Line"
{
Caption = 'Check Transmitted';
}
+ field(5865; "Is Derogatory"; Boolean)
+ {
+ Caption = 'Derogatory Line';
+ Editable = false;
+ }
///
/// Non-deductible VAT percentage for tax calculations where only part of the VAT can be deducted per tax regulations.
///
diff --git a/src/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
index d9bb0f53c9..a158fcc614 100644
--- a/src/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
+++ b/src/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al
@@ -21,6 +21,7 @@ using Microsoft.Finance.SalesTax;
using Microsoft.Finance.VAT.Calculation;
using Microsoft.Finance.VAT.Ledger;
using Microsoft.Finance.VAT.Setup;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.FixedAssets.Maintenance;
@@ -125,6 +126,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
SourceCodeSetup: Record "Source Code Setup";
GenJnlCheckLine: Codeunit "Gen. Jnl.-Check Line";
PaymentToleranceMgt: Codeunit "Payment Tolerance Management";
+ FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
DeferralUtilities: Codeunit "Deferral Utilities";
NonDeductibleVAT: Codeunit "Non-Deductible VAT";
SequenceNoMgt: Codeunit "Sequence No. Mgt.";
@@ -188,6 +190,9 @@ codeunit 12 "Gen. Jnl.-Post Line"
DescriptionMustNotBeBlankErr: Label 'When %1 is selected for %2, %3 must have a value.', Comment = '%1: Field Omit Default Descr. in Jnl., %2 G/L Account No, %3 Description';
NoDeferralScheduleErr: Label 'You must create a deferral schedule if a deferral template is selected. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
ZeroDeferralAmtErr: Label 'Deferral amounts cannot be 0. Line: %1, Deferral Template: %2.', Comment = '%1=The line number of the general ledger transaction, %2=The Deferral Template Code';
+#pragma warning disable AA0074
+ Text10800: Label 'Not a derogatory line.';
+#pragma warning restore AA0074
///
/// Returns the G/L Register that has been created during the posting process.
@@ -1108,7 +1113,6 @@ codeunit 12 "Gen. Jnl.-Post Line"
local procedure PostFAJnlLineWithGLEntryBufUpdate(GenJnlLine: Record "Gen. Journal Line"; VATPostingParameters: Record "VAT Posting Parameters"; LastNextEntryNo: Integer)
var
TempFAGLPostingBuffer: Record "FA G/L Posting Buffer" temporary;
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
GLBalanceAmount: Decimal;
IsLastDepreciationEntry: Boolean;
begin
@@ -1707,7 +1711,7 @@ codeunit 12 "Gen. Jnl.-Post Line"
TempFAGLPostBuf: Record "FA G/L Posting Buffer" temporary;
FAGLPostBuf: Record "FA G/L Posting Buffer";
VATPostingSetup: Record "VAT Posting Setup";
- FAJnlPostLine: Codeunit "FA Jnl.-Post Line";
+ FAJnlLine: Record "FA Journal Line";
FAAutomaticEntry: Codeunit "FA Automatic Entry";
ShortcutDim1Code: Code[20];
ShortcutDim2Code: Code[20];
@@ -1734,6 +1738,13 @@ codeunit 12 "Gen. Jnl.-Post Line"
if not IsHandled then
FAJnlPostLine.GenJnlPostLine(
GenJnlLine, GLEntry2.Amount, GLEntry2."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+ if GenJnlLine."Is Derogatory" then begin
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+ if GenJnlLine."FA Error Entry No." <> 0 then
+ FAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, GenJnlLine."FA Error Entry No.", FAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ CreateAndPostDerogEntry(GenJnlLine);
+ end;
ShortcutDim1Code := GenJnlLine."Shortcut Dimension 1 Code";
ShortcutDim2Code := GenJnlLine."Shortcut Dimension 2 Code";
DimensionSetID := GenJnlLine."Dimension Set ID";
@@ -7656,6 +7667,49 @@ codeunit 12 "Gen. Jnl.-Post Line"
DtldCVLedgEntryBuf."Entry Type"::"Payment Discount Tolerance (VAT Excl.)"]);
end;
+ local procedure MakeDerogatoryFAJnlLine(var FAJnlLine: Record "FA Journal Line"; GenJnlLine: Record "Gen. Journal Line")
+ var
+ DeprBook: Record "Depreciation Book";
+ FAJnlSetup: Record "FA Journal Setup";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", GenJnlLine."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ Error(Text10800);
+ FAJnlLine.Validate(FAJnlLine."Depreciation Book Code", DeprBook.Code);
+ if not FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", UserId) then
+ FAJnlSetup.Get(FAJnlLine."Depreciation Book Code", '');
+ FAJnlLine."Journal Template Name" := FAJnlSetup."FA Jnl. Template Name";
+ FAJnlLine."Journal Batch Name" := FAJnlSetup."FA Jnl. Batch Name";
+ FAJnlLine."FA Posting Type" := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAJnlLine."FA No." := GenJnlLine."Account No.";
+ if GenJnlLine."FA Posting Date" <> 0D then
+ FAJnlLine."FA Posting Date" := GenJnlLine."FA Posting Date"
+ else
+ FAJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ FAJnlLine."Posting Date" := GenJnlLine."Posting Date";
+ if FAJnlLine."Posting Date" = FAJnlLine."FA Posting Date" then
+ FAJnlLine."Posting Date" := 0D;
+ FAJnlLine."Document Type" := GenJnlLine."Document Type";
+ FAJnlLine."Document Date" := GenJnlLine."Document Date";
+ FAJnlLine."Document No." := GenJnlLine."Document No.";
+ FAJnlLine."External Document No." := GenJnlLine."External Document No.";
+ FAJnlLine.Description := GenJnlLine.Description;
+ FAJnlLine.Validate(FAJnlLine.Amount, GenJnlLine."VAT Base Amount");
+ FAJnlLine.Quantity := GenJnlLine.Quantity;
+ FAJnlLine.Validate(FAJnlLine.Correction, GenJnlLine.Correction);
+ FAJnlLine."No. of Depreciation Days" := GenJnlLine."No. of Depreciation Days";
+ FAJnlLine."Depr. until FA Posting Date" := GenJnlLine."Depr. until FA Posting Date";
+ FAJnlLine."Depr. Acquisition Cost" := GenJnlLine."Depr. Acquisition Cost";
+ FAJnlLine."FA Posting Group" := GenJnlLine."Posting Group";
+ FAJnlLine."Maintenance Code" := GenJnlLine."Maintenance Code";
+ FAJnlLine."Shortcut Dimension 1 Code" := GenJnlLine."Shortcut Dimension 1 Code";
+ FAJnlLine."Shortcut Dimension 2 Code" := GenJnlLine."Shortcut Dimension 2 Code";
+ FAJnlLine."Dimension Set ID" := GenJnlLine."Dimension Set ID";
+ FAJnlLine."Budgeted FA No." := GenJnlLine."Budgeted FA No.";
+ FAJnlLine."FA Reclassification Entry" := GenJnlLine."FA Reclassification Entry";
+ FAJnlLine."Index Entry" := GenJnlLine."Index Entry";
+ end;
+
local procedure UpdateVATEntryTaxDetails(GenJnlLine: Record "Gen. Journal Line"; var VATEntry: Record "VAT Entry"; TaxDetail: Record "Tax Detail"; var TaxJurisdiction: Record "Tax Jurisdiction")
begin
if TaxDetail."Tax Jurisdiction Code" <> '' then
@@ -7796,6 +7850,66 @@ codeunit 12 "Gen. Jnl.-Post Line"
InsertGLEntry(GenJnlLine, GLEntry, true);
end;
+ local procedure CreateAndPostDerogEntry(SourceGenJournalLine: Record "Gen. Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ GenJnlLine: Record "Gen. Journal Line";
+ FAJnlLine: Record "FA Journal Line";
+ DerogFALedgerEntry: Record "FA Ledger Entry";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceGenJournalLine."FA Posting Type" <> SourceGenJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceGenJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceGenJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceGenJournalLine."Account No.", DerogDepreciationBook.Code, SourceGenJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ MakeGenJnlLineOfTypeDerog(GenJnlLine, SourceGenJournalLine, DerogatoryAmount);
+ MakeDerogatoryFAJnlLine(FAJnlLine, GenJnlLine);
+
+ if DepreciationBook."Integration G/L - Derogatory" then begin
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJnlPostLine.GenJnlPostLineContinue(
+ GenJnlLine, GenJnlLine.Amount, GenJnlLine."VAT Amount", NextTransactionNo, NextEntryNo, GLReg."No.");
+
+ // Insert balance entry for primary depreciation book
+ DerogFALedgerEntry.SetCurrentKey("Entry No.");
+ DerogFALedgerEntry.FindLast();
+ DerogFALedgerEntry."Automatic Entry" := true;
+ FAJnlPostLine.InsertBalAcc(DerogFALedgerEntry);
+ end else begin
+ // Post FA ledger entry for primary book
+ FAJnlLine.Validate("Depreciation Book Code", SourceGenJournalLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ // Post FA ledger entry for secondary book
+ FAJnlLine.Validate("Depreciation Book Code", DerogDepreciationBook.Code);
+ FAJnlPostLine.FAJnlPostLine(FAJnlLine, true);
+ end;
+
+ local procedure MakeGenJnlLineOfTypeDerog(var DerogGenJnlLine: Record "Gen. Journal Line"; GenJnlLine: Record "Gen. Journal Line"; DerogAmount: Decimal)
+ begin
+ DerogGenJnlLine.TransferFields(GenJnlLine);
+ DerogGenJnlLine.Validate("FA Posting Type", DerogGenJnlLine."FA Posting Type"::Derogatory);
+ DerogGenJnlLine.Validate(Amount, DerogAmount);
+ DerogGenJnlLine.Validate("Depr. until FA Posting Date", false);
+ DerogGenJnlLine.Validate("Depr. Acquisition Cost", false);
+ DerogGenJnlLine.Validate("System-Created Entry", true);
+ end;
+
///
/// Updates additional-currency amount on buffer table DtldCVLedgEntryBuf when un-application of customer/vendor ledger entries is posted.
///
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al
index 8ab07ddbaa..737771e5a1 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateAcqCostDepr.Codeunit.al
@@ -63,6 +63,28 @@ codeunit 5613 "Calculate Acq. Cost Depr."
end;
end;
+ [Scope('OnPrem')]
+ procedure DerogatoryCalculation(var DeprAmount: Decimal; FANo: Code[20]; DeprBookCode: Code[10]; LocalDerogatoryBasis: Decimal)
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ DepreciationCalc: Codeunit "Depreciation Calculation";
+ DerogBasis: Decimal;
+ begin
+ DeprAmount := 0;
+ DeprBook.Get(DeprBookCode);
+ if not FADeprBook.Get(FANo, DeprBookCode) then
+ exit;
+ FADeprBook.CalcFields("Derogatory Amount", "Acquisition Cost", "Depreciable Basis");
+ DerogBasis := FADeprBook."Depreciable Basis" - LocalDerogatoryBasis;
+ if DerogBasis <= 0 then
+ CreateError(FANo, DeprBookCode);
+ if DerogBasis > 0 then
+ DeprAmount :=
+ DepreciationCalc.CalcRounding(
+ DeprBookCode, (FADeprBook."Derogatory Amount" * LocalDerogatoryBasis) / DerogBasis);
+ end;
+
local procedure CreateError(FANo: Code[20]; DeprBookCode: Code[20])
var
GenJnlLine: Record "Gen. Journal Line";
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
index 2c8bd40792..5d6b7b46ad 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateDepreciation.Report.al
@@ -26,12 +26,52 @@ report 5692 "Calculate Depreciation"
dataitem("Fixed Asset"; "Fixed Asset")
{
RequestFilterFields = "No.", "FA Class Code", "FA Subclass Code", "Budgeted Asset";
+ dataitem(CalcDerogDepr; "Fixed Asset")
+ {
+ DataItemLink = "No." = field("No.");
+ DataItemTableView = sorting("No.");
+
+ trigger OnAfterGetRecord()
+ begin
+ if not HasDerogatorySetup then
+ CurrReport.Skip();
+
+ CalculateDepr.Calculate(
+ DeprAmount, Custom1Amount, NumberOfDays, Custom1NumberOfDays,
+ "No.", DeprBook2.Code, DeprUntilDate, EntryAmounts, 0D, DaysInPeriod);
+
+ if DeprAmount2 <> 0 then
+ if not DeprBook."Integration G/L - Derogatory" or "Budgeted Asset" then begin
+ TempFAJnlLine."FA No." := "No.";
+ TempFAJnlLine."FA Posting Type" := TempFAJnlLine."FA Posting Type"::Derogatory;
+ TempFAJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempFAJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempFAJnlLine."FA Error Entry No." := ErrorNo;
+ TempFAJnlLine."Line No." := TempFAJnlLine."Line No." + 1;
+ TempFAJnlLine.Insert();
+ end else begin
+ TempGenJnlLine."Account No." := "No.";
+ TempGenJnlLine."FA Posting Type" := TempGenJnlLine."FA Posting Type"::Derogatory;
+ TempGenJnlLine.Amount := CalcDerogDeprAmount(DeprAmount, DeprAmount2);
+ TempGenJnlLine."No. of Depreciation Days" := NumberOfDays;
+ TempGenJnlLine."FA Error Entry No." := ErrorNo;
+ TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
+ TempGenJnlLine.Insert();
+ end;
+ end;
+ }
trigger OnAfterGetRecord()
begin
if Inactive or Blocked then
CurrReport.Skip();
+ HasDerogatorySetup := false;
+ FADeprBook.SetRange("FA No.", "No.");
+ FADeprBook.SetRange("Depreciation Book Code", DeprBook2.Code);
+ if FADeprBook.Find('-') then
+ HasDerogatorySetup := true;
+
OnBeforeCalculateDepreciation(
"No.", TempGenJnlLine, TempFAJnlLine, DeprAmount, NumberOfDays, DeprBookCode, DeprUntilDate, EntryAmounts, DaysInPeriod);
@@ -86,6 +126,10 @@ report 5692 "Calculate Depreciation"
TempGenJnlLine."Line No." := TempGenJnlLine."Line No." + 1;
TempGenJnlLine.Insert();
end;
+
+ if HasDerogatorySetup then
+ DeprAmount2 := DeprAmount;
+
end;
trigger OnPostDataItem()
@@ -361,7 +405,14 @@ report 5692 "Calculate Depreciation"
GeneralLedgerSetup.Get();
FASetup.Get();
+ Clear(DeprBook2);
DeprBook.Get(DeprBookCode);
+
+ if DeprBook."Derogatory Calc." <> '' then
+ Error(Text10800, DeprBook.Code);
+ DeprBook2.SetRange("Derogatory Calc.", DeprBookCode);
+ if DeprBook2.Find('-') then;
+
if DeprUntilDate = 0D then
Error(Text000, FAJnlLine.FieldCaption("FA Posting Date"));
if PostingDate = 0D then
@@ -392,6 +443,8 @@ report 5692 "Calculate Depreciation"
DeprBook: Record "Depreciation Book";
FAJnlSetup: Record "FA Journal Setup";
GeneralLedgerSetup: Record "General Ledger Setup";
+ DeprBook2: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
CalculateDepr: Codeunit "Calculate Depreciation";
FAInsertGLAcc: Codeunit "FA Insert G/L Account";
ErrorMessageMgt: Codeunit "Error Message Management";
@@ -410,6 +463,8 @@ report 5692 "Calculate Depreciation"
GenJnlNextLineNo: Integer;
EntryAmounts: array[4] of Decimal;
LineNo: Integer;
+ DeprAmount2: Decimal;
+ HasDerogatorySetup: Boolean;
FAJnlLineCreatedCount: Integer;
GenJnlLineCreatedCount: Integer;
DeprUntilDateModified: Boolean;
@@ -425,8 +480,9 @@ report 5692 "Calculate Depreciation"
Text003: Label 'Depreciating fixed asset #1##########\';
Text004: Label 'Not depreciating fixed asset #2##########\';
Text005: Label 'Inserting journal lines #3##########';
-#pragma warning restore AA0470
Text006: Label 'Use Force No. of Days must be activated.';
+ Text10800: Label 'Depreciation cannot be posted on depreciation book %1 because it is set up as derogatory.';
+#pragma warning restore AA0470
#pragma warning restore AA0074
CompletionStatsMsg: Label 'The depreciation has been calculated.\\No journal lines were created.';
#pragma warning disable AA0470
@@ -471,6 +527,12 @@ report 5692 "Calculate Depreciation"
ErrorMessageMgt.Activate(ErrorMessageHandler);
end;
+ [Scope('OnPrem')]
+ procedure CalcDerogDeprAmount(Amount1: Decimal; Amount2: Decimal): Decimal
+ begin
+ exit(Amount1 - Amount2);
+ end;
+
procedure SetSuppressCommit(NewSuppressCommmit: Boolean)
begin
SuppressCommit := NewSuppressCommmit;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
index 066e8b34e6..602dd6d38a 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CalculateNormalDepreciation.Codeunit.al
@@ -23,6 +23,8 @@ codeunit 5611 "Calculate Normal Depreciation"
FALedgEntry: Record "FA Ledger Entry";
DeprBook: Record "Depreciation Book";
FADeprBook: Record "FA Depreciation Book";
+ DerogFALedgEntry: Record "FA Ledger Entry";
+ DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
DeprBookCode: Code[10];
DaysInFiscalYear: Integer;
@@ -562,6 +564,18 @@ codeunit 5611 "Calculate Normal Depreciation"
BookValue := FADeprBook."Book Value";
end else
BookValue := EntryAmounts[1];
+ if DateFromProjection = 0D then begin
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.FindFirst() then begin
+ DerogFALedgEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date");
+ DerogFALedgEntry.SetRange("FA No.", FADeprBook."FA No.");
+ DerogFALedgEntry.SetRange("Depreciation Book Code", FADeprBook."Depreciation Book Code");
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1&<>%2', DerogFALedgEntry."FA Posting Type"::Derogatory,
+ DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ DerogFALedgEntry.CalcSums(Amount);
+ BookValue := DerogFALedgEntry.Amount;
+ end;
+ end;
MinusBookValue := DepreciationCalc.GetMinusBookValue(FA."No.", DeprBookCode, 0D, 0D) + DepreciationCalc.GetUnpostedBonusDepreciationForCalc(FADeprBook, 0D, 0D);
FADeprBook.CalcFields("Depreciable Basis", "Salvage Value");
DeprBasis := FADeprBook."Depreciable Basis";
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
index b44a40657d..a6e999bbc1 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/CopyDepreciationBook.Report.al
@@ -59,9 +59,7 @@ report 5687 "Copy Depreciation Book"
begin
DepreciationCalc.SetFAFilter(FALedgEntry, '', DeprBookCode, false);
FALedgEntry.SetRange("FA Posting Category", FALedgEntry."FA Posting Category"::" ");
- FALedgEntry.SetRange(
- "FA Posting Type",
- FALedgEntry."FA Posting Type"::"Acquisition Cost", FALedgEntry."FA Posting Type"::"Salvage Value");
+ FALedgEntry.SetFilter("FA Posting Type", '<=%1|%2', FALedgEntry."FA Posting Type"::"Salvage Value", FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("FA Posting Date", StartingDate, EndingDate2);
end;
}
@@ -173,6 +171,12 @@ report 5687 "Copy Depreciation Book"
Caption = 'Disposal';
ToolTip = 'Specifies if related disposal entries are included in the batch job .';
}
+ field("CopyChoices[13]"; CopyChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+ }
}
}
}
@@ -184,6 +188,7 @@ report 5687 "Copy Depreciation Book"
trigger OnOpenPage()
begin
+
if DeprBookCode = '' then begin
FASetup.Get();
DeprBookCode := FASetup."Default Depr. Book";
@@ -225,8 +230,8 @@ report 5687 "Copy Depreciation Book"
DepreciationCalc: Codeunit "Depreciation Calculation";
Window: Dialog;
ExchangeRate: Decimal;
- CopyChoices: array[9] of Boolean;
- GLIntegration: array[9] of Boolean;
+ CopyChoices: array[13] of Boolean;
+ GLIntegration: array[13] of Boolean;
DocumentNo: Code[20];
DocumentNo2: Code[20];
DocumentNo3: Code[20];
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
index a65e9f5b95..4f7bd55380 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBook.Table.al
@@ -37,41 +37,81 @@ table 5611 "Depreciation Book"
{
Caption = 'G/L Integration - Acq. Cost';
ToolTip = 'Specifies whether acquisition cost entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(4; "G/L Integration - Depreciation"; Boolean)
{
Caption = 'G/L Integration - Depreciation';
ToolTip = 'Specifies whether depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(5; "G/L Integration - Write-Down"; Boolean)
{
Caption = 'G/L Integration - Write-Down';
ToolTip = 'Specifies whether write-down entries posted to this depreciation book should be posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(6; "G/L Integration - Appreciation"; Boolean)
{
Caption = 'G/L Integration - Appreciation';
ToolTip = 'Specifies whether appreciation entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(7; "G/L Integration - Custom 1"; Boolean)
{
Caption = 'G/L Integration - Custom 1';
ToolTip = 'Specifies whether custom 1 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(8; "G/L Integration - Custom 2"; Boolean)
{
Caption = 'G/L Integration - Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(9; "G/L Integration - Disposal"; Boolean)
{
Caption = 'G/L Integration - Disposal';
ToolTip = 'Specifies whether disposal entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(10; "G/L Integration - Maintenance"; Boolean)
{
Caption = 'G/L Integration - Maintenance';
ToolTip = 'Specifies whether maintenance entries that are posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
}
field(11; "Disposal Calculation Method"; Option)
{
@@ -327,6 +367,66 @@ table 5611 "Depreciation Book"
Message(BonusDepreciationOnboardingMsg)
end;
}
+ field(5865; "Derogatory Calc."; Code[10])
+ {
+ Caption = 'Derogatory Calculation';
+ TableRelation = "Depreciation Book";
+
+ trigger OnValidate()
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then begin
+ if xRec."Derogatory Calc." <> '' then begin
+ FADeprBook.SetRange("Depreciation Book Code", xRec."Derogatory Calc.");
+ if FADeprBook.Find('-') then
+ repeat
+ FADeprBook.CalcFields("Derogatory Amount");
+ FADeprBook.TestField("Derogatory Amount", 0);
+ until FADeprBook.Next() = 0;
+ end else begin
+ DeprBook.SetRange("Derogatory Calc.", "Derogatory Calc.");
+ if DeprBook.Find('-') then
+ if DeprBook.Code <> Code then
+ Error(Text10802, "Derogatory Calc.", DeprBook.Code);
+ DeprBook.SetRange("Derogatory Calc.");
+ DeprBook.SetRange(Code, "Derogatory Calc.");
+#pragma warning disable AA0181
+ if DeprBook.Find('-') then
+#pragma warning restore AA0181
+ if (DeprBook."Derogatory Calc." <> '') then
+ Error(Text10804, "Derogatory Calc.");
+ end;
+ if ("Derogatory Calc." <> xRec."Derogatory Calc.") then
+ if "Derogatory Book Code" <> '' then
+ Error(Text10800, Code);
+
+ end;
+
+
+ if "Derogatory Calc." = Code then
+ Error(Text10801, "Derogatory Calc.", Code);
+
+ CheckIntegrationFields();
+ end;
+ }
+ field(5866; "Derogatory Book Code"; Code[10])
+ {
+ CalcFormula = lookup("Depreciation Book".Code where("Derogatory Calc." = field(Code)));
+ Caption = 'Used with Derogatory Book';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5867; "Integration G/L - Derogatory"; Boolean)
+ {
+ Caption = 'G/L Integration - Derogatory';
+
+ trigger OnValidate()
+ begin
+ CheckIntegrationFields();
+ end;
+ }
field(10500; "Use Accounting Period"; Boolean)
{
Caption = 'Use Accounting Period';
@@ -419,7 +519,17 @@ table 5611 "Depreciation Book"
var
FASetup: Record "FA Setup";
FAJnlSetup: Record "FA Journal Setup";
+ GLIntegration: array[13] of Boolean;
MustBeStraightLineTxt: Label 'You cannot set %1 to %2 because some Fixed Assets associated with this book\exists where Depreciation Method is other than Straight-Line.', Comment = '%1="Use Accounting Period" Field Caption %2="Use Accounting Period" Field Value';
+#pragma warning disable AA0074
+#pragma warning disable AA0470
+ Text10800: Label 'The depreciation book %1 is an accounting book and cannot be set up as a derogatory depreciation book.';
+ Text10801: Label 'The depreciation book %1 cannot be set up as derogatory for depreciation book %2.';
+ Text10802: Label 'The depreciation book %1 is already set up in combination with derogatory depreciation book %2.';
+ Text10803: Label 'Derogatory depreciation books cannot be integrated with the general ledger. Please make sure that none of the fields on the Integration tab are checked.';
+ Text10804: Label 'The depreciation book %1 is a derogatory depreciation book.';
+#pragma warning restore AA0470
+#pragma warning restore AA0074
#pragma warning disable AA0074
Text000: Label 'The book cannot be deleted because it is in use.';
@@ -432,7 +542,9 @@ table 5611 "Depreciation Book"
protected var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- procedure IndexGLIntegration(var GLIntegration: array[9] of Boolean)
+#pragma warning disable AA0244
+ procedure IndexGLIntegration(var GLIntegration: array[13] of Boolean)
+#pragma warning restore AA0244
begin
GLIntegration[1] := "G/L Integration - Acq. Cost";
GLIntegration[2] := "G/L Integration - Depreciation";
@@ -443,6 +555,26 @@ table 5611 "Depreciation Book"
GLIntegration[7] := "G/L Integration - Disposal";
GLIntegration[8] := "G/L Integration - Maintenance";
GLIntegration[9] := false; // Salvage Value
+ GLIntegration[13] := "Integration G/L - Derogatory";
+ end;
+
+ [Scope('OnPrem')]
+ procedure CheckIntegrationFields()
+ var
+ i: Integer;
+ begin
+ if "Derogatory Calc." <> '' then begin
+ IndexGLIntegration(GLIntegration);
+ for i := 1 to 13 do
+ if GLIntegration[i] then
+ Error(Text10803);
+ end;
+ end;
+
+ [Scope('OnPrem')]
+ procedure IsDerogatoryBook(): Boolean
+ begin
+ exit("Derogatory Calc." <> '');
end;
local procedure GetCurrencyCode(): Code[10]
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
index 6b0ad4f83a..561591fa2e 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationBookCard.Page.al
@@ -63,6 +63,16 @@ page 5610 "Depreciation Book Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Calc."; Rec."Derogatory Calc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies if this book is used as a tax depreciation book to calculate derogatory depreciation.';
+ }
+ field("Derogatory Book Code"; Rec."Derogatory Book Code")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the code of the tax depreciation book that this accounting book has been associated with in a derogatory setup.';
+ }
field("Allow Identical Document No."; Rec."Allow Identical Document No.")
{
ApplicationArea = FixedAssets;
@@ -157,6 +167,12 @@ page 5610 "Depreciation Book Card"
ApplicationArea = FixedAssets;
Caption = 'G/L Integration - Bonus Depreciation';
}
+ field("Integration G/L - Derogatory"; Rec."Integration G/L - Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies if you want derogatory entries that are posted to this depreciation book to be posted both to the general ledger and the FA ledger.';
+ }
}
}
group(Duplication)
@@ -314,5 +330,6 @@ page 5610 "Depreciation Book Card"
}
}
}
+
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
index 8c7ce4af40..b676bb568d 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/DepreciationCalculation.Codeunit.al
@@ -514,7 +514,7 @@ codeunit 5616 "Depreciation Calculation"
FiscalYearBegin := FADateCalc.GetFiscalYear(DeprBookCode, StartingDate);
SetFAFilter(FALedgEntry, FANo, DeprBookCode, true);
FALedgEntry.SetFilter("FA Posting Date", '%1..', FiscalYearBegin);
- FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Depreciation);
+ FALedgEntry.SetFilter("FA Posting Type", '%1|%2', FALedgEntry."FA Posting Type"::Depreciation, FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("Part of Book Value", true);
FALedgEntry.SetRange("Reclassification Entry", false);
FALedgEntry.CalcSums(Amount);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADateType.Table.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADateType.Table.al
index 1aa98fb8b8..428af4b85d 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADateType.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADateType.Table.al
@@ -71,6 +71,8 @@ table 5645 "FA Date Type"
"FA Entry" := false;
"G/L Entry" := true;
InsertRec(10, FADepreciationBook.FieldNo("G/L Acquisition Date"), FADepreciationBook.FieldCaption("G/L Acquisition Date"));
+ "FA Entry" := true;
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory"), FADepreciationBook.FieldCaption("Last Derogatory"));
end else begin
SetCurrentKey("Entry No.");
Find('-');
@@ -145,6 +147,13 @@ table 5645 "FA Date Type"
Delete();
InsertRec(10, FADepreciationBook.FieldNo("G/L Acquisition Date"), FADepreciationBook.FieldCaption("G/L Acquisition Date"));
end;
+ if "Entry No." = 11 then
+ if ("FA Date Type No." <> FADepreciationBook.FieldNo("Last Derogatory")) or
+ ("FA Date Type Name" <> FADepreciationBook.FieldCaption("Last Derogatory"))
+ then begin
+ Delete();
+ InsertRec(11, FADepreciationBook.FieldNo("Last Derogatory"), FADepreciationBook.FieldCaption("Last Derogatory"));
+ end;
until Next() = 0;
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
index ad1c16fe75..6594702754 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Depreciation/FADepreciationBook.Table.al
@@ -346,7 +346,8 @@ table 5612 "FA Depreciation Book"
CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
"Depreciation Book Code" = field("Depreciation Book Code"),
"Part of Book Value" = const(true),
- "FA Posting Date" = field("FA Posting Date Filter")));
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
Caption = 'Book Value';
ToolTip = 'Specifies the book value for the fixed asset.';
Editable = false;
@@ -879,6 +880,24 @@ table 5612 "FA Depreciation Book"
FieldError("Default FA Depreciation Book", OnlyOneDefaultDeprBookErr);
end;
}
+ field(5865; "Derogatory Amount"; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = GetCurrencyCode();
+ CalcFormula = sum("FA Ledger Entry".Amount where("FA No." = field("FA No."),
+ "Depreciation Book Code" = field("Depreciation Book Code"),
+ "FA Posting Category" = const(" "),
+ "FA Posting Type" = const(Derogatory),
+ "FA Posting Date" = field("FA Posting Date Filter"),
+ "Derogatory Excluded" = const(false)));
+ Caption = 'Derogatory';
+ Editable = false;
+ FieldClass = FlowField;
+ }
+ field(5866; "Last Derogatory"; Date)
+ {
+ Caption = 'Last Derogatory Date';
+ }
}
keys
@@ -1343,6 +1362,7 @@ table 5612 "FA Depreciation Book"
FALedgerEntry.SetRange("FA No.", "FA No.");
FALedgerEntry.SetRange("Depreciation Book Code", "Depreciation Book Code");
FALedgerEntry.SetRange("Part of Book Value", true);
+ FALedgerEntry.SetRange("Derogatory Excluded", false);
OnAfterSetBookValueFiltersOnFALedgerEntry(FALedgerEntry);
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
index 6c2db74214..d58a3c090a 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CalculateDisposal.Codeunit.al
@@ -24,7 +24,7 @@ codeunit 5605 "Calculate Disposal"
FADeprBook: Record "FA Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
- procedure CalcGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[14] of Decimal)
+ procedure CalcGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[15] of Decimal)
var
EntryAmounts2: array[4] of Decimal;
GainLoss: Decimal;
@@ -41,10 +41,11 @@ codeunit 5605 "Calculate Disposal"
EntryAmounts[I + 4] := -EntryAmounts2[I];
FADeprBook.Get(FANo, DeprBookCode);
FADeprBook.CalcFields(
- "Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation);
+ "Book Value", "Proceeds on Disposal", "Acquisition Cost", "Salvage Value", Depreciation, "Derogatory Amount");
EntryAmounts[3] := -FADeprBook."Acquisition Cost";
EntryAmounts[4] := -FADeprBook.Depreciation;
EntryAmounts[9] := -FADeprBook."Salvage Value";
+ EntryAmounts[15] := -FADeprBook."Derogatory Amount";
OnCalcGainLossOnAfterSetEntryAmounts(FANo, DeprBookCode, EntryAmounts);
if DeprBook."Disposal Calculation Method" = DeprBook."Disposal Calculation Method"::Gross then
EntryAmounts[10] := FADeprBook."Book Value";
@@ -66,7 +67,7 @@ codeunit 5605 "Calculate Disposal"
EntryAmounts[2] := GainLoss;
end;
- procedure CalcSecondGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; LastDisposalPrice: Decimal; var EntryAmounts: array[14] of Decimal)
+ procedure CalcSecondGainLoss(FANo: Code[20]; DeprBookCode: Code[10]; LastDisposalPrice: Decimal; var EntryAmounts: array[15] of Decimal)
var
NewGainLoss: Decimal;
begin
@@ -91,10 +92,9 @@ codeunit 5605 "Calculate Disposal"
end;
end;
- procedure CalcReverseAmounts(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[4] of Decimal)
+ procedure CalcReverseAmounts(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[5] of Decimal)
var
FAPostingTypeSetup: Record "FA Posting Type Setup";
- FADeprBook: Record "FA Depreciation Book";
BookValueAmounts: array[4] of Decimal;
i: Integer;
IsHandled: Boolean;
@@ -132,6 +132,7 @@ codeunit 5605 "Calculate Disposal"
FAPostingTypeSetup.TestField("Reverse before Disposal", false);
end;
end;
+ EntryAmounts[5] := -CalcDerogatoryReverseAmount(FADeprBook);
end;
procedure GetDisposalType(FANo: Code[20]; DeprBookCode: Code[10]; ErrorNo: Integer; var DisposalType: Option FirstDisposal,SecondDisposal,ErrorDisposal,LastErrorDisposal; var DisposalMethod: Option " ",Net,Gross; var MaxDisposalNo: Integer; var SalesEntryNo: Integer)
@@ -173,7 +174,7 @@ codeunit 5605 "Calculate Disposal"
OnAfterGetDisposalMethod(DisposalMethod);
end;
- procedure GetErrorDisposal(FANo: Code[20]; DeprBookCode: Code[10]; OnlyGainLoss: Boolean; MaxDisposalNo: Integer; var EntryAmounts: array[14] of Decimal; var EntryNumbers: array[14] of Integer)
+ procedure GetErrorDisposal(FANo: Code[20]; DeprBookCode: Code[10]; OnlyGainLoss: Boolean; MaxDisposalNo: Integer; var EntryAmounts: array[15] of Decimal; var EntryNumbers: array[15] of Integer)
var
FALedgEntry: Record "FA Ledger Entry";
i: Integer;
@@ -235,6 +236,8 @@ codeunit 5605 "Calculate Disposal"
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Salvage Value";
10:
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Book Value on Disposal";
+ 15:
+ FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Derogatory;
end;
OnAfterSetFAPostingType(i, FALedgEntry);
exit(FALedgEntry."FA Posting Type".AsInteger());
@@ -269,10 +272,25 @@ codeunit 5605 "Calculate Disposal"
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Custom 1";
4:
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Custom 2";
+ 5:
+ FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Derogatory;
end;
exit(FALedgEntry."FA Posting Type".AsInteger());
end;
+ local procedure CalcDerogatoryReverseAmount(FADepreciationBook: Record "FA Depreciation Book"): Decimal
+ var
+ FALedgEntry: Record "FA Ledger Entry";
+ begin
+ FALedgEntry.SetRange("FA No.", FADepreciationBook."FA No.");
+ FALedgEntry.SetRange("Depreciation Book Code", FADepreciationBook."Depreciation Book Code");
+ FALedgEntry.SetRange("FA Posting Category", FALedgEntry."FA Posting Category"::" ");
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+ FALedgEntry.SetFilter("FA Posting Date", FADepreciationBook.GetFilter("FA Posting Date Filter"));
+ FALedgEntry.CalcSums(Amount);
+ exit(FALedgEntry.Amount);
+ end;
+
[IntegrationEvent(false, false)]
local procedure OnCalcGainLossOnAfterSetEntryAmounts(FANo: Code[20]; DeprBookCode: Code[10]; var EntryAmounts: array[14] of Decimal)
begin
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al
index 769472c60e..c29d04712a 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFAEntries.Report.al
@@ -4,6 +4,8 @@
// ------------------------------------------------------------------------------------------------
namespace Microsoft.FixedAssets.Ledger;
+using Microsoft.FixedAssets.Depreciation;
+
report 5686 "Cancel FA Entries"
{
Caption = 'Cancel FA Entries';
@@ -50,6 +52,15 @@ report 5686 "Cancel FA Entries"
trigger OnPreReport()
begin
+ DerogDeprBook.SetRange(Code, FALedgEntry."Depreciation Book Code");
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then begin
+ DerogFALedgEntry.Copy(FALedgEntry);
+ DerogFALedgEntry.SetFilter("FA Posting Type", '<>%1', DerogFALedgEntry."FA Posting Type"::"Salvage Value");
+ if DerogFALedgEntry.Find('-') then
+ Error(Text10800);
+ end;
+
if UseNewPosting then
if NewPostingDate = 0D then
Error(Text000);
@@ -65,11 +76,14 @@ report 5686 "Cancel FA Entries"
var
FALedgEntry: Record "FA Ledger Entry";
+ DerogDeprBook: Record "Depreciation Book";
+ DerogFALedgEntry: Record "FA Ledger Entry";
CancelFALedgEntries: Codeunit "Cancel FA Ledger Entries";
UseNewPosting: Boolean;
NewPostingDate: Date;
-
#pragma warning disable AA0074
+ Text10800: Label 'You cannot cancel FA entries that were posted to a derogatory depreciation book. Instead you must\cancel the FA entries posted to the depreciation book integrated with G/L.';
+
Text000: Label 'You must specify New Posting Date.';
Text001: Label 'You must not specify New Posting Date.';
Text002: Label 'You must not specify a closing date.';
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al
index 4e91664961..c3cf010498 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Codeunit.al
@@ -22,7 +22,7 @@ codeunit 5624 "Cancel FA Ledger Entries"
GenJnlLine: Record "Gen. Journal Line";
FAJnlLine: Record "FA Journal Line";
FA: Record "Fixed Asset";
- GLIntegration: array[9] of Boolean;
+ GLIntegration: array[13] of Boolean;
FAJnlNextLineNo: Integer;
GenJnlNextLineNo: Integer;
DeprBookCode: Code[10];
@@ -90,7 +90,8 @@ codeunit 5624 "Cancel FA Ledger Entries"
if IsHandled then
exit;
- if (FALedgEntry."FA Posting Type".AsInteger() > FALedgEntry."FA Posting Type"::"Salvage Value".AsInteger()) or
+ if ((FALedgEntry."FA Posting Type".AsInteger() > FALedgEntry."FA Posting Type"::"Salvage Value".AsInteger()) and
+ (FALedgEntry."FA Posting Type".AsInteger() <> FALedgEntry."FA Posting Type"::Derogatory.AsInteger())) or
(FALedgEntry."FA Posting Category" <> FALedgEntry."FA Posting Category"::" ")
then begin
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Proceeds on Disposal";
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al
index e0f684c1ea..fa4dd0d1e3 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CancelFALedgerEntries.Report.al
@@ -50,9 +50,7 @@ report 5688 "Cancel FA Ledger Entries"
begin
DepreciationCalc.SetFAFilter(FALedgEntry, '', DeprBookCode, false);
FALedgEntry.SetRange("FA Posting Category", FALedgEntry."FA Posting Category"::" ");
- FALedgEntry.SetRange(
- "FA Posting Type",
- FALedgEntry."FA Posting Type"::"Acquisition Cost", FALedgEntry."FA Posting Type"::"Salvage Value");
+ FALedgEntry.SetFilter("FA Posting Type", '<=%1|%2', FALedgEntry."FA Posting Type"::"Salvage Value", FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("FA Posting Date", StartingDate, EndingDate2);
end;
}
@@ -145,6 +143,12 @@ report 5688 "Cancel FA Ledger Entries"
Caption = 'Appreciation';
ToolTip = 'Specifies if related appreciation entries are included in the batch job .';
}
+ field("Derogatory"; CancelChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+ }
field("CancelChoices[5]"; CancelChoices[5])
{
ApplicationArea = FixedAssets;
@@ -193,6 +197,11 @@ report 5688 "Cancel FA Ledger Entries"
trigger OnPreReport()
begin
+ DerogDeprBook.SetRange(Code, DeprBookCode);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then
+ Error(Text10800);
+
if (EndingDate > 0D) and (StartingDate > EndingDate) then
Error(Text000);
if UseNewPostingDate then
@@ -225,10 +234,11 @@ report 5688 "Cancel FA Ledger Entries"
FADeprBook: Record "FA Depreciation Book";
DeprBook: Record "Depreciation Book";
FAJnlSetup: Record "FA Journal Setup";
+ DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
Window: Dialog;
- CancelChoices: array[9] of Boolean;
- GLIntegration: array[9] of Boolean;
+ CancelChoices: array[13] of Boolean;
+ GLIntegration: array[13] of Boolean;
DocumentNo: Code[20];
DocumentNo2: Code[20];
DocumentNo3: Code[20];
@@ -256,6 +266,7 @@ report 5688 "Cancel FA Ledger Entries"
Text002: Label 'You must specify New Posting Date.';
Text003: Label 'You must not specify New Posting Date.';
Text004: Label 'You must not specify a closing date.';
+ Text10800: Label 'You cannot cancel FA entries that were posted to a derogatory depreciation book. Instead you must\cancel the FA entries posted to the depreciation book integrated with G/L.';
#pragma warning restore AA0074
protected var
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al
index ac1cfe5ad4..0791fff014 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/CopyFAEntriestoGLBudget.Report.al
@@ -46,9 +46,7 @@ report 5684 "Copy FA Entries to G/L Budget"
FALedgEntry.SetCurrentKey("FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date");
FALedgEntry.SetRange("Depreciation Book Code", DeprBookCode);
FALedgEntry.SetRange("FA Posting Category", FALedgEntry."FA Posting Category"::" ");
- FALedgEntry.SetRange(
- "FA Posting Type",
- FALedgEntry."FA Posting Type"::"Acquisition Cost", FALedgEntry."FA Posting Type"::"Custom 2");
+ FALedgEntry.SetFilter("FA Posting Type", '<=%1|%2', FALedgEntry."FA Posting Type"::"Custom 2", FALedgEntry."FA Posting Type"::Derogatory);
FALedgEntry.SetRange("Posting Date", StartingDate, EndingDate2);
end;
}
@@ -142,6 +140,12 @@ report 5684 "Copy FA Entries to G/L Budget"
Caption = 'Custom 2';
ToolTip = 'Specifies whether custom 2 entries posted to this depreciation book are posted to the general ledger and the FA ledger.';
}
+ field("TransferType[7]"; TransferType[7])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether derogatory depreciation entries posted to this depreciation book are posted both to the general ledger and the FA ledger.';
+ }
}
}
}
@@ -187,7 +191,7 @@ report 5684 "Copy FA Entries to G/L Budget"
FALedgEntry: Record "FA Ledger Entry";
BudgetDepreciation: Codeunit "Budget Depreciation";
Window: Dialog;
- TransferType: array[6] of Boolean;
+ TransferType: array[7] of Boolean;
BalAccount: Boolean;
PostingDescription: Text[100];
DeprBookCode: Code[10];
@@ -219,6 +223,8 @@ report 5684 "Copy FA Entries to G/L Budget"
exit(TransferType[5]);
FALedgEntry."FA Posting Type"::"Custom 2":
exit(TransferType[6]);
+ FALedgEntry."FA Posting Type"::Derogatory:
+ exit(TransferType[7]);
end;
exit(false);
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAAllocationType.Enum.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAAllocationType.Enum.al
index d44899399c..c51401ebed 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAAllocationType.Enum.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAAllocationType.Enum.al
@@ -21,4 +21,5 @@ enum 5615 "FA Allocation Type"
value(9; "Loss") { Caption = 'Loss'; }
value(10; "Book Value (Gain)") { Caption = 'Book Value (Gain)'; }
value(11; "Book Value (Loss)") { Caption = 'Book Value (Loss)'; }
+ value(12; "Derogatory") { Caption = 'Derogatory'; }
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
index a02ad7e8ec..a362ebf8b9 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FACheckConsistency.Codeunit.al
@@ -87,6 +87,7 @@ codeunit 5606 "FA Check Consistency"
DeprBasis: Decimal;
SalvageValue: Decimal;
NewAmount: Decimal;
+ DerogAmount: Decimal;
#pragma warning disable AA0074
#pragma warning disable AA0470
@@ -146,6 +147,9 @@ codeunit 5606 "FA Check Consistency"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Salvage Value");
FALedgEntry.CalcSums(Amount);
SalvageValue := FALedgEntry.Amount;
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
+ FALedgEntry.CalcSums(Amount);
+ DerogAmount := FALedgEntry.Amount;
FALedgEntry.SetRange("FA Posting Type", FALedgEntry2."FA Posting Type");
FALedgEntry.CalcSums(Amount);
NewAmount := FALedgEntry.Amount;
@@ -164,6 +168,8 @@ codeunit 5606 "FA Check Consistency"
if FALedgEntry."Part of Depreciable Basis" then
DeprBasis := DeprBasis + FALedgEntry.Amount;
end;
+ if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::Derogatory then
+ DerogAmount := DerogAmount + FALedgEntry.Amount;
if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::"Salvage Value" then
SalvageValue := SalvageValue + FALedgEntry.Amount;
if FALedgEntry."FA Posting Type" = FALedgEntry2."FA Posting Type" then
@@ -292,6 +298,8 @@ codeunit 5606 "FA Check Consistency"
FADeprBook."Last Appreciation Date" := MaxDate;
FALedgEntry2."FA Posting Type"::"Custom 1":
FADeprBook."Last Custom 1 Date" := MaxDate;
+ FALedgEntry2."FA Posting Type"::Derogatory:
+ FADeprBook."Last Derogatory" := MaxDate;
FALedgEntry2."FA Posting Type"::"Custom 2":
FADeprBook."Last Custom 2 Date" := MaxDate;
FALedgEntry2."FA Posting Type"::"Proceeds on Disposal":
@@ -350,13 +358,14 @@ codeunit 5606 "FA Check Consistency"
CreatePostingTypeError();
end;
end;
- if BookValue + SalvageValue < 0 then
+ if BookValue + SalvageValue - DerogAmount < 0 then
if not DeprBook."Allow Depr. below Zero" or
- (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::Depreciation)
+ ((FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::Depreciation) and
+ (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::Derogatory))
then
if not DeprBook."Allow Acq. Cost below Zero" or
- (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::"Acquisition Cost") or
- not FALedgEntry2."Index Entry"
+ (FALedgEntry2."FA Posting Type" <> FALedgEntry2."FA Posting Type"::"Acquisition Cost") or
+ not FALedgEntry2."Index Entry"
then begin
if FALedgEntry2."Reclassification Entry" and (SalvageValue <> 0) then
Error(SalvageValueErr);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
index 9cc73376a6..16448f4797 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGeneralReport.Codeunit.al
@@ -19,6 +19,8 @@ codeunit 5626 "FA General Report"
FADeprBook: Record "FA Depreciation Book";
FALedgEntry: Record "FA Ledger Entry";
DepreciationCalc: Codeunit "Depreciation Calculation";
+ UseCreditAmounts: Boolean;
+ UseDebitAmounts: Boolean;
#pragma warning disable AA0074
Text000: Label 'Posting Date Filter';
@@ -63,6 +65,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Last Custom 1 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Last Derogatory"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Last Custom 2 Date"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Last Salvage Value Date"):
@@ -92,7 +96,20 @@ codeunit 5626 "FA General Report"
procedure CalcFAPostedAmount(FANo: Code[20]; PostingType: Integer; Period: Option "Before Starting Date","Net Change","at Ending Date"; StartingDate: Date; EndingDate: Date; DeprBookCode: Code[10]; BeforeAmount: Decimal; UntilAmount: Decimal; OnlyReclassified: Boolean; OnlyBookValue: Boolean) Result: Decimal
begin
- ClearAll();
+ case true of
+ UseCreditAmounts:
+ begin
+ ClearAll();
+ UseCreditAmounts := true;
+ end;
+ UseDebitAmounts:
+ begin
+ ClearAll();
+ UseDebitAmounts := true
+ end;
+ else
+ ClearAll();
+ end;
if PostingType = 0 then
exit(0);
if EndingDate = 0D then
@@ -126,6 +143,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -148,7 +167,10 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.SetRange("FA Posting Date", 0D, EndingDate);
end;
- FALedgEntry.CalcSums(Amount);
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then
+ FALedgEntry.CalcSums(Amount, "Debit Amount", "Credit Amount")
+ else
+ FALedgEntry.CalcSums(Amount);
if (PostingType = FADeprBook.FieldNo("Book Value")) or
(PostingType = FADeprBook.FieldNo(Depreciation))
@@ -161,7 +183,17 @@ codeunit 5626 "FA General Report"
Period::"at Ending Date":
FALedgEntry.Amount := FALedgEntry.Amount + UntilAmount;
end;
- Result := FALedgEntry.Amount;
+ if (PostingType = FADeprBook.FieldNo("Derogatory Amount")) then begin
+ if UseCreditAmounts then begin
+ Clear(UseCreditAmounts);
+ Result := FALedgEntry."Credit Amount";
+ end;
+ if UseDebitAmounts then begin
+ Clear(UseDebitAmounts);
+ Result := FALedgEntry."Debit Amount";
+ end;
+ end else
+ Result := FALedgEntry.Amount;
OnAfterCalcFAPostedAmount(FALedgEntry, PostingType, Period, BeforeAmount, UntilAmount, Result);
end;
@@ -189,6 +221,8 @@ codeunit 5626 "FA General Report"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Appreciation);
FADeprBook.FieldNo("Custom 1"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 1");
+ FADeprBook.FieldNo("Derogatory Amount"):
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
FADeprBook.FieldNo("Custom 2"):
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
FADeprBook.FieldNo("Proceeds on Disposal"):
@@ -282,6 +316,18 @@ codeunit 5626 "FA General Report"
Window.Close();
end;
+ [Scope('OnPrem')]
+ procedure SetSign(Sign: Boolean)
+ begin
+ if Sign = true then begin
+ UseCreditAmounts := true;
+ UseDebitAmounts := false
+ end else begin
+ UseCreditAmounts := false;
+ UseDebitAmounts := true;
+ end;
+ end;
+
[IntegrationEvent(false, false)]
local procedure OnAfterCalcFAPostedAmount(var FALedgerEntry: Record "FA Ledger Entry"; PostingType: Integer; Period: Option "Before Starting Date","Net Change","at Ending Date"; BeforeAmount: Decimal; UntilAmount: Decimal; var Result: Decimal)
begin
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al
index 70a7c752f4..ce180bca2a 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetGLAccountNo.Codeunit.al
@@ -43,6 +43,8 @@ codeunit 5602 "FA Get G/L Account No."
GLAccNo := FAPostingGr.GetCustom1Account();
FALedgEntry."FA Posting Type"::"Custom 2":
GLAccNo := FAPostingGr.GetCustom2Account();
+ FALedgEntry."FA Posting Type"::Derogatory:
+ GLAccNo := FAPostingGr.GetDerogatoryAccount();
FALedgEntry."FA Posting Type"::"Proceeds on Disposal":
GLAccNo := FAPostingGr.GetSalesAccountOnDisposalGain();
FALedgEntry."FA Posting Type"::"Gain/Loss":
@@ -69,6 +71,8 @@ codeunit 5602 "FA Get G/L Account No."
GLAccNo := FAPostingGr.GetCustom1AccountOnDisposal();
FALedgEntry."FA Posting Type"::"Custom 2":
GLAccNo := FAPostingGr.GetCustom2AccountOnDisposal();
+ FALedgEntry."FA Posting Type"::Derogatory:
+ GLAccNo := FAPostingGr.GetDerogatoryAccountDecrease();
FALedgEntry."FA Posting Type"::"Book Value on Disposal":
begin
if FALedgEntry."Result on Disposal" = FALedgEntry."Result on Disposal"::Gain then
@@ -89,6 +93,8 @@ codeunit 5602 "FA Get G/L Account No."
GLAccNo := FAPostingGr.GetCustom1BalAccountOnDisposal();
FALedgEntry."FA Posting Type"::"Custom 2":
GLAccNo := FAPostingGr.GetCustom2BalAccountOnDisposal();
+ FALedgEntry."FA Posting Type"::Derogatory:
+ GLAccNo := FAPostingGr.GetDerogatoryBalAccountDecrease();
end;
OnAfterGetAccNo(FALedgEntry, GLAccNo);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
index ca759d45fe..6679c946a6 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAGetJournal.Codeunit.al
@@ -135,6 +135,8 @@ codeunit 5639 "FA Get Journal"
exit(DeprBook."G/L Integration - Maintenance");
FAPostingType::"Salvage Value":
exit(false);
+ FAPostingType::Derogatory:
+ exit(DeprBook."Integration G/L - Derogatory");
end;
OnAfterCalcGLIntegration(DeprBook, FAPostingType, Result);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
index 7805e3d670..2662026fd8 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertGLAccount.Codeunit.al
@@ -126,7 +126,7 @@ codeunit 5601 "FA Insert G/L Account"
FAPostingGr.Reset();
FAPostingGr.GetPostingGroup(PostingGrCode, DeprBookCode);
OnInsertBufferBalAccOnAfterGetFAPostingGroup(FAPostingGr);
- GLAccNo := GetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType);
+ GLAccNo := GetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType, AllocAmount);
DimensionSetIDArr[1] := DimSetID;
@@ -362,7 +362,7 @@ codeunit 5601 "FA Insert G/L Account"
GenJnlLine.Modify(true);
end;
- local procedure GetGLAccNoFromFAPostingGroup(FAPostingGr: Record "FA Posting Group"; FAPostingType: Enum "FA Posting Group Account Type") GLAccNo: Code[20]
+ local procedure GetGLAccNoFromFAPostingGroup(FAPostingGr: Record "FA Posting Group"; FAPostingType: Enum "FA Posting Group Account Type"; AllocAmount: Decimal) GLAccNo: Code[20]
var
FieldErrorText: Text[50];
IsHandled: Boolean;
@@ -459,6 +459,19 @@ codeunit 5601 "FA Insert G/L Account"
if FAPostingGr."Allocated Book Value % (Loss)" > 100 then
FAPostingGr.FieldError("Allocated Book Value % (Loss)", FieldErrorText);
end;
+ FAPostingType::Derogatory:
+ begin
+ if AllocAmount > 0 then begin
+ FAPostingGr.TestField("Derogatory Expense Acc.");
+ GLAccNo := FAPostingGr."Derogatory Expense Acc."
+ end else begin
+ FAPostingGr.TestField("Derog. Bal. Account (Decrease)");
+ GLAccNo := FAPostingGr."Derog. Bal. Account (Decrease)";
+ end;
+ FAPostingGr.CalcFields("Allocated Derogatory Pct.");
+ if FAPostingGr."Allocated Derogatory Pct." > 100 then
+ FAPostingGr.FieldError("Allocated Derogatory Pct.", FieldErrorText);
+ end;
end;
OnAfterGetGLAccNoFromFAPostingGroup(FAPostingGr, FAPostingType, GLAccNo);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
index 568dcc58e0..4eab4fbc1c 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAInsertLedgerEntry.Codeunit.al
@@ -115,6 +115,7 @@ codeunit 5600 "FA Insert Ledger Entry"
(LastEntryNo > 0)
then
CheckFADocNo(FALedgEntry);
+ FALedgEntry."Derogatory Excluded" := CalcExcludeDerogatory(FALedgEntry);
FALedgEntry.Insert(true);
FeatureTelemetry.LogUsage('0000H4F', 'Fixed Asset', 'Insert FA Ledger Entry');
OnInsertFAOnAfterInsertFALedgEntry(FALedgEntry, FALedgEntry3);
@@ -153,7 +154,9 @@ codeunit 5600 "FA Insert Ledger Entry"
OnInsertFAOnBeforeFACheckConsistency(FALedgEntry, FALedgEntry3);
if FALedgEntry3."FA Posting Category" = FALedgEntry3."FA Posting Category"::" " then
- if FALedgEntry3."FA Posting Type".AsInteger() <= FALedgEntry3."FA Posting Type"::"Salvage Value".AsInteger() then
+ if (FALedgEntry3."FA Posting Type".AsInteger() <= FALedgEntry3."FA Posting Type"::"Salvage Value".AsInteger()) or
+ (FALedgEntry3."FA Posting Type" = FALedgEntry3."FA Posting Type"::Derogatory)
+ then
CODEUNIT.Run(CODEUNIT::"FA Check Consistency", FALedgEntry);
OnBeforeInsertRegister(FALedgEntry, FALedgEntry2, NextEntryNo);
@@ -239,6 +242,7 @@ codeunit 5600 "FA Insert Ledger Entry"
end;
case FALedgerEntry."FA Posting Type" of
"FA Ledger Entry FA Posting Type"::"Acquisition Cost",
+ "FA Ledger Entry FA Posting Type"::Derogatory,
"FA Ledger Entry FA Posting Type"::Depreciation,
"FA Ledger Entry FA Posting Type"::"Bonus Depreciation":
FALedgerEntry."Part of Book Value" := true;
@@ -494,8 +498,11 @@ codeunit 5600 "FA Insert Ledger Entry"
IsHandled := false;
OnInsertReverseEntryOnBeforeInsertTempFALedgEntry(FALedgEntry3, IsHandled);
if not IsHandled then begin
- TempFALedgEntry := FALedgEntry3;
- TempFALedgEntry.Insert();
+ DeprBook.Get(FALedgEntry3."Depreciation Book Code");
+ if DeprBook."Derogatory Calc." = '' then begin
+ TempFALedgEntry := FALedgEntry3;
+ TempFALedgEntry.Insert();
+ end;
end;
SetFAReversalMark(FALedgEntry3, NextEntryNo);
FALedgEntry3."Entry No." := NextEntryNo;
@@ -518,6 +525,7 @@ codeunit 5600 "FA Insert Ledger Entry"
CODEUNIT.Run(CODEUNIT::"FA Check Consistency", FALedgEntry3);
OnInsertReverseEntryOnBeforeInsertRegister(FALedgEntry3);
InsertRegister("FA Register Called From"::"Fixed Asset", NextEntryNo);
+ InsertFARevEntryForDerog(FAEntryType, NewFAEntryNo, FALedgEntry3);
end;
end;
if FAEntryType = FAEntryType::Maintenance then begin
@@ -542,6 +550,8 @@ codeunit 5600 "FA Insert Ledger Entry"
Error(DimMgt.GetDimValuePostingErr());
OnInsertReverseEntryOnBeforeInsertMaintenanceLedgerEntryBuffer(MaintenanceLedgEntry3, SkipInsertOfMaintenanceLedgerEntry);
+ DeprBook.Get(MaintenanceLedgEntry3."Depreciation Book Code");
+ SkipInsertOfMaintenanceLedgerEntry := SkipInsertOfMaintenanceLedgerEntry or (DeprBook."Derogatory Calc." <> '');
if not SkipInsertOfMaintenanceLedgerEntry then begin
TempMaintenanceLedgEntry := MaintenanceLedgEntry3;
TempMaintenanceLedgEntry.Insert()
@@ -671,6 +681,50 @@ codeunit 5600 "FA Insert Ledger Entry"
LastEntryNo := FALedgEntry.GetLastEntryNo();
end;
+ [Scope('OnPrem')]
+ procedure InsertFARevEntryForDerog(FAEntryType: Option " ","Fixed Asset",Maintenance; var NewFAEntryNo: Integer; FALedgEntry: Record "FA Ledger Entry")
+ var
+ FALedgEntryForDerog: Record "FA Ledger Entry";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", FALedgEntry."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ exit;
+ FALedgEntryForDerog.Reset();
+ FALedgEntryForDerog.SetRange("Depreciation Book Code", DeprBook.Code);
+ FALedgEntryForDerog.SetRange("FA No.", FALedgEntry."FA No.");
+ FALedgEntryForDerog.SetRange("FA Posting Type", FALedgEntry."FA Posting Type");
+ FALedgEntryForDerog.SetRange(Amount, -FALedgEntry.Amount);
+ FALedgEntryForDerog.SetRange("Document Type", FALedgEntry."Document Type");
+ FALedgEntryForDerog.SetRange("Document No.", FALedgEntry."Document No.");
+ if FALedgEntryForDerog.FindFirst() then
+ InsertReverseEntry(0, FAEntryType, FALedgEntryForDerog."Entry No.", NewFAEntryNo, 0);
+ end;
+
+ [Scope('OnPrem')]
+ procedure InsertMaintRevEntryForDerog(FAEntryType: Option; var NewFAEntryNo: Integer; MaintenanceLedgEntry: Record "Maintenance Ledger Entry")
+ var
+ MaintLedgEntryForDerog: Record "Maintenance Ledger Entry";
+ begin
+ DeprBook.SetRange("Derogatory Calc.", MaintenanceLedgEntry."Depreciation Book Code");
+ if not DeprBook.FindFirst() then
+ exit;
+ MaintLedgEntryForDerog.Reset();
+ MaintLedgEntryForDerog.SetRange("Depreciation Book Code", DeprBook.Code);
+ MaintLedgEntryForDerog.SetRange("FA No.", MaintenanceLedgEntry."FA No.");
+ MaintLedgEntryForDerog.SetRange("Document Type", MaintenanceLedgEntry."Document Type");
+ MaintLedgEntryForDerog.SetRange("Document No.", MaintenanceLedgEntry."Document No.");
+ if MaintLedgEntryForDerog.FindFirst() then
+ InsertReverseEntry(0, FAEntryType, MaintLedgEntryForDerog."Entry No.", NewFAEntryNo, 0);
+ end;
+
+ local procedure CalcExcludeDerogatory(FALedgerEntry: Record "FA Ledger Entry"): Boolean
+ var
+ DepreciationBook: Record "Depreciation Book";
+ begin
+ DepreciationBook.Get(FALedgerEntry."Depreciation Book Code");
+ exit((FALedgerEntry."FA Posting Type" = FALedgerEntry."FA Posting Type"::Derogatory) and not DepreciationBook.IsDerogatoryBook());
+ end;
+
procedure SetGLRegisterNo(NewGLRegisterNo: Integer)
begin
GLRegisterNo := NewGLRegisterNo;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
index 73bf343603..f99e41d5c8 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlCheckLine.Codeunit.al
@@ -347,6 +347,8 @@ codeunit 5631 "FA Jnl.-Check Line"
GLIntegration := DeprBook."G/L Integration - Disposal";
FAPostingType::Maintenance:
GLIntegration := DeprBook."G/L Integration - Maintenance";
+ FAPostingType::Derogatory:
+ GLIntegration := DeprBook."Integration G/L - Derogatory";
FAPostingType::"Salvage Value":
GLIntegration := false;
FAPostingType::"Bonus Depreciation":
@@ -489,7 +491,8 @@ codeunit 5631 "FA Jnl.-Check Line"
if GenJnlLine."Depr. until FA Posting Date" then
GenJnlLine.FieldError("Depr. until FA Posting Date", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Depreciation) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::"Custom 1") and (GenJnlLine."No. of Depreciation Days" <> 0) and (GenJnlLine."FA Posting Type" <> GenJnlLine."FA Posting Type"::Derogatory);
+
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
GenJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
@@ -551,7 +554,8 @@ codeunit 5631 "FA Jnl.-Check Line"
then
FAJnlLine.FieldError("Maintenance Code", FieldErrorText);
- ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0);
+ ShouldCheckNoOfDepreciationDays := (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Depreciation) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::"Custom 1") and (FAJnlLine."No. of Depreciation Days" <> 0) and (FAJnlLine."FA Posting Type" <> FAJnlLine."FA Posting Type"::Derogatory);
+
OnCheckConsistencyOnAfterCalcShouldCheckNoOfDepreciationDays(GenJnlLine, FieldErrorText, ShouldCheckNoOfDepreciationDays, FAJnlLine);
if ShouldCheckNoOfDepreciationDays then
FAJnlLine.FieldError("No. of Depreciation Days", FieldErrorText);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
index b7297874d9..762b96aa24 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostBatch.Codeunit.al
@@ -6,6 +6,7 @@ namespace Microsoft.FixedAssets.Posting;
using Microsoft.Finance.Analysis;
using Microsoft.Finance.GeneralLedger.Preview;
+using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Ledger;
using Microsoft.Foundation.NoSeries;
@@ -45,8 +46,9 @@ codeunit 5633 "FA Jnl.-Post Batch"
LastPostedDocNo: Code[20];
PreviewMode: Boolean;
SuppressCommit: Boolean;
+#pragma warning disable AA0470
+ SetupCombErr: Label 'must not be specified when %1 = %2 in %3', Comment = 'must not be specified when G/L Integration - Derogatory = TRUE in Depreciation Book';
#pragma warning disable AA0074
-#pragma warning disable AA0470
Text001: Label 'Journal Batch Name #1##########\\';
Text002: Label 'Checking lines #2######\';
Text003: Label 'Posting lines #3###### @4@@@@@@@@@@@@@\';
@@ -262,6 +264,64 @@ codeunit 5633 "FA Jnl.-Post Batch"
FAJnlLine."Salvage Value" := 0;
end;
+ [Scope('OnPrem')]
+ procedure MakeDerogatoryFAJnlLine(var NewFAJnlLine: Record "FA Journal Line"; FAJournalLine: Record "FA Journal Line"): Boolean
+ var
+ DeprBook: Record "Depreciation Book";
+ FADeprBook: Record "FA Depreciation Book";
+ begin
+ NewFAJnlLine.Copy(FAJournalLine);
+ DeprBook.SetRange("Derogatory Calc.", FAJournalLine."Depreciation Book Code");
+ if DeprBook.FindFirst() then
+ if FADeprBook.Get(NewFAJnlLine."FA No.", DeprBook.Code) then begin
+ NewFAJnlLine.Validate("Depreciation Book Code", DeprBook.Code);
+ exit(true);
+ end;
+ exit(false);
+ end;
+
+ local procedure CreateAndPostDerogEntry(SourceFAJournalLine: Record "FA Journal Line")
+ var
+ DepreciationBook: Record "Depreciation Book";
+ DerogDepreciationBook: Record "Depreciation Book";
+ FAJournalLine: Record "FA Journal Line";
+ DerogFAJnlLine: Record "FA Journal Line";
+ CalculateAcqCostDepr: Codeunit "Calculate Acq. Cost Depr.";
+ DerogatoryAmount: Decimal;
+ begin
+ if (SourceFAJournalLine."FA Posting Type" <> SourceFAJournalLine."FA Posting Type"::"Acquisition Cost") or
+ (not SourceFAJournalLine."Depr. Acquisition Cost")
+ then
+ exit;
+
+ DepreciationBook.Get(SourceFAJournalLine."Depreciation Book Code");
+ DerogDepreciationBook.SetRange("Derogatory Calc.", DepreciationBook.Code);
+ if not DerogDepreciationBook.FindFirst() then
+ exit;
+
+ CalculateAcqCostDepr.DerogatoryCalculation(
+ DerogatoryAmount, SourceFAJournalLine."FA No.", DerogDepreciationBook.Code, SourceFAJournalLine.Amount);
+
+ if DerogatoryAmount = 0 then
+ exit;
+
+ if DepreciationBook."Integration G/L - Derogatory" then
+ SourceFAJournalLine.FieldError(
+ "Depr. Acquisition Cost", StrSubstNo(SetupCombErr,
+ DepreciationBook.FieldCaption("Integration G/L - Derogatory"), true, DepreciationBook.TableCaption()));
+ // Insert/post G/L + FA entries for primary depreciation book
+ FAJournalLine.TransferFields(SourceFAJournalLine);
+ FAJournalLine.Validate("FA Posting Type", FAJournalLine."FA Posting Type"::Derogatory);
+ FAJournalLine.Validate(Amount, DerogatoryAmount);
+ FAJournalLine.Validate("Depr. until FA Posting Date", false);
+ FAJournalLine.Validate("Depr. Acquisition Cost", false);
+ FAJnlPostLine.FAJnlPostLine(FAJournalLine, true);
+
+ // Post FA ledger entry for secondary book
+ MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJournalLine);
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, true);
+ end;
+
procedure SetPreviewMode(NewPreviewMode: Boolean)
begin
PreviewMode := NewPreviewMode;
@@ -274,6 +334,7 @@ codeunit 5633 "FA Jnl.-Post Batch"
local procedure PostLines()
var
+ DerogFAJnlLine: Record "FA Journal Line";
IsHandled: Boolean;
begin
LineCount := 0;
@@ -310,7 +371,13 @@ codeunit 5633 "FA Jnl.-Post Batch"
end;
OnPostLinesOnBeforeFAJnlPostLine(FAJnlLine, FAJnlPostLine);
FAJnlPostLine.FAJnlPostLine(FAJnlLine, false);
- OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
+ if MakeDerogatoryFAJnlLine(DerogFAJnlLine, FAJnlLine) then begin
+ if FAJnlLine."FA Error Entry No." <> 0 then
+ DerogFAJnlLine."FA Error Entry No." := FAJnlPostLine.GetNextMatchingFALedgEntry(FAJnlLine, FAJnlLine."FA Error Entry No.", DerogFAJnlLine."Depreciation Book Code");
+ FAJnlPostLine.FAJnlPostLine(DerogFAJnlLine, false);
+ OnPostLinesOnAfterFAJnlPostLine(FAJnlLine);
+ CreateAndPostDerogEntry(FAJnlLine);
+ end;
until FAJnlLine.Next() = 0;
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
index fb1313fbd0..c366492e59 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJnlPostLine.Codeunit.al
@@ -105,46 +105,52 @@ codeunit 5632 "FA Jnl.-Post Line"
IsHandled := false;
OnBeforeGenJnlPostLine(GenJnlLine, FAInsertLedgEntry, FAAmount, VATAmount, NextTransactionNo, NextGLEntryNo, GLRegisterNo, IsHandled);
if not IsHandled then begin
- FAInsertLedgEntry.SetGLRegisterNo(GLRegisterNo);
FAInsertLedgEntry.DeleteAllGLAcc();
- if GenJnlLine."Account No." = '' then
- exit;
- if GenJnlLine."FA Posting Date" = 0D then
- GenJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
- if GenJnlLine."Journal Template Name" = '' then
- GenJnlLine.Quantity := 0;
- DuplicateDeprBook.DuplicateGenJnlLine(GenJnlLine, FAAmount);
- FANo := GenJnlLine."Account No.";
- BudgetNo := GenJnlLine."Budgeted FA No.";
- DeprBookCode := GenJnlLine."Depreciation Book Code";
- FAPostingType := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
- FAPostingDate := GenJnlLine."FA Posting Date";
- Amount2 := FAAmount;
- SalvageValue := GenJnlLine.ConvertAmtFCYToLCYForSourceCurrency(GenJnlLine."Salvage Value");
- DeprUntilDate := GenJnlLine."Depr. until FA Posting Date";
- DeprAcqCost := GenJnlLine."Depr. Acquisition Cost";
- ErrorEntryNo := GenJnlLine."FA Error Entry No.";
- if GenJnlLine."FA Posting Type" = GenJnlLine."FA Posting Type"::Maintenance then begin
- MakeMaintenanceLedgEntry.CopyFromGenJnlLine(MaintenanceLedgEntry, GenJnlLine);
- MaintenanceLedgEntry.Amount := FAAmount;
- MaintenanceLedgEntry."VAT Amount" := VATAmount;
- MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
- MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
- PostMaintenance();
- end else begin
- MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
- FALedgEntry.Amount := FAAmount;
- FALedgEntry."VAT Amount" := VATAmount;
- FALedgEntry."Transaction No." := NextTransactionNo;
- FALedgEntry."G/L Entry No." := NextGLEntryNo;
- OnBeforePostFixedAssetFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount, GLRegisterNo);
- PostFixedAsset();
- end;
+ GenJnlPostLineContinue(GenJnlLine, FAAmount, VATAmount, NextTransactionNo, NextGLEntryNo, GLRegisterNo);
+ end;
+ end;
- FAInsertLedgEntry.CopyRecordLinksToFALedgEntry(GenJnlLine);
+ [Scope('OnPrem')]
+ procedure GenJnlPostLineContinue(GenJnlLine: Record "Gen. Journal Line"; FAAmount: Decimal; VATAmount: Decimal; NextTransactionNo: Integer; NextGLEntryNo: Integer; GLRegisterNo: Integer)
+ begin
+ FAInsertLedgEntry.SetGLRegisterNo(GLRegisterNo);
+ if GenJnlLine."Account No." = '' then
+ exit;
+ if GenJnlLine."FA Posting Date" = 0D then
+ GenJnlLine."FA Posting Date" := GenJnlLine."Posting Date";
+ if GenJnlLine."Journal Template Name" = '' then
+ GenJnlLine.Quantity := 0;
+ DuplicateDeprBook.DuplicateGenJnlLine(GenJnlLine, FAAmount);
+ FANo := GenJnlLine."Account No.";
+ BudgetNo := GenJnlLine."Budgeted FA No.";
+ DeprBookCode := GenJnlLine."Depreciation Book Code";
+ FAPostingType := Enum::"FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
+ FAPostingDate := GenJnlLine."FA Posting Date";
+ Amount2 := FAAmount;
+ SalvageValue := GenJnlLine.ConvertAmtFCYToLCYForSourceCurrency(GenJnlLine."Salvage Value");
+ DeprUntilDate := GenJnlLine."Depr. until FA Posting Date";
+ DeprAcqCost := GenJnlLine."Depr. Acquisition Cost";
+ ErrorEntryNo := GenJnlLine."FA Error Entry No.";
+ if GenJnlLine."FA Posting Type" = GenJnlLine."FA Posting Type"::Maintenance then begin
+ MakeMaintenanceLedgEntry.CopyFromGenJnlLine(MaintenanceLedgEntry, GenJnlLine);
+ MaintenanceLedgEntry.Amount := FAAmount;
+ MaintenanceLedgEntry."VAT Amount" := VATAmount;
+ MaintenanceLedgEntry."Transaction No." := NextTransactionNo;
+ MaintenanceLedgEntry."G/L Entry No." := NextGLEntryNo;
+ OnBeforePostMaintenanceFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount);
+ PostMaintenance();
+ end else begin
+ MakeFALedgEntry.CopyFromGenJnlLine(FALedgEntry, GenJnlLine);
+ FALedgEntry.Amount := FAAmount;
+ FALedgEntry."VAT Amount" := VATAmount;
+ FALedgEntry."Transaction No." := NextTransactionNo;
+ FALedgEntry."G/L Entry No." := NextGLEntryNo;
+ OnBeforePostFixedAssetFromGenJnlLine(GenJnlLine, FALedgEntry, FAAmount, VATAmount, GLRegisterNo);
+ PostFixedAsset();
end;
+ FAInsertLedgEntry.CopyRecordLinksToFALedgEntry(GenJnlLine);
+
OnAfterGenJnlPostLine(GenJnlLine);
end;
@@ -203,6 +209,14 @@ codeunit 5632 "FA Jnl.-Post Line"
OnAfterPostFixedAsset(FA, FALedgEntry);
end;
+ [Scope('OnPrem')]
+ procedure InsertBalAcc(var FALedgEntry: Record "FA Ledger Entry")
+ begin
+ FAInsertLedgEntry.SetOrgGenJnlLine(true);
+ FAInsertLedgEntry.InsertBalAcc(FALedgEntry);
+ FAInsertLedgEntry.SetOrgGenJnlLine(false);
+ end;
+
local procedure PostMaintenance()
begin
FA.LockTable();
@@ -232,8 +246,8 @@ codeunit 5632 "FA Jnl.-Post Line"
SalesEntryNo: Integer;
DisposalType: Option FirstDisposal,SecondDisposal,ErrorDisposal,LastErrorDisposal;
OldDisposalMethod: Option " ",Net,Gross;
- EntryAmounts: array[14] of Decimal;
- EntryNumbers: array[14] of Integer;
+ EntryAmounts: array[15] of Decimal;
+ EntryNumbers: array[15] of Integer;
i: Integer;
j: Integer;
IsHandled: Boolean;
@@ -276,7 +290,7 @@ codeunit 5632 "FA Jnl.-Post Line"
if DisposalType = DisposalType::FirstDisposal then begin
CalculateDisposal.CalcGainLoss(FANo, DeprBookCode, EntryAmounts);
- for i := 1 to 14 do
+ for i := 1 to 15 do
if EntryAmounts[i] <> 0 then begin
FALedgEntry."FA Posting Category" := CalculateDisposal.SetFALedgerPostingCategory(i);
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetFAPostingType(i));
@@ -468,14 +482,14 @@ codeunit 5632 "FA Jnl.-Post Line"
procedure PostReverseType(FALedgEntry: Record "FA Ledger Entry")
var
- EntryAmounts: array[4] of Decimal;
+ EntryAmounts: array[5] of Decimal;
i: Integer;
begin
OnBeforePostReverseType(FALedgEntry);
CalculateDisposal.CalcReverseAmounts(FANo, DeprBookCode, EntryAmounts);
FALedgEntry."FA Posting Category" := FALedgEntry."FA Posting Category"::" ";
FALedgEntry."Automatic Entry" := true;
- for i := 1 to 4 do
+ for i := 1 to 5 do
if EntryAmounts[i] <> 0 then begin
FALedgEntry.Amount := EntryAmounts[i];
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(CalculateDisposal.SetReverseType(i));
@@ -628,6 +642,24 @@ codeunit 5632 "FA Jnl.-Post Line"
end;
end;
+ [Scope('OnPrem')]
+ procedure GetNextMatchingFALedgEntry(SourceFAJournalLine: Record "FA Journal Line"; FromEntryNo: Integer; DeprBookCode: Code[10]): Integer
+ var
+ FALedgerEntry: Record "FA Ledger Entry";
+ begin
+ FALedgerEntry.SetCurrentKey("Entry No.");
+ FALedgerEntry.SetFilter("Entry No.", '>%1', FromEntryNo);
+ FALedgerEntry.SetRange("Depreciation Book Code", DeprBookCode);
+#pragma warning disable AA0210
+ FALedgerEntry.SetRange(Amount, -SourceFAJournalLine.Amount);
+#pragma warning restore AA0210
+ FALedgerEntry.SetRange("FA Posting Type", SourceFAJournalLine.ConvertToLedgEntry(SourceFAJournalLine));
+ FALedgerEntry.SetRange("FA No.", SourceFAJournalLine."FA No.");
+ FALedgerEntry.SetRange("FA Posting Date", SourceFAJournalLine."FA Posting Date");
+ FALedgerEntry.FindFirst();
+ exit(FALedgerEntry."Entry No.");
+ end;
+
[IntegrationEvent(true, false)]
local procedure OnAfterFAJnlPostLine(var FAJournalLine: Record "FA Journal Line")
begin
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al
index a2e12814ce..5b94d297a6 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLine.Table.al
@@ -435,6 +435,8 @@ table 5621 "FA Journal Line"
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Salvage Value";
FAJnlLine."FA Posting Type"::"Bonus Depreciation":
FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::"Bonus Depreciation";
+ FAJnlLine."FA Posting Type"::Derogatory:
+ FALedgEntry."FA Posting Type" := FALedgEntry."FA Posting Type"::Derogatory;
else
OnConvertToLedgEntryCase(FALedgEntry, FAJnlLine);
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al
index b8c94c8a8d..3f30d18732 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAJournalLineFAPostingType.Enum.al
@@ -51,4 +51,8 @@ enum 5602 "FA Journal Line FA Posting Type"
{
Caption = 'Bonus Depreciation';
}
+ value(12; Derogatory)
+ {
+ Caption = 'Derogatory';
+ }
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
index 5b2e4d9141..f1ceddbee7 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntry.Table.al
@@ -503,6 +503,11 @@ table 5601 "FA Ledger Entry"
CalcFormula = lookup("Dimension Set Entry"."Dimension Value Code" where("Dimension Set ID" = field("Dimension Set ID"),
"Global Dimension No." = const(8)));
}
+ field(5865; "Derogatory Excluded"; Boolean)
+ {
+ Caption = 'Exclude Derogatory';
+ Editable = false;
+ }
field(6210; "Non-Ded. VAT FA Cost"; Boolean)
{
Caption = 'Non-Deductible VAT FA Cost';
@@ -524,7 +529,7 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount;
}
- key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date")
+ key(Key4; "FA No.", "Depreciation Book Code", "Part of Book Value", "FA Posting Date", "Derogatory Excluded")
{
SumIndexFields = Amount;
}
@@ -532,7 +537,7 @@ table 5601 "FA Ledger Entry"
{
SumIndexFields = Amount;
}
- key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date")
+ key(Key6; "FA No.", "Depreciation Book Code", "FA Posting Category", "FA Posting Type", "Posting Date", "Derogatory Excluded")
{
SumIndexFields = Amount;
}
@@ -674,6 +679,8 @@ table 5601 "FA Ledger Entry"
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::"Salvage Value";
"FA Posting Type"::"Bonus Depreciation":
FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::"Bonus Depreciation";
+ "FA Posting Type"::Derogatory:
+ FAJnlLine."FA Posting Type" := FAJnlLine."FA Posting Type"::Derogatory;
else
OnAfterConvertPostingTypeElse(FAJnlLine, Rec);
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al
index 1b8595e4b6..f18d1a5f43 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FALedgerEntryFAPostingType.Enum.al
@@ -55,4 +55,8 @@ enum 5601 "FA Ledger Entry FA Posting Type"
{
Caption = 'Bonus Depreciation';
}
+ value(14; Derogatory)
+ {
+ Caption = 'Derogatory';
+ }
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al
index 8138211e97..a7aecdd7da 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAMatrixPostingType.Table.al
@@ -53,6 +53,7 @@ table 5647 "FA Matrix Posting Type"
InsertRec(9, FADepreciationBook.FieldCaption("Gain/Loss"));
InsertRec(10, FADepreciationBook.FieldCaption("Depreciable Basis"));
InsertRec(11, FADepreciationBook.FieldCaption("Salvage Value"));
+ InsertRec(12, FADepreciationBook.FieldCaption("Derogatory Amount"));
end else
repeat
if "Entry No." = 1 then
@@ -110,6 +111,11 @@ table 5647 "FA Matrix Posting Type"
Delete();
InsertRec(11, FADepreciationBook.FieldCaption("Salvage Value"));
end;
+ if "Entry No." = 12 then
+ if "FA Posting Type Name" <> FADepreciationBook.FieldCaption("Derogatory Amount") then begin
+ Delete();
+ InsertRec(12, FADepreciationBook.FieldCaption("Derogatory Amount"));
+ end;
until Next() = 0;
OnAfterCreateTypes(Rec);
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
index 32d2591cf1..f8926bcfe3 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroup.Table.al
@@ -489,6 +489,57 @@ table 5606 "FA Posting Group"
CheckGLAcc("Book Val. Acc. on Disp. (Loss)", false);
end;
}
+ field(5865; "Derogatory Acc."; Code[20])
+ {
+ Caption = 'Derogatory Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Acc.", false);
+ end;
+ }
+ field(5866; "Derogatory Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derogatory Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Account (Decrease)", false);
+ end;
+ }
+ field(5867; "Derog. Bal. Account (Decrease)"; Code[20])
+ {
+ Caption = 'Derog. Bal. Acc. (Decrease)';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derog. Bal. Account (Decrease)", true);
+ end;
+ }
+ field(5868; "Derogatory Expense Acc."; Code[20])
+ {
+ Caption = 'Derogatory Expense Account';
+ TableRelation = "G/L Account";
+
+ trigger OnValidate()
+ begin
+ CheckGLAcc("Derogatory Expense Acc.", true);
+ end;
+ }
+ field(5869; "Allocated Derogatory Pct."; Decimal)
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ CalcFormula = sum("FA Allocation"."Allocation %" where(Code = field(Code),
+ "Allocation Type" = const(Derogatory)));
+ Caption = 'Allocated Derogatory %';
+ DecimalPlaces = 1 : 1;
+ Editable = false;
+ FieldClass = FlowField;
+ }
}
keys
@@ -790,6 +841,30 @@ table 5606 "FA Posting Group"
OnAfterGetPostingGroup(Rec, DepreciationBookCode, Result);
end;
+ procedure GetDerogatoryAccount(): Code[20]
+ begin
+ TestField("Derogatory Acc.");
+ exit("Derogatory Acc.");
+ end;
+
+ procedure GetDerogatoryAccountDecrease(): Code[20]
+ begin
+ TestField("Derogatory Account (Decrease)");
+ exit("Derogatory Account (Decrease)");
+ end;
+
+ procedure GetDerogatoryBalAccountDecrease(): Code[20]
+ begin
+ TestField("Derog. Bal. Account (Decrease)");
+ exit("Derog. Bal. Account (Decrease)");
+ end;
+
+ procedure GetDerogatoryExpenseAccount(): Code[20]
+ begin
+ TestField("Derogatory Expense Acc.");
+ exit("Derogatory Expense Acc.");
+ end;
+
[IntegrationEvent(false, false)]
local procedure OnAfterGetPostingGroup(var FAPostingGroup: Record "FA Posting Group"; DepreciationBookCode: Code[10]; var Result: Boolean)
begin
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupAccountType.Enum.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupAccountType.Enum.al
index 55d0b95fa8..4b0054b0ee 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupAccountType.Enum.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupAccountType.Enum.al
@@ -57,4 +57,8 @@ enum 5606 "FA Posting Group Account Type"
{
Caption = 'Book Value Loss';
}
+ value(12; "Derogatory")
+ {
+ Caption = 'Derogatory';
+ }
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
index f3d7c68e4c..c626fda4ab 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroupCard.Page.al
@@ -54,6 +54,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
field("Acq. Cost Acc. on Disposal"; Rec."Acq. Cost Acc. on Disposal")
{
ApplicationArea = FixedAssets;
@@ -86,6 +91,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ }
}
group("Balancing Account")
{
@@ -124,6 +134,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
field("Write-Down Bal. Acc. on Disp."; Rec."Write-Down Bal. Acc. on Disp.")
{
ApplicationArea = FixedAssets;
@@ -140,6 +155,11 @@ page 5612 "FA Posting Group Card"
{
ApplicationArea = FixedAssets;
}
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ }
}
group("Gross Disposal")
{
@@ -251,6 +271,14 @@ page 5612 "FA Posting Group Card"
Caption = 'Book Value (Loss)';
ToolTip = 'Specifies the sum that applies to book value gains.';
}
+ field("Allocated Derogatory Pct."; Rec."Allocated Derogatory Pct.")
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies the total percentage of derogatory depreciation allocated, when derogatory depreciation is posted for fixed assets.';
+ }
}
}
area(factboxes)
@@ -360,15 +388,26 @@ page 5612 "FA Posting Group Card"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ }
}
}
}
}
+
var
#pragma warning disable AA0074
Text19064976: Label 'Allocated %';
Text19080001: Label 'Allocated %';
-#pragma warning restore AA0074
+#pragma warning restore AA0074
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
index 1ef4f80a05..962c7badf5 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingGroups.Page.al
@@ -55,6 +55,26 @@ page 5613 "FA Posting Groups"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Derogatory Acc."; Rec."Derogatory Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
+ field("Derogatory Account (Decrease)"; Rec."Derogatory Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L account number to post derogatory transactions to, when you dispose of fixed assets in this posting group.';
+ }
+ field("Derogatory Expense Acc."; Rec."Derogatory Expense Acc.")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the G/L balancing account number to post derogatory transactions to, for fixed assets in this posting group.';
+ }
+ field("Derog. Bal. Account (Decrease)"; Rec."Derog. Bal. Account (Decrease)")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the number of the G/L balancing account to post derogatory transactions of fixed assets to, when you dispose of fixed assets.';
+ }
field("Acq. Cost Acc. on Disposal"; Rec."Acq. Cost Acc. on Disposal")
{
ApplicationArea = FixedAssets;
@@ -326,9 +346,20 @@ page 5613 "FA Posting Groups"
"Allocation Type" = const(Loss);
ToolTip = 'View or edit the FA allocations that apply to losses.';
}
+ action(FA_Derogatory_Allocations)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'De&rogatory';
+ Image = Delegate;
+ RunObject = Page "FA Allocations";
+ RunPageLink = Code = field(Code),
+ "Allocation Type" = const(Derogatory);
+ ToolTip = 'View or change the posting account and allocation percentage for derogatory transactions for fixed assets in this posting group.';
+ }
}
}
}
}
+
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al
index a76252bbe0..705f7f175a 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingType.Table.al
@@ -76,6 +76,11 @@ table 5644 "FA Posting Type"
"FA Entry" := false;
"G/L Entry" := true;
InsertRec(12, FADepreciationBook.FieldNo("Book Value on Disposal"), FADepreciationBook.FieldCaption("Book Value on Disposal"));
+ "Entry No." := 13;
+ "FA Entry" := true;
+ "FA Posting Type No." := FADepreciationBook.FieldNo("Derogatory Amount");
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption("Derogatory Amount");
+ Insert();
end else begin
SetCurrentKey("Entry No.");
Find('-');
@@ -164,6 +169,15 @@ table 5644 "FA Posting Type"
Delete();
InsertRec(12, FADepreciationBook.FieldNo("Book Value on Disposal"), FADepreciationBook.FieldCaption("Book Value on Disposal"));
end;
+ if "Entry No." = 13 then
+ if ("FA Posting Type No." <> FADepreciationBook.FieldNo("Derogatory Amount")) or
+ ("FA Posting Type Name" <> FADepreciationBook.FieldCaption("Derogatory Amount"))
+ then begin
+ Delete();
+ "FA Posting Type No." := FADepreciationBook.FieldNo("Derogatory Amount");
+ "FA Posting Type Name" := FADepreciationBook.FieldCaption("Derogatory Amount");
+ Insert();
+ end;
until Next() = 0;
end;
OnAfterCreateTypes(Rec);
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al
index dd1bac6cc7..ba28a96586 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAPostingTypesOvervMatrix.Page.al
@@ -835,6 +835,11 @@ page 9277 "FA Posting Types Overv. Matrix"
FALedgerEntry.SetRange("FA Posting Type", FALedgerEntry."FA Posting Type"::"Salvage Value");
PAGE.Run(0, FALedgerEntry);
end;
+ 12:// 'Derogatory'
+ begin
+ FALedgerEntry.SetRange("FA Posting Type", FALedgerEntry."FA Posting Type"::Derogatory);
+ PAGE.Run(0, FALedgerEntry);
+ end;
else
OnMATRIX_OnDrillDownOnCaseElse(MATRIX_ColumnOrdinal, FALedgerEntry);
end;
@@ -937,6 +942,12 @@ page 9277 "FA Posting Types Overv. Matrix"
FADeprBook.CalcFields("Salvage Value");
MATRIX_CellData[MATRIX_ColumnOrdinal] := MatrixMgt.RoundAmount(FADeprBook."Salvage Value", RoundingFactor);
end;
+ 12:// 'Derogatory'
+ begin
+ if FADeprBook.FindFirst() then
+ FADeprBook.CalcFields("Derogatory Amount");
+ MATRIX_CellData[MATRIX_ColumnOrdinal] := MatrixMgt.RoundAmount(FADeprBook."Derogatory Amount", RoundingFactor);
+ end;
end;
SetVisible();
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
index 966148c4d1..3dfdff4033 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournal.Page.al
@@ -135,6 +135,12 @@ page 5636 "FA Reclass. Journal"
ApplicationArea = FixedAssets;
Visible = false;
}
+ field("Reclass. Derogatory"; Rec."Reclass. Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies that you want to reclassify the accumulated derogatory depreciation in the FA No. field to the fixed asset in the New FA No. field.';
+ Visible = false;
+ }
field("Insert Bal. Account"; Rec."Insert Bal. Account")
{
ApplicationArea = FixedAssets;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
index 40d2bd02a1..70d2d05eb9 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassJournalLine.Table.al
@@ -160,6 +160,10 @@ table 5624 "FA Reclass. Journal Line"
Caption = 'Calc. DB1 Depr. Amount';
ToolTip = 'Specifies that the Reclassify function fills in the Temp. Ending Date and Temp. Fixed Depr. Amount fields on the FA depreciation book.';
}
+ field(5865; "Reclass. Derogatory"; Boolean)
+ {
+ Caption = 'Reclassify Derogatory';
+ }
}
keys
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
index 796012ccb1..e0cd3e5ef7 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FAReclassTransferLine.Codeunit.al
@@ -116,7 +116,10 @@ codeunit 5642 "FA Reclass. Transfer Line"
if j = 7 then
j := 9;
Convert(OldNewFA, j, FAPostingType, Sign, FANo);
- i := FAPostingType.AsInteger() + 1;
+ if FAPostingType = FAPostingType::Derogatory then
+ i := 7
+ else
+ i := FAPostingType.AsInteger() + 1;
TemplateName := '';
BatchName := '';
if TransferType[i] and (Amounts[i] <> 0) then begin
@@ -154,6 +157,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FADeprBook.CalcFields("Custom 1");
if TransferType[6] then
FADeprBook.CalcFields("Custom 2");
+ if TransferType[7] then
+ FADeprBook.CalcFields("Derogatory Amount");
if TransferType[9] then
FADeprBook.CalcFields("Salvage Value");
Amounts[1] := FADeprBook."Acquisition Cost";
@@ -162,6 +167,7 @@ codeunit 5642 "FA Reclass. Transfer Line"
Amounts[4] := FADeprBook.Appreciation;
Amounts[5] := FADeprBook."Custom 1";
Amounts[6] := FADeprBook."Custom 2";
+ Amounts[7] := FADeprBook."Derogatory Amount";
Amounts[9] := FADeprBook."Salvage Value";
OnCalcAmountsOnAfterSetAmounts(FADeprBook, Amounts, TransferType);
if Amounts[1] = 0 then
@@ -192,6 +198,7 @@ codeunit 5642 "FA Reclass. Transfer Line"
TransferType[4] := FAReclassJnlLine."Reclassify Appreciation";
TransferType[5] := FAReclassJnlLine."Reclassify Custom 1";
TransferType[6] := FAReclassJnlLine."Reclassify Custom 2";
+ TransferType[7] := FAReclassJnlLine."Reclass. Derogatory";
TransferType[9] := FAReclassJnlLine."Reclassify Salvage Value";
end;
@@ -232,6 +239,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAPostingType := FAPostingType::"Custom 2";
6:
FAPostingType := FAPostingType::Appreciation;
+ 7:
+ FAPostingType := FAPostingType::Derogatory;
9:
FAPostingType := FAPostingType::"Acquisition Cost";
end;
@@ -249,6 +258,8 @@ codeunit 5642 "FA Reclass. Transfer Line"
FAPostingType := FAPostingType::"Custom 1";
6:
FAPostingType := FAPostingType::"Custom 2";
+ 7:
+ FAPostingType := FAPostingType::Derogatory;
9:
FAPostingType := FAPostingType::Depreciation;
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al
index c56c64c002..89a516803b 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/FixedAssetStatistics.Page.al
@@ -100,6 +100,12 @@ page 5602 "Fixed Asset Statistics"
ApplicationArea = FixedAssets;
Caption = 'Custom 1';
}
+ field("Last Derogatory"; Rec."Last Derogatory")
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies the FA posting date of the last posted derogatory depreciation.';
+ }
field("Last Salvage Value Date"; Rec."Last Salvage Value Date")
{
ApplicationArea = FixedAssets;
@@ -134,6 +140,13 @@ page 5602 "Fixed Asset Statistics"
{
ApplicationArea = FixedAssets;
}
+ field("Derogatory Amount"; Rec."Derogatory Amount")
+ {
+ AutoFormatType = 1;
+ AutoFormatExpression = '';
+ ApplicationArea = FixedAssets;
+ ToolTip = 'Specifies the total derogatory depreciation for the fixed asset.';
+ }
field("Salvage Value"; Rec."Salvage Value")
{
ApplicationArea = FixedAssets;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/GenJournalLineFAPostingType.Enum.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/GenJournalLineFAPostingType.Enum.al
index 647bd3ebbb..0a56fe1c15 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/GenJournalLineFAPostingType.Enum.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/GenJournalLineFAPostingType.Enum.al
@@ -50,4 +50,8 @@ enum 5603 "Gen. Journal Line FA Posting Type"
{
Caption = 'Bonus Depreciation';
}
+ value(13; Derogatory)
+ {
+ Caption = 'Derogatory';
+ }
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al
index 77bdf93b2a..dba221421c 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/IndexFixedAssets.Report.al
@@ -42,7 +42,7 @@ report 5690 "Index Fixed Assets"
MaintenanceLedgEntry.SetRange("FA No.", "No.");
i := 0;
- while i < 9 do begin
+ while i < 13 do begin
i := i + 1;
if i = 7 then
i := 8;
@@ -62,6 +62,8 @@ report 5690 "Index Fixed Assets"
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Custom 2");
if i = 9 then
FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::"Salvage Value");
+ if (i = 13) then
+ FALedgEntry.SetRange("FA Posting Type", FALedgEntry."FA Posting Type"::Derogatory);
if i = 8 then begin
MaintenanceLedgEntry.CalcSums(Amount);
IndexAmount := MaintenanceLedgEntry.Amount;
@@ -185,6 +187,12 @@ report 5690 "Index Fixed Assets"
Caption = 'Maintenance';
ToolTip = 'Specifies if you want to index for fixed assets of transaction type Salvage Value in the batch job.';
}
+ field("IndexChoices[13]"; IndexChoices[13])
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Derogatory';
+ ToolTip = 'Specifies whether to include derogatory depreciation.';
+ }
}
}
}
@@ -209,6 +217,11 @@ report 5690 "Index Fixed Assets"
trigger OnPreReport()
begin
+ DerogDeprBook.SetRange(Code, DeprBookCode);
+ if DerogDeprBook.Find('-') then
+ if DerogDeprBook."Derogatory Calc." <> '' then
+ Error(Text10800);
+
if FAPostingDate = 0D then
Error(Text000, FAJnlLine.FieldCaption("FA Posting Date"));
if FAPostingDate <> NormalDate(FAPostingDate) then
@@ -256,11 +269,12 @@ report 5690 "Index Fixed Assets"
FALedgEntry: Record "FA Ledger Entry";
MaintenanceLedgEntry: Record "Maintenance Ledger Entry";
FAJnlSetup: Record "FA Journal Setup";
+ DerogDeprBook: Record "Depreciation Book";
DepreciationCalc: Codeunit "Depreciation Calculation";
Window: Dialog;
- IndexChoices: array[9] of Boolean;
+ IndexChoices: array[13] of Boolean;
IndexAmount: Decimal;
- GLIntegration: array[9] of Boolean;
+ GLIntegration: array[13] of Boolean;
FirstGenJnl: Boolean;
FirstFAJnl: Boolean;
PostingDate: Date;
@@ -273,8 +287,9 @@ report 5690 "Index Fixed Assets"
FAJnlNextLineNo: Integer;
GenJnlNextLineNo: Integer;
i: Integer;
+#pragma warning disable AA0074
+ Text10800: Label 'You cannot index fixed assets in a derogatory depreciation book. Instead you must\index them in the depreciation book integrated with G/L.';
-#pragma warning disable AA0074
#pragma warning disable AA0470
Text000: Label 'You must specify %1.';
#pragma warning restore AA0470
diff --git a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
index ccf2c5de68..a3766c5e21 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/FixedAsset/MakeFALedgerEntry.Codeunit.al
@@ -100,6 +100,8 @@ codeunit 5604 "Make FA Ledger Entry"
FAJnlLine."FA Posting Type" := "FA Journal Line FA Posting Type".FromInteger(GenJnlLine."FA Posting Type".AsInteger() - 1);
FALedgEntry."FA Posting Type" := "FA Ledger Entry FA Posting Type".FromInteger(FAJnlLine.ConvertToLedgEntry(FAJnlLine));
NonDeductibleVAT.CopyNonDedVATFromGenJnlLineToFALedgEntry(FALedgEntry, GenJnlLine);
+ if FALedgEntry."FA Posting Type" = FALedgEntry."FA Posting Type"::Derogatory then
+ FALedgEntry."Automatic Entry" := GenJnlLine."System-Created Entry";
OnAfterCopyFromGenJnlLine(FALedgEntry, GenJnlLine);
end;
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al b/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al
index 40a5ec2d1d..15a24984d4 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al
+++ b/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.Report.al
@@ -85,6 +85,18 @@ report 5605 "Fixed Asset - Book Value 01"
column(Desc_FA; FADescription)
{
}
+ column(HeadLineText11; HeadLineText[11])
+ {
+ }
+ column(HeadLineText12; HeadLineText[12])
+ {
+ }
+ column(HeadLineText13; HeadLineText[13])
+ {
+ }
+ column(HeadLineText14; HeadLineText[14])
+ {
+ }
column(GroupHeadLine; GroupHeadLine)
{
}
@@ -133,6 +145,58 @@ report 5605 "Fixed Asset - Book Value 01"
column(BookValueAtEndingDate; BookValueAtEndingDate)
{
AutoFormatType = 1;
+ }
+ column(StartAmounts7; StartAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(NetChangeAmounts7; NetChangeAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(DisposalAmounts7; DisposalAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(TotalEndingAmounts7; TotalEndingAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(DeprBookInfo1; DeprBookInfo[1])
+ {
+ }
+ column(DeprBookInfo2; DeprBookInfo[2])
+ {
+ }
+ column(DeprBookInfo3; DeprBookInfo[3])
+ {
+ }
+ column(DeprBookInfo4; DeprBookInfo[4])
+ {
+ }
+ column(DeprBookInfo5; DeprBookInfo[5])
+ {
+ }
+ column(PrintFASetup; PrintFASetup)
+ {
+ }
+ column(DerogDeprBookInfo1; DerogDeprBookInfo[1])
+ {
+ }
+ column(DerogDeprBookInfo2; DerogDeprBookInfo[2])
+ {
+ }
+ column(DerogDeprBookInfo3; DerogDeprBookInfo[3])
+ {
+ }
+ column(DerogDeprBookInfo4; DerogDeprBookInfo[4])
+ {
+ }
+ column(DerogDeprBookInfo5; DerogDeprBookInfo[5])
+ {
+ }
+ column(HasDerogatorySetup; HasDerogatorySetup)
+ {
}
column(FormatGrpTotGroupHeadLine; Format(Text002 + ': ' + GroupHeadLine))
{
@@ -158,6 +222,18 @@ report 5605 "Fixed Asset - Book Value 01"
AutoFormatType = 1;
}
column(GroupDisposalAmounts2; GroupDisposalAmounts[2])
+ {
+ AutoFormatType = 1;
+ }
+ column(GroupStartAmounts7; GroupStartAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(GroupNetChangeAmounts7; GroupNetChangeAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(GroupDisposalAmounts7; GroupDisposalAmounts[7])
{
AutoFormatType = 1;
}
@@ -184,6 +260,27 @@ report 5605 "Fixed Asset - Book Value 01"
column(TotalDisposalAmounts2; TotalDisposalAmounts[2])
{
AutoFormatType = 1;
+ }
+ column(TotalStartAmounts7; TotalStartAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(TotalDisposalAmounts7; TotalDisposalAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(TotalNetChangeAmounts7; TotalNetChangeAmounts[7])
+ {
+ AutoFormatType = 1;
+ }
+ column(FASubclassCode_FixedAsset; "FA Subclass Code")
+ {
+ }
+ column(GloblDimnsnCode_FixedAsset; "Global Dimension 2 Code")
+ {
+ }
+ column(CmpntofMainAset_FixedAsset; "Component of Main Asset")
+ {
}
column(PageCaption; PageCaptionLbl)
{
@@ -199,6 +296,12 @@ report 5605 "Fixed Asset - Book Value 01"
if SkipRecord() then
CurrReport.Skip();
+ HasDerogatorySetup := false;
+ FADeprBook2.SetRange("FA No.", "No.");
+ FADeprBook2.SetRange("Depreciation Book Code", DerogDeprBook.Code);
+ if FADeprBook2.Find('-') then
+ HasDerogatorySetup := true;
+
if GroupTotals = GroupTotals::"FA Posting Group" then
if "FA Posting Group" <> FADeprBook."FA Posting Group" then
Error(Text007, FieldCaption("FA Posting Group"), "No.");
@@ -225,6 +328,8 @@ report 5605 "Fixed Asset - Book Value 01"
PostingType := FADeprBook.FieldNo("Custom 1");
6:
PostingType := FADeprBook.FieldNo("Custom 2");
+ 7:
+ PostingType := FADeprBook.FieldNo("Derogatory Amount");
end;
if StartingDate <= 00000101D then
StartAmounts[i] := 0
@@ -235,25 +340,45 @@ report 5605 "Fixed Asset - Book Value 01"
FAGenReport.CalcFAPostedAmount(
"No.", PostingType, Period2, StartingDate, EndingDate,
DeprBookCode, BeforeAmount, EndingAmount, false, true);
+ if i = 7 then begin
+ FAGenReport.SetSign(true);
+ NetChangeAmounts[i] :=
+ -(FAGenReport.CalcFAPostedAmount(
+ "No.", PostingType, Period2, StartingDate, EndingDate,
+ DeprBookCode, BeforeAmount, EndingAmount, false, true));
+ FAGenReport.SetSign(false);
+ DisposalAmounts[i] :=
+ FAGenReport.CalcFAPostedAmount(
+ "No.", PostingType, Period2, StartingDate, EndingDate,
+ DeprBookCode, BeforeAmount, EndingAmount, false, true);
+ StartAmounts[i] :=
+ FAGenReport.CalcFAPostedAmount(
+ "No.", PostingType, Period1, StartingDate,
+ EndingDate, DeprBookCode, BeforeAmount, EndingAmount, false, true);
+ end;
if GetPeriodDisposal() then
DisposalAmounts[i] := -(StartAmounts[i] + NetChangeAmounts[i])
else
- DisposalAmounts[i] := 0;
- if i >= 3 then
+ if i <> 7 then
+ DisposalAmounts[i] := 0;
+ if (i >= 3) and (i <> 7) then
AddPostingType(i - 3);
end;
for j := 1 to NumberOfTypes do
TotalEndingAmounts[j] := StartAmounts[j] + NetChangeAmounts[j] + DisposalAmounts[j];
BookValueAtEndingDate := 0;
BookValueAtStartingDate := 0;
- for j := 1 to NumberOfTypes do begin
- BookValueAtEndingDate := BookValueAtEndingDate + TotalEndingAmounts[j];
- BookValueAtStartingDate := BookValueAtStartingDate + StartAmounts[j];
- end;
+ for j := 1 to NumberOfTypes do
+ if not ((j = 7) and HasDerogatorySetup) then begin
+ BookValueAtEndingDate := BookValueAtEndingDate + TotalEndingAmounts[j];
+ BookValueAtStartingDate := BookValueAtStartingDate + StartAmounts[j];
+ end;
MakeGroupHeadLine();
UpdateTotals();
CreateGroupTotals();
+ GetDeprBookInfo();
+ GetDerogDeprBookInfo();
end;
trigger OnPostDataItem()
@@ -331,6 +456,13 @@ report 5605 "Fixed Asset - Book Value 01"
AboutTitle = 'Enable Print per Fixed Asset';
AboutText = 'Specify the applicable options to view the report details as required.';
ToolTip = 'Specifies if you want the report to print information separately for each fixed asset.';
+
+ trigger OnValidate()
+ begin
+ if not PrintDetails then
+ if PrintFASetup then
+ PrintFASetup := false;
+ end;
}
field(BudgetReport; BudgetReport)
{
@@ -338,6 +470,19 @@ report 5605 "Fixed Asset - Book Value 01"
Caption = 'Budget Report';
ToolTip = 'Specifies if you want the report to calculate future depreciation and book value. This is valid only if you have selected Depreciation and Book Value for Amount Field 1, 2 or 3.';
}
+ field(Print_FASetup; PrintFASetup)
+ {
+ ApplicationArea = FixedAssets;
+ Caption = 'Print FA Setup';
+ ToolTip = 'Specifies whether the report must include the depreciation book setup information for each fixed asset.';
+
+ trigger OnValidate()
+ begin
+ if PrintFASetup then
+ if not PrintDetails then
+ PrintDetails := true;
+ end;
+ }
}
}
}
@@ -368,8 +513,12 @@ report 5605 "Fixed Asset - Book Value 01"
trigger OnPreReport()
begin
- NumberOfTypes := 6;
+ NumberOfTypes := 7;
+ Clear(DerogDeprBook);
DeprBook.Get(DeprBookCode);
+ DerogDeprBook.SetRange("Derogatory Calc.", DeprBookCode);
+ if DerogDeprBook.Find('-') then;
+
if GroupTotals = GroupTotals::"FA Posting Group" then
FAGenReport.SetFAPostingGroup("Fixed Asset", DeprBook.Code);
FAGenReport.AppendFAPostingFilter("Fixed Asset", StartingDate, EndingDate);
@@ -395,6 +544,8 @@ report 5605 "Fixed Asset - Book Value 01"
DeprBook: Record "Depreciation Book";
FA: Record "Fixed Asset";
FAPostingTypeSetup: Record "FA Posting Type Setup";
+ DerogDeprBook: Record "Depreciation Book";
+ FADeprBook2: Record "FA Depreciation Book";
FAGenReport: Codeunit "FA General Report";
BudgetDepreciation: Codeunit "Budget Depreciation";
FAFilter: Text;
@@ -405,17 +556,17 @@ report 5605 "Fixed Asset - Book Value 01"
FANo: Text[50];
FADescription: Text[100];
GroupTotals: Option " ","FA Class","FA Subclass","FA Location","Main Asset","Global Dimension 1","Global Dimension 2","FA Posting Group";
- HeadLineText: array[10] of Text[50];
- StartAmounts: array[6] of Decimal;
- NetChangeAmounts: array[6] of Decimal;
- DisposalAmounts: array[6] of Decimal;
- GroupStartAmounts: array[6] of Decimal;
- GroupNetChangeAmounts: array[6] of Decimal;
- GroupDisposalAmounts: array[6] of Decimal;
- TotalStartAmounts: array[6] of Decimal;
- TotalNetChangeAmounts: array[6] of Decimal;
- TotalDisposalAmounts: array[6] of Decimal;
- TotalEndingAmounts: array[6] of Decimal;
+ HeadLineText: array[14] of Text[50];
+ StartAmounts: array[7] of Decimal;
+ NetChangeAmounts: array[7] of Decimal;
+ DisposalAmounts: array[7] of Decimal;
+ GroupStartAmounts: array[7] of Decimal;
+ GroupNetChangeAmounts: array[7] of Decimal;
+ GroupDisposalAmounts: array[7] of Decimal;
+ TotalStartAmounts: array[7] of Decimal;
+ TotalNetChangeAmounts: array[7] of Decimal;
+ TotalDisposalAmounts: array[7] of Decimal;
+ TotalEndingAmounts: array[7] of Decimal;
BookValueAtStartingDate: Decimal;
BookValueAtEndingDate: Decimal;
i: Integer;
@@ -431,6 +582,10 @@ report 5605 "Fixed Asset - Book Value 01"
DisposalDate: Date;
StartText: Text[30];
EndText: Text[30];
+ DeprBookInfo: array[5] of Text[30];
+ DerogDeprBookInfo: array[5] of Text[30];
+ PrintFASetup: Boolean;
+ HasDerogatorySetup: Boolean;
#pragma warning disable AA0074
Text000: Label 'Fixed Asset - Book Value 01';
@@ -442,6 +597,8 @@ report 5605 "Fixed Asset - Book Value 01"
Text006: Label 'Addition';
#pragma warning disable AA0470
Text007: Label '%1 has been modified in fixed asset %2.';
+ Text10800: Label 'Increased in Period';
+ Text10801: Label 'Decreased in Period';
#pragma warning restore AA0470
#pragma warning restore AA0074
PageCaptionLbl: Label 'Page';
@@ -551,6 +708,10 @@ report 5605 "Fixed Asset - Book Value 01"
HeadLineText[8] := StrSubstNo('%1 %2', FADeprBook.FieldCaption(Depreciation), EndText);
HeadLineText[9] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Book Value"), StartText);
HeadLineText[10] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Book Value"), EndText);
+ HeadLineText[11] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), StartText);
+ HeadLineText[12] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), Text10800);
+ HeadLineText[13] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), Text10801);
+ HeadLineText[14] := StrSubstNo('%1 %2', FADeprBook.FieldCaption("Derogatory Amount"), EndText);
end;
local procedure MakeGroupHeadLine()
@@ -605,10 +766,11 @@ report 5605 "Fixed Asset - Book Value 01"
GroupStartAmounts[j] + GroupNetChangeAmounts[j] + GroupDisposalAmounts[j];
BookValueAtEndingDate := 0;
BookValueAtStartingDate := 0;
- for j := 1 to NumberOfTypes do begin
- BookValueAtEndingDate := BookValueAtEndingDate + TotalEndingAmounts[j];
- BookValueAtStartingDate := BookValueAtStartingDate + GroupStartAmounts[j];
- end;
+ for j := 1 to NumberOfTypes do
+ if not ((j = 7) and HasDerogatorySetup) then begin
+ BookValueAtEndingDate := BookValueAtEndingDate + TotalEndingAmounts[j];
+ BookValueAtStartingDate := BookValueAtStartingDate + GroupStartAmounts[j];
+ end;
end;
local procedure CreateTotals()
@@ -653,5 +815,25 @@ report 5605 "Fixed Asset - Book Value 01"
DeprBookCode := FASetup."Default Depr. Book";
end;
end;
+
+ [Scope('OnPrem')]
+ procedure GetDeprBookInfo()
+ begin
+ DeprBookInfo[1] := DeprBookCode;
+ DeprBookInfo[2] := Format(FADeprBook."Depreciation Method");
+ DeprBookInfo[3] := Format(FADeprBook."Depreciation Starting Date");
+ DeprBookInfo[4] := Format(FADeprBook."Depreciation Ending Date");
+ DeprBookInfo[5] := Format(FADeprBook."Declining-Balance %");
+ end;
+
+ [Scope('OnPrem')]
+ procedure GetDerogDeprBookInfo()
+ begin
+ DerogDeprBookInfo[1] := FADeprBook2."Depreciation Book Code";
+ DerogDeprBookInfo[2] := Format(FADeprBook2."Depreciation Method");
+ DerogDeprBookInfo[3] := Format(FADeprBook2."Depreciation Starting Date");
+ DerogDeprBookInfo[4] := Format(FADeprBook2."Depreciation Ending Date");
+ DerogDeprBookInfo[5] := Format(FADeprBook2."Declining-Balance %");
+ end;
}
diff --git a/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.rdlc b/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.rdlc
index 7ade451493..f3f2e3d857 100644
--- a/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.rdlc
+++ b/src/Layers/W1/BaseApp/FixedAssets/Reports/FixedAssetBookValue01.rdlc
@@ -878,6 +878,217 @@
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox16
+
+
+ Bottom
+ 3pt
+ 2pt
+ 2pt
+
+
+ 6
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =First(Replace(Fields!HeadLineText11.Value," ",Chr(10)))
+
+
+
+
+
+
+ Textbox10
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =(Fields!HeadLineText12.Value)
+
+
+
+
+
+
+ Textbox11
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =First(Fields!HeadLineText13.Value)
+
+
+
+
+
+
+ Textbox12
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Replace(Fields!HeadLineText14.Value," ",chr(10))
+
+
+
+
+
+
+ Textbox13
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox14
+
+
+ 2
+
+
+
+
+
0.24694cm
@@ -1845,38 +2056,33 @@
- 0.24694cm
+ 0.6cm
-
+
true
true
-
+
-
+
- Textbox60
+ Textbox2
- 0.5pt
-
-
-
-
+ =iif(Code.SetRowColor(Code.GetRowColor()) = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -1884,7 +2090,7 @@
2pt
- 12
+ 6
@@ -1892,43 +2098,31 @@
-
-
-
-
-
-
-
-
-
- 0.24694cm
-
-
+
true
true
-
+ =Fields!StartAmounts7.Value
-
+
- Textbox47
+ Textbox15
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -1936,50 +2130,33 @@
2pt
- 12
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0.49389cm
-
-
+
+ true
true
- =Fields!FormatGrpTotGroupHeadLine.Value
+ =Fields!NetChangeAmounts7.Value
-
+
- 30
+ Textbox19
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -1987,26 +2164,22 @@
2pt
- 2
-
-
+
true
true
- =Sum(Fields!GroupStartAmounts1.Value)
+ =Fields!DisposalAmounts7.Value
@@ -2015,11 +2188,9 @@
- 29
+ Textbox20
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2031,20 +2202,18 @@
-
+
true
true
- =Sum(Fields!GroupNetChangeAmounts1.Value)
+ =Fields!TotalEndingAmounts7.Value
@@ -2053,11 +2222,9 @@
- 28
+ Textbox36
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2069,20 +2236,18 @@
-
+
true
true
- =Sum(Fields!GroupDisposalAmounts1.Value)
+
@@ -2091,11 +2256,238 @@
- 27
+ Textbox37
+
+
+ 2
+
+
+
+
+
+
+ 0.35789cm
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DeprBookInfo1.Value
+
+
+
+
+
+
+ Textbox73
+ 0.01341cm
+ 0.39538cm
+ 0.32261cm
+ 2.02251cm
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DeprBookInfo2.Value
+
+
+
+
+
+
+ Textbox66
+ 0.01341cm
+ 2.41789cm
+ 0.32261cm
+ 1.85438cm
+ 1
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DeprBookInfo3.Value
+
+
+
+
+
+
+ Textbox67
+ 0.01341cm
+ 4.27227cm
+ 0.32261cm
+ 1.47123cm
+ 2
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DeprBookInfo4.Value
+
+
+
+
+
+
+ Textbox67
+ 0.01341cm
+ 5.7435cm
+ 0.32261cm
+ 1.47123cm
+ 3
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =FormatNumber(Fields!DeprBookInfo5.Value)
+
+
+
+
+
+
+ Textbox66
+ 0.01341cm
+ 7.25001cm
+ 0.3092cm
+ 1.65432cm
+ 4
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ =iif(Code.SetRowColor(Code.GetRowColor()) = TRUE, "#EBEBEB", "White")
+
+
+ 4
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox9
+
- 26
+ Textbox38
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2145,20 +2533,18 @@
-
+
true
true
- =Sum(Fields!GroupStartAmounts2.Value)
+
@@ -2167,11 +2553,9 @@
- 25
+ Textbox39
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2183,20 +2567,18 @@
-
+
true
true
- =Sum(Fields!GroupNetChangeAmounts2.Value)
+
@@ -2205,11 +2587,9 @@
- 24
+ Textbox40
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2221,20 +2601,18 @@
-
+
true
true
- =Sum(Fields!GroupDisposalAmounts2.Value)
+
@@ -2243,11 +2621,9 @@
- 23
+ Textbox41
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2259,20 +2635,18 @@
-
+
true
true
- =Sum(Fields!TotalEndingAmounts2.Value)
+
@@ -2281,11 +2655,9 @@
- 22
+ Textbox42
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2297,20 +2669,18 @@
-
+
true
true
- =Sum(Fields!BookValueAtStartingDate.Value)
+
@@ -2319,11 +2689,9 @@
- 21
+ Textbox43
-
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
Middle
3pt
3pt
@@ -2335,20 +2703,18 @@
-
+
true
true
- =Sum(Fields!BookValueAtEndingDate.Value)
+
@@ -2357,11 +2723,236 @@
- 20
+ Textbox44
+
+
+
+
+
+
+
+ 0.39317cm
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DerogDeprBookInfo1.Value
+
+
+
+
+
+
+ Textbox73
+ 0.03528cm
+ 0.39538cm
+ 0.32261cm
+ 2.02251cm
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DerogDeprBookInfo2.Value
+
+
+
+
+
+
+ Textbox66
+ 0.03528cm
+ 2.41789cm
+ 0.32261cm
+ 1.85438cm
+ 1
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DeprBookInfo3.Value
+
+
+
+
+
+
+ Textbox67
+ 0.03528cm
+ 4.27227cm
+ 0.32261cm
+ 1.47123cm
+ 2
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DeprBookInfo4.Value
+
+
+
+
+
+
+ Textbox67
+ 0.03528cm
+ 5.7435cm
+ 0.32261cm
+ 1.47123cm
+ 3
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =FormatNumber(Fields!DeprBookInfo5.Value)
+
+
+
+
+
+
+ Textbox66
+ 0.03528cm
+ 7.25001cm
+ 0.32261cm
+ 1.65432cm
+ 4
+
+
+ =iif(Code.GetRowColor() = TRUE, "#EBEBEB", "White")
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ =iif(Code.SetRowColor(Code.GetRowColor()) = TRUE, "#EBEBEB", "White")
+
+
+ 4
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox80
+
+ 8
+
+
+
+
+
+
+
@@ -2378,7 +2977,7 @@
-
+
true
true
@@ -2389,7 +2988,7 @@
@@ -2397,10 +2996,11 @@
- Textbox4
+ Textbox60
+ 0.5pt
@@ -2433,7 +3033,7 @@
-
+
true
true
@@ -2444,7 +3044,7 @@
@@ -2452,7 +3052,7 @@
- Textbox84
+ Textbox47
@@ -2481,30 +3081,29 @@
- 0.35278cm
+ 0.49389cm
-
- true
+
true
-
+ =Fields!FormatGrpTotGroupHeadLine.Value
- Textbox72
+ 30
@@ -2516,54 +3115,1059 @@
2pt
- 12
+ 2
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupStartAmounts1.Value)
+
+
+
+
+
+
+ 29
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupNetChangeAmounts1.Value)
+
+
+
+
+
+
+ 28
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupDisposalAmounts1.Value)
+
+
+
+
+
+
+ 27
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!TotalEndingAmounts1.Value)
+
+
+
+
+
+
+ 26
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupStartAmounts2.Value)
+
+
+
+
+
+
+ 25
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupNetChangeAmounts2.Value)
+
+
+
+
+
+
+ 24
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupDisposalAmounts2.Value)
+
+
+
+
+
+
+ 23
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!TotalEndingAmounts2.Value)
+
+
+
+
+
+
+ 22
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!BookValueAtStartingDate.Value)
+
+
+
+
+
+
+ 21
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!BookValueAtEndingDate.Value)
+
+
+
+
+
+
+ 20
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox5
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+ 6
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupStartAmounts7.Value)
+
+
+
+
+
+
+ Textbox48
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupNetChangeAmounts7.Value)
+
+
+
+
+
+
+ Textbox49
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!GroupDisposalAmounts7.Value)
+
+
+
+
+
+
+ Textbox50
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!TotalEndingAmounts7.Value)
+
+
+
+
+
+
+ Textbox51
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+ 3
+
+
+
+
+
+
+
+ 0.24694cm
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox4
+
+
+
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.24694cm
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox84
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.35278cm
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox72
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.24694cm
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ textbox1
+ 46
+
+ 0.5pt
+
+
+
+
+ Middle
+ 3pt
+ 3pt
+ 2pt
+ 2pt
+
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.24694cm
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Textbox3
+
+
+ 12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0.49389cm
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!TotalCaption.Value
+
+
+
+
+
+
+ 59
+
+
+ 2
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!StartAmounts1.Value)
+
+
+
+
+
+
+ 57
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!NetChangeAmounts1.Value)
+
+
+
+
+
+
+ 56
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!DisposalAmounts1.Value)
+
+
+
+
+
+
+ 55
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!TotalEndingAmounts1.Value)
+
+
+
+
+
+
+ 54
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0.24694cm
-
-
+
+ true
true
-
+ =Sum(Fields!StartAmounts2.Value)
-
+
- textbox1
- 46
+ 53
- 0.5pt
-
-
-
-
Middle
3pt
3pt
@@ -2571,40 +4175,24 @@
2pt
- 12
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0.24694cm
-
-
+
true
true
-
+ =Sum(Fields!NetChangeAmounts2.Value)
@@ -2613,7 +4201,7 @@
- Textbox3
+ 52
- 12
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0.49389cm
-
-
+
true
true
- =Fields!TotalCaption.Value
+ =Sum(Fields!DisposalAmounts2.Value)
- 59
+ 51
- 2
-
-
+
true
true
- =Sum(Fields!StartAmounts1.Value)
+ =Sum(Fields!TotalEndingAmounts2.Value)
@@ -2701,7 +4271,7 @@
- 57
+ 50
@@ -2736,7 +4306,7 @@
- 56
+ 49
@@ -2771,7 +4341,7 @@
- 55
+ 48
- 54
+ Textbox54
+ 6
+
+
+
+
+
-
+
true
true
- =Sum(Fields!StartAmounts2.Value)
+ =Sum(Fields!StartAmounts7.Value)
@@ -2841,8 +4420,16 @@
- 53
+ Textbox62
+
+
+ Black
+
+ 1pt
+
Middle
3pt
3pt
@@ -2854,20 +4441,19 @@
-
+
true
true
- =Sum(Fields!NetChangeAmounts2.Value)
+ =Sum(Fields!NetChangeAmounts7.Value)
@@ -2876,8 +4462,16 @@
- 52
+ Textbox63
+
+
+ Black
+
+ 1pt
+
Middle
3pt
3pt
@@ -2889,20 +4483,19 @@
-
+
true
true
- =Sum(Fields!DisposalAmounts2.Value)
+ =Sum(Fields!DisposalAmounts7.Value)
@@ -2911,8 +4504,16 @@
- 51
+ Textbox64
+
+
+ Black
+
+ 1pt
+
Middle
3pt
3pt
@@ -2924,20 +4525,19 @@
-
+
true
true
- =Sum(Fields!TotalEndingAmounts2.Value)
+ =Sum(Fields!TotalEndingAmounts7.Value)
@@ -2946,8 +4546,16 @@
- 50
+ Textbox65
+
+
+ Black
+
+ 1pt
+
Middle
3pt
3pt
@@ -2955,24 +4563,24 @@
2pt
+ true
-
+
true
true
- =Sum(Fields!BookValueAtStartingDate.Value)
+
@@ -2981,8 +4589,16 @@
- 49
+ Textbox77
+
+
+ Black
+
+ 1pt
+
Middle
3pt
3pt
@@ -2994,20 +4610,19 @@
-
+
true
true
- =Sum(Fields!BookValueAtEndingDate.Value)
+
@@ -3016,8 +4631,16 @@
- 48
+ Textbox78
+
+
+ Black
+
+ 1pt
+
Middle
3pt
3pt
@@ -3176,6 +4799,10 @@
true
true
+
+ After
+ true
+
After
true
@@ -3214,15 +4841,36 @@
=IIF(Fields!PrintDetails.Value = "True",False,True)
+
+
+ =IIF(Fields!PrintDetails.Value = "True",False,True)
+
+
+
+
+ =IIF(Fields!PrintFASetup.Value,False,True)
+
+
+
+
+ =IIF(Fields!PrintFASetup.Value And Fields!HasDerogatorySetup.Value,False,True)
+
+
Detail_Collection
Output
true
+
+ =IIF(Fields!PrintFASetup.Value And Fields!HasDerogatorySetup.Value,False,True)
+
Before
+
+ =IIF(Fields!PrintFASetup.Value And Not(Fields!HasDerogatorySetup.Value),False,True)
+
Before
@@ -3239,9 +4887,21 @@
Before
+
+ =IIF(Fields!GroupTotals.Value <> " ",False,True)
+
+ Before
+
+
+
+ =IIF(Fields!GroupTotals.Value <> " ",False,True)
+
Before
+
+ =IIF(Fields!GroupTotals.Value <> " ",False,True)
+
Before
@@ -3263,15 +4923,18 @@
Before
+
+ Before
+
DataSet_Result
- 7.72583cm
+ 10.69866cm
720.24996pt
- 3.04167in
+ 4.21207in