I'm trying to write a statement in VB 6 that will give me the overtime pay. It needs to compute the first 40 hours at the normal pay rate, then any hours over 40 at rate * 1.5, then add those amount into a Datagrid field named "Gross". I can't get it to work correctly. I was trying to modify my statement for the regular hours to do it.
fldRate is the pay rate, fldGross is gross pay and fldHours are the hours. My current statement is:
If UCase(objFlds(" fldHours")) <= "40" Then
objFlds("fldGro ss") = Round(objFlds(" fldHours") * objFlds("fldRat e"), 2) ' normal work hours
Else
objFlds("fldGro ss") = Round(objFlds(" fldHours") * objFlds("fldRat e") + _ ' overtime hours
objFlds("fldHou rs") - 40 * objFlds("fldRat e") * 1.5, 2)
End If
Anyone have advice?
fldRate is the pay rate, fldGross is gross pay and fldHours are the hours. My current statement is:
If UCase(objFlds(" fldHours")) <= "40" Then
objFlds("fldGro ss") = Round(objFlds(" fldHours") * objFlds("fldRat e"), 2) ' normal work hours
Else
objFlds("fldGro ss") = Round(objFlds(" fldHours") * objFlds("fldRat e") + _ ' overtime hours
objFlds("fldHou rs") - 40 * objFlds("fldRat e") * 1.5, 2)
End If
Anyone have advice?
Comment