Which Year is active?  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Which Year is active?

Postby SBarnes » Thu Mar 03, 2022 3:11 pm

Is there an easy way from Manager.GeneralLedgerConfiguration to tell which year current or next we are running in based upon the current date?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Which Year is active?

Postby DannyC » Fri Mar 04, 2022 5:45 pm

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
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Which Year is active?  Topic is solved

Postby SBarnes » Fri Mar 04, 2022 6:00 pm

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.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 13 guests