How to Calculate the Current Fiscal Year?
- There is no function that will give you the fiscal year.
- Here’s a code that will get the fiscal year according to the accounting period.
- Define two date variables Date1 and Date2.
- Define one record variable “Accounting Period”.
AccountingPeriod.RESET;
AccountingPeriod.SETRANGE(“New Fiscal Year”,TRUE);
AccountingPeriod.”Starting Date” := WORKDATE;
AccountingPeriod.FIND(‘=<‘);
Date1 := AccountingPeriod.”Starting Date”;
IF AccountingPeriod.NEXT = 0 THEN
Date2 := 12319999D
ELSE
Date2 := AccountingPeriod.”Starting Date” – 1;
How to Create General Ledger Setup in D365 BC | How to Create Purchases and Payables Setup in D365 BC |
D365 BC Licensing and Functionalities | Fiscal calendars, fiscal years, and periods– Microsoft Docs |