theboyscout
New Member
- Joined
- Nov 29, 2012
- Messages
- 26
The below example is an employee who has a previous balance ofleave. If that employee takes time off from work then that time is subtractedfrom his leave. Therefore, used hrs would be deducted from his balance. In the below scenario the employee had 23 days 6 hours and 45 minutes of leave. Hethen used 1 day 6 hours and 46 mins of leave. Therefore, an hour had tocover the shortage in minutes making hours 5, a day had to be used to make up for theshortage of hours, thus making hours 12( 7 + 6 – 1 , used for mins).
So the criteria is as follows:
If Used_Mins > Balance_Mins , subtract 1 from Hours
If Used_Hours > Balance_Hours, add 7 to Balance_Hours –Used_Hours and subtract 1 from Days
Current_Hours should never be 0 if there’s a value > 0 inDays
The logic is 60 minutes = 1 hours, 7 hours = 1 day
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Days
[/TD]
[TD]Hours
[/TD]
[TD]Mins
[/TD]
[/TR]
[TR]
[TD]Balance
[/TD]
[TD]23
[/TD]
[TD]6
[/TD]
[TD]45
[/TD]
[/TR]
[TR]
[TD]Used
[/TD]
[TD]1
[/TD]
[TD]6
[/TD]
[TD]46
[/TD]
[/TR]
[TR]
[TD]Current
[/TD]
[TD]21
[/TD]
[TD]6
[/TD]
[TD]59
[/TD]
[/TR]
</tbody>[/TABLE]
So the criteria is as follows:
If Used_Mins > Balance_Mins , subtract 1 from Hours
If Used_Hours > Balance_Hours, add 7 to Balance_Hours –Used_Hours and subtract 1 from Days
Current_Hours should never be 0 if there’s a value > 0 inDays
The logic is 60 minutes = 1 hours, 7 hours = 1 day
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Days
[/TD]
[TD]Hours
[/TD]
[TD]Mins
[/TD]
[/TR]
[TR]
[TD]Balance
[/TD]
[TD]23
[/TD]
[TD]6
[/TD]
[TD]45
[/TD]
[/TR]
[TR]
[TD]Used
[/TD]
[TD]1
[/TD]
[TD]6
[/TD]
[TD]46
[/TD]
[/TR]
[TR]
[TD]Current
[/TD]
[TD]21
[/TD]
[TD]6
[/TD]
[TD]59
[/TD]
[/TR]
</tbody>[/TABLE]