加班费多种工资率

时间:2018-02-27 05:48:28

标签: nested

我是编程新手。我正在视觉工作室写一个工资单计算器程序,似乎无法让我的第二个加班费率正确计算。我正在努力完成以下任务: 定期工资率乘以工作小时数+假期时间(典型的40小时工作周) 工作时间为40-50小时,常规工资率为1.5(时间&半) 工作时间为50-60小时,常规工资率* 2(双倍时间)

以下是我遇到问题的嵌套IF:

If HoursWorked >= 50 And HoursWorked < 61 And HolidayHours > 0 Then
        If HoursWorked >= 50 And HoursWorked < 61 Then
            DoublePay = (HoursWorked - 40) * RateofBasePay * 2
        ElseIf HoursWorked > 40 And HoursWorked < 50 Then
            TimeHalfPay = (HoursWorked - 40) * RateofBasePay * 1.5
        End If
        RegularPay = (HolidayHours + 40) * RateofBasePay
        GrossPay = RegularPay + DoublePay + TimeHalfPay

    ElseIf HoursWorked >= 50 And HoursWorked < 61 Then
        If HoursWorked >= 50 And HoursWorked < 61 Then
            DoublePay = (HoursWorked - 40) * RateofBasePay * 2
        ElseIf HoursWorked > 40 And HoursWorked < 50 Then
            TimeHalfPay = (HoursWorked - 40) * RateofBasePay * 1.5
        End If
        RegularPay = 40 * RateofBasePay
        GrossPay = DoublePay + TimeHalfPay + RegularPay

任何帮助将不胜感激。谢谢!

0 个答案:

没有答案