SlideShare a Scribd company logo
1 of 32
A Computerized Payroll System for the
Barangay Dita
1.1 Background of the study
HISTORY OF PAYROLL SYSTEM
A computerized payroll system, the employer invests in a computerized payroll software.
Using a software such as quickbooks allows the employer to enter the wages into the system
after he has manually calculated them. The payroll and check printing are processed through
the system. The employer has access to payroll reports that he/she can print and use to
double-check against what she has entered before printing the checks. This allows his/her
to correct any detectable errors beforehand. Computerized payroll system allow you to
process all your normal payroll task via a computerized system, rather than by hand.
Essentials like name, address, Social Security number and withholding rate for each
employee are automatically filled in for every pay period until you make an employee’s
record inactive. Many different vendors offer computerized payroll system. Like different
word processors or other computer programs, they largely offer the same types of features
with slightly different interfaces. Payroll is essentially how employees are paid. It’s the legal
paperwork involved. There's more to payroll than just handing out cash or checks. However,
after gathering data on what the employees did and compared it to their salaries, some simple
payday mathematics will let the employer hand out the dough.
1.2 Objectives
1.2.1 General Objective
The main objective of the study is to design and develop a Computerizes Payroll
System for Barangay Hall, Dita that fast transactions, minimize the manual checking of
employees, monitor the status of employee’s charges, deductions and generate the
essential reports. A computerized payroll system must be able to keep and generate
accurate reports on employee income. An equally important objective of any payroll
system is to generate paychecks and pay stubs. Computerizing this task saves managers
and business owners time and money; rather than reviewing time cards manually and
calculating a check amount based on the hours worked, the payroll system should be
designed to automatically calculate these figures. A computerized payroll system must
automatically factor in the overtime pay. This helps employers stay within the law when
it comes time to pay overtime. Additionally, since an employer can use the system to
check the number of hours an employee works, the employer can shift schedules to avoid
paying additional overtime.
1.2.2 Specific Objectives
To minimize the manual checking of each daily time record.
To develop a module that will generate essentials reports.
To develop that will monitor the status of employee’s loan and other
deductions such as cash advance and charges.
1.3 Significance of the study
This part of the study discusses about the importance of creating computerized Payroll
System. It provides sample discussed how to run a Computerized Payroll System and here
are some examples of how it run. Many employers use a timekeeping system, such as clock
time, to track work hours employees '. Can separate this system regular hours from overtime
hours worked. Payroll all people will do is make edits / adjustments, if necessary. If time
employees are imported into the computerized Payroll system, the latter rounds up and
down time employees appropriately, as the nearest quarter hour. It calculates the total hours
worked and paid. It is saving the time spent manually calculating time and reduces errors. If
the person enters Payroll time system itself, automatically calculates its income, based on its
input. The system calculates all pay frequencies, such as weekly, biweely, and twice a
month. Only people attended Payroll data which the reduction is based, such as form for
withholding information federal income tax. Necessary you a manual payroll system to
print paychecks on a typewriter or by hand.
A computerized Payroll system has direct deposit capability, which saves money spent
on live checks and reconciliation. Moreover, paycheck and pay stub generation occurs
rapidly, regardless of the quantity. developing a computerized system and Prints Payroll
reports . If you want to double - check before printing Payroll stubs paychecks / pay, just
refer to the corresponding report. A computerized payroll system allows hard - copy
printing of Payroll registers pertaining to each pay period. Also saves its information
systems without boundaries .The system generates reports to ensure compliance with tax
Payroll tax. This includes quarterly and annual wage reporting and development of
employee forms. If a related departments such as accounting office holding Payroll taxes
and reconciliation of the company, print the required reports would require the department
through the computerized system. Furthermore, these days, such as vacation and personal
time, taken and paid to benefit the track system .
1.4 Scope
The study will covers the process of preparing the pay slip of each employee, monitors
loans, cash advances, charges, keeping the records and easily computers the basic pay,
regular overtime pay, pay during day off, special and legal holiday pay, gross pay, SSS
contributions, PhilHealth contributions, Pag-Ibig contributions, cash advances, charges,
deductions, lates, and net pay.
1.5 Delimitation
The study does not cover any other not employee of the Barangay Hall, Dita .This is not a
group pay slip. This system is not cover by any deduction that may not belong to the pay
slip. And also the other income that not belong in Barangay Hall, Dita .
1.6 Definition of Terms
1.6.1 Operational Terms
Computerized Payroll System- A computerized payroll system has many prominent
advantages over paper systems. They prevent clerical error in calculating hours and a
gross payment. They also automatically deduct taxes based on the gross payment.
Work Hours- is the period of time that an individual spends at paid occupational labor.
Unpaid labors such as personal housework or caring for children/pets are not considered
part of the working week.
Overtime hours- is the amount of time someone works beyond normal working hours.
Normal hours may be determined in several ways.
Regular Hours- is usually when a store opens and closes.
Total Hours- compute the number of hours you work every week counting overtime and
then average these hours over a set period.
Income Tax- is a government levy (tax) imposed on individuals or entities (taxpayers)
that varies with the income or profits (taxable income) of the taxpayer. Details vary
widely by jurisdiction. Many jurisdictions refer to income tax on business entities as
companies tax or corporation tax.
Deposit- account is a savings account, current account, or other type of bank account, at a
banking institution that allows money to be deposited and withdrawn by the account
holder.
Paychecks- is traditionally a paper document (a cheque) issued by an employer to pay an
employee for services rendered. In recent times, the physical paycheck has been
increasingly replaced by electronic to bank accounts. Such employees may still receive a
pay slip, but any attached cheque is marked as non-negotiable and cannot be cashed.
Payslip- a slip of paper included with your pay that records how much money you have
earned and how much tax or insurance etc. has been taken out.
1.6.2 Technical Terms
Data- is a set of value of qualitative or quantitative variables; restated, data are individual
pieces of information. Data in computing or data processing are represented in
a structure. Data consists of a series of facts or statements that may have been collected,
stored, processed and/or manipulated but have not been organized or placed into context.
When data is organized, it becomes information. Information can be processed and used
to draw generalized conclusions or knowledge.
1.7 Methodology Used in Developing the Software Product
Data Gathering :
Conducting of 5 interview, involving of 30 personnel of the Barangay Hall, Dita to
understand the roles, the procedures, issues, opportunities, and challenges of payroll process.
VB orVisual Basic is a Programming tool that user to develop Windows or GUI(Graphical
User Interface) applications. It means that rather than writing numerous line for code to describe
the appearance and location for interface elements like C, C++, or Basic. User can simply drag
and drop pre-built objects into the form window on computer screen.
VB is a enhanced version of BASIC programming language(NASIC is Predecessor of VB)/
The main difference is that the VB can create windows programs by just Drag & Drop where as
BASIC could only create DOS programs or work only in CUI (Command User Interface)
1.8 User’s Manual
Public Class dbSelect
Inherits System.Windows.Forms.Form
Public Shared StartUp As dbSelect
Private Sub btnNSM_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNSM.Click
Dim Login As New Login
CompDB = "NSM"
Login.Show()
Me.Hide()
End Sub
Private Sub btnPPE_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPPE.Click
Dim Login As New Login
CompDB = "PPE"
Login.Show()
Me.Hide()
End Sub
Private Sub btnSW_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSW.Click
Dim Login As New Login
CompDB = "S&W"
Login.Show()
Me.Hide()
End Sub
Private Sub btnSDOM_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSDOM.Click
Dim Login As New Login
CompDB = "SDOM"
Login.Show()
Me.Hide()
End Sub
Private Sub btnSSN_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSSN.Click
Dim Login As New Login
CompDB = "SSn"
Login.Show()
Me.Hide()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Application.Exit()
End Sub
Private Sub dbSelect_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dbSelect.StartUp = Me
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint
End Sub
End Class
Public Class Menu
Inherits System.Windows.Forms.Form
Private Sub Menu_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Select Case CompDB
Case "NSM"
Label2.Text = "Admin"
Case "PPE"
Label2.Text = "Lupon"
Case "S&W"
Label2.Text = "Barangay Health Worker"
Case "SDOM"
Label2.Text = "Barangay Tanod"
Case "SSN"
Label2.Text = "Security Aide"
End Select
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnQuit.Click
Me.Close()
End Sub
Private Sub btnCompProfile_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCompProfile.Click
Dim Company As New Company
Company.Show()
End Sub
Private Sub btnEmployees_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnEmployees.Click
Dim Employees As New Employees
Employees.Show()
End Sub
Private Sub btnPayroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPayroll.Click
Dim Payroll As New Payroll
Payroll.Show()
End Sub
Private Sub btnReports_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReports.Click
Dim ReportDialog As New ReportDialog
ReportDialog.Show()
End Sub
Private Sub btnSecurity_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSecurity.Click
Dim Password As New Password
Password.Show()
End Sub
Private Sub btnAbout_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAbout.Click
Dim About As New About
About.ShowDialog()
End Sub
Private Sub Menu_Closed(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Closed
dbSelect.StartUp.Show()
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label5.Click
End Sub
End Class
Public Class Company
Inherits System.Windows.Forms.Form
Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
Select Case msg.WParam.ToInt32()
Case 13 ' enter Key
If TypeOf Me.ActiveControl Is TextBox Then
SendKeys.Send("{Tab}")
Return True
End If
End Select
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub Company_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
cnPayroll.ConnectionString = cnSettings()
daCompany.Fill(DsPayroll)
Me.BindingContext(DsPayroll, "Company").Position = 0
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Me.BindingContext(DsPayroll, "Company").EndCurrentEdit()
daCompany.Update(DsPayroll)
End Sub
End Class
Public Class Employees
Inherits System.Windows.Forms.Form
Dim oldcbDivision As String
Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
Select Case msg.WParam.ToInt32()
Case 13 ' enter Key
If TypeOf Me.ActiveControl Is TextBox Or TypeOf
Me.ActiveControl Is ComboBox Then
SendKeys.Send("{Tab}")
Return True
End If
End Select
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub Employees_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cnPayroll.ConnectionString = cnSettings()
daEmployees.Fill(DsPayroll)
daDivision.Fill(DsPayroll)
With cbStatus
.Items.Add("ACTIVE")
.Items.Add("RESIGNED")
.Items.Add("RETIRED")
End With
With cbDivision
.DataSource = DsPayroll
.DisplayMember = "Division.Division"
.ValueMember = "Division.DivisionID"
.DataBindings.Add("Tag", DsPayroll.Tables("Employees"),
"Division")
.DataBindings.Add(New Binding("SelectedValue", _
DsPayroll, "Employees.Division"))
End With
With cbPayMethod
.Items.Add("MONTHLY")
.Items.Add("DAILY")
End With
BindEmpList()
Me.BindingContext(DsPayroll, "Employees").Position = 0
AddHandler Me.BindingContext(DsPayroll, "Employees").PositionChanged,
_
AddressOf Employee_PositionChanged
DisplayNav(sender, e)
End Sub
Sub BindEmpList()
With grdEmpList
.CaptionText = "Employees"
.DataMember = "Employees"
.DataSource = DsPayroll
End With
' You must clear out the TableStyles collection before
grdEmpList.TableStyles.Clear()
Dim grdTableStyle1 As New DataGridTableStyle
With grdTableStyle1
.MappingName = "Employees"
End With
Dim grdColStyle1 As New DataGridTextBoxColumn
With grdColStyle1
.MappingName = "AssignCode"
.HeaderText = "Assign Code"
.Width = 140
End With
Dim grdColStyle2 As New DataGridTextBoxColumn
With grdColStyle2
.MappingName = "LastName"
.HeaderText = "Last Name"
.Width = 140
End With
Dim grdColStyle3 As New DataGridTextBoxColumn
With grdColStyle3
.MappingName = "FirstName"
.HeaderText = "First Name"
.Width = 140
End With
Dim grdColStyle4 As New DataGridTextBoxColumn
With grdColStyle4
.MappingName = "MiddleName"
.HeaderText = "M.I."
.Width = 75
End With
Dim grdColStyle5 As New DataGridTextBoxColumn
With grdColStyle5
.MappingName = "Section"
.HeaderText = "Section"
.Width = 75
End With
Dim grdColStyle6 As New DataGridTextBoxColumn
With grdColStyle6
.MappingName = "DateHired"
.HeaderText = "Date Hired"
.Width = 75
End With
Dim grdColStyle7 As New DataGridTextBoxColumn
With grdColStyle7
.MappingName = "Phone"
.HeaderText = "Phone"
.Width = 75
End With
Dim grdColStyle8 As New DataGridTextBoxColumn
With grdColStyle8
.MappingName = "Status"
.HeaderText = "Status"
.Width = 75
End With
grdTableStyle1.GridColumnStyles.AddRange _
(New DataGridColumnStyle() {grdColStyle1, grdColStyle2, _
grdColStyle3, grdColStyle4, grdColStyle5, _
grdColStyle6, grdColStyle7, grdColStyle8})
grdEmpList.TableStyles.Add(grdTableStyle1)
End Sub
Private Sub DisplayNav(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnFirst.Click, btnPrev.Click, btnNext.Click,
btnLast.Click, btnDelete.Click
'Update record position when Update & Delete events
lblNavLocation.Text = Me.BindingContext(DsPayroll,
"Employees").Position + 1 & " of " & Me.BindingContext(DsPayroll,
"Employees").Count
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
Save_Record()
Me.BindingContext(DsPayroll, "Employees").Position += 1
End Sub
Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPrev.Click
Save_Record()
Me.BindingContext(DsPayroll, "Employees").Position -= 1
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLast.Click
Save_Record()
Me.BindingContext(DsPayroll, "Employees").Position =
Me.BindingContext(DsPayroll, "Employees").Count - 1
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnFirst.Click
Save_Record()
Me.BindingContext(DsPayroll, "Employees").Position = 0
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
If btnAdd.Text = "&Add" Then
Me.BindingContext(DsPayroll, "Employees").AddNew()
Else
Me.BindingContext(DsPayroll, "Employees").CancelCurrentEdit()
Change_Button(True)
btnAdd.Text = "&Add"
DisplayNav(sender, e)
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Try
If btnAdd.Text = "&Revert" Then
If txtCode.Text = "" Then
MessageBox.Show("Please don't leave assign code field
blank.", "Error", MessageBoxButtons.OK)
Exit Sub
End If
End If
Save_Record()
Change_Button(True)
btnAdd.Text = "&Add"
DisplayNav(sender, e)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
Try
If MsgBox("Are you sure you want to delete this record?",
MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub
Me.BindingContext(DsPayroll,
"Employees").RemoveAt(Me.BindingContext(DsPayroll, "Employees").Position)
Save_Record()
DisplayNav(sender, e)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Save_Record()
Try
Me.BindingContext(DsPayroll, "Employees").EndCurrentEdit()
daEmployees.Update(DsPayroll)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Change_Button(ByVal bval As Boolean)
btnFirst.Enabled = bval
btnPrev.Enabled = bval
btnNext.Enabled = bval
btnLast.Enabled = bval
btnDelete.Enabled = bval
btnExit.Enabled = bval
End Sub
Private Sub txtDailyRate_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtDailyRate.LostFocus
If IsValidTextbox(txtDailyRate) = False Then Exit Sub
End Sub
Private Sub txtAllowance_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtAllowance.LostFocus
If IsValidTextbox(txtAllowance) = False Then Exit Sub
End Sub
Private Sub txtIncentives_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtIncentives.LostFocus
If IsValidTextbox(txtIncentives) = False Then Exit Sub
End Sub
Private Sub cbDivision_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cbDivision.SelectedIndexChanged
oldcbDivision = cbDivision.Text
End Sub
Private Sub cbDivision_SelectionChangeCommitted(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cbDivision.SelectionChangeCommitted
If cbDivision.Text = "Add Division" Then
Dim Division As New Division
cbDivision.Text = oldcbDivision
Division.ShowDialog()
daDivision.Fill(DsPayroll)
End If
End Sub
Private Sub Employee_PositionChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
DisplayNav(sender, e)
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label8.Click
End Sub
Private Sub lblNavLocation_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles lblNavLocation.Click
End Sub
Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint
End Sub
Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint
End Sub
Private Sub TabData_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TabData.Click
End Sub
Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox2.Enter
End Sub
End Class
Option Explicit On
Imports System.Data.OleDb
Public Class Payroll
Inherits System.Windows.Forms.Form
Dim ACCESS_CONNECTION_STRING As String = cnSettings()
Dim strSelectedAssignCode As String
Dim dblAllowance As Double
Dim dblIncentives As Double
Dim intIndex As Integer
Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
Select Case msg.WParam.ToInt32()
Case 13 ' enter Key
If TypeOf Me.ActiveControl Is TextBox Then
SendKeys.Send("{Tab}")
Return True
End If
End Select
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
Private Sub Payroll_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
PopulateNameList()
End Sub
Private Sub PopulateNameList()
Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING)
lvName.Items.Clear()
lvName.Sorting = SortOrder.Ascending
Dim cmdfill As New OleDbCommand("SELECT AssignCode, LastName & ', ' &
FirstName & ' ' & MiddleName as Name FROM Employees", Connection)
Try
Connection.Open()
Dim datareader As OleDbDataReader
datareader = cmdfill.ExecuteReader
While datareader.Read
Dim lvi As New ListViewItem
lvi.Text = CStr(datareader("AssignCode"))
lvi.SubItems.Add(CStr(datareader("Name")))
lvName.Items.Add(lvi)
End While
If datareader.HasRows Then
lvName.TopItem.Selected = True
lvName.TopItem.Focused = True
lvName.TopItem.EnsureVisible()
lvName.Select()
'lvName.Items(0).Selected = True
'strSelectedAssignCode = lvName.Items(0).SubItems(0).Text
lvName_SelectedIndexChanged(Nothing, Nothing)
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
Finally
Connection.Close()
End Try
End Sub
Private Sub lvName_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles lvName.SelectedIndexChanged
Dim cnOleDb As OleDbConnection
Dim cmSQL As OleDbCommand
Dim drSQL As OleDbDataReader
Dim strSQL As String
'Dim strID As String
Dim ThisItem As ListViewItem
If IsNothing(lvName.FocusedItem) Then Exit Sub
For Each ThisItem In lvName.SelectedItems
strSelectedAssignCode =
lvName.Items(ThisItem.Index).SubItems(0).Text
Next
'strSelectedAssignCode = lvName.FocusedItem.Text
Try
strSQL = "SELECT AssignCode, " & _
"DailyRate, " & _
"Allowance, " & _
"Incentives " & _
"FROM Employees " & _
"WHERE AssignCode = '" & strSelectedAssignCode & "'"
cnOleDb = New OleDbConnection(ACCESS_CONNECTION_STRING)
cnOleDb.Open()
cmSQL = New OleDbCommand(strSQL, cnOleDb)
drSQL = cmSQL.ExecuteReader()
drSQL.Read()
txtDailyRate.Text =
Format(Convert.ToDouble(drSQL.Item("DailyRate").ToString()), "0.00")
dblAllowance =
Format(Convert.ToDouble(drSQL.Item("Allowance").ToString()), "0.00")
txtAllowance.Text = dblAllowance
dblIncentives =
Format(Convert.ToDouble(drSQL.Item("Incentives").ToString()), "0.00")
txtIncentives.Text = dblIncentives
' Close and Clean up objects
drSQL.Close()
cnOleDb.Close()
cmSQL.Dispose()
cnOleDb.Dispose()
GetPayslip()
txtTotal.Text = Format(txtWorkDays.Text * txtDailyRate.Text,
"0.00")
Calc_Gross()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub GetPayslip()
Dim cnOleDb As OleDbConnection
Dim cmSQL As OleDbCommand
Dim drSQL As OleDbDataReader
Dim strSQL As String
'Dim strID As String
If IsNothing(lvName.FocusedItem) Then Exit Sub
'strSelectedAssignCode = lvName.FocusedItem.Text
Try
strSQL = "SELECT * " & _
"FROM Payroll " & _
"WHERE AssignCode = '" & strSelectedAssignCode & "' And FromPay
= #" & dtpFromPay.Text & "# And ToPay = #" & dtpToPay.Text & "#"
cnOleDb = New OleDbConnection(ACCESS_CONNECTION_STRING)
cnOleDb.Open()
cmSQL = New OleDbCommand(strSQL, cnOleDb)
drSQL = cmSQL.ExecuteReader()
If drSQL.HasRows Then
drSQL.Read()
txtWorkDays.Text = drSQL.Item("NoWorkDays").ToString()
txtWorkDays.Text = Format(CDbl(txtWorkDays.Text), "0.0000")
txtRegOT.Text = Format(CDbl(drSQL.Item("RegOT").ToString()),
"0.0000")
txtSunOT.Text = Format(CDbl(drSQL.Item("SunOT").ToString()),
"0.0000")
txtHolPay.Text =
Format(Convert.ToDouble(drSQL.Item("HolOT").ToString()), "0.00")
txtAdd1.Text =
Format(Convert.ToDouble(drSQL.Item("Add1").ToString()), "0.00")
txtAdd2.Text =
Format(Convert.ToDouble(drSQL.Item("Add2").ToString()), "0.00")
txtAdd3.Text =
Format(Convert.ToDouble(drSQL.Item("Add3").ToString()), "0.00")
txtAddDesc1.Text = drSQL.Item("AddDesc1").ToString()
txtAddDesc2.Text = drSQL.Item("AddDesc2").ToString()
txtAddDesc3.Text = drSQL.Item("AddDesc3").ToString()
txtSSS.Text =
Format(Convert.ToDouble(drSQL.Item("SSS_MCR").ToString()), "0.00")
txtTax.Text =
Format(Convert.ToDouble(drSQL.Item("WTax").ToString()), "0.00")
txtSSSLoan.Text =
Format(Convert.ToDouble(drSQL.Item("SSS_Loans").ToString()), "0.00")
txtLates.Text =
Format(Convert.ToDouble(drSQL.Item("Lates").ToString()), "0.00")
txtDed1.Text =
Format(Convert.ToDouble(drSQL.Item("Ded1").ToString()), "0.00")
txtDed2.Text =
Format(Convert.ToDouble(drSQL.Item("Ded2").ToString()), "0.00")
txtDed3.Text =
Format(Convert.ToDouble(drSQL.Item("Ded3").ToString()), "0.00")
txtDedDesc1.Text = drSQL.Item("DedDesc1").ToString()
txtDedDesc2.Text = drSQL.Item("DedDesc2").ToString()
txtDedDesc3.Text = drSQL.Item("DedDesc3").ToString()
' Close and Clean up objects
drSQL.Close()
cnOleDb.Close()
cmSQL.Dispose()
cnOleDb.Dispose()
End If
txtRegOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.25) *
txtRegOT.Text, "0.00")
txtSunOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.3) *
txtSunOT.Text, "0.00")
txtHolPayTotal.Text = Format(txtDailyRate.Text * txtHolPay.Text,
"0.00")
txtIncentives.Text = Format(txtIncentives.Text *
txtWorkDays.Text, "0.00")
txtAllowance.Text = Format(txtAllowance.Text * txtWorkDays.Text,
"0.00")
Calc_Gross()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
If strSelectedAssignCode = "" Then
MsgBox("Please select employee", MsgBoxStyle.OKOnly)
Exit Sub
End If
If txtWorkDays.Text > 0 Then
Dim ReturnValue As String = isRecordExist()
If ReturnValue = "Exist" Then
If MsgBox("Payslip already exist for this employee." & vbCrLf
& vbCrLf & "Do you want to overight existing record?", MsgBoxStyle.YesNo) =
MsgBoxResult.Yes Then
UpdatePaySlip()
End If
SelectIndex()
lvName_SelectedIndexChanged(sender, e)
ElseIf ReturnValue <> "Error" Then
AddPaySlip()
SelectIndex()
lvName_SelectedIndexChanged(sender, e)
End If
Else
MsgBox("Please enter No. of Working days.", MsgBoxStyle.OKOnly)
End If
End Sub
Private Function isRecordExist() As String
Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING)
Dim cmdfill As New OleDbCommand("SELECT AssignCode, FromPay, ToPay
FROM Payroll Where AssignCode = '" & strSelectedAssignCode & "' And FromPay =
#" & dtpFromPay.Text & "# And ToPay = #" & dtpToPay.Text & "#", Connection)
Try
Connection.Open()
Dim datareader As OleDbDataReader
datareader = cmdfill.ExecuteReader
If datareader.HasRows Then Return "Exist"
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
Return "Error"
Finally
Connection.Close()
Connection.Dispose()
End Try
End Function
Private Sub AddPaySlip()
Try
'Dim dbCommand As OleDbCommand
Dim DBConn As OleDbConnection
Dim DBInsert As New OleDbCommand
DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING)
DBInsert.CommandText = "INSERT INTO Payroll VALUES (" _
& "'" & dtpFromPay.Text & "', " _
& "'" & dtpToPay.Text & "', " _
& "'" & strSelectedAssignCode & "', " _
& "'" & txtWorkDays.Text & "', " _
& "'" & txtDailyRate.Text & "', " _
& "'" & txtTotal.Text & "', " _
& "'" & txtRegOT.Text & "', " _
& "'" & txtSunOT.Text & "', " _
& "'" & txtHolPay.Text & "', " _
& "'" & txtRegOTTotal.Text & "', " _
& "'" & txtSunOTTotal.Text & "', " _
& "'" & txtHolPayTotal.Text & "', " _
& "'" & txtAdd1.Text & "', " _
& "'" & txtAdd2.Text & "', " _
& "'" & txtAdd3.Text & "', " _
& "'" & txtAddDesc1.Text & "', " _
& "'" & txtAddDesc2.Text & "', " _
& "'" & txtAddDesc3.Text & "', " _
& "'" & txtIncentives.Text & "', " _
& "'" & txtAllowance.Text & "', " _
& "'" & txtGross.Text & "', " _
& "'" & txtSSS.Text & "', " _
& "'" & txtTax.Text & "', " _
& "'" & txtSSSLoan.Text & "', " _
& "'" & txtLates.Text & "', " _
& "'" & txtDed1.Text & "', " _
& "'" & txtDed2.Text & "', " _
& "'" & txtDed3.Text & "', " _
& "'" & txtDedDesc1.Text & "', " _
& "'" & txtDedDesc2.Text & "', " _
& "'" & txtDedDesc3.Text & "', " _
& "'" & txtTotalDed.Text & "', " _
& "'" & txtNetIncome.Text & "', " _
& "'" & DateTime.Now.ToString & "')"
DBInsert.Connection = DBConn
DBInsert.Connection.Open()
DBInsert.ExecuteNonQuery()
MsgBox("Payslip created successfully.", MsgBoxStyle.OKOnly)
DBConn.Close()
DBConn.Dispose()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub UpdatePaySlip()
Try
'Dim dbCommand As OleDbCommand
Dim DBConn As OleDbConnection
Dim DBUpdate As New OleDbCommand
DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING)
DBUpdate.CommandText = "UPDATE Payroll SET " & _
"FromPay = #" & dtpFromPay.Text & "#, " & _
"ToPay = #" & dtpToPay.Text & "#, " & _
"AssignCode = '" & strSelectedAssignCode & "', " & _
"NoWorkDays = '" & txtWorkDays.Text & "', " & _
"Rate = '" & txtDailyRate.Text & "', " & _
"RegWage = '" & txtTotal.Text & "', " & _
"RegOT = '" & txtRegOT.Text & "', " & _
"SunOT = '" & txtSunOT.Text & "', " & _
"HolOT = '" & txtHolPay.Text & "', " & _
"RegOTTotal = '" & txtRegOTTotal.Text & "', " & _
"SunOTTotal = '" & txtSunOTTotal.Text & "', " & _
"HolOTTotal = '" & txtHolPayTotal.Text & "', " & _
"Add1 = '" & txtAdd1.Text & "', " & _
"Add2 = '" & txtAdd2.Text & "', " & _
"Add3 = '" & txtAdd3.Text & "', " & _
"AddDesc1 = '" & txtAddDesc1.Text & "', " & _
"AddDesc2 = '" & txtAddDesc2.Text & "', " & _
"AddDesc3 = '" & txtAddDesc3.Text & "', " & _
"Incentives = '" & txtIncentives.Text & "', " & _
"Allowance = '" & txtAllowance.Text & "', " & _
"GrossPay = '" & txtGross.Text & "', " & _
"SSS_MCR = '" & txtSSS.Text & "', " & _
"WTax = '" & txtTax.Text & "', " & _
"SSS_Loans = '" & txtSSSLoan.Text & "', " & _
"Lates = '" & txtLates.Text & "', " & _
"Ded1 = '" & txtDed1.Text & "', " & _
"Ded2 = '" & txtDed2.Text & "', " & _
"Ded3 = '" & txtDed3.Text & "', " & _
"DedDesc1 = '" & txtDedDesc1.Text & "', " & _
"DedDesc2 = '" & txtDedDesc2.Text & "', " & _
"DedDesc3 = '" & txtDedDesc3.Text & "', " & _
"TotalDed = '" & txtTotalDed.Text & "', " & _
"NetPay = '" & txtNetIncome.Text & "' " & _
"WHERE AssignCode = '" & strSelectedAssignCode & "' And "
& _
"FromPay = #" & dtpFromPay.Text & "# And " & _
"ToPay = #" & dtpToPay.Text & "#"
DBUpdate.Connection = DBConn
DBUpdate.Connection.Open()
DBUpdate.ExecuteNonQuery()
MsgBox("Payslip created successfully.", MsgBoxStyle.OKOnly)
DBConn.Close()
DBConn.Dispose()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub Calc_Gross()
Try
txtGross.Text = Convert.ToDouble(IIf(txtTotal.Text = "", "0.00",
txtTotal.Text)) _
+ Convert.ToDouble(IIf(txtRegOTTotal.Text = "",
"0.00", txtRegOTTotal.Text)) _
+ Convert.ToDouble(IIf(txtSunOTTotal.Text = "",
"0.00", txtSunOTTotal.Text)) _
+ Convert.ToDouble(IIf(txtHolPayTotal.Text = "",
"0.00", txtHolPayTotal.Text)) _
+ Convert.ToDouble(IIf(txtAllowance.Text = "",
"0.00", txtAllowance.Text)) _
+ Convert.ToDouble(IIf(txtIncentives.Text = "",
"0.00", txtIncentives.Text)) _
+ Convert.ToDouble(IIf(txtAdd1.Text = "", "0.00",
txtAdd1.Text)) _
+ Convert.ToDouble(IIf(txtAdd2.Text = "", "0.00",
txtAdd2.Text)) _
+ Convert.ToDouble(IIf(txtAdd3.Text = "", "0.00",
txtAdd3.Text))
txtGross.Text = Format(CDbl(txtGross.Text), "0.00")
Calc_Deductions()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub Calc_Deductions()
Try
txtTotalDed.Text = Convert.ToDouble(IIf(txtSSS.Text = "", "0.00",
txtSSS.Text)) _
+ Convert.ToDouble(IIf(txtTax.Text = "", "0.00",
txtTax.Text)) _
+ Convert.ToDouble(IIf(txtSSSLoan.Text = "",
"0.00", txtSSSLoan.Text)) _
+ Convert.ToDouble(IIf(txtLates.Text = "",
"0.00", txtLates.Text)) _
+ Convert.ToDouble(IIf(txtDed1.Text = "", "0.00",
txtDed1.Text)) _
+ Convert.ToDouble(IIf(txtDed2.Text = "", "0.00",
txtDed2.Text)) _
+ Convert.ToDouble(IIf(txtDed3.Text = "", "0.00",
txtDed3.Text))
txtTotalDed.Text = Format(CDbl(txtTotalDed.Text), "0.00")
txtNetIncome.Text = Convert.ToDouble(IIf(txtGross.Text = "",
"0.00", txtGross.Text) - IIf(txtTotalDed.Text = "", "0.00",
txtTotalDed.Text))
txtNetIncome.Text = Format(CDbl(txtNetIncome.Text), "0.00")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub txtWorkDays_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtWorkDays.LostFocus
If IsNumeric(txtWorkDays.Text) = False Then
MsgBox("Please enter correct information", MsgBoxStyle.OKOnly)
txtWorkDays.Focus()
txtWorkDays.SelectAll()
Exit Sub
End If
txtWorkDays.Text = Format(CDbl(txtWorkDays.Text), "0.0000")
txtAllowance.Text = Format(dblAllowance * txtWorkDays.Text, "0.00")
txtIncentives.Text = Format(dblIncentives * txtWorkDays.Text, "0.00")
txtTotal.Text = Format(txtWorkDays.Text * txtDailyRate.Text, "0.00")
Calc_Gross()
End Sub
Private Sub txtRegOT_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtRegOT.LostFocus
If IsNumeric(txtRegOT.Text) = False Then
MsgBox("Please enter correct information", MsgBoxStyle.OKOnly)
txtRegOT.Focus()
txtRegOT.SelectAll()
Exit Sub
End If
txtRegOT.Text = Format(CDbl(txtRegOT.Text), "0.0000")
txtRegOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.25) *
txtRegOT.Text, "0.00")
Calc_Gross()
End Sub
Private Sub txtSunOT_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtSunOT.LostFocus
If IsNumeric(txtSunOT.Text) = False Then
MsgBox("Please enter correct information", MsgBoxStyle.OKOnly)
txtSunOT.Focus()
txtSunOT.SelectAll()
Exit Sub
End If
txtSunOT.Text = Format(CDbl(txtSunOT.Text), "0.0000")
txtSunOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.3) *
txtSunOT.Text, "0.00")
Calc_Gross()
End Sub
Private Sub txtHolPay_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtHolPay.LostFocus
If IsNumeric(txtHolPay.Text) = False Then
MsgBox("Please enter correct information", MsgBoxStyle.OKOnly)
txtHolPay.Focus()
txtHolPay.SelectAll()
Exit Sub
End If
If IsValidTextbox(txtHolPay) = False Then Exit Sub
txtHolPayTotal.Text = Format(txtDailyRate.Text * txtHolPay.Text,
"0.00")
Calc_Gross()
End Sub
rivate Sub txtAllowance_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtAllowance.LostFocus
If IsValidTextbox(txtAllowance) = False Then Exit Sub
Calc_Gross()
End Sub
Private Sub txtIncentives_LostFocus(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles txtIncentives.LostFocus
If IsValidTextbox(txtIncentives) = False Then Exit Sub
Calc_Gross()
End Sub
Private Sub txtAdd1_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtAdd1.LostFocus
If IsValidTextbox(txtAdd1) = False Then Exit Sub
Calc_Gross()
End Sub
Private Sub txtAdd2_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtAdd2.LostFocus
If IsValidTextbox(txtAdd2) = False Then Exit Sub
Calc_Gross()
End Sub
Private Sub txtAdd3_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtAdd3.LostFocus
If IsValidTextbox(txtAdd3) = False Then Exit Sub
Calc_Gross()
End Sub
Private Sub txtSSS_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtSSS.LostFocus
If IsValidTextbox(txtSSS) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub txtTax_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtTax.LostFocus
If IsValidTextbox(txtTax) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub txtSSSLoan_LostFocus(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles txtSSSLoan.LostFocus
If IsValidTextbox(txtSSSLoan) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub txtLates_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtLates.LostFocus
If IsValidTextbox(txtLates) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub txtDed1_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtDed1.LostFocus
If IsValidTextbox(txtDed1) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub txtDed2_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtDed2.LostFocus
If IsValidTextbox(txtDed2) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub txtDed3_LostFocus(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtDed3.LostFocus
If IsValidTextbox(txtDed3) = False Then Exit Sub
Calc_Deductions()
End Sub
Private Sub SelectIndex()
Dim ThisItem As ListViewItem
Dim intNumRows As Integer
Try
For Each ThisItem In lvName.SelectedItems
intNumRows = lvName.Items.Count
If ThisItem.Index + 1 <> intNumRows Then
lvName.Items(ThisItem.Index + 1).Selected = True
strSelectedAssignCode = lvName.Items(ThisItem.Index +
1).SubItems(0).Text
End If
Next
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
End Try
End Sub
Private Sub dtpFromPay_ValueChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles dtpFromPay.ValueChanged
lvName_SelectedIndexChanged(sender, e)
End Sub
Private Sub dtpToPay_ValueChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles dtpToPay.ValueChanged
lvName_SelectedIndexChanged(sender, e)
End Sub
Private Sub Label22_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label22.Click
End Sub
Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox2.Enter
End Sub
Private Sub GroupBox4_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox4.Enter
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label8.Click
End Sub
Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label7.Click
End Sub
Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint
End Sub
Private Sub Label21_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label21.Click
End Sub
Private Sub txtDailyRate_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles txtDailyRate.TextChanged
End Sub
End Class
Public Class ReportDialog
Inherits System.Windows.Forms.Form
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPreview.Click
Dim frmReport As Reports
If optVoucher.Checked = True Then
frmReport = New Reports(Me, "Voucher.rpt")
frmReport.Show()
ElseIf optPayrollSum.Checked = True Then
frmReport = New Reports(Me, "PayrollSum.rpt")
frmReport.Show()
Else
Dim frmListofEmpReport As ListofEmpReport
frmListofEmpReport = New ListofEmpReport(Me, "EmployeesList.rpt")
frmListofEmpReport.Show()
End If
End Sub
Private Sub optVoucher_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles optVoucher.CheckedChanged
If optVoucher.Checked = True Then
GroupBox1.Enabled = True
End If
End Sub
Private Sub optPayrollSum_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles optPayrollSum.CheckedChanged
If optPayrollSum.Checked = True Then
GroupBox1.Enabled = True
End If
End Sub
Private Sub optListofEmp_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles optListofEmp.CheckedChanged
If optListofEmp.Checked = True Then
GroupBox1.Enabled = False
End If
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint
End Sub
Private Sub ReportDialog_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
Imports System.Data.OleDb
Public Class Password
Inherits System.Windows.Forms.Form
Dim ACCESS_CONNECTION_STRING As String = cnSettings()
Dim strSelectedAssignCode As String
Dim strOldPassword As String
Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean
Select Case msg.WParam.ToInt32()
Case 13 ' enter Key
If TypeOf Me.ActiveControl Is TextBox Then
SendKeys.Send("{Tab}")
Return True
End If
End Select
Return MyBase.ProcessCmdKey(msg, keyData)
End Function 'ProcessCmdKey
Private Sub Password_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
PopulateUser()
End Sub
Private Sub PopulateUser()
Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING)
lvUserName.Items.Clear()
lvUserName.Sorting = SortOrder.Ascending
Dim cmdfill As New OleDbCommand("SELECT UserName, [Password] FROM
[Password]", Connection)
Try
Connection.Open()
Dim datareader As OleDbDataReader
datareader = cmdfill.ExecuteReader
While datareader.Read
Dim lvi As New ListViewItem
lvi.Text = CStr(datareader("UserName"))
lvUserName.Items.Add(lvi)
End While
If datareader.HasRows Then
lvUserName.TopItem.Selected = True
lvUserName.TopItem.Focused = True
lvUserName.TopItem.EnsureVisible()
lvUserName.Select()
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
Finally
Connection.Close()
End Try
End Sub
Private Sub RetrieveUser()
Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING)
Dim cmdfill As New OleDbCommand("SELECT UserName, [Password] FROM
[Password] Where UserName = '" & strSelectedAssignCode & "'", Connection)
Try
Connection.Open()
Dim datareader As OleDbDataReader
datareader = cmdfill.ExecuteReader
datareader.Read()
txtUserName2.Text = CStr(datareader("UserName"))
strOldPassword = CStr(datareader("Password"))
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
Finally
Connection.Close()
End Try
End Sub
Private Sub AddUser()
Try
'Dim dbCommand As OleDbCommand
Dim DBConn As OleDbConnection
Dim DBInsert As New OleDbCommand
DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING)
DBInsert.CommandText = "INSERT INTO [Password] VALUES (" _
& "'" & txtUserName1.Text & "', " _
& "'" & txtPassword1.Text & "')"
Dim lvi As New ListViewItem
lvi.Text = txtUserName1.Text
lvUserName.Items.Add(lvi)
clearTxtBox()
DBInsert.Connection = DBConn
DBInsert.Connection.Open()
DBInsert.ExecuteNonQuery()
DBConn.Close()
DBConn.Dispose()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub UpdateUser()
Try
'Dim dbCommand As OleDbCommand
Dim DBConn As OleDbConnection
Dim DBUpdate As New OleDbCommand
DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING)
DBUpdate.CommandText = "UPDATE [Password] SET " & _
"[Password] = '" & txtPassword2.Text & "' " & _
"WHERE UserName = '" & txtUserName2.Text & "'"
clearTxtBox()
DBUpdate.Connection = DBConn
DBUpdate.Connection.Open()
DBUpdate.ExecuteNonQuery()
DBConn.Close()
DBConn.Dispose()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
End Sub
Private Sub DeleteUser()
Try
Dim DBConn As OleDbConnection
Dim dbCommand As New OleDbCommand
'Dim strPath As String
DBConn = New OleDbConnection(cnSettings())
dbCommand.CommandText = "DELETE FROM [Password] " _
& "WHERE UserName = '" &
strSelectedAssignCode & "'"
dbCommand.Connection = DBConn
dbCommand.Connection.Open()
dbCommand.ExecuteNonQuery()
lvUserName.Items.Remove(lvUserName.FocusedItem)
DBConn.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
End Try
End Sub
Private Sub clearTxtBox()
txtUserName1.Text = ""
txtUserName2.Text = ""
txtPassword1.Text = ""
txtPassword2.Text = ""
txtConfirmPassword1.Text = ""
txtConfirmPassword2.Text = ""
txtOldPassword.Text = ""
End Sub
Private Sub lvUserName_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles lvUserName.MouseDown
Try
If IsNothing(lvUserName.FocusedItem) Then Exit Sub
strSelectedAssignCode = lvUserName.FocusedItem.Text
If e.Button = MouseButtons.Right Then
If lvUserName.SelectedItems.Count > 0 Then
ContextMenu1.Show(lvUserName, New Point(e.X, e.Y))
End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
End Try
End Sub
Private Sub lvUserName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvUserName.SelectedIndexChanged
Try
'If IsNothing(lvUserName.FocusedItem) Then Exit Sub
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly)
End Try
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
grpEdit.Hide()
grpAdd.Show()
End Sub
Private Sub mnuAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuAdd.Click
grpAdd.Visible = True
grpEdit.Visible = False
btnUpdate.Text = "&Save"
End Sub
Private Sub mnuEdit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuEdit.Click
grpEdit.Visible = True
grpAdd.Visible = False
btnUpdate.Text = "&Update"
RetrieveUser()
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
If btnUpdate.Text = "&Save" Then
If txtPassword1.Text <> txtConfirmPassword1.Text Then
MsgBox("Password does not match.", MsgBoxStyle.OKOnly)
Exit Sub
End If
AddUser()
Else
If txtOldPassword.Text <> strOldPassword Then
MsgBox("Please enter the correct password in the Old Password
field.", MsgBoxStyle.OKOnly)
Exit Sub
End If
If txtPassword2.Text <> txtConfirmPassword2.Text Then
MsgBox("Password does not match.", MsgBoxStyle.OKOnly)
Exit Sub
End If
UpdateUser()
End If
End Sub
Private Sub mnuDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuDelete.Click
If strSelectedAssignCode = "Admin" Then
MsgBox("Sorry you can't delete this account.",
MsgBoxStyle.OKOnly)
Exit Sub
End If
If MsgBox("Are you sure you want to delete this user?",
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then _
DeleteUser()
End Sub
Private Sub Label23_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label23.Click
End Sub
End Class
Thesis about Computerized Payroll System for Barangay Hall, Dita

More Related Content

What's hot

School management system
School management systemSchool management system
School management systemSoumya Behera
 
Payroll Management System Complete Report
Payroll Management System Complete ReportPayroll Management System Complete Report
Payroll Management System Complete ReportSavio Aberneithie
 
Payroll Management System
Payroll Management SystemPayroll Management System
Payroll Management SystemDheeraj Jha
 
Food ordering System
Food ordering SystemFood ordering System
Food ordering SystemArman Ahmed
 
Payroll management system_synopsis
Payroll management system_synopsisPayroll management system_synopsis
Payroll management system_synopsisSameer Bhatt
 
Employee management system report
Employee management system reportEmployee management system report
Employee management system reportPrince Singh
 
Payroll and attendance system
Payroll and attendance system Payroll and attendance system
Payroll and attendance system Moses Nkrumah
 
Online Faculty evaluation system project presentation
Online Faculty evaluation system project presentationOnline Faculty evaluation system project presentation
Online Faculty evaluation system project presentationShaikhul Saad
 
Online clinic reservation
Online clinic reservationOnline clinic reservation
Online clinic reservationMay Ann Mas
 
HCI Group Project Report
HCI Group Project ReportHCI Group Project Report
HCI Group Project Reportweilong1113
 
Employee management system
Employee management systemEmployee management system
Employee management systemAnjaliSharma585
 
Types Of Information System
Types Of Information SystemTypes Of Information System
Types Of Information Systemguestead93f3
 
Employee self-service
Employee self-serviceEmployee self-service
Employee self-serviceproditech12
 
Hotel management-system-hms
Hotel management-system-hmsHotel management-system-hms
Hotel management-system-hmsMiran Hussen
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management SystemAnjali Agrawal
 
STUDENT RECORD MANAGEMENT SYSTEM (1)
STUDENT RECORD MANAGEMENT SYSTEM (1)STUDENT RECORD MANAGEMENT SYSTEM (1)
STUDENT RECORD MANAGEMENT SYSTEM (1)Juliet Nandutu
 

What's hot (20)

School management system
School management systemSchool management system
School management system
 
Attendance monitoring system
Attendance monitoring systemAttendance monitoring system
Attendance monitoring system
 
Payroll Management System Complete Report
Payroll Management System Complete ReportPayroll Management System Complete Report
Payroll Management System Complete Report
 
Payroll Management System
Payroll Management SystemPayroll Management System
Payroll Management System
 
Food ordering System
Food ordering SystemFood ordering System
Food ordering System
 
Payroll management system_synopsis
Payroll management system_synopsisPayroll management system_synopsis
Payroll management system_synopsis
 
Employee management system report
Employee management system reportEmployee management system report
Employee management system report
 
Payroll and attendance system
Payroll and attendance system Payroll and attendance system
Payroll and attendance system
 
Online Faculty evaluation system project presentation
Online Faculty evaluation system project presentationOnline Faculty evaluation system project presentation
Online Faculty evaluation system project presentation
 
Online clinic reservation
Online clinic reservationOnline clinic reservation
Online clinic reservation
 
HCI Group Project Report
HCI Group Project ReportHCI Group Project Report
HCI Group Project Report
 
Employee management system
Employee management systemEmployee management system
Employee management system
 
Food Order Management System
Food Order Management SystemFood Order Management System
Food Order Management System
 
Types Of Information System
Types Of Information SystemTypes Of Information System
Types Of Information System
 
Employee self-service
Employee self-serviceEmployee self-service
Employee self-service
 
Attendance Management System
Attendance Management SystemAttendance Management System
Attendance Management System
 
Information management
Information managementInformation management
Information management
 
Hotel management-system-hms
Hotel management-system-hmsHotel management-system-hms
Hotel management-system-hms
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
STUDENT RECORD MANAGEMENT SYSTEM (1)
STUDENT RECORD MANAGEMENT SYSTEM (1)STUDENT RECORD MANAGEMENT SYSTEM (1)
STUDENT RECORD MANAGEMENT SYSTEM (1)
 

Similar to Thesis about Computerized Payroll System for Barangay Hall, Dita

Thesis in Computerized Payroll System for Brangay Hall, Dita
Thesis in Computerized Payroll System for Brangay Hall, DitaThesis in Computerized Payroll System for Brangay Hall, Dita
Thesis in Computerized Payroll System for Brangay Hall, DitaAcel Carl David O, Dolindo
 
Introduction on Workday Payroll Management System and Software Solutions
Introduction on Workday Payroll Management System and Software SolutionsIntroduction on Workday Payroll Management System and Software Solutions
Introduction on Workday Payroll Management System and Software SolutionsERP Cloud Training
 
6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...
6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...
6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...Anjali127411
 
GTM's Evolution Demo
GTM's Evolution DemoGTM's Evolution Demo
GTM's Evolution DemoGTMmarketing
 
Java developer interview questions
Java developer interview questionsJava developer interview questions
Java developer interview questionsSkillPracticalEdTech
 
Process Payroll Anytime, Anywhere
Process Payroll Anytime, Anywhere Process Payroll Anytime, Anywhere
Process Payroll Anytime, Anywhere Business.com
 
HOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptx
HOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptxHOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptx
HOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptxTASCCorporateService
 
5 Reasons - Payroll System Important for All Companies
5 Reasons - Payroll System Important for All Companies5 Reasons - Payroll System Important for All Companies
5 Reasons - Payroll System Important for All CompaniesNYGGS Automation Suite
 
Role and advantage of computerized account system
Role and advantage of computerized account systemRole and advantage of computerized account system
Role and advantage of computerized account systemHassan Ahmed
 
CSIS 375Final Project InstructionsInstructionsGeneral Backg.docx
CSIS 375Final Project InstructionsInstructionsGeneral Backg.docxCSIS 375Final Project InstructionsInstructionsGeneral Backg.docx
CSIS 375Final Project InstructionsInstructionsGeneral Backg.docxannettsparrow
 
PPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptx
PPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptxPPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptx
PPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptxSuraj857568
 
Time and Attendance Software- A Business.com Guide
Time and Attendance Software- A Business.com GuideTime and Attendance Software- A Business.com Guide
Time and Attendance Software- A Business.com GuideBusiness.com
 
Payroll Management Process, Payroll Methods and Solutions
Payroll Management Process, Payroll Methods and SolutionsPayroll Management Process, Payroll Methods and Solutions
Payroll Management Process, Payroll Methods and SolutionsDaria Kizilova
 
What are the key features and functionalities offered by payroll software i...
What are the key features and functionalities offered by  payroll software  i...What are the key features and functionalities offered by  payroll software  i...
What are the key features and functionalities offered by payroll software i...HR365 India
 
Computerized applications in accounting
Computerized applications in accountingComputerized applications in accounting
Computerized applications in accountingPVAbhi
 

Similar to Thesis about Computerized Payroll System for Barangay Hall, Dita (20)

Thesis in Computerized Payroll System for Brangay Hall, Dita
Thesis in Computerized Payroll System for Brangay Hall, DitaThesis in Computerized Payroll System for Brangay Hall, Dita
Thesis in Computerized Payroll System for Brangay Hall, Dita
 
Introduction on Workday Payroll Management System and Software Solutions
Introduction on Workday Payroll Management System and Software SolutionsIntroduction on Workday Payroll Management System and Software Solutions
Introduction on Workday Payroll Management System and Software Solutions
 
Advantage of computerized payroll system
Advantage of computerized payroll systemAdvantage of computerized payroll system
Advantage of computerized payroll system
 
6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...
6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...
6qh6iyoesuitvyv0exyn-signature-c0a664d80fc39ee9e26afe9aaa4fdd53cac2536d6a0ca7...
 
GTM's Evolution Demo
GTM's Evolution DemoGTM's Evolution Demo
GTM's Evolution Demo
 
Java developer interview questions
Java developer interview questionsJava developer interview questions
Java developer interview questions
 
Process Payroll Anytime, Anywhere
Process Payroll Anytime, Anywhere Process Payroll Anytime, Anywhere
Process Payroll Anytime, Anywhere
 
HOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptx
HOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptxHOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptx
HOW IS THE PAYROLL MANAGEMENT SYSTEM BENEFICIAL.pptx
 
5 Reasons - Payroll System Important for All Companies
5 Reasons - Payroll System Important for All Companies5 Reasons - Payroll System Important for All Companies
5 Reasons - Payroll System Important for All Companies
 
Role and advantage of computerized account system
Role and advantage of computerized account systemRole and advantage of computerized account system
Role and advantage of computerized account system
 
CSIS 375Final Project InstructionsInstructionsGeneral Backg.docx
CSIS 375Final Project InstructionsInstructionsGeneral Backg.docxCSIS 375Final Project InstructionsInstructionsGeneral Backg.docx
CSIS 375Final Project InstructionsInstructionsGeneral Backg.docx
 
PPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptx
PPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptxPPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptx
PPPPPPPAYROLL_MANAGEMENT_SYSTEM_BOO.pptx
 
Erp pptx
Erp pptxErp pptx
Erp pptx
 
Time and Attendance Software- A Business.com Guide
Time and Attendance Software- A Business.com GuideTime and Attendance Software- A Business.com Guide
Time and Attendance Software- A Business.com Guide
 
Hamida ali al shabani
Hamida ali al shabaniHamida ali al shabani
Hamida ali al shabani
 
Payroll
PayrollPayroll
Payroll
 
Payroll Management Process, Payroll Methods and Solutions
Payroll Management Process, Payroll Methods and SolutionsPayroll Management Process, Payroll Methods and Solutions
Payroll Management Process, Payroll Methods and Solutions
 
Features of payroll system
Features of  payroll systemFeatures of  payroll system
Features of payroll system
 
What are the key features and functionalities offered by payroll software i...
What are the key features and functionalities offered by  payroll software  i...What are the key features and functionalities offered by  payroll software  i...
What are the key features and functionalities offered by payroll software i...
 
Computerized applications in accounting
Computerized applications in accountingComputerized applications in accounting
Computerized applications in accounting
 

Recently uploaded

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 

Recently uploaded (20)

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 

Thesis about Computerized Payroll System for Barangay Hall, Dita

  • 1. A Computerized Payroll System for the Barangay Dita 1.1 Background of the study HISTORY OF PAYROLL SYSTEM A computerized payroll system, the employer invests in a computerized payroll software. Using a software such as quickbooks allows the employer to enter the wages into the system after he has manually calculated them. The payroll and check printing are processed through the system. The employer has access to payroll reports that he/she can print and use to double-check against what she has entered before printing the checks. This allows his/her to correct any detectable errors beforehand. Computerized payroll system allow you to process all your normal payroll task via a computerized system, rather than by hand. Essentials like name, address, Social Security number and withholding rate for each employee are automatically filled in for every pay period until you make an employee’s record inactive. Many different vendors offer computerized payroll system. Like different word processors or other computer programs, they largely offer the same types of features with slightly different interfaces. Payroll is essentially how employees are paid. It’s the legal paperwork involved. There's more to payroll than just handing out cash or checks. However, after gathering data on what the employees did and compared it to their salaries, some simple payday mathematics will let the employer hand out the dough. 1.2 Objectives 1.2.1 General Objective The main objective of the study is to design and develop a Computerizes Payroll System for Barangay Hall, Dita that fast transactions, minimize the manual checking of employees, monitor the status of employee’s charges, deductions and generate the essential reports. A computerized payroll system must be able to keep and generate accurate reports on employee income. An equally important objective of any payroll system is to generate paychecks and pay stubs. Computerizing this task saves managers and business owners time and money; rather than reviewing time cards manually and calculating a check amount based on the hours worked, the payroll system should be designed to automatically calculate these figures. A computerized payroll system must automatically factor in the overtime pay. This helps employers stay within the law when it comes time to pay overtime. Additionally, since an employer can use the system to check the number of hours an employee works, the employer can shift schedules to avoid paying additional overtime. 1.2.2 Specific Objectives To minimize the manual checking of each daily time record.
  • 2. To develop a module that will generate essentials reports. To develop that will monitor the status of employee’s loan and other deductions such as cash advance and charges. 1.3 Significance of the study This part of the study discusses about the importance of creating computerized Payroll System. It provides sample discussed how to run a Computerized Payroll System and here are some examples of how it run. Many employers use a timekeeping system, such as clock time, to track work hours employees '. Can separate this system regular hours from overtime hours worked. Payroll all people will do is make edits / adjustments, if necessary. If time employees are imported into the computerized Payroll system, the latter rounds up and down time employees appropriately, as the nearest quarter hour. It calculates the total hours worked and paid. It is saving the time spent manually calculating time and reduces errors. If the person enters Payroll time system itself, automatically calculates its income, based on its input. The system calculates all pay frequencies, such as weekly, biweely, and twice a month. Only people attended Payroll data which the reduction is based, such as form for withholding information federal income tax. Necessary you a manual payroll system to print paychecks on a typewriter or by hand. A computerized Payroll system has direct deposit capability, which saves money spent on live checks and reconciliation. Moreover, paycheck and pay stub generation occurs rapidly, regardless of the quantity. developing a computerized system and Prints Payroll reports . If you want to double - check before printing Payroll stubs paychecks / pay, just refer to the corresponding report. A computerized payroll system allows hard - copy printing of Payroll registers pertaining to each pay period. Also saves its information systems without boundaries .The system generates reports to ensure compliance with tax Payroll tax. This includes quarterly and annual wage reporting and development of employee forms. If a related departments such as accounting office holding Payroll taxes and reconciliation of the company, print the required reports would require the department through the computerized system. Furthermore, these days, such as vacation and personal time, taken and paid to benefit the track system . 1.4 Scope The study will covers the process of preparing the pay slip of each employee, monitors loans, cash advances, charges, keeping the records and easily computers the basic pay, regular overtime pay, pay during day off, special and legal holiday pay, gross pay, SSS contributions, PhilHealth contributions, Pag-Ibig contributions, cash advances, charges, deductions, lates, and net pay. 1.5 Delimitation The study does not cover any other not employee of the Barangay Hall, Dita .This is not a group pay slip. This system is not cover by any deduction that may not belong to the pay slip. And also the other income that not belong in Barangay Hall, Dita .
  • 3. 1.6 Definition of Terms 1.6.1 Operational Terms Computerized Payroll System- A computerized payroll system has many prominent advantages over paper systems. They prevent clerical error in calculating hours and a gross payment. They also automatically deduct taxes based on the gross payment. Work Hours- is the period of time that an individual spends at paid occupational labor. Unpaid labors such as personal housework or caring for children/pets are not considered part of the working week. Overtime hours- is the amount of time someone works beyond normal working hours. Normal hours may be determined in several ways. Regular Hours- is usually when a store opens and closes. Total Hours- compute the number of hours you work every week counting overtime and then average these hours over a set period. Income Tax- is a government levy (tax) imposed on individuals or entities (taxpayers) that varies with the income or profits (taxable income) of the taxpayer. Details vary widely by jurisdiction. Many jurisdictions refer to income tax on business entities as companies tax or corporation tax. Deposit- account is a savings account, current account, or other type of bank account, at a banking institution that allows money to be deposited and withdrawn by the account holder. Paychecks- is traditionally a paper document (a cheque) issued by an employer to pay an employee for services rendered. In recent times, the physical paycheck has been increasingly replaced by electronic to bank accounts. Such employees may still receive a pay slip, but any attached cheque is marked as non-negotiable and cannot be cashed. Payslip- a slip of paper included with your pay that records how much money you have earned and how much tax or insurance etc. has been taken out. 1.6.2 Technical Terms Data- is a set of value of qualitative or quantitative variables; restated, data are individual pieces of information. Data in computing or data processing are represented in a structure. Data consists of a series of facts or statements that may have been collected, stored, processed and/or manipulated but have not been organized or placed into context. When data is organized, it becomes information. Information can be processed and used to draw generalized conclusions or knowledge.
  • 4. 1.7 Methodology Used in Developing the Software Product Data Gathering : Conducting of 5 interview, involving of 30 personnel of the Barangay Hall, Dita to understand the roles, the procedures, issues, opportunities, and challenges of payroll process. VB orVisual Basic is a Programming tool that user to develop Windows or GUI(Graphical User Interface) applications. It means that rather than writing numerous line for code to describe the appearance and location for interface elements like C, C++, or Basic. User can simply drag and drop pre-built objects into the form window on computer screen. VB is a enhanced version of BASIC programming language(NASIC is Predecessor of VB)/ The main difference is that the VB can create windows programs by just Drag & Drop where as BASIC could only create DOS programs or work only in CUI (Command User Interface) 1.8 User’s Manual Public Class dbSelect Inherits System.Windows.Forms.Form Public Shared StartUp As dbSelect Private Sub btnNSM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNSM.Click Dim Login As New Login
  • 5. CompDB = "NSM" Login.Show() Me.Hide() End Sub Private Sub btnPPE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPPE.Click Dim Login As New Login CompDB = "PPE" Login.Show() Me.Hide() End Sub Private Sub btnSW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSW.Click Dim Login As New Login CompDB = "S&W" Login.Show() Me.Hide() End Sub Private Sub btnSDOM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSDOM.Click Dim Login As New Login CompDB = "SDOM" Login.Show() Me.Hide() End Sub Private Sub btnSSN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSSN.Click Dim Login As New Login CompDB = "SSn" Login.Show() Me.Hide() End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Application.Exit() End Sub Private Sub dbSelect_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load dbSelect.StartUp = Me End Sub Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint End Sub Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint End Sub End Class
  • 6. Public Class Menu Inherits System.Windows.Forms.Form Private Sub Menu_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Select Case CompDB Case "NSM" Label2.Text = "Admin" Case "PPE" Label2.Text = "Lupon" Case "S&W" Label2.Text = "Barangay Health Worker" Case "SDOM" Label2.Text = "Barangay Tanod" Case "SSN" Label2.Text = "Security Aide" End Select End Sub Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click Me.Close() End Sub Private Sub btnCompProfile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompProfile.Click Dim Company As New Company Company.Show() End Sub Private Sub btnEmployees_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmployees.Click Dim Employees As New Employees Employees.Show() End Sub Private Sub btnPayroll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPayroll.Click Dim Payroll As New Payroll Payroll.Show() End Sub Private Sub btnReports_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReports.Click Dim ReportDialog As New ReportDialog
  • 7. ReportDialog.Show() End Sub Private Sub btnSecurity_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSecurity.Click Dim Password As New Password Password.Show() End Sub Private Sub btnAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbout.Click Dim About As New About About.ShowDialog() End Sub Private Sub Menu_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed dbSelect.StartUp.Show() End Sub Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint End Sub Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click End Sub End Class
  • 8. Public Class Company Inherits System.Windows.Forms.Form Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean Select Case msg.WParam.ToInt32() Case 13 ' enter Key If TypeOf Me.ActiveControl Is TextBox Then SendKeys.Send("{Tab}") Return True End If End Select Return MyBase.ProcessCmdKey(msg, keyData) End Function 'ProcessCmdKey Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub Company_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load cnPayroll.ConnectionString = cnSettings() daCompany.Fill(DsPayroll) Me.BindingContext(DsPayroll, "Company").Position = 0 End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Me.BindingContext(DsPayroll, "Company").EndCurrentEdit() daCompany.Update(DsPayroll) End Sub End Class
  • 9. Public Class Employees Inherits System.Windows.Forms.Form
  • 10. Dim oldcbDivision As String Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean Select Case msg.WParam.ToInt32() Case 13 ' enter Key If TypeOf Me.ActiveControl Is TextBox Or TypeOf Me.ActiveControl Is ComboBox Then SendKeys.Send("{Tab}") Return True End If End Select Return MyBase.ProcessCmdKey(msg, keyData) End Function 'ProcessCmdKey Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub Employees_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load cnPayroll.ConnectionString = cnSettings() daEmployees.Fill(DsPayroll) daDivision.Fill(DsPayroll) With cbStatus .Items.Add("ACTIVE") .Items.Add("RESIGNED") .Items.Add("RETIRED") End With With cbDivision .DataSource = DsPayroll .DisplayMember = "Division.Division" .ValueMember = "Division.DivisionID" .DataBindings.Add("Tag", DsPayroll.Tables("Employees"), "Division") .DataBindings.Add(New Binding("SelectedValue", _ DsPayroll, "Employees.Division")) End With With cbPayMethod .Items.Add("MONTHLY") .Items.Add("DAILY") End With BindEmpList() Me.BindingContext(DsPayroll, "Employees").Position = 0 AddHandler Me.BindingContext(DsPayroll, "Employees").PositionChanged, _ AddressOf Employee_PositionChanged DisplayNav(sender, e) End Sub Sub BindEmpList() With grdEmpList .CaptionText = "Employees" .DataMember = "Employees" .DataSource = DsPayroll End With ' You must clear out the TableStyles collection before grdEmpList.TableStyles.Clear()
  • 11. Dim grdTableStyle1 As New DataGridTableStyle With grdTableStyle1 .MappingName = "Employees" End With Dim grdColStyle1 As New DataGridTextBoxColumn With grdColStyle1 .MappingName = "AssignCode" .HeaderText = "Assign Code" .Width = 140 End With Dim grdColStyle2 As New DataGridTextBoxColumn With grdColStyle2 .MappingName = "LastName" .HeaderText = "Last Name" .Width = 140 End With Dim grdColStyle3 As New DataGridTextBoxColumn With grdColStyle3 .MappingName = "FirstName" .HeaderText = "First Name" .Width = 140 End With Dim grdColStyle4 As New DataGridTextBoxColumn With grdColStyle4 .MappingName = "MiddleName" .HeaderText = "M.I." .Width = 75 End With Dim grdColStyle5 As New DataGridTextBoxColumn With grdColStyle5 .MappingName = "Section" .HeaderText = "Section" .Width = 75 End With Dim grdColStyle6 As New DataGridTextBoxColumn With grdColStyle6 .MappingName = "DateHired" .HeaderText = "Date Hired" .Width = 75 End With Dim grdColStyle7 As New DataGridTextBoxColumn With grdColStyle7 .MappingName = "Phone" .HeaderText = "Phone" .Width = 75 End With Dim grdColStyle8 As New DataGridTextBoxColumn With grdColStyle8 .MappingName = "Status" .HeaderText = "Status" .Width = 75 End With grdTableStyle1.GridColumnStyles.AddRange _ (New DataGridColumnStyle() {grdColStyle1, grdColStyle2, _ grdColStyle3, grdColStyle4, grdColStyle5, _
  • 12. grdColStyle6, grdColStyle7, grdColStyle8}) grdEmpList.TableStyles.Add(grdTableStyle1) End Sub Private Sub DisplayNav(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click, btnPrev.Click, btnNext.Click, btnLast.Click, btnDelete.Click 'Update record position when Update & Delete events lblNavLocation.Text = Me.BindingContext(DsPayroll, "Employees").Position + 1 & " of " & Me.BindingContext(DsPayroll, "Employees").Count End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click Save_Record() Me.BindingContext(DsPayroll, "Employees").Position += 1 End Sub Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click Save_Record() Me.BindingContext(DsPayroll, "Employees").Position -= 1 End Sub Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click Save_Record() Me.BindingContext(DsPayroll, "Employees").Position = Me.BindingContext(DsPayroll, "Employees").Count - 1 End Sub Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click Save_Record() Me.BindingContext(DsPayroll, "Employees").Position = 0 End Sub Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click If btnAdd.Text = "&Add" Then Me.BindingContext(DsPayroll, "Employees").AddNew() Else Me.BindingContext(DsPayroll, "Employees").CancelCurrentEdit() Change_Button(True) btnAdd.Text = "&Add" DisplayNav(sender, e) End If End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Try If btnAdd.Text = "&Revert" Then If txtCode.Text = "" Then MessageBox.Show("Please don't leave assign code field blank.", "Error", MessageBoxButtons.OK) Exit Sub End If End If Save_Record() Change_Button(True) btnAdd.Text = "&Add"
  • 13. DisplayNav(sender, e) Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click Try If MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub Me.BindingContext(DsPayroll, "Employees").RemoveAt(Me.BindingContext(DsPayroll, "Employees").Position) Save_Record() DisplayNav(sender, e) Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub Save_Record() Try Me.BindingContext(DsPayroll, "Employees").EndCurrentEdit() daEmployees.Update(DsPayroll) Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub Change_Button(ByVal bval As Boolean) btnFirst.Enabled = bval btnPrev.Enabled = bval btnNext.Enabled = bval btnLast.Enabled = bval btnDelete.Enabled = bval btnExit.Enabled = bval End Sub Private Sub txtDailyRate_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDailyRate.LostFocus If IsValidTextbox(txtDailyRate) = False Then Exit Sub End Sub Private Sub txtAllowance_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAllowance.LostFocus If IsValidTextbox(txtAllowance) = False Then Exit Sub End Sub Private Sub txtIncentives_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtIncentives.LostFocus If IsValidTextbox(txtIncentives) = False Then Exit Sub End Sub Private Sub cbDivision_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDivision.SelectedIndexChanged oldcbDivision = cbDivision.Text
  • 14. End Sub Private Sub cbDivision_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbDivision.SelectionChangeCommitted If cbDivision.Text = "Add Division" Then Dim Division As New Division cbDivision.Text = oldcbDivision Division.ShowDialog() daDivision.Fill(DsPayroll) End If End Sub Private Sub Employee_PositionChanged(ByVal sender As Object, ByVal e As System.EventArgs) DisplayNav(sender, e) End Sub Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click End Sub Private Sub lblNavLocation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblNavLocation.Click End Sub Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint End Sub Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint End Sub Private Sub TabData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabData.Click End Sub Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter End Sub End Class
  • 15. Option Explicit On Imports System.Data.OleDb Public Class Payroll Inherits System.Windows.Forms.Form Dim ACCESS_CONNECTION_STRING As String = cnSettings() Dim strSelectedAssignCode As String Dim dblAllowance As Double Dim dblIncentives As Double Dim intIndex As Integer Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean Select Case msg.WParam.ToInt32() Case 13 ' enter Key If TypeOf Me.ActiveControl Is TextBox Then SendKeys.Send("{Tab}") Return True End If End Select Return MyBase.ProcessCmdKey(msg, keyData) End Function 'ProcessCmdKey Private Sub Payroll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load PopulateNameList() End Sub Private Sub PopulateNameList() Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING) lvName.Items.Clear() lvName.Sorting = SortOrder.Ascending
  • 16. Dim cmdfill As New OleDbCommand("SELECT AssignCode, LastName & ', ' & FirstName & ' ' & MiddleName as Name FROM Employees", Connection) Try Connection.Open() Dim datareader As OleDbDataReader datareader = cmdfill.ExecuteReader While datareader.Read Dim lvi As New ListViewItem lvi.Text = CStr(datareader("AssignCode")) lvi.SubItems.Add(CStr(datareader("Name"))) lvName.Items.Add(lvi) End While If datareader.HasRows Then lvName.TopItem.Selected = True lvName.TopItem.Focused = True lvName.TopItem.EnsureVisible() lvName.Select() 'lvName.Items(0).Selected = True 'strSelectedAssignCode = lvName.Items(0).SubItems(0).Text lvName_SelectedIndexChanged(Nothing, Nothing) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") Finally Connection.Close() End Try End Sub Private Sub lvName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvName.SelectedIndexChanged Dim cnOleDb As OleDbConnection Dim cmSQL As OleDbCommand Dim drSQL As OleDbDataReader Dim strSQL As String 'Dim strID As String Dim ThisItem As ListViewItem If IsNothing(lvName.FocusedItem) Then Exit Sub For Each ThisItem In lvName.SelectedItems strSelectedAssignCode = lvName.Items(ThisItem.Index).SubItems(0).Text Next 'strSelectedAssignCode = lvName.FocusedItem.Text Try strSQL = "SELECT AssignCode, " & _ "DailyRate, " & _ "Allowance, " & _ "Incentives " & _ "FROM Employees " & _ "WHERE AssignCode = '" & strSelectedAssignCode & "'" cnOleDb = New OleDbConnection(ACCESS_CONNECTION_STRING) cnOleDb.Open() cmSQL = New OleDbCommand(strSQL, cnOleDb) drSQL = cmSQL.ExecuteReader() drSQL.Read() txtDailyRate.Text = Format(Convert.ToDouble(drSQL.Item("DailyRate").ToString()), "0.00") dblAllowance = Format(Convert.ToDouble(drSQL.Item("Allowance").ToString()), "0.00")
  • 17. txtAllowance.Text = dblAllowance dblIncentives = Format(Convert.ToDouble(drSQL.Item("Incentives").ToString()), "0.00") txtIncentives.Text = dblIncentives ' Close and Clean up objects drSQL.Close() cnOleDb.Close() cmSQL.Dispose() cnOleDb.Dispose() GetPayslip() txtTotal.Text = Format(txtWorkDays.Text * txtDailyRate.Text, "0.00") Calc_Gross() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub GetPayslip() Dim cnOleDb As OleDbConnection Dim cmSQL As OleDbCommand Dim drSQL As OleDbDataReader Dim strSQL As String 'Dim strID As String If IsNothing(lvName.FocusedItem) Then Exit Sub 'strSelectedAssignCode = lvName.FocusedItem.Text Try strSQL = "SELECT * " & _ "FROM Payroll " & _ "WHERE AssignCode = '" & strSelectedAssignCode & "' And FromPay = #" & dtpFromPay.Text & "# And ToPay = #" & dtpToPay.Text & "#" cnOleDb = New OleDbConnection(ACCESS_CONNECTION_STRING) cnOleDb.Open() cmSQL = New OleDbCommand(strSQL, cnOleDb) drSQL = cmSQL.ExecuteReader() If drSQL.HasRows Then drSQL.Read() txtWorkDays.Text = drSQL.Item("NoWorkDays").ToString() txtWorkDays.Text = Format(CDbl(txtWorkDays.Text), "0.0000") txtRegOT.Text = Format(CDbl(drSQL.Item("RegOT").ToString()), "0.0000") txtSunOT.Text = Format(CDbl(drSQL.Item("SunOT").ToString()), "0.0000") txtHolPay.Text = Format(Convert.ToDouble(drSQL.Item("HolOT").ToString()), "0.00") txtAdd1.Text = Format(Convert.ToDouble(drSQL.Item("Add1").ToString()), "0.00") txtAdd2.Text = Format(Convert.ToDouble(drSQL.Item("Add2").ToString()), "0.00") txtAdd3.Text = Format(Convert.ToDouble(drSQL.Item("Add3").ToString()), "0.00") txtAddDesc1.Text = drSQL.Item("AddDesc1").ToString() txtAddDesc2.Text = drSQL.Item("AddDesc2").ToString() txtAddDesc3.Text = drSQL.Item("AddDesc3").ToString()
  • 18. txtSSS.Text = Format(Convert.ToDouble(drSQL.Item("SSS_MCR").ToString()), "0.00") txtTax.Text = Format(Convert.ToDouble(drSQL.Item("WTax").ToString()), "0.00") txtSSSLoan.Text = Format(Convert.ToDouble(drSQL.Item("SSS_Loans").ToString()), "0.00") txtLates.Text = Format(Convert.ToDouble(drSQL.Item("Lates").ToString()), "0.00") txtDed1.Text = Format(Convert.ToDouble(drSQL.Item("Ded1").ToString()), "0.00") txtDed2.Text = Format(Convert.ToDouble(drSQL.Item("Ded2").ToString()), "0.00") txtDed3.Text = Format(Convert.ToDouble(drSQL.Item("Ded3").ToString()), "0.00") txtDedDesc1.Text = drSQL.Item("DedDesc1").ToString() txtDedDesc2.Text = drSQL.Item("DedDesc2").ToString() txtDedDesc3.Text = drSQL.Item("DedDesc3").ToString() ' Close and Clean up objects drSQL.Close() cnOleDb.Close() cmSQL.Dispose() cnOleDb.Dispose() End If txtRegOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.25) * txtRegOT.Text, "0.00") txtSunOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.3) * txtSunOT.Text, "0.00") txtHolPayTotal.Text = Format(txtDailyRate.Text * txtHolPay.Text, "0.00") txtIncentives.Text = Format(txtIncentives.Text * txtWorkDays.Text, "0.00") txtAllowance.Text = Format(txtAllowance.Text * txtWorkDays.Text, "0.00") Calc_Gross() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click If strSelectedAssignCode = "" Then MsgBox("Please select employee", MsgBoxStyle.OKOnly) Exit Sub End If If txtWorkDays.Text > 0 Then Dim ReturnValue As String = isRecordExist() If ReturnValue = "Exist" Then If MsgBox("Payslip already exist for this employee." & vbCrLf & vbCrLf & "Do you want to overight existing record?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then UpdatePaySlip() End If SelectIndex()
  • 19. lvName_SelectedIndexChanged(sender, e) ElseIf ReturnValue <> "Error" Then AddPaySlip() SelectIndex() lvName_SelectedIndexChanged(sender, e) End If Else MsgBox("Please enter No. of Working days.", MsgBoxStyle.OKOnly) End If End Sub Private Function isRecordExist() As String Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING) Dim cmdfill As New OleDbCommand("SELECT AssignCode, FromPay, ToPay FROM Payroll Where AssignCode = '" & strSelectedAssignCode & "' And FromPay = #" & dtpFromPay.Text & "# And ToPay = #" & dtpToPay.Text & "#", Connection) Try Connection.Open() Dim datareader As OleDbDataReader datareader = cmdfill.ExecuteReader If datareader.HasRows Then Return "Exist" Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") Return "Error" Finally Connection.Close() Connection.Dispose() End Try End Function Private Sub AddPaySlip() Try 'Dim dbCommand As OleDbCommand Dim DBConn As OleDbConnection Dim DBInsert As New OleDbCommand DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING) DBInsert.CommandText = "INSERT INTO Payroll VALUES (" _ & "'" & dtpFromPay.Text & "', " _ & "'" & dtpToPay.Text & "', " _ & "'" & strSelectedAssignCode & "', " _ & "'" & txtWorkDays.Text & "', " _ & "'" & txtDailyRate.Text & "', " _ & "'" & txtTotal.Text & "', " _ & "'" & txtRegOT.Text & "', " _ & "'" & txtSunOT.Text & "', " _ & "'" & txtHolPay.Text & "', " _ & "'" & txtRegOTTotal.Text & "', " _ & "'" & txtSunOTTotal.Text & "', " _ & "'" & txtHolPayTotal.Text & "', " _ & "'" & txtAdd1.Text & "', " _ & "'" & txtAdd2.Text & "', " _ & "'" & txtAdd3.Text & "', " _ & "'" & txtAddDesc1.Text & "', " _ & "'" & txtAddDesc2.Text & "', " _ & "'" & txtAddDesc3.Text & "', " _ & "'" & txtIncentives.Text & "', " _ & "'" & txtAllowance.Text & "', " _ & "'" & txtGross.Text & "', " _ & "'" & txtSSS.Text & "', " _
  • 20. & "'" & txtTax.Text & "', " _ & "'" & txtSSSLoan.Text & "', " _ & "'" & txtLates.Text & "', " _ & "'" & txtDed1.Text & "', " _ & "'" & txtDed2.Text & "', " _ & "'" & txtDed3.Text & "', " _ & "'" & txtDedDesc1.Text & "', " _ & "'" & txtDedDesc2.Text & "', " _ & "'" & txtDedDesc3.Text & "', " _ & "'" & txtTotalDed.Text & "', " _ & "'" & txtNetIncome.Text & "', " _ & "'" & DateTime.Now.ToString & "')" DBInsert.Connection = DBConn DBInsert.Connection.Open() DBInsert.ExecuteNonQuery() MsgBox("Payslip created successfully.", MsgBoxStyle.OKOnly) DBConn.Close() DBConn.Dispose() Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub UpdatePaySlip() Try 'Dim dbCommand As OleDbCommand Dim DBConn As OleDbConnection Dim DBUpdate As New OleDbCommand DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING) DBUpdate.CommandText = "UPDATE Payroll SET " & _ "FromPay = #" & dtpFromPay.Text & "#, " & _ "ToPay = #" & dtpToPay.Text & "#, " & _ "AssignCode = '" & strSelectedAssignCode & "', " & _ "NoWorkDays = '" & txtWorkDays.Text & "', " & _ "Rate = '" & txtDailyRate.Text & "', " & _ "RegWage = '" & txtTotal.Text & "', " & _ "RegOT = '" & txtRegOT.Text & "', " & _ "SunOT = '" & txtSunOT.Text & "', " & _ "HolOT = '" & txtHolPay.Text & "', " & _ "RegOTTotal = '" & txtRegOTTotal.Text & "', " & _ "SunOTTotal = '" & txtSunOTTotal.Text & "', " & _ "HolOTTotal = '" & txtHolPayTotal.Text & "', " & _ "Add1 = '" & txtAdd1.Text & "', " & _ "Add2 = '" & txtAdd2.Text & "', " & _ "Add3 = '" & txtAdd3.Text & "', " & _ "AddDesc1 = '" & txtAddDesc1.Text & "', " & _ "AddDesc2 = '" & txtAddDesc2.Text & "', " & _ "AddDesc3 = '" & txtAddDesc3.Text & "', " & _ "Incentives = '" & txtIncentives.Text & "', " & _ "Allowance = '" & txtAllowance.Text & "', " & _ "GrossPay = '" & txtGross.Text & "', " & _ "SSS_MCR = '" & txtSSS.Text & "', " & _ "WTax = '" & txtTax.Text & "', " & _ "SSS_Loans = '" & txtSSSLoan.Text & "', " & _ "Lates = '" & txtLates.Text & "', " & _ "Ded1 = '" & txtDed1.Text & "', " & _ "Ded2 = '" & txtDed2.Text & "', " & _ "Ded3 = '" & txtDed3.Text & "', " & _
  • 21. "DedDesc1 = '" & txtDedDesc1.Text & "', " & _ "DedDesc2 = '" & txtDedDesc2.Text & "', " & _ "DedDesc3 = '" & txtDedDesc3.Text & "', " & _ "TotalDed = '" & txtTotalDed.Text & "', " & _ "NetPay = '" & txtNetIncome.Text & "' " & _ "WHERE AssignCode = '" & strSelectedAssignCode & "' And " & _ "FromPay = #" & dtpFromPay.Text & "# And " & _ "ToPay = #" & dtpToPay.Text & "#" DBUpdate.Connection = DBConn DBUpdate.Connection.Open() DBUpdate.ExecuteNonQuery() MsgBox("Payslip created successfully.", MsgBoxStyle.OKOnly) DBConn.Close() DBConn.Dispose() Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub Calc_Gross() Try txtGross.Text = Convert.ToDouble(IIf(txtTotal.Text = "", "0.00", txtTotal.Text)) _ + Convert.ToDouble(IIf(txtRegOTTotal.Text = "", "0.00", txtRegOTTotal.Text)) _ + Convert.ToDouble(IIf(txtSunOTTotal.Text = "", "0.00", txtSunOTTotal.Text)) _ + Convert.ToDouble(IIf(txtHolPayTotal.Text = "", "0.00", txtHolPayTotal.Text)) _ + Convert.ToDouble(IIf(txtAllowance.Text = "", "0.00", txtAllowance.Text)) _ + Convert.ToDouble(IIf(txtIncentives.Text = "", "0.00", txtIncentives.Text)) _ + Convert.ToDouble(IIf(txtAdd1.Text = "", "0.00", txtAdd1.Text)) _ + Convert.ToDouble(IIf(txtAdd2.Text = "", "0.00", txtAdd2.Text)) _ + Convert.ToDouble(IIf(txtAdd3.Text = "", "0.00", txtAdd3.Text)) txtGross.Text = Format(CDbl(txtGross.Text), "0.00") Calc_Deductions() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub Calc_Deductions() Try txtTotalDed.Text = Convert.ToDouble(IIf(txtSSS.Text = "", "0.00", txtSSS.Text)) _ + Convert.ToDouble(IIf(txtTax.Text = "", "0.00", txtTax.Text)) _ + Convert.ToDouble(IIf(txtSSSLoan.Text = "", "0.00", txtSSSLoan.Text)) _ + Convert.ToDouble(IIf(txtLates.Text = "", "0.00", txtLates.Text)) _ + Convert.ToDouble(IIf(txtDed1.Text = "", "0.00", txtDed1.Text)) _
  • 22. + Convert.ToDouble(IIf(txtDed2.Text = "", "0.00", txtDed2.Text)) _ + Convert.ToDouble(IIf(txtDed3.Text = "", "0.00", txtDed3.Text)) txtTotalDed.Text = Format(CDbl(txtTotalDed.Text), "0.00") txtNetIncome.Text = Convert.ToDouble(IIf(txtGross.Text = "", "0.00", txtGross.Text) - IIf(txtTotalDed.Text = "", "0.00", txtTotalDed.Text)) txtNetIncome.Text = Format(CDbl(txtNetIncome.Text), "0.00") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub txtWorkDays_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtWorkDays.LostFocus If IsNumeric(txtWorkDays.Text) = False Then MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtWorkDays.Focus() txtWorkDays.SelectAll() Exit Sub End If txtWorkDays.Text = Format(CDbl(txtWorkDays.Text), "0.0000") txtAllowance.Text = Format(dblAllowance * txtWorkDays.Text, "0.00") txtIncentives.Text = Format(dblIncentives * txtWorkDays.Text, "0.00") txtTotal.Text = Format(txtWorkDays.Text * txtDailyRate.Text, "0.00") Calc_Gross() End Sub Private Sub txtRegOT_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRegOT.LostFocus If IsNumeric(txtRegOT.Text) = False Then MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtRegOT.Focus() txtRegOT.SelectAll() Exit Sub End If txtRegOT.Text = Format(CDbl(txtRegOT.Text), "0.0000") txtRegOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.25) * txtRegOT.Text, "0.00") Calc_Gross() End Sub Private Sub txtSunOT_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSunOT.LostFocus If IsNumeric(txtSunOT.Text) = False Then MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtSunOT.Focus() txtSunOT.SelectAll() Exit Sub End If txtSunOT.Text = Format(CDbl(txtSunOT.Text), "0.0000") txtSunOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.3) * txtSunOT.Text, "0.00") Calc_Gross() End Sub Private Sub txtHolPay_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtHolPay.LostFocus If IsNumeric(txtHolPay.Text) = False Then MsgBox("Please enter correct information", MsgBoxStyle.OKOnly)
  • 23. txtHolPay.Focus() txtHolPay.SelectAll() Exit Sub End If If IsValidTextbox(txtHolPay) = False Then Exit Sub txtHolPayTotal.Text = Format(txtDailyRate.Text * txtHolPay.Text, "0.00") Calc_Gross() End Sub rivate Sub txtAllowance_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAllowance.LostFocus If IsValidTextbox(txtAllowance) = False Then Exit Sub Calc_Gross() End Sub Private Sub txtIncentives_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtIncentives.LostFocus If IsValidTextbox(txtIncentives) = False Then Exit Sub Calc_Gross() End Sub Private Sub txtAdd1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAdd1.LostFocus If IsValidTextbox(txtAdd1) = False Then Exit Sub Calc_Gross() End Sub Private Sub txtAdd2_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAdd2.LostFocus If IsValidTextbox(txtAdd2) = False Then Exit Sub Calc_Gross() End Sub Private Sub txtAdd3_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAdd3.LostFocus If IsValidTextbox(txtAdd3) = False Then Exit Sub Calc_Gross() End Sub Private Sub txtSSS_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSSS.LostFocus If IsValidTextbox(txtSSS) = False Then Exit Sub Calc_Deductions() End Sub Private Sub txtTax_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTax.LostFocus If IsValidTextbox(txtTax) = False Then Exit Sub Calc_Deductions() End Sub Private Sub txtSSSLoan_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSSSLoan.LostFocus If IsValidTextbox(txtSSSLoan) = False Then Exit Sub Calc_Deductions() End Sub Private Sub txtLates_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLates.LostFocus If IsValidTextbox(txtLates) = False Then Exit Sub Calc_Deductions() End Sub Private Sub txtDed1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDed1.LostFocus If IsValidTextbox(txtDed1) = False Then Exit Sub
  • 24. Calc_Deductions() End Sub Private Sub txtDed2_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDed2.LostFocus If IsValidTextbox(txtDed2) = False Then Exit Sub Calc_Deductions() End Sub Private Sub txtDed3_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDed3.LostFocus If IsValidTextbox(txtDed3) = False Then Exit Sub Calc_Deductions() End Sub Private Sub SelectIndex() Dim ThisItem As ListViewItem Dim intNumRows As Integer Try For Each ThisItem In lvName.SelectedItems intNumRows = lvName.Items.Count If ThisItem.Index + 1 <> intNumRows Then lvName.Items(ThisItem.Index + 1).Selected = True strSelectedAssignCode = lvName.Items(ThisItem.Index + 1).SubItems(0).Text End If Next Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly) End Try End Sub Private Sub dtpFromPay_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpFromPay.ValueChanged lvName_SelectedIndexChanged(sender, e) End Sub Private Sub dtpToPay_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpToPay.ValueChanged lvName_SelectedIndexChanged(sender, e) End Sub Private Sub Label22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label22.Click End Sub Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter End Sub Private Sub GroupBox4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox4.Enter End Sub Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click End Sub Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click End Sub Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint End Sub Private Sub Label21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label21.Click End Sub
  • 25. Private Sub txtDailyRate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDailyRate.TextChanged End Sub End Class Public Class ReportDialog Inherits System.Windows.Forms.Form Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click Me.Close() End Sub Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click Dim frmReport As Reports If optVoucher.Checked = True Then frmReport = New Reports(Me, "Voucher.rpt") frmReport.Show() ElseIf optPayrollSum.Checked = True Then frmReport = New Reports(Me, "PayrollSum.rpt") frmReport.Show() Else Dim frmListofEmpReport As ListofEmpReport frmListofEmpReport = New ListofEmpReport(Me, "EmployeesList.rpt") frmListofEmpReport.Show() End If End Sub Private Sub optVoucher_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optVoucher.CheckedChanged If optVoucher.Checked = True Then GroupBox1.Enabled = True End If End Sub Private Sub optPayrollSum_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optPayrollSum.CheckedChanged If optPayrollSum.Checked = True Then GroupBox1.Enabled = True End If End Sub Private Sub optListofEmp_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optListofEmp.CheckedChanged If optListofEmp.Checked = True Then GroupBox1.Enabled = False End If End Sub Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
  • 26. End Sub Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint End Sub Private Sub ReportDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class
  • 27. Imports System.Data.OleDb Public Class Password Inherits System.Windows.Forms.Form Dim ACCESS_CONNECTION_STRING As String = cnSettings() Dim strSelectedAssignCode As String Dim strOldPassword As String Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean Select Case msg.WParam.ToInt32() Case 13 ' enter Key If TypeOf Me.ActiveControl Is TextBox Then SendKeys.Send("{Tab}") Return True End If End Select Return MyBase.ProcessCmdKey(msg, keyData) End Function 'ProcessCmdKey Private Sub Password_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load PopulateUser()
  • 28. End Sub Private Sub PopulateUser() Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING) lvUserName.Items.Clear() lvUserName.Sorting = SortOrder.Ascending Dim cmdfill As New OleDbCommand("SELECT UserName, [Password] FROM [Password]", Connection) Try Connection.Open() Dim datareader As OleDbDataReader datareader = cmdfill.ExecuteReader While datareader.Read Dim lvi As New ListViewItem lvi.Text = CStr(datareader("UserName")) lvUserName.Items.Add(lvi) End While If datareader.HasRows Then lvUserName.TopItem.Selected = True lvUserName.TopItem.Focused = True lvUserName.TopItem.EnsureVisible() lvUserName.Select() End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") Finally Connection.Close() End Try End Sub Private Sub RetrieveUser() Dim Connection As New OleDbConnection(ACCESS_CONNECTION_STRING) Dim cmdfill As New OleDbCommand("SELECT UserName, [Password] FROM [Password] Where UserName = '" & strSelectedAssignCode & "'", Connection) Try Connection.Open() Dim datareader As OleDbDataReader datareader = cmdfill.ExecuteReader datareader.Read() txtUserName2.Text = CStr(datareader("UserName")) strOldPassword = CStr(datareader("Password")) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") Finally Connection.Close() End Try End Sub Private Sub AddUser() Try 'Dim dbCommand As OleDbCommand Dim DBConn As OleDbConnection Dim DBInsert As New OleDbCommand DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING) DBInsert.CommandText = "INSERT INTO [Password] VALUES (" _ & "'" & txtUserName1.Text & "', " _ & "'" & txtPassword1.Text & "')" Dim lvi As New ListViewItem lvi.Text = txtUserName1.Text
  • 29. lvUserName.Items.Add(lvi) clearTxtBox() DBInsert.Connection = DBConn DBInsert.Connection.Open() DBInsert.ExecuteNonQuery() DBConn.Close() DBConn.Dispose() Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub UpdateUser() Try 'Dim dbCommand As OleDbCommand Dim DBConn As OleDbConnection Dim DBUpdate As New OleDbCommand DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING) DBUpdate.CommandText = "UPDATE [Password] SET " & _ "[Password] = '" & txtPassword2.Text & "' " & _ "WHERE UserName = '" & txtUserName2.Text & "'" clearTxtBox() DBUpdate.Connection = DBConn DBUpdate.Connection.Open() DBUpdate.ExecuteNonQuery() DBConn.Close() DBConn.Dispose() Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error") End Try End Sub Private Sub DeleteUser() Try Dim DBConn As OleDbConnection Dim dbCommand As New OleDbCommand 'Dim strPath As String DBConn = New OleDbConnection(cnSettings()) dbCommand.CommandText = "DELETE FROM [Password] " _ & "WHERE UserName = '" & strSelectedAssignCode & "'" dbCommand.Connection = DBConn dbCommand.Connection.Open() dbCommand.ExecuteNonQuery() lvUserName.Items.Remove(lvUserName.FocusedItem) DBConn.Close() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") End Try End Sub Private Sub clearTxtBox() txtUserName1.Text = "" txtUserName2.Text = "" txtPassword1.Text = "" txtPassword2.Text = "" txtConfirmPassword1.Text = "" txtConfirmPassword2.Text = "" txtOldPassword.Text = "" End Sub
  • 30. Private Sub lvUserName_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lvUserName.MouseDown Try If IsNothing(lvUserName.FocusedItem) Then Exit Sub strSelectedAssignCode = lvUserName.FocusedItem.Text If e.Button = MouseButtons.Right Then If lvUserName.SelectedItems.Count > 0 Then ContextMenu1.Show(lvUserName, New Point(e.X, e.Y)) End If End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly) End Try End Sub Private Sub lvUserName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvUserName.SelectedIndexChanged Try 'If IsNothing(lvUserName.FocusedItem) Then Exit Sub Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly) End Try End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) grpEdit.Hide() grpAdd.Show() End Sub Private Sub mnuAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAdd.Click grpAdd.Visible = True grpEdit.Visible = False btnUpdate.Text = "&Save" End Sub Private Sub mnuEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEdit.Click grpEdit.Visible = True grpAdd.Visible = False btnUpdate.Text = "&Update" RetrieveUser() End Sub Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click If btnUpdate.Text = "&Save" Then If txtPassword1.Text <> txtConfirmPassword1.Text Then MsgBox("Password does not match.", MsgBoxStyle.OKOnly) Exit Sub End If AddUser() Else If txtOldPassword.Text <> strOldPassword Then MsgBox("Please enter the correct password in the Old Password field.", MsgBoxStyle.OKOnly)
  • 31. Exit Sub End If If txtPassword2.Text <> txtConfirmPassword2.Text Then MsgBox("Password does not match.", MsgBoxStyle.OKOnly) Exit Sub End If UpdateUser() End If End Sub Private Sub mnuDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDelete.Click If strSelectedAssignCode = "Admin" Then MsgBox("Sorry you can't delete this account.", MsgBoxStyle.OKOnly) Exit Sub End If If MsgBox("Are you sure you want to delete this user?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then _ DeleteUser() End Sub Private Sub Label23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label23.Click End Sub End Class