Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to get it's corresponding Asp.net code(function) from the belowed Stored procedure.
Can help me.
SQL
ALTER PROCEDURE [dbo].[usp_Payroll_CurrentFinancialYear_Select] 
	(@Date DATETIME=NULL)
 AS
BEGIN
		DECLARE @Year INT =0
		DECLARE @Month INT=0
		DECLARE @FinYearID INT=0
		DECLARE @CheckYear VARCHAR(10)=NULL
		SET @Date=ISNULL(@Date,GETDATE())

		SELECT  @Year=YEAR(@Date)
		SELECT  @Month=MONTH(@Date)
 	
		IF(@Month>3)
				BEGIN
					SET @CheckYear=@Year
				END
		ELSE
				BEGIN
					SET @CheckYear=@Year-1
				END
		SELECT @FinYearID=FinYearID
		FROM Common_FinancialYearMaster
		WHERE FinYear LIKE @CheckYear + '%' 
		
		RETURN @FinYearID 
		
END
Posted
Updated 18-Apr-13 21:02pm
v4
Comments
Maciej Los 18-Apr-13 2:10am    
Financial year, OK, but when it starts?
What is your exact question?
Please, be more specific and provide more details (database/table design/structure, example data).
renjimaramanan mr 18-Apr-13 2:13am    
Financial year starts from 1/04/2013

1 solution

Take a look at following link, it gets the current financial year. You can tweak based on your requirement:
http://www.dotnetpools.com/Article/ArticleDetiail/?articleId=63[^]

Also below link, see if its helpful to you.
sql-server-how-to-dynamically-determine-financial-year[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900