thesis in computerized payroll system for brangay hall, dita

40
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

Upload: acel-carl-david-o-dolindo

Post on 28-Aug-2014

382 views

Category:

Software


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Thesis in Computerized Payroll System for Brangay Hall, Dita

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.

Page 2: Thesis in Computerized Payroll System for Brangay Hall, Dita

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.

Page 3: Thesis in Computerized Payroll System for Brangay 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, dataare 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.

Page 4: Thesis in Computerized Payroll System for Brangay Hall, Dita

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

PublicClass dbSelectInherits System.Windows.Forms.FormPublicShared StartUp As dbSelectPrivateSub btnNSM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNSM.ClickDim Login AsNew Login

Page 5: Thesis in Computerized Payroll System for Brangay Hall, Dita

CompDB = "NSM"

Login.Show()Me.Hide()EndSubPrivateSub btnPPE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPPE.ClickDim Login AsNew Login CompDB = "PPE" Login.Show()Me.Hide()EndSubPrivateSub btnSW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSW.ClickDim Login AsNew Login CompDB = "S&W" Login.Show()Me.Hide()EndSubPrivateSub btnSDOM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSDOM.ClickDim Login AsNew Login CompDB = "SDOM" Login.Show()Me.Hide()EndSubPrivateSub btnSSN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSSN.ClickDim Login AsNew Login CompDB = "SSn" Login.Show()Me.Hide()EndSubPrivateSub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Application.Exit()EndSubPrivateSub dbSelect_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Load dbSelect.StartUp = MeEndSubPrivateSub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.PaintEndSubPrivateSub Panel3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel3.PaintEndSubEndClass

Page 6: Thesis in Computerized Payroll System for Brangay Hall, Dita

PublicClass MenuInherits System.Windows.Forms.Form

PrivateSub Menu_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.LoadSelectCase CompDBCase"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"EndSelect

EndSubPrivateSub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.ClickMe.Close()

EndSubPrivateSub btnCompProfile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompProfile.ClickDim Company AsNew Company Company.Show()EndSubPrivateSub btnEmployees_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmployees.ClickDim Employees AsNew Employees Employees.Show()

EndSubPrivateSub btnPayroll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPayroll.ClickDim Payroll AsNew Payroll Payroll.Show()

EndSubPrivateSub btnReports_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReports.Click

Page 7: Thesis in Computerized Payroll System for Brangay Hall, Dita

Dim ReportDialog AsNew ReportDialog ReportDialog.Show()EndSubPrivateSub btnSecurity_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSecurity.ClickDim Password AsNew Password Password.Show()

EndSubPrivateSub btnAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbout.ClickDim About AsNew About About.ShowDialog()EndSubPrivateSub Menu_Closed(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Closed dbSelect.StartUp.Show()

EndSubPrivateSub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.PaintEndSubPrivateSub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.ClickEndSubEndClass

Page 8: Thesis in Computerized Payroll System for Brangay Hall, Dita

PublicClass CompanyInherits System.Windows.Forms.Form

ProtectedOverridesFunction ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) AsBooleanSelectCase msg.WParam.ToInt32()Case 13 ' enter Key IfTypeOfMe.ActiveControl Is TextBox Then SendKeys.Send("{Tab}")ReturnTrueEndIfEndSelectReturnMyBase.ProcessCmdKey(msg, keyData)

EndFunction'ProcessCmdKeyPrivateSub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.ClickMe.Close()

EndSubPrivateSub Company_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Load cnPayroll.ConnectionString = cnSettings() daCompany.Fill(DsPayroll)Me.BindingContext(DsPayroll, "Company").Position = 0

EndSubPrivateSub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.ClickMe.BindingContext(DsPayroll, "Company").EndCurrentEdit() daCompany.Update(DsPayroll)EndSub

EndClass

Page 9: Thesis in Computerized Payroll System for Brangay Hall, Dita

PublicClass Employees

Page 10: Thesis in Computerized Payroll System for Brangay Hall, Dita

Inherits System.Windows.Forms.FormDim oldcbDivision AsStringProtectedOverridesFunction ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) AsBooleanSelectCase msg.WParam.ToInt32()Case 13 ' enter Key IfTypeOfMe.ActiveControl Is TextBox OrTypeOfMe.ActiveControl Is ComboBox Then SendKeys.Send("{Tab}")ReturnTrueEndIfEndSelectReturnMyBase.ProcessCmdKey(msg, keyData)EndFunction'ProcessCmdKey PrivateSub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.ClickMe.Close()EndSubPrivateSub Employees_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Load cnPayroll.ConnectionString = cnSettings() daEmployees.Fill(DsPayroll) daDivision.Fill(DsPayroll)With cbStatus .Items.Add("ACTIVE") .Items.Add("RESIGNED") .Items.Add("RETIRED")EndWith

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"))EndWithWith cbPayMethod .Items.Add("MONTHLY") .Items.Add("DAILY")EndWith BindEmpList()Me.BindingContext(DsPayroll, "Employees").Position = 0AddHandlerMe.BindingContext(DsPayroll, "Employees").PositionChanged, _AddressOf Employee_PositionChanged DisplayNav(sender, e)EndSubSub BindEmpList()With grdEmpList .CaptionText = "Employees" .DataMember = "Employees" .DataSource = DsPayrollEndWith' You must clear out the TableStyles collection before grdEmpList.TableStyles.Clear()

Page 11: Thesis in Computerized Payroll System for Brangay Hall, Dita

Dim grdTableStyle1 AsNew DataGridTableStyleWith grdTableStyle1 .MappingName = "Employees"EndWithDim grdColStyle1 AsNew DataGridTextBoxColumnWith grdColStyle1 .MappingName = "AssignCode" .HeaderText = "Assign Code" .Width = 140EndWithDim grdColStyle2 AsNew DataGridTextBoxColumnWith grdColStyle2 .MappingName = "LastName" .HeaderText = "Last Name" .Width = 140EndWithDim grdColStyle3 AsNew DataGridTextBoxColumnWith grdColStyle3 .MappingName = "FirstName" .HeaderText = "First Name" .Width = 140EndWithDim grdColStyle4 AsNew DataGridTextBoxColumnWith grdColStyle4 .MappingName = "MiddleName" .HeaderText = "M.I." .Width = 75EndWith

Dim grdColStyle5 AsNew DataGridTextBoxColumnWith grdColStyle5 .MappingName = "Section" .HeaderText = "Section" .Width = 75EndWithDim grdColStyle6 AsNew DataGridTextBoxColumnWith grdColStyle6 .MappingName = "DateHired" .HeaderText = "Date Hired" .Width = 75EndWithDim grdColStyle7 AsNew DataGridTextBoxColumnWith grdColStyle7 .MappingName = "Phone" .HeaderText = "Phone" .Width = 75EndWithDim grdColStyle8 AsNew DataGridTextBoxColumnWith grdColStyle8 .MappingName = "Status" .HeaderText = "Status" .Width = 75EndWith grdTableStyle1.GridColumnStyles.AddRange _ (New DataGridColumnStyle() {grdColStyle1, grdColStyle2, _ grdColStyle3, grdColStyle4, grdColStyle5, _ grdColStyle6, grdColStyle7, grdColStyle8})

Page 12: Thesis in Computerized Payroll System for Brangay Hall, Dita

grdEmpList.TableStyles.Add(grdTableStyle1)EndSubPrivateSub 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").CountEndSubPrivateSub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click Save_Record()Me.BindingContext(DsPayroll, "Employees").Position += 1EndSubPrivateSub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click Save_Record()Me.BindingContext(DsPayroll, "Employees").Position -= 1EndSubPrivateSub 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 - 1EndSub

PrivateSub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click Save_Record()Me.BindingContext(DsPayroll, "Employees").Position = 0EndSubPrivateSub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.ClickIf btnAdd.Text = "&Add"ThenMe.BindingContext(DsPayroll, "Employees").AddNew()ElseMe.BindingContext(DsPayroll, "Employees").CancelCurrentEdit() Change_Button(True) btnAdd.Text = "&Add" DisplayNav(sender, e)EndIfEndSubPrivateSub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.ClickTryIf btnAdd.Text = "&Revert"ThenIf txtCode.Text = ""Then MessageBox.Show("Please don't leave assign code field blank.", "Error", MessageBoxButtons.OK)ExitSubEndIfEndIf Save_Record() Change_Button(True) btnAdd.Text = "&Add"

Page 13: Thesis in Computerized Payroll System for Brangay Hall, Dita

DisplayNav(sender, e)Catch ex As Exception MsgBox(ex.Message)EndTryEndSub

PrivateSub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.ClickTryIf MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.YesNo) = MsgBoxResult.No ThenExitSub

Me.BindingContext(DsPayroll, "Employees").RemoveAt(Me.BindingContext(DsPayroll, "Employees").Position)

Save_Record()

DisplayNav(sender, e)Catch ex As Exception MsgBox(ex.Message)EndTryEndSub

PrivateSub Save_Record()TryMe.BindingContext(DsPayroll, "Employees").EndCurrentEdit()

daEmployees.Update(DsPayroll)Catch ex As Exception MsgBox(ex.Message)EndTryEndSubPrivateSub Change_Button(ByVal bval AsBoolean) btnFirst.Enabled = bval btnPrev.Enabled = bval btnNext.Enabled = bval btnLast.Enabled = bval btnDelete.Enabled = bval btnExit.Enabled = bvalEndSubPrivateSub txtDailyRate_LostFocus(ByVal sender AsObject, ByVal e As System.EventArgs) Handles txtDailyRate.LostFocusIf IsValidTextbox(txtDailyRate) = FalseThenExitSubEndSubPrivateSub txtAllowance_LostFocus(ByVal sender AsObject, ByVal e As System.EventArgs) Handles txtAllowance.LostFocusIf IsValidTextbox(txtAllowance) = FalseThenExitSubEndSubPrivateSub txtIncentives_LostFocus(ByVal sender AsObject, ByVal e As System.EventArgs) Handles txtIncentives.LostFocusIf IsValidTextbox(txtIncentives) = FalseThenExitSubEndSubPrivateSub cbDivision_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDivision.SelectedIndexChanged oldcbDivision = cbDivision.TextEndSub

Page 14: Thesis in Computerized Payroll System for Brangay Hall, Dita

PrivateSub cbDivision_SelectionChangeCommitted(ByVal sender AsObject, ByVal e As System.EventArgs) Handles cbDivision.SelectionChangeCommittedIf cbDivision.Text = "Add Division"ThenDim Division AsNew Division cbDivision.Text = oldcbDivision Division.ShowDialog() daDivision.Fill(DsPayroll)EndIfEndSubPrivateSub Employee_PositionChanged(ByVal sender AsObject, ByVal e As System.EventArgs) DisplayNav(sender, e)EndSubPrivateSub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.ClickEndSubPrivateSub lblNavLocation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblNavLocation.ClickEndSubPrivateSub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.PaintEndSubPrivateSub Panel3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel3.PaintEndSub

PrivateSub TabData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabData.ClickEndSubPrivateSub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.EnterEndSub

EndClass

Page 15: Thesis in Computerized Payroll System for Brangay Hall, Dita

OptionExplicitOnImports System.Data.OleDbPublicClass PayrollInherits System.Windows.Forms.FormDim ACCESS_CONNECTION_STRING AsString = cnSettings()Dim strSelectedAssignCode AsStringDim dblAllowance AsDoubleDim dblIncentives AsDoubleDim intIndex AsIntegerProtectedOverridesFunction ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) AsBooleanSelectCase msg.WParam.ToInt32()Case 13 ' enter Key IfTypeOfMe.ActiveControl Is TextBox Then SendKeys.Send("{Tab}")ReturnTrueEndIfEndSelectReturnMyBase.ProcessCmdKey(msg, keyData)EndFunction'ProcessCmdKeyPrivateSub Payroll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load PopulateNameList()EndSubPrivateSub PopulateNameList()Dim Connection AsNew OleDbConnection(ACCESS_CONNECTION_STRING) lvName.Items.Clear() lvName.Sorting = SortOrder.Ascending

Dim cmdfill AsNew OleDbCommand("SELECT AssignCode, LastName & ', ' & FirstName & ' ' & MiddleName as Name FROM Employees", Connection)

Page 16: Thesis in Computerized Payroll System for Brangay Hall, Dita

Try Connection.Open()Dim datareader As OleDbDataReader datareader = cmdfill.ExecuteReaderWhile datareader.ReadDim lvi AsNew ListViewItem lvi.Text = CStr(datareader("AssignCode")) lvi.SubItems.Add(CStr(datareader("Name"))) lvName.Items.Add(lvi)EndWhileIf 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)EndIfCatch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")Finally Connection.Close()EndTryEndSubPrivateSub lvName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvName.SelectedIndexChangedDim cnOleDb As OleDbConnectionDim cmSQL As OleDbCommandDim drSQL As OleDbDataReaderDim strSQL AsString'Dim strID As StringDim ThisItem As ListViewItemIf IsNothing(lvName.FocusedItem) ThenExitSubForEach ThisItem In lvName.SelectedItems strSelectedAssignCode = lvName.Items(ThisItem.Index).SubItems(0).TextNext'strSelectedAssignCode = lvName.FocusedItem.TextTry 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

Page 17: Thesis in Computerized Payroll System for Brangay Hall, Dita

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")EndTryEndSub

PrivateSub GetPayslip()Dim cnOleDb As OleDbConnectionDim cmSQL As OleDbCommandDim drSQL As OleDbDataReaderDim strSQL AsString'Dim strID As StringIf IsNothing(lvName.FocusedItem) ThenExitSub'strSelectedAssignCode = lvName.FocusedItem.TextTry 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")

Page 18: Thesis in Computerized Payroll System for Brangay Hall, Dita

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()EndIf 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")EndTryEndSubPrivateSub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.ClickMe.Close()EndSubPrivateSub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.ClickIf strSelectedAssignCode = ""Then MsgBox("Please select employee", MsgBoxStyle.OKOnly)ExitSubEndIfIf txtWorkDays.Text > 0 ThenDim ReturnValue AsString = isRecordExist()If ReturnValue = "Exist"ThenIf MsgBox("Payslip already exist for this employee."& vbCrLf & vbCrLf &"Do you want to overight existing record?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then UpdatePaySlip()EndIf SelectIndex() lvName_SelectedIndexChanged(sender, e)ElseIf ReturnValue <>"Error"Then AddPaySlip()

Page 19: Thesis in Computerized Payroll System for Brangay Hall, Dita

SelectIndex() lvName_SelectedIndexChanged(sender, e)EndIfElse MsgBox("Please enter No. of Working days.", MsgBoxStyle.OKOnly)EndIfEndSubPrivateFunction isRecordExist() AsStringDim Connection AsNew OleDbConnection(ACCESS_CONNECTION_STRING)Dim cmdfill AsNew 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.ExecuteReaderIf datareader.HasRows ThenReturn"Exist"Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")Return"Error"Finally Connection.Close() Connection.Dispose()EndTryEndFunctionPrivateSub AddPaySlip()Try'Dim dbCommand As OleDbCommandDim DBConn As OleDbConnectionDim DBInsert AsNew 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 &"', " _

Page 20: Thesis in Computerized Payroll System for Brangay Hall, Dita

&"'"& 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")EndTryEndSubPrivateSub UpdatePaySlip()Try'Dim dbCommand As OleDbCommandDim DBConn As OleDbConnectionDim DBUpdate AsNew 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 &"', "& _

Page 21: Thesis in Computerized Payroll System for Brangay Hall, Dita

"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")EndTryEndSubPrivateSub 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")EndTryEndSubPrivateSub 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))

Page 22: Thesis in Computerized Payroll System for Brangay Hall, Dita

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")EndTryEndSubPrivateSub txtWorkDays_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtWorkDays.LostFocusIf IsNumeric(txtWorkDays.Text) = FalseThen MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtWorkDays.Focus() txtWorkDays.SelectAll()ExitSubEndIf 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()EndSubPrivateSub txtRegOT_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRegOT.LostFocusIf IsNumeric(txtRegOT.Text) = FalseThen MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtRegOT.Focus() txtRegOT.SelectAll()ExitSubEndIf txtRegOT.Text = Format(CDbl(txtRegOT.Text), "0.0000") txtRegOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.25) * txtRegOT.Text, "0.00") Calc_Gross()EndSubPrivateSub txtSunOT_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSunOT.LostFocusIf IsNumeric(txtSunOT.Text) = FalseThen MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtSunOT.Focus() txtSunOT.SelectAll()ExitSubEndIf txtSunOT.Text = Format(CDbl(txtSunOT.Text), "0.0000") txtSunOTTotal.Text = Format(((txtDailyRate.Text / 8) * 1.3) * txtSunOT.Text, "0.00") Calc_Gross()EndSubPrivateSub txtHolPay_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtHolPay.LostFocusIf IsNumeric(txtHolPay.Text) = FalseThen MsgBox("Please enter correct information", MsgBoxStyle.OKOnly) txtHolPay.Focus() txtHolPay.SelectAll()ExitSubEndIfIf IsValidTextbox(txtHolPay) = FalseThenExitSub

Page 23: Thesis in Computerized Payroll System for Brangay Hall, Dita

txtHolPayTotal.Text = Format(txtDailyRate.Text * txtHolPay.Text, "0.00") Calc_Gross()EndSubrivateSub txtAllowance_LostFocus(ByVal sender AsObject, ByVal e As System.EventArgs) Handles txtAllowance.LostFocusIf IsValidTextbox(txtAllowance) = FalseThenExitSub Calc_Gross()EndSubPrivateSub txtIncentives_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtIncentives.LostFocusIf IsValidTextbox(txtIncentives) = FalseThenExitSub Calc_Gross()EndSubPrivateSub txtAdd1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAdd1.LostFocusIf IsValidTextbox(txtAdd1) = FalseThenExitSub Calc_Gross()EndSubPrivateSub txtAdd2_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAdd2.LostFocusIf IsValidTextbox(txtAdd2) = FalseThenExitSub Calc_Gross()EndSubPrivateSub txtAdd3_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAdd3.LostFocusIf IsValidTextbox(txtAdd3) = FalseThenExitSub Calc_Gross()EndSubPrivateSub txtSSS_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSSS.LostFocusIf IsValidTextbox(txtSSS) = FalseThenExitSub Calc_Deductions()EndSubPrivateSub txtTax_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTax.LostFocusIf IsValidTextbox(txtTax) = FalseThenExitSub Calc_Deductions()EndSubPrivateSub txtSSSLoan_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSSSLoan.LostFocusIf IsValidTextbox(txtSSSLoan) = FalseThenExitSub Calc_Deductions()EndSubPrivateSub txtLates_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLates.LostFocusIf IsValidTextbox(txtLates) = FalseThenExitSub Calc_Deductions()EndSubPrivateSub txtDed1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDed1.LostFocusIf IsValidTextbox(txtDed1) = FalseThenExitSub Calc_Deductions()EndSubPrivateSub txtDed2_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDed2.LostFocusIf IsValidTextbox(txtDed2) = FalseThenExitSub

Page 24: Thesis in Computerized Payroll System for Brangay Hall, Dita

Calc_Deductions()EndSubPrivateSub txtDed3_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDed3.LostFocusIf IsValidTextbox(txtDed3) = FalseThenExitSub Calc_Deductions()EndSubPrivateSub SelectIndex()Dim ThisItem As ListViewItemDim intNumRows AsIntegerTryForEach ThisItem In lvName.SelectedItems intNumRows = lvName.Items.CountIf ThisItem.Index + 1 <> intNumRows Then lvName.Items(ThisItem.Index + 1).Selected = True strSelectedAssignCode = lvName.Items(ThisItem.Index + 1).SubItems(0).TextEndIfNextCatch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly)EndTryEndSubPrivateSub dtpFromPay_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpFromPay.ValueChanged lvName_SelectedIndexChanged(sender, e)EndSubPrivateSub dtpToPay_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpToPay.ValueChanged lvName_SelectedIndexChanged(sender, e)EndSubPrivateSub Label22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label22.ClickEndSubPrivateSub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.EnterEndSubPrivateSub GroupBox4_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox4.EnterEndSubPrivateSub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.ClickEndSubPrivateSub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.ClickEndSubPrivateSub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.PaintEndSubPrivateSub Label21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label21.ClickEndSubPrivateSub txtDailyRate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDailyRate.TextChangedEndSubEndClass

Page 25: Thesis in Computerized Payroll System for Brangay Hall, Dita

PublicClass ReportDialogInherits System.Windows.Forms.FormPrivateSub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.ClickMe.Close()EndSubPrivateSub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.ClickDim frmReport As ReportsIf optVoucher.Checked = TrueThen frmReport = New Reports(Me, "Voucher.rpt") frmReport.Show()ElseIf optPayrollSum.Checked = TrueThen frmReport = New Reports(Me, "PayrollSum.rpt") frmReport.Show()ElseDim frmListofEmpReport As ListofEmpReport frmListofEmpReport = New ListofEmpReport(Me, "EmployeesList.rpt") frmListofEmpReport.Show()EndIfEndSubPrivateSub optVoucher_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optVoucher.CheckedChangedIf optVoucher.Checked = TrueThen GroupBox1.Enabled = TrueEndIfEndSubPrivateSub optPayrollSum_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optPayrollSum.CheckedChangedIf optPayrollSum.Checked = TrueThen GroupBox1.Enabled = TrueEndIfEndSubPrivateSub optListofEmp_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optListofEmp.CheckedChangedIf optListofEmp.Checked = TrueThen GroupBox1.Enabled = FalseEndIfEndSubPrivateSub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.PaintEndSubPrivateSub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint

Page 26: Thesis in Computerized Payroll System for Brangay Hall, Dita

EndSubPrivateSub ReportDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.LoadEndSubEndClass

Page 27: Thesis in Computerized Payroll System for Brangay Hall, Dita

Imports System.Data.OleDbPublicClass PasswordInherits System.Windows.Forms.FormDim ACCESS_CONNECTION_STRING AsString = cnSettings()Dim strSelectedAssignCode AsStringDim strOldPassword AsStringProtectedOverridesFunction ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) AsBooleanSelectCase msg.WParam.ToInt32()Case 13 ' enter Key IfTypeOfMe.ActiveControl Is TextBox Then SendKeys.Send("{Tab}")ReturnTrueEndIfEndSelectReturnMyBase.ProcessCmdKey(msg, keyData)EndFunction'ProcessCmdKey

PrivateSub Password_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Load PopulateUser()EndSubPrivateSub PopulateUser()Dim Connection AsNew OleDbConnection(ACCESS_CONNECTION_STRING)

Page 28: Thesis in Computerized Payroll System for Brangay Hall, Dita

lvUserName.Items.Clear() lvUserName.Sorting = SortOrder.AscendingDim cmdfill AsNew OleDbCommand("SELECT UserName, [Password] FROM [Password]", Connection)Try Connection.Open()Dim datareader As OleDbDataReader datareader = cmdfill.ExecuteReaderWhile datareader.ReadDim lvi AsNew ListViewItem lvi.Text = CStr(datareader("UserName")) lvUserName.Items.Add(lvi)EndWhileIf datareader.HasRows Then lvUserName.TopItem.Selected = True lvUserName.TopItem.Focused = True lvUserName.TopItem.EnsureVisible() lvUserName.Select()EndIfCatch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")Finally Connection.Close()EndTryEndSubPrivateSub RetrieveUser()Dim Connection AsNew OleDbConnection(ACCESS_CONNECTION_STRING)Dim cmdfill AsNew 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()EndTryEndSubPrivateSub AddUser()Try'Dim dbCommand As OleDbCommandDim DBConn As OleDbConnectionDim DBInsert AsNew OleDbCommand DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING) DBInsert.CommandText = "INSERT INTO [Password] VALUES (" _&"'"& txtUserName1.Text &"', " _&"'"& txtPassword1.Text &"')"Dim lvi AsNew ListViewItem lvi.Text = txtUserName1.Text lvUserName.Items.Add(lvi) clearTxtBox() DBInsert.Connection = DBConn

Page 29: Thesis in Computerized Payroll System for Brangay Hall, Dita

DBInsert.Connection.Open() DBInsert.ExecuteNonQuery() DBConn.Close() DBConn.Dispose()Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")EndTryEndSubPrivateSub UpdateUser()Try'Dim dbCommand As OleDbCommandDim DBConn As OleDbConnectionDim DBUpdate AsNew 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")EndTryEndSubPrivateSub DeleteUser()TryDim DBConn As OleDbConnectionDim dbCommand AsNew 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")EndTryEndSubPrivateSub clearTxtBox() txtUserName1.Text = "" txtUserName2.Text = "" txtPassword1.Text = "" txtPassword2.Text = "" txtConfirmPassword1.Text = "" txtConfirmPassword2.Text = "" txtOldPassword.Text = ""EndSubPrivateSub lvUserName_MouseDown(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lvUserName.MouseDownTryIf IsNothing(lvUserName.FocusedItem) ThenExitSub

Page 30: Thesis in Computerized Payroll System for Brangay Hall, Dita

strSelectedAssignCode = lvUserName.FocusedItem.TextIf e.Button = MouseButtons.Right ThenIf lvUserName.SelectedItems.Count > 0 Then ContextMenu1.Show(lvUserName, New Point(e.X, e.Y))EndIfEndIfCatch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly)EndTryEndSubPrivateSub lvUserName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lvUserName.SelectedIndexChangedTry'If IsNothing(lvUserName.FocusedItem) Then Exit SubCatch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly)EndTryEndSubPrivateSub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.ClickMe.Close()EndSubPrivateSub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) grpEdit.Hide() grpAdd.Show()EndSubPrivateSub mnuAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAdd.Click grpAdd.Visible = True grpEdit.Visible = False btnUpdate.Text = "&Save"EndSubPrivateSub 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()EndSubPrivateSub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.ClickIf btnUpdate.Text = "&Save"ThenIf txtPassword1.Text <> txtConfirmPassword1.Text Then MsgBox("Password does not match.", MsgBoxStyle.OKOnly)ExitSubEndIf AddUser()ElseIf txtOldPassword.Text <> strOldPassword Then MsgBox("Please enter the correct password in the Old Password field.", MsgBoxStyle.OKOnly)ExitSubEndIfIf txtPassword2.Text <> txtConfirmPassword2.Text Then MsgBox("Password does not match.", MsgBoxStyle.OKOnly)ExitSub

Page 31: Thesis in Computerized Payroll System for Brangay Hall, Dita

EndIf UpdateUser()EndIfEndSubPrivateSub mnuDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDelete.ClickIf strSelectedAssignCode = "Admin"Then MsgBox("Sorry you can't delete this account.", MsgBoxStyle.OKOnly)ExitSubEndIfIf MsgBox("Are you sure you want to delete this user?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then _ DeleteUser()EndSubPrivateSub Label23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label23.ClickEndSubEndClass

Page 32: Thesis in Computerized Payroll System for Brangay Hall, Dita