Code:
Private Sub cmdAdd_Click()
Dim NetPay As Double
If cmdAdd.Caption = "Add" Then
Adodc1.Recordset.AddNew
cmdAdd.Caption = "Save"
cmdUpdate.Enabled = False
cmdDel.Enabled = False
Else
Text9 = Val(txtSSS.Text) + Val(txtTAX.Text) + Val(txtPhilHealth.Text) + Val(txtPagibig.Text) + Val(txtCanteen.Text) + Val(txtOthers.Text)
TotalDeduction = Format(txtTotalDeduction, "00.00")
Adodc1.Recordset.Fields("TotalDeduction") = TotalDeduction
Adodc1.Recordset.Update
cmdAdd.Caption = "Add"
cmdUpdate.Enabled = True
cmdDel.Enabled = True
End If
End Sub
Private Sub cmdDel_Click()
Adodc1.Recordset.Delete
Adodc1.Recordset.Requery
End Sub
Private Sub cmdUpdate_Click()
Text10 = Val(txtGrossPay.Text) - Val(txttd.Text)
Adodc1.Recordset.Update
End Sub
Private Sub cmdTotalDeduction_Click()
'to add the value in text 3, text 4, text 5, text 6, text 7, text 8
txtTotalDeduction = Val(txtSSS.Text) + Val(txtTAX.Text) + Val(txtPhilHealth.Text) + Val(txtPagibig.Text) + Val(txtCanteen.Text) + Val(txtOthers.Text)
'display the amount in text 9
Text9 = Format(txtTotalDeduction, "00.00")
End Sub
Private Sub cmdNetPay_Click()
'to minus the value in tex box 2 by text box 9
txtNetPay = Val(txtGrossPay.Text) - Val(txtTotalDeduction.Text)
'display the amount in text box 10
Text10 = Format(txtNetPay, "00.00")
End Sub
Comment