一旦员工输入他们的信息和时间,我编写了一个程序来计算工资数据。我在将数据从一种形式的变量读取到另一种形式时遇到问题。我试图做的是从另一个名为 Payroll_Submission 的表单中读取一个名为 TimeSheet 的表单。这是我到目前为止的代码,我真的需要从其他表单中获取数据来进行计算。如果您需要我的 TimeSheet 代码,请告诉我,它很长,所以我这次没有附上。
Public Class Payroll_Submission
Private Sub Payroll_Submission_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim counter As Integer
counter = 0
lblEmployee.Text = TimeSheet.EmpName
lblSuperName.Text = TimeSheet.Supervisor
lblReport.Text = TimeSheet.Period
If Not TimeSheet.flag Then
lblHoursWorked.Text = TimeSheet.txtMon1 + TimeSheet.txtTues1 + TimeSheet.txtWed1 + TimeSheet.txtThurs1 + TimeSheet.txtFri1 + TimeSheet.txtSat1 + TimeSheet.txtSun1
If lblOvertimeHours.Text > 40 Then
lblRegHours.Text = 40
lblRegHours.Text = lblHoursWorked.Text - 40
Else
lblRegHours.Text = lblHoursWorked.Text
lblOvertimeHours.Text = 0
End If
lblOvertimeHours.Text = "$15"
lblRateOver.Text = "$22.50"
HourlyPay.Text = Convert.ToInt32(lblRegHours.Text) * 15
lblOvertimeHours.Text = Convert.ToInt32(lblOvertimeHours.Text) * 22.5
lblGrossPay.Text = Convert.ToInt32(HourlyPay.Text) + Convert.ToInt32(lblOvertimeHours.Text)
If TimeSheet.chk1.Checked Then
counter = counter + 1
End If
If TimeSheet.chk2.Checked Then
counter = counter + 1
End If
If TimeSheet.chk3.Checked Then
counter = counter + 1
End If
If TimeSheet.chk4.Checked Then
counter = counter + 1
End If
If TimeSheet.chk5.Checked Then
counter = counter + 1
End If
If TimeSheet.chk6.Checked Then
counter = counter + 1
End If
If TimeSheet.chk7.Checked Then
counter = counter + 1
End If
lblPTOHours.Text = counter
End If
HourlyPay.Text = Convert.ToInt32(lblRegHours.Text) * 15
lblOvertimeHours.Text = Convert.ToInt32(lblOvertimeHours.Text) * 22.5
lblGrossPay.Text = Convert.ToInt32(lblRegHours.Text) + Convert.ToInt32(lblOvertimeHours.Text)
End Sub
结束类