Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Leave Allocation Summary batch update on year end

Author  Topic 

micnie_2020
Posting Yak Master

232 Posts

Posted - 2011-08-24 : 04:04:01
Dear All,

I have 4 table.

Employee
--------
employeecode
datejoin
allocateid

leaveallocatebyPosId
--------------------
allocateid
day (eg: start with 18 day)
incrementday (eg: 1 day)
maxday (28)
rangeincrement (eg: 2 year increase 1 day )

P/s: Joined Date on Apr 2010 - Mar 2011 1 year. If join on 28/Aug/2010 will count as pro-data from Sept 2010 to Mar 2011.


leavesummary
------------
employeecode
year
BF
YearToDate
dayTaken

LeaveHistory
------------
id [autonumber]
code
fromdate
todate
dayTaken
reason
allocateid


Anyone can provide me the Stored Procedure to run end of the day of the year to update table leavesummary (eg: Last of every year March). The calculation will based on employee joindate & allocateid link with table leaveallocatebyPosId.

Thank you. Appreciate for your kindly help.

Regards,
Micheale

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-24 : 04:21:56
whats
BF
YearToDate
dayTaken etc fields? where do u get thier values from?



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-24 : 05:37:13
sorry i dont follow you. would you mind posting question in below format

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-29 : 07:34:34
where are rest of sample data and explanation of logic. Please understand we dont have access to your system and dunno how data is existing in your tables.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -