OH for the love of god, for some reason i cant make sense of this, please someone help. This is what i have
Timecard Object/Class
MinutesRegular as Integer
MinutesOvertimeDailyRate1 as Integer
MinutesOvertimeDailyRate2 as Integer
MinutesOvertimeWeeklyRate1 as Integer
MinutesOvertimeWeeklyRate2 as Integer
MinutesTotal as Integer
WageRegular as Double
WageOvertimeDailyRate1 as Double
WageOvertimeDailyRate2 as Double
WageOvertimeWeeklyRate1 as Double
WageOvertimeWeeklyRate2 as Double
WageTotal as Double
DeductedMinutes as Integer
OvertimeRule Object/Class
OvertimeID As Long
OvertimeName As String
IncludeLeaveHours As Boolean
OvertimeRate1 As Decimal
OvertimeRate2 As Decimal
WeeklyThreshold1 As Decimal
WeeklyThreshold2 As Decimal
MondayThreshold1 As Decimal
MondayThreshold2 As Decimal
TuesdayThreshold1 As Decimal
TuesdayThreshold2 As Decimal
WednesdayThreshold1 As Decimal
WednesdayThreshold2 As Decimal
ThursdayThreshold1 As Decimal
ThursdayThreshold2 As Decimal
FridayThreshold1 As Decimal
FridayThreshold2 As Decimal
SaturdayThreshold1 As Decimal
SaturdayThreshold2 As Decimal
SundayThreshold1 As Decimal
SundayThreshold2 As Decimal
SixthDaySetting1 As String
SixthDaySetting2 As String
SeventhDaySetting1 As String
SeventhDaySetting2 As String
So upon Closing the period, All Timecards within the pay period are retrieved from the database.
All deducted minutes are applied,then the Leave times are calculated, then the daily OT, then each timecard is saved, All is good up to this point, then a call to calculateWeeklyOT and this is where i have the problem for some reason:
At this point say an employee has worked 12.5 hours each day for 7 days, 30 mins gets deducted because of the autotime deduction(Non relevant really) but The MinutesRegular will show 720 minutes and deductedMinutes will show 30 for each day, Daily OT is anything over 8 hours so MinutesOvertimeDailyRate1 shows 240 minutes, which updates minutesRegular to 480 minutes for each day. The Timecards are already sorted by startdatetime so so far i have the following
Private Sub CalculateWeeklyOvertime()
Dim TotalMinutes As Decimal
Dim OT1Applied As Decimal = 0
Dim OT2Applied As Decimal = 0
Dim TimeWorked As Decimal = 0
Dim MinutesOverOT1 As Decimal = 0
Dim MinutesOverOT2 As Decimal = 0
Dim WeeklyThreshold1 As Decimal = OT.WeeklyThreshold1 * 60
Dim WeeklyThreshold2 As Decimal = OT.WeeklyThreshold2 * 60
For Each Timecard In CalculatedTimecardList
If Timecard.EntryType = 2 Then
If TCC.PayrollSettings.IncludeLeaveInOvertimeCalcs = False Then
Continue For
End If
End If
TotalMinutes += Timecard.MinutesRegular + Timecard.MinutesOvertimeDailyRate1 + Timecard.MinutesOvertimeDailyRate2
TimeWorked = Timecard.MinutesRegular + Timecard.MinutesOvertimeDailyRate1 + Timecard.MinutesOvertimeDailyRate2
MinutesOverOT1 = TotalMinutes - WeeklyThreshold1
MinutesOverOT2 = TotalMinutes - WeeklyThreshold2
If OT.WeeklyThreshold2 = 0 Then
Timecard.MinutesOvertimeWeeklyRate2 = 0
Else
If TotalMinutes > WeeklyThreshold2 Then
End If
End If
If OT.WeeklyThreshold1 <= 0 Then
Timecard.MinutesOvertimeWeeklyRate1 = 0
Else
If TotalMinutes > WeeklyThreshold1 Then
End If
End If
Timecard.Save(False)
Next
End Sub
What Im trying to do is to record the Weekly Overtime On Each Timecard and whether its WOT1 or WOt2
So if given this example of 12.5 hours, .5 hours deducted, so 12 hours a day
The Minutes Regular being 480 and DailyOT1 240
I should get a result like this
MinutesReg DOT1 DOt2 WOt1 WOT2
480 240
480 240
480 240
0 240 480
0 240 480
0 240 480
0 240 480
I really cant get this, im probably over complicating this, or over thinking or something but any help at all, i would be grateful, it seem like such a trivial thing. I know its alot to read but the basics is i want each timecard to record its own WOT1 and WOT2 (WOT1 being 40 hours and WOT2 being 60 hours). Thanks again if you an assist in any way.