You are on page 1of 14

// log in form If .

EOF Then MsgBox "Invalid User", vbCritical GoTo EXIT_FOR Else Private Sub cmdCancel_Click() End End Sub End If Private Sub cmdLogin_Click() End With Dim CONNECT_STRING As String CONNECT_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & App.Path & "\database\dbpayrollsys.mdb" & ";" Rs.Close Dim Rs As Recordset Set Rs = New Recordset End Sub Dim strSQL As String strSQL = "SELECT user, pass FROM tbllogin " & _ "WHERE user = '" & txtUser.Text & "' AND pass = '" & txtPass.Text & "'" //new employee form Option Explicit Dim EmpID As String Public Sub empty_obj() With Rs .Open strSQL, CONNECT_STRING txtEmpID.Text = "" Set Rs = Nothing Unload Me frmMain.Show

EXIT_FOR:

txtfullname.Text = "" cbogender.Text = "" cbostatus.Text = "" txtposition.Text = "" txtBs.Text = " " cboEStatus.Text = " " txtAdd.Text = " " txtContact.Text = " " txtSSS.Text = " " txtTin.Text = " " txtphil.Text = " " txtName.Text = " " txtAddress.Text = " " txtContactno.Text = " " End Sub Public Sub disabled_obj()

txtposition.Enabled = False txtBs.Enabled = False cboEStatus.Enabled = False txtAdd.Enabled = False txtContact.Enabled = False txtSSS.Enabled = False txtTin.Enabled = False txtphil.Enabled = False txtName.Enabled = False txtAddress.Enabled = False txtContactno.Enabled = False End Sub Public Sub Enabled_obj()

cmdAdd.Enabled = True cmdback.Enabled = True txtEmpID.Enabled = True

cmdAdd.Enabled = True cmdback.Enabled = True cmdBrowse.Enabled = True cmdSave.Enabled = True txtEmpID.Enabled = False txtfullname.Enabled = False cbogender.Enabled = False cbostatus.Enabled = False

txtfullname.Enabled = True cbogender.Enabled = True cbostatus.Enabled = True txtposition.Enabled = True txtBs.Enabled = True cboEStatus.Enabled = True txtAdd.Enabled = True txtContact.Enabled = True

txtSSS.Enabled = True txtTin.Enabled = True txtphil.Enabled = True txtName.Enabled = True txtAddress.Enabled = True txtContactno.Enabled = True If BEdt = False Then empty_obj End If End Sub

txtContact.Enabled = True txtSSS.Enabled = True txtTin.Enabled = True txtphil.Enabled = True txtName.Enabled = True txtAddress.Enabled = True txtContactno.Enabled = True

txtEmpID.Text = " " txtfullname.Text = " " cbogender.Text = " - - - Select Gender - - -

Private Sub cmdaddemp_Click()

" cbostatus.Text = " - - - Select Status - - - "

cmdAdd.Enabled = True cmdback.Enabled = True cmdBrowse.Enabled = True cmdSave.Enabled = True txtEmpID.Enabled = True txtfullname.Enabled = True cbogender.Enabled = True cbostatus.Enabled = True txtposition.Enabled = True txtBs.Enabled = True cboEStatus.Enabled = True txtAdd.Enabled = True

txtposition.Text = " " txtBs.Text = " " cboEStatus.Text = " - - - Employment Status - - - " txtAdd.Text = " " txtContact.Text = " " txtSSS.Text = " " txtTin.Text = " " txtphil.Text = " " txtName.Text = " " txtAddress.Text = " " txtContactno.Text = " "

End Sub

+ Trim(txtContact.Text) + "','" + Trim(txtBs.Text) + "','" _ + Trim(txtSSS.Text) + "','" + Trim(txtTin.Text) + "','" _ + Trim(txtphil.Text) + "','" + Trim(txtName.Text) + " ','" _ + Trim(txtAddress.Text) + "','" + Trim(txtContactno.Text) + "')"

Private Sub cmdback_Click() frmMain.Show Unload Me

End Sub

MsgBox "New Record Saved!", vbInformation, "Employee Info" End If Else ' update

Private Sub cmdAdd_Click()

Call Open_conn If BEdt = False Then Rs.Open "Select * from tblemployeerecord where EmployeeID='" + Trim(txtEmpID.Text) + " '", Cn If Rs.EOF = False Then MsgBox "Duplicate Employee ID", vbInformation, "Duplicate" Else Cn.Execute "Insert into tblemployeerecord values('" + Trim(txtEmpID.Text) + "', '" _ + Trim(txtfullname.Text) + "','" + Trim(cbogender.Text) + "','" _ + Trim(cbostatus.Text) + "','" + Trim(cboEStatus.Text) + "','" _ + Trim(txtposition.Text) + "','" + Trim(txtAdd.Text) + "','" _ Cn.Execute "Delete * from tblemployeerecord where EmployeeID = '" + Trim(txtEmpID.Text) + "'" Cn.Execute "Insert into tblemployeerecord values('" + Trim(txtEmpID.Text) + "', '" _ + Trim(txtfullname.Text) + "','" + Trim(cbogender.Text) + "','" _ + Trim(cbostatus.Text) + "','" + Trim(cboEStatus.Text) + "','" _ + Trim(txtposition.Text) + "','" + Trim(txtAdd.Text) + "','" _ + Trim(txtContact.Text) + "','" + Trim(txtBs.Text) + "','" _ + Trim(txtSSS.Text) + "','" + Trim(txtTin.Text) + "','" _

+ Trim(txtphil.Text) + "','" + Trim(txtName.Text) + " ','" _ + Trim(txtAddress.Text) + "','" + Trim(txtContactno.Text) + "')" MsgBox "Record Updated!", vbInformation, "User Info" BEdt = False End If

Private Sub cmdSave_Click() cd.ShowSave If cd.FileName <> Empty Then SavePicture Image1.Picture, cd.FileName End If End Sub

Private Sub Command1_Click()

Call disabled_obj Close_Conn

End Sub

Public Sub Move_record() End Sub Private Sub cmdBrowse_Click() cd.ShowOpen Image1.Picture = LoadPicture(cd.FileName) End Sub Set Rs = Cn.Execute("Select*from tblemployeerecord") If Not Rs.EOF Then Do While Not Rs.EOF txtEmpID.Text = Rs!EmployeeID txtfullname.Text = Rs!FullName cbogender.Text = Rs!Gender Private Sub cmdEdit_Click() Call Enabled_obj BEdt = True cbostatus.Text = Rs!Status txtposition.Text = Rs!Position txtBs.Text = Rs!basicsalary cboEStatus.Text = Rs!EmploymentStatus txtAdd.Text = Rs!Address End Sub txtContact.Text = Rs!Contact txtSSS.Text = Rs!sss

txtTin.Text = Rs!TIN txtphil.Text = Rs!Philhealth txtName.Text = Rs!EmName txtAddress.Text = Rs!EmAddress txtContactno.Text = Rs!EmContact

txtName.Text = " " txtAddress.Text = " " txtContactno.Text = " "

End Sub

Rs.MoveNext Loop End If End Sub

//search employee Private Sub cmdTransfer_Click() Call transfer End Sub Public Sub transfer()

Public Sub clear_text()

If lvwInfo.ListItems.Count <> 0 Then Call Open_conn

txtEmpID.Text = " " txtfullname.Text = " " cbogender.Text = " " cbostatus.Text = " " txtposition.Text = " " txtBs.Text = " " cboEStatus.Text = " " txtAdd.Text = " " txtContact.Text = " " txtSSS.Text = " " txtTin.Text = " " txtphil.Text = " "

Set Rs = Cn.Execute("Select * from tblemployeerecord where EmployeeID= '" + Trim(lvwInfo.SelectedItem) + "'") If Not Rs.EOF Then With frmnewemp .txtEmpID.Text = Rs!EmployeeID .txtfullname.Text = Rs!FullName .cbogender.Text = Rs!Gender .cbostatus.Text = Rs!Status .txtposition.Text = Rs!Position .txtBs.Text = Rs!basicsalary .cboEStatus.Text = Rs!EmploymentStatus .txtAdd.Text = Rs!Address

.txtContact.Text = Rs!Contact .txtSSS.Text = Rs!sss .txtTin.Text = Rs!TIN .txtphil.Text = Rs!Philhealth .txtName.Text = Rs!EmName .txtAddress.Text = Rs!EmAddress .txtContactno.Text = Rs!EmContact End With End If Call Close_Conn Unload Me End If frmnewemp.Show End Sub

Do While Not Rs.EOF Set itmx = lvwInfo.ListItems.Add(, , Rs!EmployeeID) itmx.SubItems(1) = Rs!FullName itmx.SubItems(2) = Rs!Gender itmx.SubItems(3) = Rs!Status itmx.SubItems(4) = Rs!Position itmx.SubItems(5) = Rs!basicsalary itmx.SubItems(6) = Rs!EmploymentStatus itmx.SubItems(7) = Rs!Contact itmx.SubItems(8) = Rs!sss itmx.SubItems(9) = Rs!TIN itmx.SubItems(10) = Rs!Philhealth Rs.MoveNext Loop Else

Private Sub Form_Load() Call Open_conn Set Rs = Cn.Execute("Select * from tblemployeerecord") Call listemployee Call Close_Conn End Sub Public Sub listemployee() If Not Rs.EOF Then lvwInfo.ListItems.Clear

lvwInfo.ListItems.Clear End If End Sub

Public Sub searchitems() Call Open_conn Select Case cbocriteria.Text Case Is = "Employee Id" Set Rs = Cn.Execute("Select * from tblemployeerecord where EmpId = '" + Trim(txtSearchkey.Text) + "'")

Call listemployee Case Is = "Full Name" Set Rs = Cn.Execute("Select * from tblemployeerecord where FullName like '" + Trim(txtSearchkey.Text) + "%';") Call listemployee Case Is = "Position" Set Rs = Cn.Execute("Select * from tblemployeerecord where Position like '" + Trim(txtSearchkey.Text) + "%';") Call listemployee End Select Call Close_Conn End Sub

End Sub //computation form Private Sub cboEmpID_Click()

Call Open_conn Set Rs = Cn.Execute("Select*from tblemployeerecord where EmployeeID='" + Trim(cboEmpID.Text) + "'") If Not Rs.EOF Then Do While Not Rs.EOF txtfullname.Text = Rs!FullName txtBs.Text = Rs!basicsalary txtEmpStat.Text = Rs!EmploymentStatus txtposition.Text = Rs!Position

Private Sub Form_Unload(Cancel As Integer) Call Close_Conn End Sub

Rs.MoveNext Loop End If Call Close_Conn

Private Sub lvwInfo_DblClick() Call transfer End Sub End Sub

Private Sub txtSearchkey_Change() lvwInfo.ListItems.Clear Call searchitems

Private Sub cmdCompute_Click() If txtBs.Text = 5000 Then txtSSS.Text = "166.70"

ElseIf txtBs.Text = 9500 Then ElseIf txtBs.Text = 5500 Then txtSSS.Text = "183.30" ElseIf txtBs.Text = 10000 Then ElseIf txtBs.Text = 6000 Then txtSSS.Text = "200.00" ElseIf txtBs.Text = 10500 Then ElseIf txtBs.Text = 6500 Then txtSSS.Text = "216.70" ElseIf txtBs.Text = 11000 Then ElseIf txtBs.Text = 7000 Then txtSSS.Text = "233.30" ElseIf txtBs.Text = 11500 Then ElseIf txtBs.Text = 7500 Then txtSSS.Text = "250.00" ElseIf txtBs.Text = 12000 Then ElseIf txtBs.Text = 8000 Then txtSSS.Text = "266.70" ElseIf txtBs.Text = 12500 Then ElseIf txtBs.Text = 8500 Then txtSSS.Text = "283.30" ElseIf txtBs.Text = 13000 Then ElseIf txtBs.Text = 9000 Then txtSSS.Text = "300.00" ElseIf txtBs.Text = 13500 Then txtSSS.Text = "433.30" txtSSS.Text = "416.70" txtSSS.Text = "400.00" txtSSS.Text = "383.30" txtSSS.Text = "366.70" txtSSS.Text = "350.00" txtSSS.Text = "333.30" txtSSS.Text = "316.70"

txtSSS.Text = "450.00"

txtphilhealth.Text = "87.50"

ElseIf txtBs.Text = 14000 Then txtSSS.Text = "466.70"

ElseIf txtBs.Text < 9000 Then txtphilhealth.Text = "100.00"

ElseIf txtBs.Text = 14500 Then txtSSS.Text = "483.30"

ElseIf txtBs.Text < 10000 Then txtphilhealth.Text = "112.50"

ElseIf txtBs.Text = 15000 Then txtSSS.Text = "500.00" End If

ElseIf txtBs.Text < 11000 Then txtphilhealth.Text = "125.00"

ElseIf txtBs.Text < 12000 Then txtphilhealth.Text = "137.50"

ElseIf txtBs.Text < 13000 Then If txtBs.Text < 5000 Then txtphilhealth.Text = "50.00" ElseIf txtBs.Text < 14000 Then ElseIf txtBs.Text < 6000 Then txtphilhealth.Text = "62.50" ElseIf txtBs.Text < 15000 Then ElseIf txtBs.Text < 7000 Then txtphilhealth.Text = "75.00" ElseIf txtBs.Text < 16000 Then ElseIf txtBs.Text < 8000 Then txtphilhealth.Text = "187.50" txtphilhealth.Text = "175.00" txtphilhealth.Text = "162.50" txtphilhealth.Text = "150.00"

ElseIf txtBs.Text < 25000 Then ElseIf txtBs.Text < 17000 Then txtphilhealth.Text = "200.00" ElseIf txtBs.Text < 26000 Then ElseIf txtBs.Text < 18000 Then txtphilhealth.Text = "212.50" ElseIf txtBs.Text < 27000 Then ElseIf txtBs.Text < 19000 Then txtphilhealth.Text = "225.00" ElseIf txtBs.Text < 28000 Then ElseIf txtBs.Text < 20000 Then txtphilhealth.Text = "237.50" ElseIf txtBs.Text < 29000 Then ElseIf txtBs.Text < 21000 Then txtphilhealth.Text = "250.00" ElseIf txtBs.Text < 30000 Then ElseIf txtBs.Text < 22000 Then txtphilhealth.Text = "262.50" ElseIf txtBs.Text >= 30000 Then ElseIf txtBs.Text < 23000 Then txtphilhealth.Text = "275.00" txtphilhealth.Text = "375.00" End If txtphilhealth.Text = "362.50" txtphilhealth.Text = "350.00" txtphilhealth.Text = "337.50" txtphilhealth.Text = "325.00" txtphilhealth.Text = "312.50" txtphilhealth.Text = "300.00"

ElseIf txtBs.Text < 24000 Then txtphilhealth.Text = "287.50" Dim sss As Double Dim phil As Double

Dim loan As Double Dim paluagan As Double Dim absent As Double Dim borrowed As Double Dim acct As Double Dim water As Double Dim insurance As Double Dim bs As Double Dim cola As Double

absent = bs / 22 * absent

txtTD.Text = FormatNumber(sss + phil + loan + paluagan + absent + borrowed + acct + water + insurance, 2)

txtOT.Text = FormatNumber(bs / 22 / 8 * txtOT.Text, 2)

txtNP.Text = FormatNumber(bs + txtOT.Text + cola - txtTD.Text, 2)

sss = Val(txtSSS.Text) phil = Val(txtphilhealth.Text) loan = Val(txtLoan.Text) paluagan = Val(txtpaluagan.Text) absent = Val(txtabsent.Text) borrowed = Val(txtBorrowed.Text) acct = Val(txtAccount.Text) water = Val(txtWater.Text) insurance = Val(txtInsurance.Text) cola = Val(txtCOLA.Text) bs = Val(txtBs.Text) End Sub Private Sub Command2_Click() frmSearch.Show End Sub

+ Trim(txtNP.Text) + "')" Private Sub cmdSave_Click() MsgBox "New Record Saved!", vbInformation, "Payroll Info" End If End If

Call Open_conn If BEdt = False Then Rs.Open "Select * from tblpayroll where EmployeeID='" + Trim(cboEmpID.Text) + " '", Cn 'save If Rs.EOF = False Then MsgBox "Duplicate Employee Id!", vbCritical, "Duplicate" Else Cn.Execute "Insert into tblpayroll values('" + Trim(cboEmpID.Text) + "', '" _ + Trim(txtfullname.Text) + "','" + Trim(txtBs.Text) + "','" _ + Trim(txtEmpStat.Text) + "','" + Trim(txtposition.Text) + "','" _ + Trim(txtCOLA.Text) + "','" + Trim(txtOT.Text) + "','" _ + Trim(txtSSS.Text) + "','" + Trim(txtphilhealth.Text) + "','" _ + Trim(txtTD.Text) + "','" + Trim(txtabsent.Text) + "','" _ + Trim(txtpaluagan.Text) + "','" + Trim(txtLoan.Text) + "','" _ + Trim(txtBorrowed.Text) + "','" + Trim(txtAccount.Text) + "','" _ + Trim(txtInsurance.Text) + "','" + Trim(txtWater.Text) + "','" _

Close_Conn Call clear_text End Sub Public Sub clear_text()

cboEmpID.Text = "--Select Employee Id--" txtfullname.Text = " " txtBs.Text = " " txtEmpStat.Text = " " txtposition.Text = " " txtCOLA.Text = " " txtSSS.Text = " " txtphilhealth.Text = " " txtTD.Text = " " txtabsent.Text = " " txtpaluagan.Text = " " txtLoan.Text = " " txtBorrowed.Text = " " txtAccount.Text = " " txtInsurance.Text = " "

txtWater.Text = " " txtNP.Text = " "

End Sub

Private Sub Form_Load() Call loadempid End Sub Public Sub loadempid() Call Open_conn Set Rs = Cn.Execute("Select*from tblemployeerecord") If Not Rs.EOF Then Do While Not Rs.EOF cboEmpID.AddItem Rs!EmployeeID Rs.MoveNext Loop End If Call Close_Conn End Sub

You might also like