Praveen Kumar V

Download as pdf or txt
Download as pdf or txt
You are on page 1of 169

PROJECT REPORT ON

EMPLOYEE PAYROLL MANAGEMENT SYSTEM


Report submitted fulfilment of the requirements for the award of the Degree in

BACHELOR OF COMPUTER APPLICATION


BANGALORE UNIVERSITY

SUBMITTED BY:

PRAVEEN KUMAR V (15XESB7048)


Under the guidance of:

Ms. RAJI PAUL T


Lecturer
Dept. of Bachelor of Computer Application

EAST POINT COLLEGE OF HIGHER EDUCATION

BIDARAHALLI, BANGALORE - 49
DECLARATION

I do hereby declare that the project work entitled “EMPLOYEE PAYROLL


MANAGEMENT SYSTEM” submitted to the Bangalore University in the partial fulfilment
of the requirements for the award of Degree of Bachelor of Computer Application is a record
of confide and independent project work carried out by myself under the guidance and
supervision of

“MS. RAJI PAUL T”, Lecturer, Department of Bachelor of Computer Application and this
report does not form any part of any previous dissertations or reports previously submitted to
this University or any other Universities for the award of degree or diploma.

Name:

PRAVEEN KUMAR V (15XESB7048)


ACKNOWLEDGEMENT

We take this opportunity to express our deep sense of gratitude to our founder Chairman
Dr. Venkatapathi S.M

We express our sincere thanks to our respected Principal, Prof. Dr. Roopa T N, Director of
East Point College of Higher Education and Prof. Chaya Devi H B, HOD of Management
Science for providing all necessary help during our project work.

We also express our sincere thanks to the Coordinator of BCA Department


Ms. Namratha K S for her valuable guidance, keen interest and helpful during the project.

We would like to thank my friends, staff and all other who have directly and indirectly helped
me in the successful completion of this project.

Date:

Place: Bangalore

Name:

PRAVEEN KUMAR V (15XESB7048)


EMPLOYEE PAYROLL MANAGEMENT SYSTEM

DEPARTMENT OF BCA (EPCHE)


EMPLOYEE PAYROLL MANAGEMENT SYSTEM

SL.NO PARTICULARS PAGE NO

1 INTRODUCTION 1-4

2 INTRODUCTION TO MICROSOFT ACCESS 5 - 10

3 INTRODUCTION TO SOFTWARE 11 - 12
ENGINEERING

4 SOFTWARE REQUIREMENTS AND 13 - 14


SPECIFICATIONS

5 INTRODUCTION TO VISUAL BASIC 6.0 15 - 18

6 E – R DIAGRAMS 19 - 23

7 SOURCE CODE AND TESTING 24 - 147

8 SNAP SHOTS 148 - 160

9 CONCLUSION 161 - 162

10 BIBLIOGRAPHY 163 - 164

DEPARTMENT OF BCA (EPCHE)


EMPLOYEE PAYROLL MANAGEMENT SYSTEM

1
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

EMPLOYEE PAYROLL MANAGEMENT SYSTEM

PROJECT INTRODUCTION

Payroll system is the heart of any human resource system of an organization. The
solution has to take care of the calculation of salary as per rules of the company, income
tax calculation and various deductions to be done from the salary including statutory
deductions like Income tax and provident fund deductions. It has to generate pay-slip,
cheque summary and MIS reports.

It is understood that we are tired of managing thousand of odd papers, pay slips, payroll
reports, and salary details and so on. Imagine that we have a payroll processing system
which will generate our pay slips and payroll reports within seconds. We can help others
automated your payroll system by developing a customized payroll application that suits
your specific requirements.

Purpose:

Main aim of developing Employee Payroll Management is to provide an easy way not
only to automate all functionalities involved managing leaves and Payroll for the
employees of Company, but also to provide full functional reports to management of
Company with the details about usage of leave facility.

We are committed to bring the best way of management in the various forms of EPM.
We understand that EPM in not a product to be sold, it is a tool to manage the inner
operation of Company related to employee leave and Payroll.

2
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Scope:

This Application works in Multiple PC’s installed on multiple Computers but sharing
same database by which users of different department can use it sitting at different
locations simultaneously.

But in future we can make the Application where the database will be hosted in order to
manage the all departments which will be located in different places and by keeping
domain of Application as Online.

Benefits:

 To improve the efficiency.


 Quickly find out information of an employee details.
 To provide easy and faster access information.
 To provide user friendly environment.

3
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Tools Used In Development

Hardware:

Processor: Intel Core i3

RAM: 4 GB

Hard Disk: 1 TB

Laptop: DELL Inspiron 15 3567

Keypad: DELL

Mouse: DELL

Software:

Application Software:

Front End: Visual Basic 6.0

Data Base:

Back End: Microsoft Access

Operating System: Windows 10 Home Single Language

4
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

5
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Introduction to Microsoft Access:

A database is a collection of data as well as programs required to manage that data. The
data is stored in a tabular format, across rows and columns, in much the same way as in
the spread sheet. The difference lies in the fact that a Database Management System takes
care of complex calculations storing and other tasks that perhaps could not be performed
using a spread sheet.

Moreover most DBMS provide security for the data within the database. Complex
validations can also be taken care of by a DBMS, to ensure that entered into system is
valid.

We describe that the need for storing data within tables. In this context we briefly
outlined the evolution of the database. In this session, we deal with how to identify the
tables and the fields needed in application. We have user look at tables and related topics
such as data types and constraints. By the end of this session, we will have gone through
the steps involved in the creation of tables.

6
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Main Modules of Project:

* Login

* COMPANY MASTER
 Company
 Branch
 Department
 Designation
 Grade

* EMPLOYEE
 Employee Details

* LEAVE
 Leave Master
 Leave Availed

* LOAN
 Loan Master
 Loan Availed

* SALARY
 Payroll Generation

7
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Steps in designing a table


Designing a table would involve the following steps:
 Picking out the fields or the data items that would fit into each of the tables.
 Specifying the data type for each of the data items in a table.
 Providing a field size for the field, where possible.
 Enforcing constraints on the required fields.

In the session above, we already worked with identifying the tables and fields that fit into
each of this table. In the session that follow, we shall have a look at the data types, field
size and some of the constraints that can be enforced in MS Access XP.

The field name, field size, constraints and other properties comprise the “Structure” of
the table. It forms the basis on which data will be entered and maintained. This can be
considered as ‘Conceptual view’ to a table in a relational database. Visual DBMS like
MS Access provide a view called the ‘design view’ to enable users to create and modify
the structure of a table. For a person who used a non-Visual DBMS.

Data type
In different types of data items and corresponding field names have to be defined at the
time of creating the table.

The data types common to most RDBMS are:

 This data type is used to store a combination of characters and numeric data. In
some RDBMS, alphanumeric data type can be of two types. One having fixed size
and the other having a variable size.
 In MS-Access, the alphanumeric data type is referred to as the ‘text data type’
 And is of variable length. It can hold up to a maximum of 255 characters.

8
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

a) Numeric:

The numeric data type is used to store numbers. Most RDBMS have several
subcategories for the number data type. Each of these could be data types in them.
The most common among these are:

Numeric Description

Byte Stores number in the range 0 to 255; It occupies up to 2 bytes.

Integer This stores only integers. It occupies 2 bytes, that is it allows


number in the range of -32768 to 32767
Long Integer This occupies 4 bytes and stores much larger integers.

Float Stores real numbers, and provide a precision of up to 6 decimal


places.
Double Stores real number with a higher degree of precision.

b) Date/time:

This data type is common to most RDMS, and is used to store date and time and
stores time. Again, the format a date is stored differs depending on the RDBMS.

c) Boolean:

This data type is used to a Boolean value(True\False)


In MS-Access this data type is referred to as the ‘yes’ (‘True’ or ‘False’). It occupies
just one bit.

d) Memo:
Some RDBMS, like MS-Access also provide a data type for storing data that exceeds the
amount that can be stored in a ‘text’ field. As discussed earlier, a ‘text’ field in MS-

9
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Access can store up to 255 characters. To store anything that exceeds that, a memo data
type can be used. This data type allows the user to store up to 64000 characters.

Enforcing Constraints

A ‘Constraint’ is a ‘limitation’ or ‘restriction’ that is enforced on fields for verifying data


that is being entered into a table. Every RDBMS allows the user to place some constraints
on table.

Primary Key Constraints

A ‘Primary key’ constraint is one, which ensures that the user does not enter duplicate
values in the field or set of field on which the constraint is enforced.
A ‘Primary key’ constraint when placed on a field, or combination of fields, makes that
particular field or set of fields as the ‘Primary key’.

Check Constraints

Most RDBMS automatically validate value based on a field’s data type, i.e, text value is
not allowed into a date or numeric field. Some validation rules or ‘check constraints’ that
check the entering the database.

 NOT NULL CONSTRAINT


This constraint is used to ensure that the user does not enter a ‘NULL’ value into
a field.

 DEFAULT CONSTRAINT
This constraint is used to specify a value that will be displayed and stored in a
field by default, in case the user does not enter any value.

10
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

11
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Introduction to Software Engineering


The SRS is the starting point of software activity. It is produced at the culmination of the
analysis book. The function and performance allocated to the software as a part of
description, details, functional description, detailed functional constraints description,
appropriate validation criteria and other data requirement.

Specification consists of two basic activities, they are:

 Problem analysis.
 System requirements specification.

12
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

13
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

System Requirement and Specification


The process of SRS is to bridge the communication gap between the user and the
programmers. SRS is a medium, which the client and the user needs are accurately and
unambiguously specified. In deed forms the basis for the software development.

Computer
System
Engineering

Software
Requirement
Analysis

Software
Design

Fig: Overlap of Analysis Task

14
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

15
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Introduction to VB6.0:

Visual Basic is a programming language and a powerful front end tools for developing
windows applications, as the name suggests, programming with Visual Basics is
accomplished visually. Visual basic is a graphical user interface (GUI). Visual Basic is a
programming language with the inbuilt ability to create user interface quickly and easily.
While writing the program, you are able to see how your program will look during your
run time. This is the great advantage over the other programming languages. In visual
basic you have available tool box of these elements. You can create a new window called
Forms. Programmers, creates the GUI by selecting an object, setting the object properties
to define the object appearance like colour, size, images, etc., and behaviour and writes
code that responds to a particular event that occurs in the interface. These program work
on the text mode using the extended character set to give the user the feeling of a
graphical environment. Visual Basic made programming under the GUI environment
easy and fast.

Feasibility Analysis
It is highly feasible as it provides all the employee management process in an easier
method by saving the lot of time and also it provides cost effective solution.

Economic Feasibility
The system is economically acceptable as it provides a cost effective solution because,
the developer of the system take very few risks. The benefits from the system outs
number of cost.

Technical Feasibility
The system is technically acceptable as it can be used in all employee organization.
Where it automates the annual activities.

16
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Operational Feasibilities
The user who has basic knowledge can operate the software.

Cost us benefit Analysis


This software is very beneficial to its users as it is very accurate in maintaining all the
required details and it is prescriptive in nature and its benefits are so high that it outs the
cost of the project. This software is well designed in such a manner the expenditure of the
software is very less compared to its benefits.

Environment
The software is developed on VISUAL BASIC 6.0 as the front-end tool and MS-
ACCESS-XP and back end tool under the MS-WINDOWS XP platform as an operating
system.

Software specification
 The software should be in a position to maintain all the required details.
 The software should be readable, understandable and upgradeable.
 The software must work on a variety of hardware’s.

Features of software
 The software is simple yet efficient.
 The minimum configuration required is a 286 machine.
 It is user friendly.
 The software is very successful.
 Current dates, time and other details of different levels are automatically
generated by the system.
 It is because it restricts more acceptation part from the user side.
 The software itself generates most of all the acceptation part.

17
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Design Constraints:

Hardware design constraints:


The design constraints regarding the hardware is concerned is that it cannot be run on
machine less than 150 machines and least needs 32 MB RANDOM ACCESS MEMORY
(RAM) and hard disk capacity of 20 MB for the minimum user.

Software Design Constraints:


The software design constraint is that it should particularly have MS Access XP 2000 as
back-end and visual basic 6.0 as front-end tool.

General design constraints:


The general constraints are that it is fast as windows based application any failure in VB
coding result in non-functioning of the software if any tables are corrupted in MS Access
XP will result in wrong values.

18
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

19
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOGIN DETAILS:

USERNAME PASSWORD

Cancel

DEPARTMENT DETAILS:

BRANCH DEPARTMENT DEPT


CODE CODE

DEPT
NAME

20
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

COMPANY DETAILS:

COMPANY
NAME ADDRESS
CODE

PHONE COMPANY FAX


DETAILS

E-MAIL DATE OF
WEBSITE COMMENC
E

BRANCH DETAILS:

COMPANY
CODE ADDRESS
BRANCH
CODE

TELE BRANCH FAX


PHONE DETAILS

E-MAIL DATE OF
WEBSITE COMMENC
E

21
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

GRADE DETAILS:

GRADE GRADE DESG.


CODE CODE

GRADE
NAME

DESIGNATION DETAILS:

DEPT. DESIGNATION DESG.


CODE CODE

DESG.
NAME

22
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

EMPLOYEE DETAILS:

NAME
FATHER
PHONE NAME

QUALIFICA EMPLOYEE ADDRESS


TION PERSONAL DETAILS

E-MAIL DATE OF
DOB JOINING

LOAN DETAILS:

TYPE
AMOUNT
AMOUNT REPAID
AVAILAED

RATE OF LOAN DETAILS TOTAL


INTEREST INSTALMENTS

BALANCE
DATE INSTALMENTS
AMOUNT
REPAID

23
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

24
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOGIN FORM:
Dim s1 As String
Dim s2 As String
Private Sub cmdcancel_Click()
Unload Me
End Sub

Private Sub cmdlogin_Click()


If txtusername = "" Or txtpassword = "" Then
MsgBox "Please enter all details"
txtusername.SetFocus
Exit Sub
End If
s1 = txtusername.Text
s2 = txtpassword.Text
Adologin.RecordSource = " select * from login where username = '" + s1 + "' and
password = '" + s2 + "'"
Adologin.Refresh
If Adologin.Recordset.RecordCount = 0 Then
MsgBox "Invalid Login"
Else
MsgBox "Login Successful"
MDIForm1.Show
Exit Sub
End If
txtusername.Text = ""
txtpassword.Text = ""
txtusername.SetFocus
End Sub

25
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

COMPANY:
Option Explicit
Dim enableflag As Integer
'-------add record to the table---------
Private Sub cmdadd_Click()
Dim code, str, num, alp As String
Dim i, K As Integer
Call clear_all(Me) 'procedure in module
cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
' for automatic generation of branch code:user's choice
If cmp.EOF = cmp.BOF And cmp.RecordCount < 1 Then
chkcode:
code = InputBox("Please enter the company code (like CMP10):", "Payroll : Branch
Code Generation")
K = Len(code)
If K > 10 Then
MsgBox "You have entered a value of more than 10 character length" & Chr(13) &
"Please enter only less than 10 characters", vbCritical, "Payroll : Data entry error"
GoTo chkcode
End If

26
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

For i = K To 1 Step -1

str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alp = Mid(code, 1, i)
num = Mid(code, i + 1)
Exit For
End If
Next i
If num = "" Then
MsgBox "Invalid value for company code, Please enter like 'BRH10'. ", , "Payroll:Branch
Details"
GoTo chkcode
Else
txt_cmpcode = code
End If
If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
txt_cmpname.SetFocus
Else
cmp.MoveLast
code = cmp(0)
K = Len(code)
For i = K To 1 Step -1
str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alp = Mid(code, 1, i)
num = Mid(code, i + 1)

27
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Exit For
End If

Next i
If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
txt_cmpcode = alp & (CInt(num) + 1)
txt_cmpcode.SetFocus
End If
cmp.AddNew
End Sub
'----cancel updations-----------
Private Sub cmdcancel_Click()
cmp.CancelUpdate
MsgBox "Update cancelled"
Call chk_displayrec
cmdadd.Enabled = True
cmddel.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmp.MoveFirst
Call get_cmpdata

28
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdadd.SetFocus
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure

enableflag = 2
End If
End Sub
'-------delete a record ------------
Private Sub cmddel_Click()
Dim i As Integer
If txt_cmpcode.Text = "" Or txt_cmpname.Text = "" Then
MsgBox "No record found to delete. " & Chr(13) & "To delete, first select a record.",
vbCritical, "Payroll : Delete error"
Exit Sub
End If
i = MsgBox("Delete this record ? ", vbYesNo, "Payroll:company Details")
If i = vbYes Then
cmp.Delete
MsgBox "Record Deleted", , "Payroll"
Call clear_all(Me)
If cmp.RecordCount < 1 Then
MsgBox "Zero records in the table now. " & Chr(13) & "If required start entering
records now", vbInformation, "Payroll : Data Entry"
Call disableall(Me)
cmdadd.Enabled = True
cmdExit.Enabled = True
Else
Call chk_displayrec
End If
End If

29
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub

'------edit record----------
Private Sub cmdedit_Click()

cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
If cmp.EOF Then
cmp.MovePrevious
ElseIf cmp.BOF Then
cmp.MoveNext
End If
cmp.Edit
Call get_cmpdata
If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
txt_cmpname.SetFocus
End Sub
'-------closing the form--------
Private Sub cmdexit_Click()

30
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Unload cmpdetails
'Call menu_disable
End Sub
'-----move to the first record-----------

Private Sub cmdfirst_Click()


On Error GoTo err_movfirst
cmp.MoveFirst
get_cmpdata
Exit Sub
err_movfirst:
MsgBox "Zero records in the Company Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'------move to the last record---------
Private Sub cmdlast_Click()
On Error GoTo err_movlast
cmp.MoveLast
get_cmpdata
Exit Sub
err_movlast:
MsgBox "Zero records in the Company Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'--------move to the next record--------
Private Sub cmdnext_Click()
On Error GoTo err_movnext
cmp.MoveNext
If cmp.EOF Then

31
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

MsgBox "Current record is the last record", , "Payroll"


cmp.MovePrevious
Call get_cmpdata
Exit Sub
End If
Call get_cmpdata

Exit Sub
err_movnext:
MsgBox "Zero records in the Company Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'-----------move to the previous record--------
Private Sub cmdprev_Click()
On Error GoTo err_movprev
cmp.MovePrevious
If cmp.BOF Then
MsgBox "Current record is the First record"
cmp.MoveNext
Call get_cmpdata
Exit Sub
End If
Call get_cmpdata
Exit Sub
err_movprev:
MsgBox "Zero records in the Company Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'--------save record---------------
Private Sub cmdsave_Click()

32
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

'Call chk_nullvalue(txt_cmpname)
If txt_cmpname.Text = "" Then
MsgBox "Company name cannot be null." & Chr(13) & "Enter the company name and
then Click on Save.", vbCritical, "Payroll : Data entry error"
txt_cmpname.SetFocus
Exit Sub
End If

cmdadd.Enabled = True
cmddel.Enabled = True

cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
Call put_cmpdata
cmp.Update
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
End If
Call chk_displayrec
End Sub
'default settings in form load

Private Sub Form_Load()


Dim frgkey_status As Integer

33
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)


Set cmp = db.OpenRecordset("company", dbOpenDynaset)
frgkey_status = chk_rscount("company")
If frgkey_status < 1 Then
MsgBox "Zero records in the Company Table" & Chr(13) & "Start adding records.",
vbInformation, "Payroll :Data entry error"
enableflag = 1

Call disableall(Me) 'procedure in module


enableflag = 2
cmdadd.Enabled = True

cmdExit.Enabled = True
Exit Sub
Else
cmdcancel.Enabled = False
cmdsave.Enabled = False
enableflag = 1
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
Call chk_displayrec
End If
Me.Top = 750
Me.Left = 2200
txt_addr1.Text = ""
txt_addr2.Text = ""
txt_addr3.Text = ""
txt_cmpcode.Text = ""
txt_cmpname.Text = ""
txt_email.Text = ""

34
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

txt_fax.Text = ""
txt_pincode.Text = ""
txt_tel1.Text = ""
txt_tel2.Text = ""
txt_web.Text = ""
'Call menu_disable
End Sub
'to extract values from the database

Public Sub get_cmpdata()


txt_cmpcode = cmp(0)
txt_cmpname = cmp(1)
txt_addr1 = cmp(2)

txt_addr2 = cmp(3)
txt_addr3 = cmp(4)
txt_pincode = cmp(5)
txt_tel1 = cmp(6)
txt_tel2 = cmp(7)
txt_fax = cmp(8)
txt_email = cmp(9)
txt_web = cmp(10)
TxtDate.Text = cmp(11)
End Sub
'to append values to the database
Public Sub put_cmpdata()
cmp(0) = UCase(txt_cmpcode)
cmp(1) = UCase(txt_cmpname)
cmp(2) = UCase(txt_addr1)
cmp(3) = UCase(txt_addr2)

35
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmp(4) = UCase(txt_addr3)
cmp(5) = Val(txt_pincode)
cmp(6) = UCase(txt_tel1)
cmp(7) = UCase(txt_tel2)
cmp(8) = UCase(txt_fax)
cmp(9) = txt_email
cmp(10) = txt_web
cmp(11) = Format(TxtDate.Text, "dd/mm/yy")
End Sub

Private Sub TxtDate_LostFocus()


If IsDate(TxtDate.Text) = False Then
MsgBox "You have entered a wrong value for date." & Chr(13) & "Valid date
format :'dd/mm/yy'", vbCritical, "Payroll : Data entry error"
TxtDate.Text = ""
TxtDate.SetFocus
End If
End Sub

Public Sub chk_displayrec()


If cmp.RecordCount > 0 Or cmp.BOF <> cmp.EOF Then
cmp.MoveFirst
Call get_cmpdata
End If
End Sub

36
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

BRANCH:
Option Explicit
Dim enableflag As Integer
'------add records to the table-------
Private Sub cmdadd_Click()
Dim code, str, num, alp As String
Dim i, K As Integer
Call clear_all(Me) 'procedure in module
cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
' for automatic generation of branch code:user's choice
If brh.EOF = brh.BOF And brh.RecordCount < 1 Then
chkcode:
code = InputBox("Please enter the branch code (like BRH10):", "Payroll : Branch Code
Generation")
K = Len(code)
For i = K To 1 Step -1

37
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alp = Mid(code, 1, i)
num = Mid(code, i + 1)
Exit For
End If
Next i
If num = "" Then
MsgBox "Invalid value for branch code, Please enter like 'BRH10'. ", , "Payroll:Branch
Details"
GoTo chkcode
Else
txt_brhcode = code
End If
Else
brh.MoveLast
code = brh(0)
K = Len(code)
For i = K To 1 Step -1
str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alp = Mid(code, 1, i)
num = Mid(code, i + 1)
Exit For
End If
Next i
txt_brhcode = alp & (CInt(num) + 1)
txt_brhname.SetFocus
End If
brh.AddNew

38
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub
'----cancel updations-----------
Private Sub cmdcancel_Click()
brh.CancelUpdate
MsgBox "Update cancelled"
Call chk_displayrec
cmdadd.Enabled = True
cmddel.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False

If brh.RecordCount < 1 Then


Call norec_action
End If
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
End If
End Sub

'-------delete records as per users choice--------


Private Sub cmddel_Click()
Dim i As Integer
i = MsgBox("Delete this record ? ", vbYesNo, "Payroll")

39
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If i = vbYes Then
If Combo1.Text = "" Or txt_brhcode.Text = "" Then
MsgBox "No record found to delete. " & Chr(13) & "To delete, first select a record.",
vbCritical, "Payroll : Delete error"
Exit Sub
End If
brh.Delete
MsgBox "Record Deleted", , "Payroll"
Call clear_all(Me) 'procedure in module
If brh.RecordCount < 1 And brh.BOF = brh.EOF Then
MsgBox "Zero records in the table now. " & Chr(13) & "If required start entering
records now", vbInformation, "Payroll : Data Entry"
Call norec_action
Else
Call chk_displayrec
End If
End If
End Sub
'--------edit values in the record----------
Private Sub cmdedit_Click()
cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True

40
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

brh.Edit
Call get_brhdata
If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
End Sub
'-------exit from the form--------
Private Sub cmdexit_Click()
Call menu_disable
Unload brhdetails
End Sub
'--move to the first record-------
Private Sub cmdfirst_Click()
On Error GoTo err_movfirst
brh.MoveFirst
Call get_brhdata
Exit Sub
err_movfirst:
MsgBox "Zero records in the Branch Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'-----move to the last record-----
Private Sub cmdlast_Click()
On Error GoTo err_movlast
brh.MoveLast
Call get_brhdata
Exit Sub
err_movlast:

41
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

MsgBox "Zero records in the Branch Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'----move to the next record--------
Private Sub cmdnext_Click()
On Error GoTo err_movnext
brh.MoveNext
If brh.EOF Then
MsgBox "Current record is the last record", , "Payroll"
brh.MovePrevious
Call get_brhdata
Exit Sub
End If
Call get_brhdata
Exit Sub
err_movnext:
MsgBox "Zero records in the Branch Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'---move to the previous record-----
Private Sub cmdprev_Click()
On Error GoTo err_movprev
brh.MovePrevious
If brh.BOF = True Then
MsgBox "Current record is the First record", , "Payroll"
brh.MoveNext
Call get_brhdata
Exit Sub
End If
Call get_brhdata

42
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Exit Sub
err_movprev:
MsgBox "Zero records in the Branch Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'------save records to the table-------
Private Sub cmdsave_Click()
If txt_brhname.Text = "" Then
MsgBox "Branch name cannot be empty." & Chr(13) & "First enter the branch name and
then click on Save. ", vbCritical, "Payroll : Data entry error"
txt_brhname.SetFocus
Exit Sub
End If
If Combo1.Text = "" Or Combo1.ListIndex = 0 Then
MsgBox "Company code is either empty or you have selected the heading. " & Chr(13)
& "Select a Company code and name.", vbCritical, "Payroll : Data entry error"
Combo1.Text = ""
Combo1.SetFocus
Exit Sub
End If
cmdadd.Enabled = True
cmddel.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False

43
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call put_brhdata
brh.Update
Call chk_displayrec
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
End If
End Sub

'---default settings in form load -------


Private Sub Form_Load()
Dim frgkey_status As Integer
Me.Top = 750
Me.Left = 1500
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set brh = db.OpenRecordset("branch", dbOpenDynaset)
frgkey_status = chk_rscount("company")
Set cmp = db.OpenRecordset("company", dbOpenDynaset)
If frgkey_status < 1 Then
MsgBox "Zero records in the Company Table" & Chr(13) & "First add records to the
Company Table and then start adding records to the Branch Table. ", vbCritical,
"Payroll :Data entry error"
Call disableall(Me) 'procedure in module
cmdExit.Enabled = True
Exit Sub
Else
'====if brh contains 0 records then only add and exit buttons should be
enabled========
If brh.RecordCount < 1 Then
Call norec_action

44
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Else
Call chk_displayrec
End If
txt_brhcode.Enabled = False
cmdsave.Enabled = False
cmdcancel.Enabled = False
enableflag = 1
'set flag value for enabling text boxes
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
Call get_cmpcode 'get company code from company table
End If
Call menu_disable
txt_addr1.Text = ""
txt_addr2.Text = ""
txt_addr3.Text = ""
txt_brhcode.Text = ""
txt_brhname.Text = ""
txt_email.Text = ""
txt_fax.Text = ""
txt_pin.Text = ""
txt_tel.Text = ""
txt_web.Text = ""
txt_dateofcomm.Text = ""
Combo1 = ""
End Sub
'-------append values to the table--------------
Public Sub get_brhdata()
With brh
txt_brhcode = .Fields(0)

45
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Combo1.Text = .Fields(1)
txt_brhname = .Fields(2)
txt_addr1 = .Fields(3)
txt_addr2 = .Fields(4)
txt_addr3 = .Fields(5)
txt_pin = .Fields(6)
txt_tel = .Fields(7)
txt_fax = .Fields(8)
txt_email = .Fields(9)
txt_web = .Fields(10)
txt_dateofcomm = .Fields(11)
End With
End Sub
'----append values to the fields in the table---------
Public Sub put_brhdata()
Dim str, str1, lval As String
Dim i As Integer
'-------------extract cmpcode from combobox text value
str = Combo1.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
lval = Left(str, i - 1)
Exit For
End If
Next
With brh
Fields(0) = UCase(txt_brhcode)
If lval = "" Then
Fields(1) = UCase(str)

46
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Else
.Fields(1) = UCase(lval)
End If
.Fields(2) = UCase(txt_brhname)
.Fields(3) = UCase(txt_addr1)
.Fields(4) = UCase(txt_addr2)
.Fields(5) = UCase(txt_addr3)
.Fields(6) = Val(txt_pin)
.Fields(7) = UCase(txt_tel)
.Fields(8) = UCase(txt_fax)
.Fields(9) = UCase(txt_email)
.Fields(10) = UCase(txt_web)
.Fields(11) = Format(txt_dateofcomm.Text, "dd/mm/yy")
End With
End Sub

Public Sub get_cmpcode()


cmp.MoveFirst
Combo1.AddItem "Code Name"
Do While cmp.EOF = False
Combo1.AddItem cmp.Fields(0) & " " & cmp.Fields(1)
cmp.MoveNext
Loop
End Sub

Private Sub norec_action()


cmdsave.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdcancel.Enabled = False

47
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdfirst.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdlast.Enabled = False
End Sub
Private Sub txt_dateofcomm_LostFocus()
If IsDate(txt_dateofcomm.Text) = False Then
MsgBox "You have entered a wrong value for date." & Chr(13) & "Valid date
format :'dd/mm/yy'", vbCritical, "Payroll : Data entry error"
txt_dateofcomm.Text = ""
txt_dateofcomm.SetFocus
End If
End Sub

Public Sub chk_displayrec()


If brh.RecordCount > 0 Or brh.BOF <> brh.EOF Then
brh.MoveFirst
Call get_brhdata
End If
End Sub

48
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

DEPARTMENT:
Option Explicit
Dim enableflag As Integer
'------add records to table -----
Private Sub cmdadd_Click()
Dim code, str1, str2, num As String
Dim i, K As Integer

Call clear_all(Me) 'procedure in function

cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True

If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
'generate next / new department code
If dpt.EOF = dpt.BOF And dpt.RecordCount < 1 Then
inputagain:

49
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

code = InputBox("Please enter the department code (like :TRN10)", "Payroll:Department


Code Generation")
K = Len(code)
For i = K To 1 Step -1
str1 = Mid(code, i, 1)
If IsNumeric(str1) <> True Then
str2 = Left(code, i)
num = Mid(code, i + 1)
Exit For
End If
Next
If num = "" Then
MsgBox "Invalid department code. Please enter like : TRN10", , "Payroll:Department
Details"
GoTo inputagain
Else
txt_dptcode = code
End If
Else
dpt.MoveLast
code = dpt.Fields(0)
K = Len(code)
For i = K To 1 Step -1
str1 = Mid(code, i, 1)
If IsNumeric(str1) <> True Then
str2 = Left(code, i)
num = Mid(code, i + 1, K)
Exit For
End If
Next

50
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

txt_dptcode = str2 & (CInt(num) + 1)


End If
dpt.AddNew
End Sub
'------delete records from the table---------
Private Sub cmddel_Click()
Dim i As Integer
i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll:Department
Details")
If i = vbYes Then
If Combo1.Text = "" Or txt_dptcode.Text = "" Then
MsgBox "No record found to delete. " & Chr(13) & "To delete, first select a record.",
vbCritical, "Payroll : Delete error"
Exit Sub
End If
dpt.Delete
MsgBox "Record Deleted"
Call clear_all(Me) 'procedure in module
If dpt.RecordCount < 1 And dpt.EOF = dpt.BOF Then
MsgBox "Zero records in the table now." & Chr(13) & "If required start entering records
now", vbInformation, "Payroll : Data Entry"
Call norec_action
Else
Call chk_displayrec
End If
End If
End Sub
'--------editing records--------
Private Sub cmdedit_Click()
cmdadd.Enabled = False

51
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
dpt.Edit
Call get_dptdata

If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
End Sub
'---------exit form----------
Private Sub cmdexit_Click()
Unload deptdetails
Call menu_disable
End Sub

Private Sub cmdfirst_Click()


On Error GoTo err_movfirst
dpt.MoveFirst
Call get_dptdata
Exit Sub
err_movfirst:

52
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

MsgBox "Zero records in the Department Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

Private Sub cmdlast_Click()


On Error GoTo err_movlast
dpt.MoveLast
Call get_dptdata
Exit Sub
err_movlast:
MsgBox "Zero records in the Department Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

Private Sub cmdnext_Click()


On Error GoTo err_movnext
dpt.MoveNext
If dpt.EOF Then
MsgBox "Current record is the last record", , "Payroll"
dpt.MovePrevious
Call get_dptdata
Exit Sub
Else
Call get_dptdata
End If
Exit Sub
err_movnext:
MsgBox "Zero records in the Department Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

53
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub cmdprev_Click()


On Error GoTo err_movprev
dpt.MovePrevious
If dpt.BOF Then
MsgBox "Current record is the first record", , "Payroll"
dpt.MoveNext
Call get_dptdata
Exit Sub
Else
Call get_dptdata
End If
Exit Sub
err_movprev:
MsgBox "Zero records in the Department Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'---------save record--------
Private Sub cmdsave_Click()
If txt_dptname.Text = "" Then
MsgBox "Department name cannot be empty. Enter a name for the department and then
click on Save", vbCritical, "Payroll : Data entry error"
txt_dptname.SetFocus
Exit Sub
End If
cmdadd.Enabled = True
cmddel.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True

54
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
Call put_dptdata
dpt.Update
Call chk_displayrec
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
End If
End Sub
Private Sub Combo1_LostFocus()
If Combo1.ListIndex = 0 Or Combo1.Text = "" Then
MsgBox "You have not selected the company code or you have selected the heading." &
Chr(13) & "Select the values and not the heading.", vbCritical, "Payroll :Data entry error"
Combo1.Text = ""
Combo1.SetFocus
End If
End Sub

'------set form default properties -------------


Private Sub Form_Load()
Dim frgkey_status As Integer
Me.Top = 750
Me.Left = 1500
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set brh = db.OpenRecordset("branch", dbOpenDynaset)
frgkey_status = chk_rscount("branch")
Set dpt = db.OpenRecordset("department", dbOpenDynaset)

55
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If frgkey_status < 1 Then


MsgBox "Zero records found in Branch Table" & Chr(13) & "First add records to the
Branch Table and then start adding records to the department table.", vbCritical,
"Payroll :Data entry error"
Call disableall(Me) 'procedure in module
cmdExit.Enabled = True
Exit Sub
Else
'====if brh contains 0 records then only add and exit buttons should be
enabled========
If dpt.RecordCount < 1 Then
Call norec_action
Else
Call chk_displayrec
End If
txt_dptcode.Enabled = False
cmdsave.Enabled = False
cmdcancel.Enabled = False
enableflag = 1 'set flag value for enabling text boxes
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
Call get_brhcode
End If
Call menu_disable
txt_dptcode.Text = ""
txt_dptname.Text = ""
Combo1 = ""
End Sub
'--------extract branch code from branch table-----
Public Sub get_brhcode()

56
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

brh.MoveFirst
Combo1.AddItem "Branch Code Name"
Do While brh.EOF = False
Combo1.AddItem brh.Fields(0) & " " & brh.Fields(2)
brh.MoveNext
Loop
End Sub
'-------get dept details from dept table ------
Public Sub get_dptdata()
With dpt
txt_dptcode = .Fields(0)
Combo1.Text = .Fields(1)
txt_dptname = .Fields(2)
End With
End Sub
'--------put dept details from dept table -------
Public Sub put_dptdata()
Dim str, str1, str2 As String
Dim i As Integer
'---------to extract branch code from the combo box
str = Combo1.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
str2 = Left(str, i)
Exit For
End If
Next
With dpt
.Fields(0) = UCase(txt_dptcode)

57
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If str2 = "" Then


.Fields(1) = UCase(str)
Else
.Fields(1) = UCase(str2)
End If
.Fields(2) = UCase(txt_dptname)
End With
End Sub
'----cancel updations-----------
Private Sub cmdcancel_Click()
dpt.CancelUpdate
MsgBox "Update cancelled"
Call chk_displayrec
cmdadd.Enabled = True
cmddel.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
End If
End Sub

'Currently no records in the department table

58
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

'Allow user only to add record / exit form


Private Sub norec_action()
cmdsave.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdcancel.Enabled = False
cmdfirst.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdlast.Enabled = False
End Sub

Public Sub chk_displayrec()


If dpt.RecordCount > 0 Or dpt.BOF <> dpt.EOF Then
dpt.MoveFirst
Call get_dptdata
End If
End Sub

59
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

DESGANATION:
Option Explicit
Dim enableflag As Integer
'-------add records to the database-----------
Private Sub cmdadd_Click()
Dim code, str, alpa, num As String
Dim i, K As Integer
If enableflag = 2 Then
Call txtcmb_disable(Me) 'Procedure in module
enableflag = 1
End If
Call clear_all(Me) 'Procedure in module
cmdadd.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
'generate new / next designation code
If dsg.EOF = dsg.BOF And dsg.RecordCount < 1 Then
inputagain:
code = InputBox("Please input a starting Designation code:(like A1)", "Designation
details:Code Generation")
For i = Len(code) To 1 Step -1
str = Mid(code, i, 1)

60
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If IsNumeric(str) <> True Then


alpa = Left(code, i)
num = Mid(code, i + 1, Len(code) - 1)
Exit For
End If
Next i
If num = "" Then
MsgBox "Invalid Code. Please enter code like : A1", vbCritical + vbOKOnly, "Payroll"
GoTo inputagain
End If
txt_dsgcode.Text = code
Else
dsg.MoveLast
code = dsg.Fields(0)
For i = Len(code) To 1 Step -1
str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alpa = Left(code, i)
num = Mid(code, i + 1, Len(code) - 1)
Exit For
End If
Next i
txt_dsgcode.Text = alpa & (CInt(num) + 1)
End If
dsg.AddNew
End Sub

Private Sub cmdcancel_Click()


If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure

61
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

enableflag = 2
End If
dsg.CancelUpdate
MsgBox "Update cancelled. "
Call chk_displayrec
cmdadd.Enabled = True
cmdedit.Enabled = True
cmddel.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
End Sub
'---------delete the records in the database---------
Private Sub cmddel_Click()
Dim i As Integer
i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll")
If i = vbYes Then
If Combo1.Text = "" Or txt_dsgcode.Text = "" Then
MsgBox "No record found to delete. " & Chr(13) & "To delete, first select a record.",
vbCritical, "Payroll : Delete error"
Exit Sub
End If
dsg.Delete
Call clear_all(Me) 'procedure in module
If dsg.RecordCount < 1 Or dsg.EOF = dsg.BOF Then
MsgBox "Zero records in the table now. If required, you can add records now"

62
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call norec_action
Exit Sub
Else
Call chk_displayrec
End If
End If
End Sub
'---------edit the records in the database------------
Private Sub cmdedit_Click()
Call getdata
If enableflag = 2 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 1
End If
dsg.Edit
cmdadd.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
End Sub
Private Sub cmdexit_Click()
Call menu_disable
Unload Me
End Sub

63
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub cmdfirst_Click()


On Error GoTo err_movfirst
dsg.MoveFirst
Call getdata
Exit Sub
err_movfirst:
MsgBox "Zero records in the Designation Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

Private Sub cmdlast_Click()


On Error GoTo err_movlast
dsg.MoveLast
Call getdata
Exit Sub
err_movlast:
MsgBox "Zero records in the Designation Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

Private Sub cmdnext_Click()


On Error GoTo err_movnext
dsg.MoveNext
If dsg.EOF Then
MsgBox "Current record is the last record", , "Payroll"
dsg.MovePrevious
Call getdata
Exit Sub
Else
Call getdata

64
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
Exit Sub
err_movnext:
MsgBox "Zero records in the Designation Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

Private Sub cmdprev_Click()


On Error GoTo err_movprev
dsg.MovePrevious
If dsg.BOF Then
MsgBox "Current record is the first record", , "Payroll"
dsg.MoveNext
Call getdata
Exit Sub
Else
Call getdata
End If
Exit Sub
err_movprev:
MsgBox "Zero records in the Designation Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'---------save the user input to the backend----------
Private Sub cmdsave_Click()
If txt_dsgname.Text = "" Then
MsgBox "Designation name cannot be empty." & Chr(13) & "Enter a value for
designation name and then Click on Save. ", vbCritical, "Payroll : Data entry error"
txt_dsgname.SetFocus
Exit Sub

65
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
cmdadd.Enabled = True
cmdedit.Enabled = True
cmddel.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
Call putdata
dsg.Update
If enableflag = 1 Then
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
End If
Call chk_displayrec
End Sub

Private Sub Combo1_LostFocus()


If Combo1.ListIndex = 0 Then
MsgBox "You have selected the heading." & Chr(13) & "Select the values and not the
heading.", vbCritical, "Payroll :Data entry error"
Combo1.Text = ""
Combo1.SetFocus
End If
End Sub

'---------default form settings -----------------

66
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub Form_Load()


Dim frgkey_status As String
Me.Top = 500
Me.Left = 1750
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set dpt = db.OpenRecordset("department", dbOpenDynaset)
frgkey_status = chk_rscount("department")
Set dsg = db.OpenRecordset("designation", dbOpenDynaset)
If frgkey_status < 1 Then
MsgBox "No records found in Department Table" & Chr(13) & "Cannot open
Designation details for data entry", vbCritical, "Payroll :Data entry error"
Call disableall(Me) 'procedure in module
cmdExit.Enabled = True
Exit Sub
Else
Call getdeptinfo
'====if brh contains 0 records then only add and exit buttons should be
enabled========
If dsg.RecordCount < 1 Then
Call norec_action
Exit Sub
Else
Call chk_displayrec
enableflag = 1
Call txtcmb_disable(Me) 'module procedure
enableflag = 2
cmdsave.Enabled = False
cmdcancel.Enabled = False
End If
End If

67
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call menu_disable
txt_dsgcode.Text = ""
txt_dsgname.Text = ""
Combo1 = ""
End Sub
'------------append values from backend to the form ------
Public Sub getdata()
With dsg
txt_dsgcode.Text = .Fields(0)
Combo1.Text = .Fields(1)
txt_dsgname.Text = .Fields(2)
End With
End Sub
'-----fetch values from the backend to the textboxes----------
Public Sub putdata()
Dim i As Integer
Dim str, str1, str2 As String
str = Combo1.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
str2 = Left(str, i)
Exit For
End If
Next i
With dsg
.Fields(0) = UCase(txt_dsgcode.Text)
If str2 = "" Then
.Fields(1) = UCase(str)
Else

68
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

.Fields(1) = UCase(str2)
End If
.Fields(2) = UCase(txt_dsgname.Text)
End With
End Sub
'---get department code from dept table
Public Sub getdeptinfo()
dpt.MoveFirst
Combo1.AddItem "Department.Code Name"
Do While dpt.EOF = False
Combo1.AddItem (dpt(0) & " " & dpt(2))
dpt.MoveNext
Loop
End Sub

'-------if Currently no records in the department table


''-------Allow user only to add record / exit form
Public Sub norec_action()
cmdsave.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdcancel.Enabled = False
cmdfirst.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdlast.Enabled = False
End Sub
Public Sub chk_displayrec()
If dsg.RecordCount > 0 Or dsg.BOF <> dsg.EOF Then
dsg.MoveFirst

69
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call getdata
End If
End Sub

70
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

GRADE:
Option Explicit
Dim enableflag As Integer

Private Sub cmdadd_Click()


Dim code, str1, str2, num As String
Dim i, K As Integer

Call clear_all(Me) 'procedure in module


If enableflag = 2 Then
Call txtcmb_disable(Me) 'procedure in module
enableflag = 1
End If
cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
'generate new / next grade code

If grd.EOF = grd.BOF And grd.RecordCount < 1 Then


inputagain:
code = InputBox("Please enter the Grade Code (like :G1)", "Payroll : Grade Code
Generation")
K = Len(code)

71
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

For i = K To 1 Step -1
str1 = Mid(code, i, 1)
If IsNumeric(str1) <> True Then
str2 = Left(code, i)
num = Mid(code, i + 1)
Exit For
End If
Next
If num = "" Then
MsgBox "Invalid Grade code. Please enter like : G1", , "Payroll:Grade Details"
GoTo inputagain
Else
txt_grdcode = code
End If
Else
grd.MoveLast
code = grd.Fields(0)
K = Len(code)
For i = K To 1 Step -1
str1 = Mid(code, i, 1)
If IsNumeric(str1) <> True Then
str2 = Left(code, i)
num = Mid(code, i + 1)
Exit For
End If

Next
txt_grdcode = str2 & (CInt(num) + 1)
End If
grd.AddNew

72
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub

Private Sub cmdcancel_Click()

grd.CancelUpdate
MsgBox "Update cancelled"
Call chk_displayrec
cmdadd.Enabled = True
cmddel.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
If enableflag = 1 Then
Call txtcmb_disable(Me) 'procedure in module
enableflag = 2
End If
End Sub

Private Sub cmddel_Click()


Dim i As Integer
i = MsgBox("Delete this record ? ", vbYesNo, "Payroll:GradeDetails")

If i = vbYes Then
If Combo1.Text = "" Or txt_grdname.Text = "" Then

73
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

MsgBox "No record found to delete. " & Chr(13) & "To delete, first select a record.",
vbCritical, "Payroll : Delete error"
Exit Sub
End If
grd.Delete
MsgBox "Record Deleted."
Call clear_all(Me)
If grd.BOF = grd.EOF Or grd.RecordCount < 1 Then
MsgBox "Zero records in the table now. " & Chr(13) & "If required start entering
records now", vbInformation, "Payroll : Data Entry"
Call norec_action
Else
Call chk_displayrec
End If
End If
End Sub

Private Sub cmdedit_Click()


Call getdata
grd.Edit
cmdadd.Enabled = False
cmddel.Enabled = False
cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False

cmdsave.Enabled = True
cmdcancel.Enabled = True

74
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If enableflag = 2 Then
Call txtcmb_disable(Me) 'procedure in module
enableflag = 1
End If
End Sub

Private Sub cmdexit_Click()


Call menu_disable
Unload Me
End Sub

Private Sub cmdfirst_Click()


On Error GoTo err_movfirst
grd.MoveFirst
Call getdata
Exit Sub
err_movfirst:
MsgBox "Zero records in the Grade Details Table", vbInformation, "Payroll : Data Entry
Error"
End Sub

Private Sub cmdlast_Click()


On Error GoTo err_movlast
grd.MoveLast
Call getdata
Exit Sub
err_movlast:

MsgBox "Zero records in the Grade Details Table", vbInformation, "Payroll : Data Entry
Error"

End Sub

75
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub cmdnext_Click()


On Error GoTo err_movnext
grd.MoveNext
If grd.EOF Then
MsgBox "Current record is the last record", , "Payroll"
grd.MovePrevious
Call getdata
Exit Sub
Else
Call getdata
End If
Exit Sub
err_movnext:
MsgBox "Zero records in the Grade Details Table", vbInformation, "Payroll : Data Entry
Error"
End Sub

Private Sub cmdprev_Click()


On Error GoTo err_movprev
grd.MovePrevious
If grd.BOF Then
MsgBox "Current record is the first record", , "Payroll"
grd.MoveNext
Call getdata
Exit Sub
Else

Call getdata

End If
Exit Sub

76
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

err_movprev:
MsgBox "Zero records in the Grade Details Table", vbInformation, "Payroll : Data Entry
Error"
End Sub

Private Sub cmdsave_Click()


If txt_grdname = "" Then
MsgBox "Grade name cannot be empty." & Chr(13) & "First enter a value for grade
name and then Click on Save", vbCritical, "Payroll : Data entry error"
txt_grdname.SetFocus
Exit Sub
End If
cmdadd.Enabled = True
cmdedit.Enabled = True
cmddel.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
Call putdata
grd.Update
If enableflag = 1 Then
Call txtcmb_disable(Me) 'procedure in module
enableflag = 2

End If
Call chk_displayrec
End Sub

77
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub Combo1_LostFocus()


If Combo1.ListIndex = 0 Or Combo1.Text = "" Then
MsgBox "Either you have not selected the designation code or you have selected the
heading." & Chr(13) & "Select a valid designation code / name.", vbCritical,
"Payroll :Data entry error"
Combo1.Text = ""
Combo1.SetFocus
End If
End Sub

Private Sub Form_Load()


Dim frgkey_status As Integer
Me.Top = 1500
Me.Left = 2500
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set dsg = db.OpenRecordset("designation", dbOpenDynaset)
frgkey_status = chk_rscount("designation")
Set grd = db.OpenRecordset("grade", dbOpenDynaset)
If frgkey_status < 1 Then
MsgBox "No records found in Master Designation Table" & Chr(13) & "Cannot open
Grade details for data entry", vbCritical, "Payroll :Data entry error"
Call disableall(Me) 'procedure in module
cmdExit.Enabled = True
Exit Sub
Else
Call get_dsgdetails

'====if brh contains 0 records then only add and exit buttons should be
enabled========
If grd.RecordCount < 1 Then
Call norec_action

78
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Else
Call chk_displayrec
enableflag = 1
Call txtcmb_disable(Me) 'procedure in module
enableflag = 2
txt_grdcode.Enabled = False
cmdsave.Enabled = False
cmdcancel.Enabled = False
End If
End If
Call menu_disable
txt_grdcode.Text = ""
txt_grdname.Text = ""
Combo1 = ""
End Sub

Public Sub get_dsgdetails()


dsg.MoveFirst
Combo1.AddItem "Desg.Code Name"
Do While dsg.EOF = False
Combo1.AddItem dsg.Fields(0) & " " & dsg.Fields(2)
dsg.MoveNext
Loop
End Sub

Public Sub getdata()

With grd
txt_grdcode = .Fields(0)
Combo1.Text = .Fields(1)
txt_grdname = .Fields(2)

79
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End With
End Sub

Public Sub putdata()


Dim i As Integer
Dim str, str1, str2 As String
str = Combo1.Text
For i = 1 To Len(str)
str1 = Mid(str, i, 1)
If str1 = " " Then
str2 = Left(str, i)
Exit For
End If
Next
With grd
.Fields(0) = UCase(txt_grdcode)
If str2 = "" Then
.Fields(1) = UCase(str)
Else
.Fields(1) = UCase(str2)
End If
.Fields(2) = UCase(txt_grdname)
End With
End Sub
'-------if Currently no records in the department table
'-------Allow user only to add record / exit form

Private Sub norec_action()


cmdsave.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False

80
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdcancel.Enabled = False
cmdfirst.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdlast.Enabled = False
End Sub
Public Sub chk_displayrec()
If grd.RecordCount > 0 Or grd.BOF <> grd.EOF Then
grd.MoveFirst
Call getdata
End If
End Sub

81
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

EMPLOYEE:
Option Explicit
Dim enableflag As Integer
Dim cmb_enable As Integer
Dim cmdval As Integer 'status of request generated by employee personal
Dim edit_sal_status As Integer

Private Sub cmd_salary_Click()


salary_master.Show
emp_pers.Hide
If cmdval = 1 Then
'Adding a new employee record, salary - master to be opened for add
Set sal_mast = db.OpenRecordset("salary_master", dbOpenDynaset)

salary_master.cmdokay.Enabled = True
salary_master.cmdExit.Enabled = False
salary_master.cleardata
salary_master.tgross.Text = 0
sal_mast.AddNew
salary_master.tbasic.SetFocus
ElseIf cmdval = 0 Then
'viewing employee records, salary master to be opened for viewing
Set sal_mast = db.OpenRecordset("select * from salary_master where emp_code = '" &
txt_empcode.Text & "'", dbOpenDynaset)
salary_master.cmdokay.Enabled = False
salary_master.cmdExit.Enabled = True
salary_master.getdata
salary_master.enabletxt
salary_master.cmdExit.SetFocus
ElseIf cmdval = 2 Then

82
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

'Editing an employee record, salary master to be opened in edit


edit_sal_status = 1
emp_pers.cmd_salary.Enabled = True
Set sal_mast = db.OpenRecordset("select * from salary_master where emp_code = '" &
txt_empcode.Text & "'", dbOpenDynaset)
salary_master.cmdokay.Enabled = True
salary_master.cmdExit.Enabled = False
salary_master.getdata
sal_mast.Edit
salary_master.tbasic.SetFocus
ElseIf cmdval = 3 Then
'deleting an employee record, salary master to be opened in delete mode
Set sal_mast = db.OpenRecordset("select * from salary_master where emp_code = '" &
txt_empcode.Text & "'", dbOpenDynaset)

salary_master.cmdokay.Enabled = True
salary_master.cmdExit.Enabled = False
salary_master.getdata
sal_mast.Delete
End If
End Sub
'------add record (s) to the database--------
Private Sub cmdadd_Click()
Dim code, str, num, alp As String
Dim i, K As Integer
'-------------
cmdval = 1
Call clear_all(Me) 'procedure in module
cmdadd.Enabled = False
cmddel.Enabled = False

83
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdedit.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
If enableflag = 2 Then
Call txt_disable(Me) 'procedure in module
Call combo_enable
enableflag = 1

End If
' for automatic generation of branch code:user's choice
If emp.EOF = emp.BOF And emp.RecordCount < 1 Then

chkcode:
code = InputBox("Please enter the employee code (like PSG100):", "Payroll : Employee
Code Generation")
K = Len(code)
For i = K To 1 Step -1
str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alp = Mid(code, 1, i)
num = Mid(code, i + 1)
Exit For
End If
Next i
If num = "" Then

84
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

MsgBox "Invalid value for employee code, Please enter like 'PSG100'. ", ,
"Payroll:Branch Details"
GoTo chkcode
Else
txt_empcode = code
End If
Else
emp.MoveLast
code = emp(0)
K = Len(code)
For i = K To 1 Step -1
str = Mid(code, i, 1)
If IsNumeric(str) <> True Then
alp = Mid(code, 1, i)
num = Mid(code, i + 1)
Exit For
End If

Next i
txt_empcode = alp & (CInt(num) + 1)
End If
emp_pers.cmd_salary.Enabled = True
emp.AddNew
End Sub
'---------cancel update / edit ----------
Private Sub cmdcancel_Click()
emp.CancelUpdate
MsgBox "Update record cancelled"
Call chk_displayrec
cmdadd.Enabled = True

85
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdedit.Enabled = True
cmddel.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
If enableflag = 1 Then
Call txt_disable(Me) 'procedure in module
Call combo_enable
enableflag = 2
End If

deptcombo.Enabled = False
dsgcombo.Enabled = False
gradecombo.Enabled = False

emp_pers.cmd_salary.Enabled = False
End Sub
'-------delete record (s) to the table ---------
Private Sub cmddel_Click()
Dim i As Integer
i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll")
If i = vbYes Then
If txt_empcode.Text = "" Or deptcombo.Text = "" Then
MsgBox "No record found to delete. " & Chr(13) & "To delete, first select a record.",
vbCritical, "Payroll : Delete error"
Exit Sub

86
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Else
emp_pers.cmd_salary.Enabled = False
cmdval = 3
emp.Delete
Call clear_all(Me) 'procedure in module
If emp.RecordCount < 1 Or emp.EOF Or emp.BOF Then
Call chk_displayrec
End If
End If
End If
End Sub
'-----------edit current record -----------
Private Sub cmdedit_Click()
Call getdata
emp.Edit
'-------------
cmdval = 2
emp_pers.cmd_salary.Enabled = True
cmdadd.Enabled = False

cmdedit.Enabled = False
cmddel.Enabled = False
cmdExit.Enabled = False
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
If enableflag = 2 Then

87
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call txt_disable(Me) 'procedure in module


Call combo_enable
txt_empcode.Enabled = False
' deptcombo.SetFocus
enableflag = 1
End If
End Sub
'------exit working on the form ---------
Private Sub cmdexit_Click()
Call menu_disable
Unload Me
End Sub
'-----------move to first record --------
Private Sub cmdfirst_Click()
On Error GoTo err_movfirst
cmdval = 0
If emp.BOF <> True Then
emp.MoveFirst
Call getdata
emp_pers.cmd_salary.Enabled = True

End If
Exit Sub
err_movfirst:
MsgBox "Zero records in the Employee Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'---------move to last record --------
Private Sub cmdlast_Click()
On Error GoTo err_movlast

88
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdval = 0
If emp.EOF <> True Then
emp.MoveLast
Call getdata
emp_pers.cmd_salary.Enabled = True
End If
Exit Sub
err_movlast:
MsgBox "Zero records in the Employee Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'----------move to the next record -------
Private Sub cmdnext_Click()
On Error GoTo err_movnext
cmdval = 0
emp.MoveNext
If emp.EOF Then
MsgBox "Current record is the last record", , "Payroll"
emp.MovePrevious
Call getdata
emp_pers.cmd_salary.Enabled = True

Exit Sub
End If
Call getdata
Exit Sub
err_movnext:
MsgBox "Zero records in the Employee Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub

89
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

'---------move to the previous record ----------


Private Sub cmdprev_Click()
On Error GoTo err_movprevious
cmdval = 0
emp.MovePrevious
If emp.BOF Then
MsgBox "Current record is the first record", , "Payroll"
emp.MoveNext
Call getdata
emp_pers.cmd_salary.Enabled = True
Exit Sub
End If
Call getdata
Exit Sub
err_movprevious:
MsgBox "Zero records in the Employee Details Table", vbInformation, "Payroll : Data
Entry Error"
End Sub
'---------save the added / edited record --------
Private Sub cmdsave_Click()
cmdadd.Enabled = True
cmddel.Enabled = True

cmdedit.Enabled = True
cmdExit.Enabled = True
cmdfirst.Enabled = True
cmdnext.Enabled = True
cmdprev.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False

90
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdcancel.Enabled = False
If enableflag = 1 Then
Call txt_disable(Me) 'module procedure
Call combo_enable
enableflag = 2
End If
Call putdata
emp.Update
If cmdval = 2 Then
If edit_sal_status = 1 Then
sal_mast.Update
'GoTo cont
End If
End If

MsgBox " Salary details saved.", vbInformation, "Payroll : Save record"


Unload salary_master
cmd_salary.Enabled = False
Call chk_displayrec
End Sub

Private Sub deptcombo_GotFocus()


dpt.MoveFirst

deptcombo.Clear
deptcombo.AddItem "Dept.code Name"
Do While dpt.EOF = False
deptcombo.AddItem dpt.Fields(0)
dpt.MoveNext
Loop

91
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub
Private Sub deptcombo_LostFocus()
If deptcombo.ListIndex = 0 Then
MsgBox "You have selected the heading." & Chr(13) & "Select the Department code,
name and not the heading", vbCritical, "Payroll : Data entry error"
deptcombo.Text = ""
deptcombo.SetFocus
Exit Sub
Else
'deptcombo.Enabled = False
dsgcombo.Clear
dsgcombo.Enabled = True
dsgcombo.AddItem "Desg.code Name"
Set dept_dsg = db.OpenRecordset("select dsg_code from designation where dpt_code='"
& deptcombo.Text & "'", dbOpenDynaset)
End If
End Sub
Private Sub dsgcombo_GotFocus()
If dept_dsg.EOF Then
MsgBox "No designations found under this department"
deptcombo.SetFocus
Exit Sub
Else
deptcombo.Enabled = False

dept_dsg.MoveFirst
Do While dept_dsg.EOF = False
dsgcombo.AddItem dept_dsg.Fields(0)
dept_dsg.MoveNext
Loop

92
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
End Sub
Private Sub dsgcombo_LostFocus()
If dsgcombo.ListIndex = 0 Then
MsgBox "You have selected the heading." & Chr(13) & "Select the Designation code,
name and not the heading", vbCritical, "Payroll : Data entry error"
dsgcombo.Text = ""
dsgcombo.SetFocus
Exit Sub
Else
'dsgcombo.Enabled = False
gradecombo.Clear
gradecombo.AddItem "Grade.code Name"
gradecombo.Enabled = True
Set dsg_grd = db.OpenRecordset("select grd_code from grade where dsg_code = '" &
dsgcombo.Text & "'", dbOpenDynaset)
End If
End Sub
'----------default settings in form load---------
Private Sub Form_Load()
Dim frgkey_status As Integer

Me.Top = 250
Me.Left = 1500

Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)


Set dpt = db.OpenRecordset("department", dbOpenDynaset)
Set dsg = db.OpenRecordset("designation", dbOpenDynaset)
Set grd = db.OpenRecordset("grade", dbOpenDynaset)

93
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

frgkey_status = chk_rscount("grade")
Set emp = db.OpenRecordset("emp_personal", dbOpenDynaset)
If frgkey_status < 1 Then
MsgBox "Zero records in the Grade Table" & Chr(13) & "First add records to the
Company Table and then start adding records to the Grade Table. ", vbCritical,
"Payroll :Data entry error"
Call disableall(Me) 'procedure in module
cmdExit.Enabled = True
Exit Sub
End If

'====if brh contains 0 records then only add and exit buttons should be
enabled========
If emp.RecordCount < 1 Then
Call norec_action
Else
Call chk_displayrec
enableflag = 1
Call txt_disable(Me) 'module procedure
Call combo_enable
cmd_salary.Enabled = False
enableflag = 2
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmdval = 0

End If
Call menu_disable
dsgcombo = ""
gradecombo = ""

94
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

deptcombo = ""
txt_empcode.Text = ""
txt_empname.Text = ""
txt_father.Text = ""
txt_dob.Text = ""
txt_addr1.Text = ""
txt_addr2.Text = ""
txt_addr3.Text = ""
txt_pin.Text = ""
txt_tel.Text = ""
txt_djoin.Text = ""
txt_dconfirm.Text = ""
bl_grpcombo = ""
txt_qualif.Text = ""
End Sub
'----------get data from the backend to the form-------
Public Sub getdata()
With emp
deptcombo.Text = .Fields(16)
dsgcombo.Text = .Fields(17)
gradecombo.Text = .Fields(1)
txt_empcode.Text = .Fields(0)
txt_empname.Text = .Fields(2)
txt_father.Text = .Fields(3)
txt_dob.Text = .Fields(4)
txt_addr1.Text = .Fields(5)

txt_addr2.Text = .Fields(6)
txt_addr3.Text = .Fields(7)
txt_pin.Text = .Fields(8)
txt_tel.Text = .Fields(9)

95
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If .Fields(10) = True Then '-------get values for marital status


Check1.Value = Checked
Else
Check1.Value = Unchecked
End If
If .Fields(11) = True Then '----get values for sex type
Option1.Value = True
Else
Option2.Value = True
End If
bl_grpcombo.Text = .Fields(12) '-----get value for blood group
txt_qualif.Text = .Fields(13)
txt_djoin.Text = .Fields(14)
txt_dconfirm.Text = .Fields(15)
End With
End Sub
'---------save data to the backend --------
Public Sub putdata()
With emp
.Fields(0) = UCase(txt_empcode.Text)
.Fields(16) = UCase(deptcombo.Text)
.Fields(17) = UCase(dsgcombo.Text)
.Fields(1) = UCase(gradecombo.Text)
.Fields(2) = UCase(txt_empname.Text)
.Fields(3) = UCase(txt_father.Text)
.Fields(4) = Format(txt_dob.Text, "dd/mm/yy")

.Fields(5) = UCase(txt_addr1.Text)
.Fields(6) = UCase(txt_addr2.Text)
.Fields(7) = UCase(txt_addr3.Text)

96
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

.Fields(8) = Val(txt_pin.Text)
.Fields(9) = UCase(txt_tel.Text) & " "
If Check1.Value = True Then '---append values for marital status
.Fields(10) = "True"
Else
.Fields(10) = "False"
End If
inputsex:
If Option1.Value = True Then
.Fields(11) = "True"
ElseIf Option2.Value = True Then
.Fields(11) = "False"
Else
MsgBox "Insufficient data. Please click for Employee Sex type", vbQuestion,
"Payroll:Employee Details"
GoTo inputsex
End If
.Fields(12) = UCase(bl_grpcombo.Text)
.Fields(13) = UCase(txt_qualif.Text)
.Fields(14) = Format(txt_djoin.Text, "dd/mm/yy")
.Fields(15) = Format(txt_dconfirm.Text, "dd/mm/yy")
End With
End Sub
Private Sub gradecombo_GotFocus()
If dsg_grd.EOF Then
MsgBox "No Grades found under this designation"
dsgcombo.SetFocus

Exit Sub
Else

97
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

dsgcombo.Enabled = False
dsg_grd.MoveFirst
Do While dsg_grd.EOF = False
gradecombo.AddItem dsg_grd.Fields(0)
dsg_grd.MoveNext
Loop
End If
End Sub
Private Sub gradecombo_LostFocus()
If gradecombo.ListIndex = 0 Then
MsgBox "You have selected the heading." & Chr(13) & "Select the grade code, name and
not the heading", vbCritical, "Payroll : Data entry error"
gradecombo.Text = ""
gradecombo.SetFocus
Exit Sub
Else
gradecombo.Enabled = False
End If
End Sub
'Status of command buttons in form if no records found in employee table
Private Sub norec_action()
cmdsave.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdcancel.Enabled = False
cmdfirst.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False

cmdlast.Enabled = False

98
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub
'Check whether valid date entered or not
Private Sub txt_dconfirm_LostFocus()
If IsDate(txt_dconfirm.Text) = False Then
MsgBox "You have entered a wrong value for date." & Chr(13) & "Valid date
format :'dd/mm/yy'", vbCritical, "Payroll : Data entry error"
txt_dconfirm.Text = ""
' txt_dconfirm.SetFocus
End If
End Sub
'Check whether valid date entered or not
Private Sub txt_djoin_LOSTFOCUS()
If IsDate(txt_djoin.Text) = False Then
MsgBox "You have entered a wrong value for date." & Chr(13) & "Valid date
format :'dd/mm/yy'", vbCritical, "Payroll : Data entry error"
txt_djoin.Text = ""
End If
End Sub
'Check whether valid date entered or not
Private Sub txt_dob_LostFocus()
If IsDate(txt_dob.Text) = False Then
MsgBox "You have entered a wrong value for date." & Chr(13) & "Valid date
format :'dd/mm/yy'", vbCritical, "Payroll : Data entry error"
txt_dob.Text = ""
End If
End Sub

Public Sub chk_displayrec()


If emp.RecordCount > 0 Or emp.BOF <> emp.EOF Then

99
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

emp.MoveFirst
cmdval = 0
Call getdata
End If
End Sub

Public Sub combo_enable()


deptcombo.Enabled = Not deptcombo.Enabled
dsgcombo.Enabled = Not dsgcombo.Enabled
gradecombo.Enabled = Not gradecombo.Enabled
End Sub

100
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LEAVE MASTER:
Option Explicit
Dim enableflag As Integer
Dim flag As Integer

Private Sub cmdadd_Click()


Call cleardata
If enableflag = 2 Then
Call enable
enableflag = 1
End If

cmdadd.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdfirst.Enabled = False

cmdprev.Enabled = False
cmdnext.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
empcombo.Enabled = True
levdetails.AddNew
End Sub

Private Sub cmdcancel_Click()


levdetails.CancelUpdate
If enableflag = 1 Then
Call enable

101
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

enableflag = 2
End If
cmdadd.Enabled = True
cmdedit.Enabled = True
cmddel.Enabled = True
cmdfirst.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False
empcombo.Enabled = False
End Sub

Private Sub cmddel_Click()


Dim i As Integer
i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll")

If i = vbYes Then
If empcombo.Text = " " Then
MsgBox "No record found to delete.", vbCritical, "Payroll"
Exit Sub
End If
levdetails.Delete
Call cleardata
MsgBox "deleted"
End If
End Sub

Private Sub cmdedit_Click()

102
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

cmdadd.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
cmdfirst.Enabled = False
cmdprev.Enabled = False
cmdnext.Enabled = False
cmdlast.Enabled = False
cmdsave.Enabled = True
cmdcancel.Enabled = True
flag = 1
If enableflag = 2 Then
Call enable
enableflag = 1
End If
'levdetails.Edit
empcombo.Enabled = True
End Sub

Private Sub cmdexit_Click()


Unload Me
End Sub

Private Sub cmdfirst_Click()


levdetails.MoveFirst
Call getdata
MsgBox "First record ", , "Payroll"
End Sub

Private Sub cmdlast_Click()

levdetails.MoveLast

103
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call getdata
MsgBox "Last record ", , "Payroll"
End Sub

Private Sub cmdnext_Click()


levdetails.MoveNext
If levdetails.EOF Then
MsgBox "Current record is the last record", , "Payroll"
levdetails.MovePrevious
Call getdata
Exit Sub
Else
Call getdata
End If
End Sub

Private Sub cmdprev_Click()


levdetails.MovePrevious

If levdetails.BOF Then
MsgBox "Current record is the first record", , "Payroll"
levdetails.MoveNext
Call getdata
Exit Sub
Else
Call getdata
End If
End Sub

Private Sub cmdsave_Click()


Call putdata
levdetails.Update

104
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If enableflag = 1 Then
Call enable
enableflag = 2
End If
cmdadd.Enabled = True
cmdedit.Enabled = True
cmddel.Enabled = True
cmdfirst.Enabled = True
cmdprev.Enabled = True
cmdnext.Enabled = True
cmdlast.Enabled = True
cmdsave.Enabled = False
cmdcancel.Enabled = False

empcombo.Enabled = False
levdetails.MoveFirst
Call getdata

End Sub

Private Sub empcombo_LostFocus()


Dim str As String
Dim lval As String, str1 As String
Dim i As Integer
If flag = 1 Then
str = empcombo.Text
For i = 1 To Len(str) Step 1

str1 = Mid(str, i, 1)
If str1 = " " Then
lval = Left(str, i - 1)
Exit For

105
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
Next
levdetails.MoveFirst
Do While levdetails.EOF = False
If levdetails.Fields(0) = lval Then
getdata
levdetails.Edit
flag = 0
Exit Do
End If
levdetails.MoveNext
Loop
End If
End Sub

Private Sub Form_Load()


Me.Top = 1500

Me.Left = 2000
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set levdetails = db.OpenRecordset("emp_leave_details", dbOpenDynaset)
If levdetails.EOF Then
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False

End If
Call getempdata
empcombo.Enabled = False
enableflag = 1

106
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If enableflag = 1 Then
Call enable
enableflag = 2
End If
cmdsave.Enabled = False
cmdcancel.Enabled = False
End Sub

Public Sub enable()


Yrcombo.Enabled = Not Yrcombo.Enabled
txt_cs.Enabled = Not txt_cs.Enabled
txt_sk.Enabled = Not txt_sk.Enabled
txt_pl.Enabled = Not txt_pl.Enabled
txt_ml.Enabled = Not txt_ml.Enabled
txt_oth.Enabled = Not txt_oth.Enabled
End Sub

Public Sub getdata()

With levdetails
empcombo.Text = .Fields(0)
Yrcombo.Text = .Fields(1)
txt_cs.Text = .Fields(2)
txt_sk.Text = .Fields(3)
txt_pl.Text = .Fields(4)
txt_oth.Text = .Fields(5)

txt_ml.Text = .Fields(6)
End With
End Sub

Public Sub putdata()

107
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Dim str, str1, lval As String


Dim i As Integer
'-------------extract cmpcode from combobox text value
str = empcombo.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
lval = Left(str, i - 1)
Exit For
End If
Next
With levdetails
If lval = "" Then
.Fields(0) = str
Else
.Fields(0) = lval
End If
.Fields(1) = Yrcombo.Text

.Fields(2) = txt_cs.Text
.Fields(3) = txt_sk.Text
.Fields(4) = txt_pl.Text
.Fields(5) = txt_oth.Text
.Fields(6) = txt_ml.Text
End With
End Sub

Public Sub getempdata()


Set emp = db.OpenRecordset("emp_personal", dbOpenDynaset)
emp.MoveFirst
Do While emp.EOF = False

108
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

empcombo.AddItem emp.Fields(0) & " " & emp.Fields(1)


emp.MoveNext
Loop
End Sub

Public Sub cleardata()


empcombo.Text = ""
txt_cs.Text = ""
txt_sk.Text = ""
txt_pl.Text = ""
txt_oth.Text = ""
txt_ml.Text = ""
Yrcombo.Text = ""
End Sub
Private Sub Yrcombo_GotFocus()
Dim yrval, yrcur As Integer
yrcur = Year(Now)
For yrval = 0 To 2 Step 1

Yrcombo.AddItem (yrcur + yrval)


Next yrval
Yrcombo.Text = yrcur
End Sub

109
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LEAVE AVAILED:
Option Explicit
Dim enableflag As Integer
Dim flag As Integer

Private Sub cmdadd_Click()


Call cleardata
If enableflag = 2 Then
Call enable
enableflag = 1
End If
Call cmdenable
empcombo.Enabled = True
empcombo.SetFocus
levavailed.AddNew
End Sub

Private Sub cmdcancel_Click()


levavailed.CancelUpdate
If enableflag = 1 Then
Call enable
enableflag = 2
End If

Call cmdenable
empcombo.Enabled = False
End Sub

Private Sub cmddel_Click()


Dim i As Integer

110
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll")


If i = vbYes Then
If empcombo.Text = " " Then
MsgBox "No record found to delete.", vbCritical, "Payroll"
Exit Sub
End If
levavailed.Delete
Call cleardata
MsgBox "deleted"
End If
End Sub

Private Sub cmdedit_Click()


Call cmdenable
flag = 1
If enableflag = 2 Then
Call enable
enableflag = 1
End If
levavailed.Edit
'empcombo.Enabled = True
End Sub

Private Sub cmdexit_Click()

Unload Me
End Sub

Private Sub cmdfirst_Click()


levavailed.MoveFirst

111
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call getdata
Call getbal_leave
End Sub

Private Sub cmdlast_Click()


levavailed.MoveLast
Call getdata
Call getbal_leave
End Sub

Private Sub cmdnext_Click()


levavailed.MoveNext
If levavailed.EOF Then
MsgBox "Current record is the last record", , "Payroll"
levavailed.MovePrevious
Call getdata
Call getbal_leave
Exit Sub
Else
Call getdata
Call getbal_leave
End If
End Sub

Private Sub cmdprev_Click()

levavailed.MovePrevious
If levavailed.BOF Then
MsgBox "Current record is the first record", , "Payroll"
levavailed.MoveNext

112
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call getdata
Call getbal_leave
Exit Sub
Else
Call getdata
Call getbal_leave
End If
End Sub

Private Sub cmdsave_Click()


On Error GoTo errsave
Call putdata
levavailed.Update
leavedetup
If enableflag = 1 Then
Call enable
enableflag = 2
End If
Call cmdenable
empcombo.Enabled = False
Exit Sub
errsave:
MsgBox "Duplicate entry for the employee for the same month. Kindly check",
vbExclamation, "Payroll"
empcombo.SetFocus
End Sub

'Private Sub empcombo_LostFocus()


'Dim str As String
'Dim lval As String, str1 As String

113
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

'Dim i As Integer
'If flag = 1 Then
'str = empcombo.Text
'For i = 1 To Len(str) Step 1
' str1 = Mid(str, i, 1)
' If str1 = " " Then
' lval = Left(str, i - 1)
' Exit For
' End If
'Next
'levavailed.MoveFirst
'Do While levavailed.EOF = False
' If levavailed.Fields(0) = lval Then
' getdata
' levavailed.Edit
' flag = 0
' Exit Do
' End If
' levavailed.MoveNext
'Loop
'End If
'End Sub

Private Sub Form_Load()


Me.Top = 1500
Me.Left = 2000
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)

Set levavailed = db.OpenRecordset("emp_leave_availed", dbOpenDynaset)


'If levavailed.EOF Then

114
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

' cmdfirst.Enabled = False


' cmdnext.Enabled = False
' cmdprev.Enabled = False
' cmdlast.Enabled = False
'End If
Call getempdata
enableflag = 1
If enableflag = 1 Then
Call enable
enableflag = 2
End If
cmdsave.Enabled = False
cmdcancel.Enabled = False
End Sub

Public Sub enable()


monthcombo.Enabled = Not monthcombo.Enabled
txt_cs.Enabled = Not txt_cs.Enabled
txt_sk.Enabled = Not txt_sk.Enabled
txt_pl.Enabled = Not txt_pl.Enabled
txt_ml.Enabled = Not txt_ml.Enabled
txt_oth.Enabled = Not txt_oth.Enabled
End Sub

Public Sub cmdenable()


Dim cont As Control
For Each cont In Controls
If TypeOf cont Is CommandButton Then

cont.Enabled = Not cont.Enabled

115
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
Next
End Sub

Public Sub getdata()


With levavailed
empcombo.Text = .Fields(0)
monthcombo.Text = .Fields(1)
txt_cs.Text = .Fields(2)
txt_sk.Text = .Fields(3)
txt_pl.Text = .Fields(4)
txt_oth.Text = .Fields(5)
txt_ml.Text = .Fields(6)
End With
End Sub

Public Sub putdata()


Dim str, str1, lval As String
Dim i As Integer
'-------------extract cmpcode from combobox text value
str = empcombo.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
lval = Left(str, i - 1)
Exit For
End If
Next
With levavailed

116
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If lval = "" Then


.Fields(0) = str
Else
.Fields(0) = lval
End If
.Fields(1) = monthcombo.Text
.Fields(2) = txt_cs.Text
.Fields(3) = txt_sk.Text
.Fields(4) = txt_pl.Text
.Fields(5) = txt_oth.Text
.Fields(6) = txt_ml.Text
End With
End Sub

Public Sub getempdata()


Set emp = db.OpenRecordset("emp_personal", dbOpenDynaset)
emp.MoveFirst
Do While emp.EOF = False
empcombo.AddItem emp.Fields(0) & " " & emp.Fields(1)
emp.MoveNext
Loop
End Sub

Public Sub cleardata()


Dim clr As Control
For Each clr In Controls
If TypeOf clr Is TextBox Then
clr.Text = ""
End If
Next

117
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

empcombo.Text = ""
monthcombo.Text = ""
End Sub

Private Sub empcombo_LostFocus()


Dim str, str1, empstring As String
Dim i As Integer
'-------------extract cmpcode from combobox text value
str = empcombo.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
empstring = Left(str, i - 1)
Exit For
End If
Next
Set leave_query = db.OpenRecordset("Select * from emp_leave_details where
emp_code='" & empstring & "'", dbOpenDynaset)
With leave_query
bal_cs.Text = .Fields(1)
bal_sk.Text = .Fields(2)
bal_pl.Text = .Fields(3)
bal_oth.Text = .Fields(4)
bal_ml.Text = .Fields(5)
End With
End Sub

Private Sub txt_cs_LostFocus()


bal_cs.Text = Val(bal_cs.Text) - Val(txt_cs.Text)
End Sub

118
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub txt_sk_LostFocus()


bal_sk.Text = Val(bal_sk.Text) - Val(txt_sk.Text)
End Sub

Private Sub txt_pl_LostFocus()


bal_pl.Text = Val(bal_pl.Text) - Val(txt_pl.Text)
End Sub

Private Sub txt_oth_LostFocus()


bal_oth.Text = Val(bal_oth.Text) - Val(txt_oth.Text)
End Sub

Private Sub txt_ml_LostFocus()


bal_ml.Text = Val(bal_ml.Text) - Val(txt_ml.Text)
End Sub

Public Sub getbal_leave()


Set leave_query = db.OpenRecordset("Select * from emp_leave_details where
emp_code='" & empcombo.Text & "'", dbOpenDynaset)
'leave_query.Refresh
With leave_query
bal_cs.Text = .Fields(1)
bal_sk.Text = .Fields(2)
bal_pl.Text = .Fields(3)
bal_oth.Text = .Fields(4)
bal_ml.Text = .Fields(5)
End With
End Sub

Private Sub leavedetup()

119
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

leave_query.Edit
With leave_query
.Fields(1) = bal_cs.Text
.Fields(2) = bal_sk.Text
.Fields(3) = bal_pl.Text
.Fields(4) = bal_oth.Text
.Fields(5) = bal_ml.Text
End With
leave_query.Update
End Sub

120
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOAN MASTER:
Option Explicit
Dim enableflag As Integer
Dim flag As Integer
Private Sub cmdadd_Click()
If enableflag = 2 Then
Call enable
enableflag = 1
End If
Call cleardata
Call cmdenable
lm.AddNew
End Sub

Private Sub cmdcancel_Click()


lm.CancelUpdate
If enableflag = 1 Then
Call enable
enableflag = 2

End If
Call cmdenable
End Sub

Private Sub cmddel_Click()


Dim i As Integer
i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll")
If i = vbYes Then
If txt_lname.Text = "" Then
MsgBox "No record found to delete.", vbCritical, "Payroll"

121
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Exit Sub
Else
lm.Delete
Call cleardata
MsgBox "Current record deleted", vbInformation, "Payroll"
End If
End If
End Sub

Private Sub cmdedit_Click()


Call cmdenable
lm.Edit
If enableflag = 2 Then
Call enable
enableflag = 1
End If
End Sub

Private Sub cmdexit_Click()


Unload Me
End Sub

Private Sub cmdfirst_Click()


lm.MoveFirst
Call getdata
MsgBox "First record ", , "Payroll"
End Sub

Private Sub cmdlast_Click()


lm.MoveLast

122
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call getdata
MsgBox "Last record ", , "Payroll"
End Sub

Private Sub cmdnext_Click()


lm.MoveNext
If lm.EOF Then
MsgBox "Current record is the last record", , "Payroll"
lm.MovePrevious
Call getdata
Exit Sub
Else
Call getdata
End If
End Sub

Private Sub cmdprev_Click()


lm.MovePrevious
If lm.BOF Then
MsgBox "Current record is the first record", , "Payroll"

lm.MoveNext
Call getdata
Exit Sub
Else
Call getdata
End If
End Sub

Private Sub cmdsave_Click()

123
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call putdata
lm.Update
If enableflag = 1 Then
Call enable
enableflag = 2
End If
Call cmdenable
End Sub
Private Sub Form_Load()
Me.Top = 1500
Me.Left = 2000
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set lm = db.OpenRecordset("Loan_Master", dbOpenDynaset)
If lm.EOF Then
cmdfirst.Enabled = False
cmdnext.Enabled = False
cmdprev.Enabled = False
cmdlast.Enabled = False
End If
enableflag = 1
If enableflag = 1 Then

Call enable
enableflag = 2
End If
cmdsave.Enabled = False
cmdcancel.Enabled = False
End Sub

Public Sub enable()

124
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

txt_lname.Enabled = Not txt_lname.Enabled


rinterest.Enabled = Not rinterest.Enabled
End Sub

Public Sub cmdenable()


Dim cont As Control
For Each cont In Controls
If TypeOf cont Is CommandButton Then
cont.Enabled = Not cont.Enabled
End If
Next
End Sub

Public Sub getdata()


txt_lname.Text = lm.Fields(0)
rinterest.Text = lm.Fields(1)
End Sub

Public Sub putdata()


lm.Fields(0) = txt_lname.Text
lm.Fields(1) = rinterest
End Sub

Public Sub cleardata()


txt_lname.Text = ""
End Sub

125
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOAN AVAILED:
Option Explicit
Dim enableflag As Integer
Dim flag As Integer

Private Sub cmdadd_Click()


Call cleardata
Call cmdenable
empcombo.Enabled = True
empcombo.SetFocus
If enableflag = 2 Then
Call enable
enableflag = 1
End If
ln.AddNew
End Sub

Private Sub cmdcancel_Click()


ln.CancelUpdate
If enableflag = 1 Then
Call enable
enableflag = 2
End If
Call cmdenable
empcombo.Enabled = False

End Sub

Private Sub cmddel_Click()


Dim i As Integer

126
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

i = MsgBox("Delete this record ? ", vbQuestion + vbYesNo, "Payroll")


If i = vbYes Then
If empcombo.Text = " " Then
MsgBox "No record found to delete.", vbCritical, "Payroll"
Exit Sub
End If
If Val(txt_bal.Text) = 0 Then
ln.Delete
Call cleardata
MsgBox "deleted"
Else
MsgBox "Delete not allowed. Loan balance to be cleared first,Kindly re-check",
vbCritical, "Payroll"
End If
End If
End Sub

Private Sub cmdedit_Click()


If enableflag = 2 Then
Call enable
enableflag = 1
End If
empcombo.Enabled = True
Call cmdenable
ln.Edit
End Sub

Private Sub cmdexit_Click()


Unload Me
End Sub

127
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub cmdfirst_Click()


ln.MoveFirst
Call getdata
MsgBox "First record ", , "Payroll"
End Sub

Private Sub cmdlast_Click()


ln.MoveLast
Call getdata
MsgBox "Last record ", , "Payroll"
End Sub

Private Sub cmdnext_Click()


ln.MoveNext
If ln.EOF Then
MsgBox "Current record is the last record", , "Payroll"
ln.MovePrevious
Call getdata
Exit Sub
Else
Call getdata
End If
End Sub

Private Sub cmdprev_Click()


ln.MovePrevious

If ln.BOF Then
MsgBox "Current record is the first record", , "Payroll"
ln.MoveNext

128
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Call getdata
Exit Sub
Else
Call getdata
End If
End Sub

Private Sub cmdsave_Click()


On Error GoTo errsave
Call putdata
ln.Update

If enableflag = 1 Then
Call enable
enableflag = 2
End If
Call cmdenable
empcombo.Enabled = False
Exit Sub
errsave:
MsgBox "Employee already availed this loan. Please re-check on the loan type. ",
vbExclamation, "Payroll"
lncombo.SetFocus
End Sub

Private Sub Form_Load()


Me.Top = 1500

Me.Left = 2000
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)

129
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Set ln = db.OpenRecordset("Loan_availed", dbOpenDynaset)


Set lm = db.OpenRecordset("loan_master", dbOpenDynaset)
enableflag = 1
If enableflag = 1 Then
Call enable
enableflag = 2
End If
cmdsave.Enabled = False
cmdcancel.Enabled = False
Call getempdata
Call get_lm
empcombo.Enabled = False
End Sub

Public Sub enable()


lncombo.Enabled = Not lncombo.Enabled
txt_amt.Enabled = Not txt_amt.Enabled
txt_rate.Enabled = Not txt_rate.Enabled
bal_amt.Enabled = Not bal_amt.Enabled
txt_davail.Enabled = Not txt_davail.Enabled
txt_instal.Enabled = Not txt_instal.Enabled
txt_bal.Enabled = Not txt_bal.Enabled
End Sub

Public Sub cmdenable()


Dim cont As Control
For Each cont In Controls
If TypeOf cont Is CommandButton Then

cont.Enabled = Not cont.Enabled

130
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
Next
End Sub

Public Sub getdata()


With ln
empcombo.Text = .Fields(0)
lncombo.Text = .Fields(1)
txt_davail.Text = .Fields(2)
txt_amt.Text = .Fields(3)
bal_amt.Text = .Fields(4)
txt_instal.Text = .Fields(5)
txt_bal.Text = .Fields(6)
Text2.Text = .Fields(7)
End With
End Sub

Public Sub putdata()


Dim str, str1, lval As String
Dim i As Integer
'-------------extract cmpcode from combobox text value
str = empcombo.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)
If str1 = " " Then
lval = Left(str, i - 1)
Exit For
End If
Next

131
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

With ln
If lval = " " Then
.Fields(0) = str
Else
.Fields(0) = lval
End If
.Fields(1) = lncombo.Text
.Fields(2) = txt_davail.Text
.Fields(3) = txt_amt.Text
.Fields(4) = 0
.Fields(5) = txt_instal.Text
.Fields(6) = txt_instal.Text
.Fields(7) = Text2.Text
End With
End Sub

Public Sub getempdata()


Set emp = db.OpenRecordset("emp_personal", dbOpenDynaset)
emp.MoveFirst
Do While emp.EOF = False
empcombo.AddItem emp.Fields(0) & " " & emp.Fields(1)
emp.MoveNext
Loop
End Sub

Public Sub cleardata()


Dim txt As Control
For Each txt In Controls
If TypeOf txt Is TextBox Then
txt.Text = ""

132
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End If
Next
empcombo.Text = ""
lncombo.Text = ""
End Sub

Public Sub get_lm()


Set loan_query = db.OpenRecordset("select * from loan_master")
loan_query.MoveFirst
Do While loan_query.EOF = False
lncombo.AddItem loan_query.Fields(0)
loan_query.MoveNext
Loop
End Sub

Private Sub lncombo_LostFocus()


Set loan_rate = db.OpenRecordset("select rate_interest from loan_master where
loan_master.ln_name= '" & lncombo.Text & "'", dbOpenDynaset)
txt_rate.Text = loan_rate.Fields(0)
End Sub

Private Sub txt_amt_LostFocus()


Text1.Text = Val(txt_amt) + ((Val(txt_rate) / 100) * Val(txt_amt))
End Sub

Private Sub txt_instal_LostFocus()


Text2.Text = Val(Text1.Text) / Val(txt_instal.Text)
End Sub

133
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

PAYROLL GENARATION(SALARY):
Option Explicit
Dim enableflag As Integer
Dim code As String
Dim dedtotal As Integer

Private Sub cmdcancel_Click()


MsgBox "Cancelling Update", , "Payroll"
sal_det.CancelUpdate
Call cleardata
empcombo.Text = ""
empcombo.Enabled = False
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmdissue.Enabled = True
cmdedit.Enabled = True
cmddel.Enabled = True
cmdExit.Enabled = True
End Sub

Private Sub cmdedit_Click()


empcombo.Enabled = True
sal_det.Edit
End Sub

Private Sub cmdexit_Click()


Call menu_disable
Unload Me
End Sub

134
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub cmdissue_Click()


Call cleardata
empcombo.Enabled = True
empcombo.Text = ""
sal_det.AddNew
cmdsave.Enabled = True
cmdcancel.Enabled = True
cmdissue.Enabled = False
cmdExit.Enabled = False
End Sub

Private Sub cmdsave_Click()


Call putdata
sal_det.Update
MsgBox "Saved !"
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmdissue.Enabled = True
cmdedit.Enabled = True
cmdExit.Enabled = True
End Sub

'to fetch dept, desg, grade name for employee code


Private Sub empcombo_LostFocus()
Dim str, str1 As String
Dim i As Integer
'-------------extract cmpcode from combobox text value
str = empcombo.Text
For i = 1 To Len(str) Step 1
str1 = Mid(str, i, 1)

135
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

If str1 = " " Then


code = Left(str, i - 1)
Exit For
End If
Next
Set info = db.OpenRecordset("select dpt.dpt_name, ds.dsg_name, gr.grd_name from
emp_personal emp, department dpt, designation ds, grade gr where emp.emp_code='" &
code & "'", dbOpenDynaset)
tdept.Text = info.Fields(0)
tdesg.Text = info.Fields(1)
tgrade.Text = info.Fields(2)
txt_dofissual.Text = Format(Date, "dd/mm/yy")
empcombo.Enabled = False
txt_dofissual.SetFocus
End Sub

Private Sub Form_Load()


Me.Top = 750
Me.Left = 1000
Set db = OpenDatabase(App.Path & "\payroll_db.mdb", , False)
Set sal_det = db.OpenRecordset("salary_details", dbOpenDynaset)
Call getempdata
cmdsave.Enabled = False
cmdcancel.Enabled = False
cmdedit.Enabled = False
cmddel.Enabled = False
empcombo.Enabled = False
Call menu_disable
End Sub

136
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Private Sub t_splallw_LostFocus()


If t_splallw.Text = "" Or IsNumeric(t_splallw.Text) = False Then
t_splallw.Text = 0
End If
allw = Val(tgross.Text) + Val(t_splallw.Text) - dedtotal
t_splded.SetFocus
End Sub
Private Sub t_splded_LostFocus()
If t_splded.Text = "" Or IsNumeric(t_splded.Text) = False Then
t_splded.Text = 0
End If
dedn.Text = dedtotal + Val(t_splded)
tnetsal.Text = Val(tgross.Text) + Val(t_splallw.Text) - dedtotal - Val(t_splded)
cmdsave.SetFocus
End Sub

Private Sub tbasic_GotFocus()


'Dim b, pf, gpf, med, ptax, itax As Integer
'Dim ins1, ins2, loan1, loan2, loan3, ded4, ded5 As Integer
'
'
'Set sm = db.OpenRecordset("select * from salary_master where
salary_master.emp_code='" & code & "'", dbOpenDynaset)
'If sm.RecordCount < 1 Then
' MsgBox "Currently no records found in the Salary Master", vbInformation, "Payroll"
'Else
' tbasic.Text = sm.Fields(1)
' b = Val(tbasic.Text)
' thra.Text = CInt((sm.Fields(2) / 100) * b)
' tcca.Text = CInt((sm.Fields(3) / 100) * b)

137
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

' tda.Text = CInt((sm.Fields(4) / 100) * b)


' tmed.Text = CInt((sm.Fields(5) / 100) * b)
' twash.Text = CInt((sm.Fields(6) / 100) * b)
' tconv.Text = CInt((sm.Fields(7) / 100) * b)
' tlta.Text = CInt((sm.Fields(8) / 100) * b)
' tall1.Text = CInt((sm.Fields(9) / 100) * b)
' tall2.Text = CInt((sm.Fields(10) / 100) * b)
' tpf.Text = CInt((sm.Fields(11) / 100) * b)
' pf = Val(tpf.Text)
' tgpf.Text = CInt((sm.Fields(12) / 100) * b)
' gpf = Val(tgpf.Text)
' tmed_ded.Text = CInt((sm.Fields(13) / 100) * b)
' med = Val(tmed_ded.Text)
' tptax.Text = CInt((sm.Fields(14) / 100) * b)
' ptax = Val(tptax.Text)
' tItax.Text = CInt((sm.Fields(15) / 100) * b)
' itax = Val(tItax.Text)
' tins1.Text = CInt((sm.Fields(16) / 100) * b)
' ins1 = Val(tins1.Text)
' tins2.Text = CInt((sm.Fields(17) / 100) * b)
' ins2 = Val(tins2.Text)
' tded4.Text = CInt((sm.Fields(21) / 100) * b)
' ded4 = Val(tded4.Text)
' tded5.Text = CInt((sm.Fields(22) / 100) * b)
' ded5 = Val(tded5.Text)
'End If
'tgross.Text = sm.Fields(23)
'dedtotal = (pf + gpf + med + ptax + itax + ins1 + ins2 + Val(tloan1) + Val(tloan2) +
Val(tloan3) + ded4 + ded5)
't_splallw.SetFocus

138
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub
Public Sub getempdata()
Set empsal = db.OpenRecordset("select emp_code, emp_name from emp_personal",
dbOpenDynaset)
empsal.MoveFirst
Do While empsal.EOF = False
empcombo.AddItem empsal.Fields(0) & " " & empsal.Fields(1)
empsal.MoveNext
Loop
End Sub

Public Sub putdata()


If tloan1(1).Text = "" Then
tloan1(1).Text = 0
End If
If tloan1(2).Text = "" Then
tloan1(2).Text = 0
End If
If tloan1(3).Text = "" Then
tloan1(3).Text = 0
End If
With sal_det
.Fields(0) = code
.Fields(1) = txt_dofissual
.Fields(2) = tbasic.Text
.Fields(3) = thra.Text
.Fields(4) = tcca.Text

.Fields(5) = tda.Text
.Fields(6) = tmed.Text

139
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

.Fields(7) = twash.Text
.Fields(8) = tconv.Text
.Fields(9) = tlta.Text
.Fields(10) = tall1.Text
.Fields(11) = tall2.Text
.Fields(12) = tpf.Text
.Fields(13) = tgpf.Text
.Fields(14) = tmed_ded.Text
.Fields(15) = tptax.Text
.Fields(16) = titax.Text
.Fields(17) = tins1.Text
.Fields(18) = tins2.Text
.Fields(19) = tloan1(1).Text
.Fields(20) = tloan1(2).Text
.Fields(21) = tloan1(3).Text
.Fields(22) = tded4.Text
.Fields(23) = tded5.Text
.Fields(24) = t_splallw.Text
.Fields(25) = t_splded.Text
.Fields(26) = tgross.Text
.Fields(27) = tnetsal.Text
End With
End Sub
Public Sub cleardata()
Dim forclear As Control
For Each forclear In Controls
If TypeOf forclear Is TextBox Then
forclear.Text = ""
End If
Next

140
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

End Sub
Private Sub txt_dofissual_LostFocus()
Dim b, pf, gpf, med, ptax, itax As Integer
Dim ins1, ins2, loan1, loan2, loan3, ded4, ded5 As Integer
Dim i As Integer
i=1
Set loan_sal = db.OpenRecordset("select la.amt_paid, la.bal_instal, la.amt_per_instal
from Loan_availed la where la.emp_code='" & code & "'", dbOpenDynaset)
If loan_sal.RecordCount < 1 Then
MsgBox "Employee not availed any Loan.", vbOKOnly, "Payroll"
Else
Do While loan_sal.EOF = False
tloan1(i).Text = loan_sal.Fields(2)
i=i+1
loan_sal.MoveNext
Loop
End If
Set sm = db.OpenRecordset("select * from salary_master where
salary_master.emp_code='" & code & "'", dbOpenDynaset)
If sm.RecordCount < 1 Then
MsgBox "Currently no records found in the Salary Master", vbInformation, "Payroll"
Else
tbasic.Text = sm.Fields(1)
b = Val(tbasic.Text)
thra.Text = CInt((sm.Fields(2) / 100) * b)
tcca.Text = CInt((sm.Fields(3) / 100) * b)

tda.Text = CInt((sm.Fields(4) / 100) * b)


tmed.Text = CInt((sm.Fields(5) / 100) * b)
twash.Text = CInt((sm.Fields(6) / 100) * b)

141
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

tconv.Text = CInt((sm.Fields(7) / 100) * b)


tlta.Text = CInt((sm.Fields(8) / 100) * b)
tall1.Text = CInt((sm.Fields(9) / 100) * b)
tall2.Text = CInt((sm.Fields(10) / 100) * b)
tpf.Text = CInt((sm.Fields(11) / 100) * b)
pf = Val(tpf.Text)
tgpf.Text = CInt((sm.Fields(12) / 100) * b)
gpf = Val(tgpf.Text)
tmed_ded.Text = CInt((sm.Fields(13) / 100) * b)
med = Val(tmed_ded.Text)
tptax.Text = CInt((sm.Fields(14) / 100) * b)
ptax = Val(tptax.Text)
titax.Text = CInt((sm.Fields(15) / 100) * b)
itax = Val(titax.Text)
tins1.Text = CInt((sm.Fields(16) / 100) * b)
ins1 = Val(tins1.Text)
tins2.Text = CInt((sm.Fields(17) / 100) * b)
ins2 = Val(tins2.Text)
tded4.Text = CInt((sm.Fields(21) / 100) * b)
ded4 = Val(tded4.Text)
tded5.Text = CInt((sm.Fields(22) / 100) * b)
ded5 = Val(tded5.Text)
End If
tgross.Text = sm.Fields(23)
dedtotal = (pf + gpf + med + ptax + itax + ins1 + ins2 + Val(tloan1(1)) + Val(tloan1(2)) +
Val(tloan1(3)) + ded4 + ded5)
t_splallw.SetFocus
End Sub

142
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

143
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

SYSTEM IMPLEMENTATION AND TESTING:

Implementation is the stage of the project where the theoretical design is turned into a
working system. It can be considered to be the most crucial stage in achieving a
successful new system gaining. The users confidence that the new system will work and
will be effective and accurate. It is primarily concerned with the user training and
documentation. Conversion usually takes place about the same time the user is being
trained or later. Implementation simply means convening a new system design into
operations, which is the process of converting a new revised system design into an
operational one.

SYSTEM TESTING:
Software Testing is the process of executing software in a controlled manner, in order to
answer the question– Does the software behaves as specified?. Software testing is often
used in association with the terms verification and validation. Validation is the checking
or testing of items, includes software for conformance and consistency with an associated
specification. Software testing is just one kind of verification, which also uses techniques
such as reviews, analysis, inspections, and walkthroughs. Validation is the process of
checking what has been specified is What the user actually wanted.

144
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

VALIDATION: Are we doing the right job?


VERIFICATION: Are we doing the right job?

Software testing should not be confused with debugging. Debugging is the process of
analyzing and localizing bugs when software does not behave as expected. Although the
identification of bugs will be obvious from playing with the software, a methodical
approach to software testing is a much more through means for identifying bugs.
Debugging is therefore an activity which supports testing but cannot replace testing.

Other activities which are often associated with software testing are static analysis and
dynamic analysis.
Static analysis investigates the source code of software, looking for problems and
gathering metrics without actually executing the code.
Dynamic analysis looks at the behavior of the software while it is executing to provide
information such as execution traces, timing profiles and test coverage information.

Testing is the set of activity that can be planned in advanced and conduct
Systematically. Testing begins at the module level and works towards the integration of
entire computers based system. Nothing is complete without testing. As it is vital success
of system testing objectives. There are several rules that can serve as testing objectives.

The levels of Testing:


 Unit Testing
 Integration Testing
 Data Validation Testing
 Output Testing

145
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Unit Testing:

Unit testing focuses verification effort on the smallest unit of software design. The
software component on module. Using the component level design description as a guide,
important control paths are tested to uncover errors within the boundary of the module.
The relative complexity of testing and uncovered scope established for unit testing.
The Unit testing is white box oriented and step can be conducted in parallel for multiple
components. The modular interface is tested to ensure that information is properly flows
into and out of the program unit order test. The local data structure is examined to ensure
the data stored temporarily maintain its integrity during all steps in an algorithm
execution.
Boundary condition are tested to ensure that all statements in the module have been
executed atleast once. Finally, all errors handling paths are tested.

Integration Testing:

Integration testing is systematic technique for constructing the program structure while at
the same time conducting tests to uncover errors associated with interfacing. The
objective is to take unit tested components and build a program structure that has been
dictated by design. The entire program is tested as whole. Corection is difficult because
isolation of acuses is complicated by vast expanse of entire program. Once these errors
are corrected, new ones appear and the process continues in a seemingly endless loop.

Validation Testing or System Testing:

This is final step in testing. In this, the entire system was tested as a whole with all forms,
code, modules and class modules. This form of testing is popularly known as Black Box
testing or System Testing.

146
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

Black Box testing method focuses on the functional requirements of the software. That is,
Black Box testing enables the software engineer to drive sets of input conditions that will
fully exercise all functional requirements for a program.
Black Box testing attempts to find errors in the following categories: incorrect or missing
functions, interface errors, errors in data structures or external data access, performance
errors and initialization errors and termination errors.

Output Testing or User Acceptance Testing:

The system is considered is tested for user acceptance; here it should satisfy the firm’s
need. The software should keep in touch with perspective system; user at the time of
developing and making changes whenever required. This

done with respect to the following points: Input Screen Designs, Output Screen Designs,
Online message to guide the user and the like
The above testing is done taking various kinds of test data. Preparation of test data plays
a vital role in the system testing. After preparing the test data, the system under study is
tested using that test data. While testing system by which test data errors are again
uncovered and corrected by using above testing steps and corrections are also noted for
future also.

147
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

148
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOGIN FORM:

MDI MAIN FORM:

149
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

COMPANY DETAILS:

BRANCH DETAILS:

150
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

DEPARTMENT DETAILS:

DESGANATION DETAILS:

151
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

GRADE DETAILS:

EMPLOYEE DETAILS:

152
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LEAVE MASTER:

LEAVE AVAILED:

153
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOAN MASTER:

LOAN AVAILED:

154
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

PAYROLL GENERATION

155
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

156
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOGIN TABLE:

BRANCH DETAILS:

COMPANY DETAILS:

157
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

DEPARTMENT DETAILS:

DESIGNATION DETAILS:

LEAVE MASTER:

158
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LEAVE AVAILED:

GRADE DETAILS:

LOAN AVAILED:

159
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

LOAN MASTER:

SALARY DETAILS:

160
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

161
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

In doing this project we obtained good amount of knowledge in the database


Environment in the windows operating system and thus has given us enough satisfaction

We have also acquired a good deal of knowledge and working experience in Visual Basic
6.0 as well as Microsoft Access. The synchronization of the interface between Visual
Basic 6.0 as front end and MS Access as back end was really interesting.

The report is well organized and all the technical specifications have been presented in a
good format in the report.

This project can be used as foundation for implementing the advanced concepts of
database like object oriented relational database model.

FUTURE ENHACEMENT:

In the service form we can include an option to selcet the particulars according to the
choice of the customers using the check box tool and process and genereate bill according
to the selection.

162
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

163
DEPARTMENT OF BCA (EPCHE)
EMPLOYEE PAYROLL MANAGEMENT SYSTEM

BOOKS:

1. Steven M.Bragg (2003) ‘Essentials of Payroll Management and Accounting’

2. Herbert Schildt (2000) ‘Visual Basic 6.0’ Tata McGraw Hill

3. John Zukowski (2000) ‘Visual Basic 6.0’ BPB Publications

4. Jamie Jaworsky ‘Visual Basic 6.0’ Techmedia

5. Stefen Denninger ‘Visual Basic 6.0’ Author’s Press

WEBSITES:

https://en.wikipedia.org/wiki/Payroll

www.vbtutor.net/vbtutor.html

https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-
features/strings/validating-strings

https://www.safaribooksonline.com/library/view/programming-visual-
basic/0596000936/ch08s03.html

https://www.youtube.com/watch?v=Byt6D7M4AJU

https://www.youtube.com/watch?v=oReH2vO8Izc

164
DEPARTMENT OF BCA (EPCHE)

You might also like