Page 1 of 1

Which Year is active?

PostPosted: Thu Mar 03, 2022 3:11 pm
by SBarnes
Is there an easy way from Manager.GeneralLedgerConfiguration to tell which year current or next we are running in based upon the current date?

Re: Which Year is active?

PostPosted: Fri Mar 04, 2022 5:45 pm
by DannyC
You could try the SQL user defined function ufn_JIWA_GL_YearNo. Use the GetDate() for the @TranDate

It's code is
Code: Select all
ALTER FUNCTION [dbo].[ufn_JIWA_GL_YearNo] (@TranDate DATETIME)
RETURNS SMALLINT
AS
BEGIN
   --Used by:
   --
   --ufn_JIWA_GL_PeriodNo

   RETURN (
         SELECT
         TOP 1 YearNo
         FROM
         GL_Config WITH (NOLOCK)
         WHERE
         @TranDate >= YearStartingDate AND @TranDate <= dbo.ufn_JIWA_GL_YearEndingDate(YearNo)
         ORDER BY YearStartingDate ASC)
END
GO

Re: Which Year is active?  Topic is solved

PostPosted: Fri Mar 04, 2022 6:00 pm
by SBarnes
Na I think I've sussed it the manager has a General Ledger configuration which has properties called NextFinancialYear and CurrentFinancialYear that are of type JiwaFinancials.Jiwa.JiwaApplication.GeneralLedger.FinancialYear and that class has a start and end date for the year on it so it's just a matter of comparing the current date to which one's start and end date it's between.

As near as I can tell Jiwa has already read this data at start up so there is no need to go back to the database for it.