Untitled
unknown
vbscript
4 years ago
4.7 kB
5
Indexable
Public Class frmTaxComputation
Dim annualTax As Double
Dim isTrue As Boolean
Private Sub cboPos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPos.SelectedIndexChanged
Dim pos As String
pos = cboPos.Text
Select Case pos
Case "Administrative Assistant", "Business Analyst", "Liaison Officer", "Secretary"
checkIfEmpty()
If isTrue = True Then
clearAtMr()
Else
txtMonthlyRate.Text = Format(30000, "##,###.00")
computeAnnualTax(30000)
End If
Case "Project Manager"
checkIfEmpty()
If isTrue = True Then
clearAtMr()
Else
txtMonthlyRate.Text = Format(45000, "##,###.00")
computeAnnualTax(45000)
End If
Case "Software Developer"
If isTrue = True Then
clearAtMr()
Else
txtMonthlyRate.Text = Format(35000, "##,###.00")
computeAnnualTax(35000)
End If
Case "Human Resource Officer"
If isTrue = True Then
clearAtMr()
Else
txtMonthlyRate.Text = Format(40000, "##,###.00")
computeAnnualTax(40000)
End If
Case "Chief Executive Officer"
If isTrue = True Then
clearAtMr()
Else
txtMonthlyRate.Text = Format(100000, "###,###.00")
computeAnnualTax(100000)
End If
Case "Chief Operating Officer"
If isTrue = True Then
clearAtMr()
Else
txtMonthlyRate.Text = Format(85000, "##,###.00")
computeAnnualTax(85000)
End If
End Select
End Sub
Private Sub computeAnnualTax(monthlyRate As Integer)
Dim annualRate As Double
annualRate = monthlyRate * 12
If annualRate < 250000 Then
annualTax = 0
ElseIf annualRate > 250000 And annualRate < 400000 Then
annualTax = (annualRate - 250000) * 0.2
txtAnnualTax.Text = Format(annualTax, "##,###.00")
ElseIf annualRate > 400000 And annualRate < 800000 Then
annualTax = 30000 + ((annualRate - 400000) * 0.25)
txtAnnualTax.Text = Format(annualTax, "##,###.00")
ElseIf annualRate > 80000 And annualRate < 2000000 Then
annualTax = 130000 + ((annualRate - 800000) * 0.3)
txtAnnualTax.Text = Format(annualTax, "###,###.00")
ElseIf annualRate > 2000000 And annualRate < 8000000 Then
annualTax = 490000 + ((annualRate - 2000000) * 0.32)
txtAnnualTax.Text = Format(annualTax, "###,###.00")
ElseIf annualRate > 8000000 Then
annualTax = 2410000 + ((annualRate - 8000000) * 0.35)
txtAnnualTax.Text = Format(annualTax, "#,###,###.00")
End If
End Sub
Private Sub checkIfEmpty() 'Checks whether employee name or employee no text box is empty
If txtEmployeeNo.Text = "" Or txtEmployeeName.Text = "" Then
isTrue = True
Else
isTrue = False
End If
End Sub
Private Sub clearAtMr() 'Clears annual tax & monthly rate
txtAnnualTax.Text = ""
txtMonthlyRate.Text = ""
MsgBox("Please enter the correct Employee No.")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim idFound As Boolean
Dim employeeRecord(,) As String = New String(,) {
{"1211", "Jose dela Cruz"},
{"1111", "Sally Martinez"},
{"1201", "Miesha Reyes"},
{"1113", "Ramon Sy"},
{"1212", "Joselito Silay"}
}
For i As Integer = 0 To employeeRecord.GetLength(0) - 1
For j As Integer = 0 To employeeRecord.GetLength(1) - 1
checkIfEmpty()
If employeeRecord(i, j) = txtEmployeeNo.Text Then
idFound = True
txtEmployeeName.Text = employeeRecord(i, j + 1)
ElseIf idFound = False Then
MsgBox("Employee No. not found.")
Exit For
End If
Next
Exit For
Next
End Sub
End Class
Editor is loading...