ALAppExtensions
ALAppExtensions copied to clipboard
[Event Request] Codeunit 5617 "FA Date Calculation" - GetFiscalYear()
Describe the request
Please add a new integration event OnBeforeGetFiscalYear() with parameters DeprBookCode, EndingDate, FiscalYearStartDate and IsHandled in the Codeunit 5617 "FA Date Calculation"
Example:
procedure GetFiscalYear(DeprBookCode: Code[10]; EndingDate: Date): Date
var
AccountingPeriod: Record "Accounting Period";
FAJnlLine: Record "FA Journal Line";
FiscalYearStartDate: Date;
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeGetFiscalYear(DeprBookCode, EndingDate, FiscalYearStartDate, IsHandled);
if IsHandled then
exit(FiscalYearStartDate);
DeprBook.Get(DeprBookCode);
if DeprBook."New Fiscal Year Starting Date" > 0D then begin
if DeprBook."New Fiscal Year Starting Date" > EndingDate then
DeprBook.FieldError(
"New Fiscal Year Starting Date",
StrSubstNo(Text000, FAJnlLine.FieldCaption("FA Posting Date")));
exit(DeprBook."New Fiscal Year Starting Date");
end;
if AccountingPeriod.IsEmpty() then
exit(CalcDate('<-CY>', EndingDate));
AccountingPeriod.SetRange("New Fiscal Year", true);
AccountingPeriod.SetRange("Starting Date", 0D, EndingDate);
if AccountingPeriod.FindLast() then
exit(AccountingPeriod."Starting Date");
Error(Text001, AccountingPeriod.FieldCaption("Starting Date"), AccountingPeriod.TableCaption);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeGetFiscalYear(DeprBookCode: Code[10]; EndingDate: Date; var FiscalYearStartDate: Date; var IsHandled: Boolean)
begin
end;
Additional context
Set the fiscal year start date by custom logic. Internal work item: AB#565802
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 30839.