Vous êtes sur la page 1sur 117

Payroll Management System

PREFACE

The project on “PAYROLL MANAGEMENT SYSTEM” is aimed in helping to the


salary or compensation paid in the exchange of services rendered by the employees of
an organization.Payroll Management System is a system that manages the salaries of
all employees in an organization like it adds allowances to salaries, make updation in
salaries and make necessary deductions from salary and prepares the payslip of
employees till their retirement period comes or they remain in the company.
.

1
Payroll Management System

CONTENTS

CHAPTERS
CHAPTER 1-INTRODUCTION
1.1 Introduction about Company………………………………………
1.2 Introduction about Project………………………………………
1.3 Present state of the art…………………………………………….
1.4 Need of Computerization of System……………………………..
1.5 Proposed Software…………………………………………………

CHAPTER 2- SYSTEM ANALYSIS


2.1 Feasibility Study of s/w includes its types……………………….
2.2 Analysis Methodology (Types)…………………………………..
2.3 Choice of Platforms s/w & h/w…………………………………..

CHAPTER 3-SYSTEM DESIGN


3.1 Design methodology……………………………………………
3.2 Database Design……………………………………………......
3.3 Screen Design…………………………………………………..
3.4 Report Design………………………………………………......

CHAPTER 4-TESTING

4.1 Testing Methodology(Types)………………………………..


4.2 Unit Testing…………………………………………………
4.3 Module testing………………………………………………
4.4 System Testing………………………………………………
4.5 Alpha/ Beta Testing…………………………………………
4.6 Black Box And White Box Testing…………………………

CHAPTER 5-CONCLUSION AND REFRENCES


5.1 Conclusion………………………………………………….
5.2 Limitation of the system……………………………………
5.3 Future Scope for Modification……………………………..
5.4 Refrences…………………………………………………..

2
Payroll Management System

CHAPTER 1
INTRODUCTION
1.1 Introduction about Company
1.2 Introduction about Project
1.3 Present state of the art
1.4 Need of Computerization of System
1.5 Proposed Software (What would s/w accomplish?)

3
Payroll Management System

1.0 INTRODUCTION

1.Introduction about Company

 SOWMIYA HOSPITAL Hospital, run by DR.SOWMIYS VADANA .MS Coimbatore


district.
 Started as a 10-bed hospital in 1974, the Hospital is today a 100-bed multi-super specialty
high-tech hospital, offering a variety of healthcare services.
 Dr NS.JEYARAMAN,MBBS, who is the Managing Trustee of the Medical Trust and
Chairman of SOWMIYA HOSPITAL Hospital, is a recipient of many coveted awards,
including LIFE TIME ACHIEVEMENTAward from the President of India and Dr B.C.Roy
Award from the Prime Minister of India.

 Sowmiya Hospital has become one of the finest medical centres in the country and has
emerged as a completely self-contained healthcare institute, having some of the most
sophisticated equipment available in the world. It has earned national recognition as a
Leader in providing World Class Healthcare Services to the common man at affordable
costs.

 Sowmiya Hospital is a recognized Designated Blood Bank for nearly 200 hospitals
located in Coimbatore and the adjoining areas.
 The Hospital is also a beneficiary of the Prime Minister's Relief Fund and Tamil Nadu
Chief Minister's Relief Fund for providing medical care to the poorer sections of the society.
 Sowmiya Hospital is recognized under the Tamil Nadu Chief Minister's Comprehensive
Health Insurance Scheme for treating people below the poverty line.
 The Hospital has received quality accreditation from the NABH (National Accreditation
Board for Hospitals and Healthcare Providers) of Quality Council of India, New Delhi. .

4
Payroll Management System

1.2 Introduction about Project

“Payroll Management” is a distributed application, developed to evaluate the performance of employees


working in any organization. It maintains the information about a company, personal details of their
employees, also the project details assigned to particular developer. The application is actually a suite of
applications developed using Java.
It is simple to understand and can be used by anyone who is not even familiar with simple employees
system. It is user friendly and just asks the user to follow step by step operations by giving him few options.
It is fast and can perform many operations of a company.
This software package has been developed using the powerful coding tools of VB.Net 2008 at Front End and
Sql Server 2005 at Back End. Because of the Visual features, the software is very user friendly. The package
contains different modules like Contacts, Search for property and other useful Links. This version of the
software has multi-user approach. For further enhancement or development of the package, user’s feedback
will be considered.
This project basically deals with five modules and their further sub modules. First module is the employee
module into which we can enter employee details such as his name, address, phone number, his basic salary
and many more. After that we can view the details further by using the employee id, and we can modify the
details also. Similarly in department we have the details of all the HOD’s of the departments. Next comes the
salary module in this we can view the salary issued to the employee. And can issue them to the employee we
want to and can fix it to them.
We can put the grades also in the grade module. Basically we create the grades in this with specified details.
We can view the details accordingly. We can just enter the grade name and can view the details encapsulated
in the grade. Other than this we can view the whole thing all together by getting into the view grade section.
We can view the report also in this. It can be viewed in this easily that to which the monthly salary has been
allotted and for which month. We can also look out those employees to whom the salary has not been issued
and the further details also such as for which month it has not been issued. This is the basic overview of the
whole project

5
Payroll Management System

AIM: To design the record book for employees of a firm.


OBJECTIVE:
The main objective of our project is to prepare a record of all emplyees working in a firm.
Master:
 Nation Master.
 State Master
 City Master
 Schema Master
 Department Master
 Designation Master
 Employee Master
 Holidays Master

Transaction:
 Log Form.
 Leave Entry.
 Salary Calculation.

Users:
 Create Users.

Reports:
 Department Reports.
 Designation Reports.
 Scheme Reports
 Employee Reports
 Payroll Reports

6
Payroll Management System

1.3 Present state of the art

Presently salary calculation is done manually, it take so much of time to compose salary of all employees. It
also takes very long time to make salary slip ready. Due to manual process some time it takes very long time,
in turn it delays the salary distribution. This is a big problem to manage when salary is not generated in time.
The other main problem is errors, even with double cross check here or there some errors will happen, this
again create large problem. To solve all this the organization require very good software to take care of all
these.

1.4 Need of Computerization of System

The client uses MS Excel and maintains their records however it is not possible for them to share the data
from multiple system in multi user environment, there is lot of duplicate work, and chance of mistake. When
the records are changed they need to update each and every excel file. There is no option to find and print
previous saved records. There is no security anybody can access any report and sensitive data also reports of
summary. This Payroll Management System is used to overcome the entire problem which they are facing
currently, and making complete atomization of manual system to computerized system.

1.5 Proposed Software (What would s/w accomplish)

The proposed software will solve all the problems they are facing now. This software is designed such way
that it will generate the salary automatically every month in time. So there not much worries. This software
also equipped with the facility of checking the employees to whom no salary has been sanctioned. The
software built to generate individual pay slip and summary of the payroll.

7
Payroll Management System

CHAPTER 2
SYSTEM ANALYSIS

2.1 Feasibility Study of s/w includes its types


2.2 Analysis Methodology (Types)
2.3 Choice of Platforms s/w & h/w

SYSTEM ANALYSIS

2.1 Feasibility Study of s/w includes its types


Feasibility Study

Operational Feasibility

Technical Feasibility

Economical Feasibility

Motivational Feasibility

Scheduled Feasibility

Feasibility study :

Every project is feasible for given unlimited resources and infinitive time. Feasibility study is anevaluation
of the proposed system regarding its workability, impact on the organization, ability to meet the user needs
and effective use of resources. Thus when a new application is proposed it normally goes through a
feasibility study before it is approved for development .Feasibility and risk analysis and related in many
ways. If a project risk is great and feasibility of producing software is reduced. During the feasibility
analysis in this project has been discussed below in the abovementioned topics.
8
Payroll Management System


Operational Feasibility:

Feasibility of the working of the system after the installation inthe organization as mentioned in the
feasibility analysis.

Technical Feasibility:

Technical feasibility is frequently the most difficult area to ensure this stage. It is essential that the process of
analysis and definition to be conducted parallel toan assessment of the technical feasibility. The
consideration that is normally associated with technical feasibility includes the resources availability of the
Organization where the project is to be developed and implemented. By taking these facts into consideration
before developing the resource availability at Retail Outlet of Hindustan Petroleum was observed. As very
limited resources are required for this project hence this project is considered feasible for development.

Economic Feasibility:

An evaluation of development cost is weighted against the ultimate income or benefits derived from the
developed system. There was no need of extra hardware and software for development of this project. Hence
this project has economically justified for development in this organization.

Motivational Feasibility:

An evaluation of the probability that the organization is sufficient motivation to support the development and
implementation of the application with necessary user participation, resources, training etc. The interest and
support shown by the organization during the system study do not seem that the new system developed to
have efficient support from the organization.

Schedule Feasibility:

9
Payroll Management System

An evaluation of the time needed for the development of this project. The time schedule required for the
development of this project is very important, since more development time effects machine time, costs and
delays in the development of the other systems. So the project should be complete within affixed schedule
time as far as the organization is concerned.
Project Schedule:

The major output of the production process is the project schedule. This is a graphic representation of the
entire project related activities necessary to produce successful project. They allow the project manager to
efficiently coordinate and facilitate the efforts of the entire project team for the live project. This project
schedule dynamic in nature that will undoubtedly be modified as the project proceeds .Without the master
schedule the effective project control would be virtually impossible. If the schedule does not exist it is
impossible to accurately estimate the project status. Projects that are not complete within the time frame
established by the master schedule almost invariably exceed planned costs. The most complaint is that
production takes too much time and costs too much money .For schedule to be effective, it must process
several major characteristics:-

Understandable by those who will use it.

Sufficient detail to be provide on the basis of measurement and control of project progress.

Capable of highlighting critical tasks.

Flexible and easily modifiable.

Confirm to available resources.

Compatible with the system available in the organization.

10
Payroll Management System

2.2 Analysis Methodology (Types)

 Descriptive

 Exploratory

 Inferential

 Predictive

 Causal

 Mechanistic

1. Descriptive (least amount of effort): The discipline of quantitatively describing the main
features of a collection of data. In essence, it describes a set of data.
- Typically the first kind of data analysis performed on a data set
- Commonly applied to large volumes of data, such as census data
-The description and interpretation processes are different steps
- Univariate and Bivariate are two types of statistical descriptive analyses.
- Type of data set applied to: Census Data Set – a whole population

2. Exploratory: An approach to analyzing data sets to find previously unknown relationships.


- Exploratory models are good for discovering new connection.
- They are also useful for defining future studies/questions
- Exploratory analyses are usually not the definitive answer to the question at hand, but only the start
- Exploratory analyses alone should not be used for generalizing and/or predicting
- Remember: correlation does not imply causation
- Type of data set applied to: Census and Convenience Sample Data Set (typically non-uniform)
- a random sample with many variables measured

11
Payroll Management System

3. Inferential: Aims to test theories about the nature of the world in general (or some part of it) based on
samples of “subjects” taken from the world (or some part of it). That is, use a relatively small sample of data
to say something about a bigger population.
- Inference is commonly the goal of statistical models
- Inference involves estimating both the quantity you care about and your uncertainty about your estimate
- Inference depends heavily on both the population and the sampling scheme
- Type of data set applied to: Observational, Cross Sectional Time Study, and Retrospective Data Set – the
right, randomly sampled population

4. Predictive: The various types of methods that analyze current and historical facts to make predictions
about future events. In essence, to use the data on some objects to predict values for another object.
- The models predicts, but it does not mean that the independent variables cause
- Accurate prediction depends heavily on measuring the right variables
- Although there are better and worse prediction models, more data and a simple model works really well
- Prediction is very hard, especially about the future references
- Type of data set applied to: Prediction Study Data Set – a training and test data set from the same
population

5. Causal: To find out what happens to one variable when you change another.
- Implementation usually requires randomized studies
- There are approaches to inferring causation in non-randomized studies
- Causal models are said to be the “gold standard” for data analysis
- Type of data set applied to: Randomized Trial Data Set – data from a randomized study

6. Mechanistic (most amount of effort): Understand the exact changes in variables that lead to changes in
other variables for individual objects.
- Incredibly hard to infer, except in simple situations
- Usually modeled by a deterministic set of equations (physical/engineering science)
- Generally the random component of the data is measurement error
- If the equations are known but the parameters are not, they may be inferred with data analysis
- Type of data set applied to: Randomized Trial Data Set – data about all components of the system

12
Payroll Management System

2.3 Choice of Platforms s/w & h/w

FRONT END:

The programming has been done using the language Java. It is Sun Microsystems’s strategic language for
platform independent programming. It is easy to use, efficient and flexible. This language is preferred
because one can build a program using this object oriented and platform independent programming with less
effort than with any other programming language. It’s a natural language for building database applications,
owing to the level and sophistication of the tools included with the language.

BACK END:

Microsoft SQL Server is one of the leading database management systems available on the market today. It
is easy to use and administer, and it comes with tools and wizards that make it easy to develop applications.
The database itself has been redesigned to automatically perform many tuning functions, leaving you free to
focus on most important tasks.

PLATFORM USED:

The Payroll Management System is targeted at Microsoft Windows platforms.

FRONT-END TOOLS
Visual Basic.NET
Visual basic.NET is the latest incarnation of the world’s most popular computer programming language, and
it brings a lot of new features to the table. This new things called “dot.net” is a revolutionary change from
Visual Studio 6.0 (which included Visual Basic 6.0). Visual Basic .NET is not “Visual Studio 7.0” as you
13
Payroll Management System

might think. On the contrary, it is a new product developed from scratch, not tied to the previous version
(and not entirely compatible either). In a sense, you might think of this as a whole new product line starting
at version 1.0—but that’s only partially true. The people who created Visual Basic .NET took all of the
favorite features of Visual Basic 6.0 and the features of a dozen other popular language, and crammed all of
this new goodness into a single new development tool. The result is a stellar programming language, and it
has no equivalent in the computer world.

FEATURES OF Visual Basic.NET:

 Powerful Windows-based Applications


 Building Web-based Applications

 Simplified Deployment

 Powerful, Flexible, Simplified Data Access

 Improved Coding

 Direct Access to the Platform

 Full Object-Oriented Constructs

 XML Web Services

 Mobile Applications

 COM Interoperability

 Reuse Existing Investments

 Upgrade Wizard

ADVANTAGES OF VISUAL BASIC.NET:

1. First of all, VB.NET provides managed code execution that runs under the Common Language
Runtime (CLR), resulting in robust, stable and secure applications. All features of the .NET
framework are readily available in VB.NET.
2. VB.NET is totally object oriented.
14
Payroll Management System

3. The .NET framework comes with ADO.NET, which follows the disconnected paradigm, i.e. once the
required records are fetched the connection no longer exists. It also retrieves the records that are
expected to be accessed in the immediate future. This enhances Scalability of the application to a
great extent.
4. VB.NET uses XML to transfer data between the various layers in the DNA Architecture i.e. data are
passed as simple text strings.
5. Error handling has changed in VB.NET. A new Try-Catch-Finally block has been introduced to
handle errors and exceptions as a unit, allowing appropriate action to be taken at the place the error
occurred thus discouraging the use of ON ERROR GOTO statement. This again credits to the
maintainability of the code.
6. Another great feature added to VB.NET is free threading against the VB single-threaded apartment
feature. In many situations developers need spawning of a new thread to run as a background process
and increase the usability of the application. VB.NET allows developers to spawn threads wherever
they feel like, hence giving freedom and better control on the application.
7. Security has become more robust in VB.NET. In addition to the role-based security in VB6, VB.NET
comes with a new security model, Code Access security. This security controls on what the code can
access. For example you can set the security to a component such that the component cannot access
the database. This type of security is important because it allows building components that can be
trusted to various degrees.
8. The CLR takes care of garbage collection i.e. the CLR releases resources as soon as an object is no
more in use. This relieves the developer from thinking of ways to manage memory. CLR does this for
them.

Due to large number of facilities provided by the Visual Basic .NET, it has been used as a front-end tool
in “Payroll Management System”.

MICROSOFT SQL (BACK END):

A database is a collection of information stored somewhere for easy organization and exploration. Databases
are used in various situations such as keeping a record of registering employees job attendance, counting the
number of Employee in a Company and keeping a record of their grades. This means that we have been
using databases all our life. We are going to learn how to use the computer to create and exploit databases.
We will use Microsoft Sql. Learning how to use Microsoft Sql and some programming is just a matter of

15
Payroll Management System

applying your already tremendous knowledge on information storage and retrieval. Microsoft Sql is a
software product used for desktop database applications. You can use it for personal stuff, for home, or for
your business/company.
2.3.2 DATA BASE:
In the Circular system data should be stored in the database, when circular event are
entered in the list by one user to another user, all the events are stored in database in their
particular fields.
When user view their events in the circular screen, the stored data in the database
are retrieve back to the particular user who as the privileges to view the events.
Storing and Retrieving are the two main features of the project and Hence I choose
SQL Server 2005 which is faster in storing the data and user friendly to easy understand.
Database can contain a maximum of 2^31 object, and can span multiple OS-level files with
a maximum file size of 2^20 TB.
The circular system as unit of data storage, which is a collection of tables with typed
columns. SQL server supports different data types, including primary keys such as Integer,
Float, Decimal, Char (including character strings),Text(for textual data) among others. It also
allow user-defined composite types (UDTS) to be defined and used.
The circular event page type –data storage in the database; index, allocation map
which holds information about how pages are allocated to tables and indexes, change map
which holds information about changes made to other pages since last backup or logging, or
contain large data.

16
Payroll Management System

SQL SERVER 2005


Microsoft SQL server is a relational model database server produced by Microsoft. Its
primary query languages are T-SQL and ANSI SQL.
Storage space allocated to a database is divided into sequentially numbered pages,
each 8KB in size. A page is the basic unit of I/O for SQL Server operations. A page is marked
with a 96-byte header which stores metadata about the page including the page number, page
type, free space on the page and the ID of the object that owns it.
A database object can either span all 8 page in an extent (“uniform extent”) or share an
extent with up to 7 more object (“mixed extent”). A row in a database table cannot span more
than one page, so is limited to 8 KB in size. However, I the data exceeds 8 KB and the row
contain Varchar or Varbinary data, the data in those columns are moved to a new page (or
possibly a sequence of pages, called an Allocation unit) and replaced with a pointer to the
data.
SQL Server 2005 actually has seven different editions available such as: standard
edition, enterprise addition, personnel edition, developer edition, windows, CE edition,
evaluations edition and Microsoft desktop edition.
The most frequently used tools are Enterprise Manager, Query Analyzer, SQL Profiler,
Service Manager, Data Transformation Services and Books Online. SQL Server 2005 also
provides many client tools and networking interfaces for other Microsoft opening systems.
SQL Server is part of the core of a family of integrated products that including the
development tools, system management tools, distributed system components and open
development interfaces.
17
Payroll Management System

3.2 HARDWARE SPECIFICATIONS

 CPU Intel Pentium IV 1.80 GHz or higher


 RAM 512 % GB and Higher(for best performance)
 Keyboard 105 Standard keys
 Hard disk 10GB or higher free space

CHAPTER 3
SYSTEM DESIGN

3.1 Design methodology


3.2 Database Design
3.3 Screen Design
3.4 Report Design
(Include DFD/ERD/OOAD/ Screen Shots/ Reports & Data Base
Design)

SYSTEM DESIGN

3.1 Design methodology

18
Payroll Management System

A software require specification document tells us what a system does and becomes input to the design
process. The purpose of design phase is to produce a solution to problem given SRS document.

SOFTWARE REQUIREMENT SPECIFICATION

Software Requirement Specification (SRS) Document

The SRS is a specification for a particular software product, program or a set of program that perform certain
functions in specified environment. The two scenarios entirely different purpose for the document. First case
SRS is used to define the needs and expectations of the user. The second case, SRS is written for different
purpose and serve as a centre document between customers and develop.
Nature of SRS: -
The basic issues that SRS writer shall address the following.
1.Functionality: - What the software supposed to do?
2. External Interface: - How does the software interact with people, the system hardware
and other software?
3. Attributes: -What re the considerations for portability, correctness, security, reliability etc.?

Characteristic of a good SRS An SRS should be


1. Correct
2. Complete
3. Consistent
4. Verifiable
5. Modifiable
6. Traceable
A well-designed, well-written SRS accomplishes four major goals:
19
Payroll Management System

 It provides feedback to the customer. An SRS is the customer's assurance that the development

 It serves as a product organization understands the issue or problems to be solved and the software
behavior necessary to address those problems.

 It decomposes the problem into component parts. The simple act of writing down software requirements
in a well-designed format organizes information, place borders around the problem, solidifies ideas and help
break down the problem into its component parts into an orderlyfashion.

 It serves as an input to the design specification. As mentioned previously, the SRS serves as the parent
document to subsequent software design specification and statement of work. Therefore the SRS must contain
sufficient detail in the functional system requirement so that a design solution can be devised.

 Validation check. The SRS also serves as a parent document for testing and validation strategies that will
be applied for the requirements for verification.
SRS are typically developed during the first stage of "Requirements Development" which is the initial
product development phase in which information is gathered about what requirements are needed or not.
This information gathering stage can include onsite visit, questionnaires, surveys, interviews and perhaps a
return-on-investment (ROI) analysis of the customer or client's current business environment. The actual
specifications, then is written after the requirements have been gathered and analyz

SRS INCLUDE:
Several standard organizations (including the IEEE) have identified nine topics that must be addressed
when designing and writing an SRS:

1) Interfaces
2) Functional capabilities
3) Performance Levels
4) Data Structure Elements
5) Safety
6) Reliability
7) Security/Privacy
8) Quality
9) Constraints
20
Payroll Management System

TABLES:

Mainly, in this project we have four tables that are employee table, department table, salary table and grade
table. After filling all the enteries the detail of all the employees are ready.
STATUS: Working

AREAS OF APPLICATION: For Small Scale Industries


TARGET USERS: Large scale version can be implemented in both small scale & medium scale.
ADVANTAGES: 1. Cost effective
2. Simple to operate

Design Process

The computer system design process is an exercise of specifying how, the system will work. It is an iterative
process, which is based on what the system will be do as shown in the feasibility report.Mainly, following
five parts have been included in the system design process

Output Design

The starting point of the design process is the proper knowledge of system requirements which will normally
be converted in terms of output.

Input Design

Once the output requirements have been finalized, the next step is to find out what data need to be made
available to the system to produce the desired outputs. The basic documents in which these data are available

21
Payroll Management System

need to be identified. If necessary, these documents may have to be revised or new documents may have to
be introduced.

File Design

Once the input data is captured in the system, these may to be preserved either for a short or long period.
These data will generally be stored in files in a logical manner. The designer will have to devise the
techniques of storing and retrieving data from these files.

Procedure Design

This step involves specifications of how processing will be performed. In this, there are two aspects:

 Computer Procedure

The computer procedure will specify what functions will be carried out on computer, what will be
different programs and in what sequence the programs will be run.

 Non-computer procedure

The non-computer procedure will specify the manual procedures for feeding input data, receiving outputs
etc.

 Control Design

The control design indicates necessary procedures which will ensure correctness of processing, accuracy of
data, timely output etc. this will ensure that the system is functioning as per plan.

 Development and Deployment Design

Major responsibilities include system Requirement Study, Preparing System Design Document, Preparing
the Program (Form) Specs, Peer Review of the Specs, Implement Quality procedures as per the QMS
Document, Documentation of SRS Revalidation & Design Documents, thorough grasping of the user
functionality and applying, approving the same in the project, Developing, Testing & Debugging of Forms,
User Training and Implementation of the module.

22
Payroll Management System

 INPUT DESIGN(Introduction)

Once the analysis and design of the system has been done, it would be necessary to identify the data that are
required to be processed to produce the outputs. Input is one of the most expensive phases of the operation
of a computerized system and creates sometimes a major problem. Different type of problem with a system
can usually be traced back to faulty input design method needless to say, therefore, that the input data are the
lifeblood of a system and have to be analyzed and designed with utmost care and consideration. Input design
features can ensure the reliability of the system and generate correct reports form the accurate data. The
input design also determines whether the user can interact efficiently with the system.

 Elements of Input Data

Inaccurate input data are the most common cause of errors in data processing. Errors entered by data entry
operators can be controlled by input design. Input data are collected and organized into groups of similar
data. Once identified, appropriate input media are selected for processing.

 Input Data

The goal of designing input data is to make data entry as easy, logical and error free from errors as possible.
In entering data, operators need to know the following:

 The allocated space for each field.


 Field sequence, which much match that in the source document.
 The format in which data fields are entered for example, filling out the date field is required
through the edited format dd/MM/yyyy.
 When we approach input data design, we design the source document. Let us elaborate on each
step.
Source Documents

Source data are captured initially on original paper or a source document. For example, a cheque written
against an account is a source document. When it reaches the bank, it is encoded with special magnetic ink
character recognition so that a reader that is part of the information system of the bank can process it.
Therefore, source documents initiate a processing cycle as soon as they are entered into the system. Source
documents may be entered into the system from punch cards, from diskettes, or even directly through the
keyboard.

A source document should be logical and easy to understand. Each area in the form should be clearly
identified and should specify for the user what to write and where to write it.A source document may or may
23
Payroll Management System

not be retained in the proposed system. Thus, each source document may be evaluated in terms of Its
continued use in the proposed system .The extent of modification for the proposed system & Replacement
by an alternative source document.

Input Design Guidelines

The design of input play very significant role in getting the correct output. It covers al phases of input from
creation of initial data (original recording) to actual entering the data to the system for processing. The input
design is the link that ties the information system into the world of its users. Some features of design may
vary depending on whether the system is batch-oriented or on-line. Here, we will discuss the various
objectives of input design. They focus on:

 Controlling amount of input


 Avoiding delay
 Avoiding errors in data
 Avoiding extra steps
 Keeping the process simple

Each of the five objectives of input design is briefly discussed below:

 Controlling Amount of Data

An effective design controls the quantity of data for input for the following reasons:Firstly, data preparation
and data entry operations depend on people. Since labor costs are high, the cost or preparing and entering
data is also high. It is quite evident, then that reducing data requirements mean lowering cost through
reduced labor expense.Secondly, the input phase of computing can be slow process and take many times
longer than that needed by computers to carry out their tasks. In fact, the computer itself may sit idle until
data is prepared and input for processing. By reducing input requirements, the analyst will speed the entire
process from data capture to processing to provide result to users.

 Avoiding Delay

When processing is delayed owing to data preparation or data entry, the cause is called a bottleneck. Avoid
bottlenecks when designing input should always be one of the objectives of the analyst.

24
Payroll Management System

 Avoiding Errors in Data

The third objective deals with errors. In one sense, the rate at which errors occur is dependent on the quantity
of data. Since the lower the amount of data is inputted, there are fewer opportunities for the error to occur.
Firstly, the analyst can reduce this number by reducing the volume of data dust must be entered for each
transaction.Secondly, the analyst can also affect error rates of an operation through design. The manner in
which data must be entered can reduce the chance of errors.Still, a third aspect of error control is the need to
detect errors when they do occur. Checks and balances in the data entry programs, called input validation
techniques, also detect errors input.

OUTPUT DESIGN (Introduction)

Presenting the data processed by a computer-based information system in an attractive and usable form has
become very essential these days’ success and acceptance of a system to some extent depends on good
presentation. Therefore, system analyst must know fully how to design output report in an attractive way.
Many new output devices are being introduced in the market because of recent development in computer
technology. System analyst must be aware of these new technologies and try to use these new output devices
if possible. Currently, excellent graphic displays are widely available. Speech output systems are also fast
emerging.

There are three main reasons why outputs from the computer are required. They are:

 For communication to the persons concerned.


 For re-input to the computer for being connected with other data and further processing.
 For permanent storage.

Types of Output:

Outputs of a system can take different forms. The most common are reports, displays on screen, printed
forms etc. the outputs also vary in terms of their contents, type of stationery. Frequency and timing etc.
besides, due consideration also need to be given as to who will use the output and for what purpose. All
these points must be kept in mind while designing outputs so that the objectives of the system are met in the
best possible way.

Outputs of a data-processing system can be placed into two categories:

 Application Output

25
Payroll Management System

 Operating Output

Application Output

These are the outputs desired out of the system to meet its objectives. These are of three types:

 Output as a basis for decision-making. This type of output is generally required by management
for decision-making purposes.
 Output as a requirement to meet a functional objective. Invoices, Excise Gate Pass, Purchase
Orders are the examples of such output.
 Statutory outputs: All organization is required to produce a certain amount of reports and forms as
required by law.

Operating Output

These outputs are mainly generated for use of EDP staff and give various indications as to how the system
operates. System logs, error messages, status indicators etc. are the examples of such output. These types of
output are not concerned for the users.

Database Design

26
Payroll Management System

Database
We have various tables in our project namely:
 User Table
 Nation Table
 State Table
 City Table
 Scheme Table
 Department table
 Designation Table
 Employee Table
 Holidays Table
 Attendance Table
 Leave Table
 Salary Table

27
Payroll Management System

All the above tables are now briefly explained in which the Primary key and the Data Type of all fields are
discussed.
Table Name: Mas_User
For Users Details
Column Name Data Type Description
uid bigint Auto identity

Userid Nvarchar(50) Login id(Primary Key)

username Nvarchar(100) User Name

password Nvarchar(50) User Password

Rights Nvarchar(50) Fixed Rights Controled by


Admin
InActivate Int 0- Deactivate User
1-Activate User

Table Name: Mas_Nation


For Nation(Country) Details
Column Name Data Type Description
Code bigint Nation Code(Primary Key)

Nationality Nvarchar(100) Nation Name

Description Nvarchar(100) About the Nation

Table Name: Mas_State


For State Details
Column Name Data Type Description
Code bigint Nation Code(Primary Key)

Nation_Code Nvarchar(100) Refer Nation Name from


Nation Table
State Nvarchar(100) State Name

Table Name: Mas_City


28
Payroll Management System

For City Details


Column Name Data Type Description
CID bigint Auto Identity(Primary Key)

Code bigint City Code

City Nvarchar(100) City Name

StateCode bigint Refer State Name from State


Table
Country_Code bigint Refer Nation Name from
Nation Table

Table Name: Mas_Scheme


For under by employee scheme and employee Salary
Column Name Data Type Description
SchemeID bigint Auto Identity(Primary Key)

Scheme_Code nvarchar(50) Scheme Code

Scheme_Name nvarchar(255) SchemeName

Salaryp numeric(18, 2) Daily Salary

Salary numeric(18, 2) Monthly Salary

Basicp numeric(18, 2) Basic Daily Salary

Basic numeric(18, 2) Monthly Basic Salary

HRAP numeric(18, 2) HRA Percentage

HRA_Amount numeric(18, 2) HRA Amount

ESIP numeric(18, 2) ESI Percentage

ESI_Amount numeric(18, 2) ESI Amount

EPFP numeric(18, 2) EPF Percentage

EPF_Amount numeric(18, 2) EPF Amount

DeductionP numeric(18, 2) Deduction Percentage

Deduction_Amount numeric(18, 2) Deduction Amount

TaxP numeric(18, 2) Tax Percentage

Tax_Amount numeric(18, 2) Tax Amount

29
Payroll Management System

Medicare numeric(18, 2) Medicare Amount

Medicompany nvarchar(255) Medicare Company Name

CL numeric(18, 2) Casual Company Leave

Description nvarchar(MAX) Any Other Details

Table Name: Mas_Department


For Department Details
Column Name Data Type Description
Code bigint (Primary Key)

Department nvarchar(100) Department Name

Description nvarchar(100) Any other Details

Table Name: Mas_Designation


For Designation Details
Column Name Data Type Description
Code bigint (Primary Key)

Designation nvarchar(100) Designation Name

Description nvarchar(100) Any other Details

Table Name: Mas_Employee


For Employee Details
Column Name Data Type Description
EmpId bigint Auto Identity(Primary Key)

EmpCode nvarchar(50) Employee Code

EmpPfix nvarchar(50) Employee Prefix

Code bigint Employee Numeric Code

EmpName nvarchar(50) Employee Name

30
Payroll Management System

Sex nvarchar(50) Employee Gender

DOB datetime Date of Birth

Age bigint Age

Add1 nvarchar(100) Address1

Add2 nvarchar(100) Address2

Add3 nvarchar(100) Address3

CityCode nvarchar(50) City code from city table

Mobile nvarchar(50) Mobile No

Phone nvarchar(50) Phone No

EmailId nvarchar(100) Email ID

OutLet nvarchar(50) Out Let

DeptCode nvarchar(50) Department code from


department table
DesignCode nvarchar(50) Designation code from
designation table
Activate bigint 0- Deactivate
1- Activate
Photo image Employee Image

Pincode nvarchar(50) Pin Code

DOJ datetime Date of Join

ipath nvarchar(255) Image Path or Location

Emp_Scheme nvarchar(50) Under the Employee Scheme

Table Name: Mas_Holidays


For Holidays Details
Column Name Data Type Description
Code bigint (Primary Key)

Month_Name nvarchar(100) Month Name

Holidays numeric(18, 2) Number of leave particular


month
Description nvarchar(100) Any other details

Table Name: Attendance


31
Payroll Management System

For employee Attendance Details


Column Name Data Type Description
Aid bigint Auto Identity(Primary Key)

Emp_Code nvarchar(50) Employee Code

Emp_Name nvarchar(250) Employee Name

Department nvarchar(100) Employee Department

Designation nvarchar(100) Employee Designation

Login_Date datetime Login Date

Login_Time datetime Login Time

Logout_Date datetime LogOut Date

Logout_Time datetime LogOut Time

Total_Hours numeric(18, 2) Total Hours

Entry_Date datetime Entry Date(System date)

Status nvarchar(50) 0-Absent


1-Present

Table Name: Mas_Holidays


For Holidays Details
Column Name Data Type Description
Lid bigint Leave Code (Primary Key)

Emp_code nvarchar(50) Employee Code

LDate datetime Leave Date

EDate datetime System Date

LType nvarchar(50) Leave Type(Leave,Absent,CL)

Description nvarchar(MAX) Any others

Table Name: Salary_Table


For Salary Details
Column Name Data Type Description
Sal_ID int Auto Identity(Primary Key)

32
Payroll Management System

Pay_No int Salary Slip No

Emp_Code nvarchar(50) Employee Code

Emp_Name nvarchar(150) Employee Name

Department nvarchar(150) Department Name

Designation nvarchar(150) Designation Name

Salary_Month nvarchar(150) Salary Month

From_Date datetime From Date

To_Date datetime To Date

Salary_Date datetime Salary Date

Scheme_ID int Schem ID

Month_Salary numeric(18, 2) Total Month Salary

Day_Salary numeric(18, 2) Daily Salary

Working_Days numeric(18, 2) Month Working Days

Present_Days numeric(18, 2) Present Days

Present_Salary numeric(18, 2) Present Salry

Holidays numeric(18, 2) No of holidays

Holidays_Salary numeric(18, 2) Holidays Salary

CL numeric(18, 2) Company Casual leave

usedcl numeric(18, 2) Used Company Casual leave

CL_Salary numeric(18, 2) Company Casual leave Salary

Absent_Days numeric(18, 2) Absent Days(With out


information)
Absent_Salary numeric(18, 2) Absent days Salary(-)

Leave_Days numeric(18, 2) Leave Days(With information)

Leave_Salary numeric(18, 2) Leave days Salary(-)

HRA numeric(18, 2) HRA Percentage %

HRA_Amount numeric(18, 2) HRA Amount(-)

ESI numeric(18, 2) ESI Percentage %

ESI_Amount numeric(18, 2) ESI Amount(-)

33
Payroll Management System

EPF numeric(18, 2) EPF Percentage %

EPF_Amount numeric(18, 2) EPF Amount(-)

Deduction numeric(18, 2) Deduction Percentage %

Deduction_Amount numeric(18, 2) Deduction Amount(-)

Taxp numeric(18, 2) TaxPercentage %

Tax_Amount numeric(18, 2) TaxAmount(-)

Extra_Plus numeric(18, 2) Extra Amount(+)

Extra_Minus numeric(18, 2) Extra Amount(-)

Total_Salary numeric(18, 2) Total Salary

Views:
View Name:view_attandance
Calculate the Employee Attendance
create view [dbo].[view_attandance] as
select emp_code,emp_name,department,designation,count(aid) as Presents,
leave=(select count(lid) from Leave_tbl where emp_code=attn.emp_code and
Ltype='Leave'),
Absent=(select count(lid) from Leave_tbl where emp_code=attn.emp_code and
Ltype='Absent'),
CL=(select count(lid) from Leave_tbl where emp_code=attn.emp_code and Ltype='CL')
from Attendance attn where status=1
group by emp_code,emp_name,department,designation

View Name: view_employee


Retrieve the Employee Records

create view [dbo].[view_employee] as


select emp.*,dep.department as department,des.designation as designation,cit.city as
cityname,st.state as state,nat.nationality as nation,ms.Scheme_Code,ms.Scheme_name from
mas_employee emp left outer join mas_department dep on dep.code=deptcode left outer
join mas_designation des on des.code=designcode left outer join mas_city cit on
cit.city_code=emp.citycode left outer join mas_state st on st.code=cit.statecode left
outer join mas_nation nat on nat.code=cit.country_code left outer join mas_scheme ms on
ms.Scheme_Code=emp.Emp_Scheme

34
Payroll Management System

3.3 Screen Design


Login Screen

FORMS
Main Form Name: PayRoll Management System

35
Payroll Management System

This is the main menu of our project. This is the front page or the first page which appears when we start our
project
It has 5 modules namely:
Master:
 Nation Master.
 State Master
 City Master
 Schema Master
 Department Master
 Designation Master
 Employee Master
 Holidays Master

Transaction:
 Log Form.
 Leave Entry.
 Salary Calculation.

36
Payroll Management System

Users:
 Create Users.

Reports:
 Department Reports.
 Designation Reports.
 Scheme Reports
 Employee Reports
 Payroll Reports

Main Form Menu Design

37
Payroll Management System

38
Payroll Management System

Form Name: Nation Master

Form Name: State Master

39
Payroll Management System

Form Name : City Master

Form Name : Holidays Master

40
Payroll Management System

Form Name : Scheme Master

Form Name : Department Master

41
Payroll Management System

Form Name : Designation Master

Form Name: Employee Master

42
Payroll Management System

Form Name : Log Form

Form Name : Leave Entry

43
Payroll Management System

Form Name : Calculate Salary

Salary Slip Design using Crystal Report

44
Payroll Management System

Form Name: User Creation

Reports
Department Report

45
Payroll Management System

Designation Report

Scheme Report

46
Payroll Management System

Employee Report Form

Employee Report Design

47
Payroll Management System

Payroll Report Form

48
Payroll Management System

Payroll Report – Monthly Salary Report

49
Payroll Management System

Attendance Report

3.4 Report Design

50
Payroll Management System

(Include DFD/ERD/OOAD/ Screen Shots/ Reports & Data Base Design)

DFD SYMBOLS:

In the DFD, there are four symbols


1. A square defines a source(originator) or destination of system data
2. An arrow identifies data flow. It is the pipeline through which the information flows
3. A circle or a bubble represents a process that transforms incoming data flow into
outgoing
data flows.
4. An open rectangle is a data store, data at rest or a temporary repository of data

51
Payroll Management System

52
Payroll Management System

0 LEVEL DFD
Employee

Department

Salary Scheme

Report

1st LEVEL DFD:

Employee

Modify

New
View Employee

All
Id

Employee

53
Payroll Management System

2nd Level DFD:

54
Payroll Management System

E-R Diagram

55
Payroll Management System

Database Design

56
Payroll Management System

SCREENSHOTS

57
Payroll Management System

EXECUTION PHASE:
In this phase we will enter the details of an employee and we will save the record in the database.in this we
will do the things stepwise and these are as follows:

Login Screen

FORMS
Main Form Name: PayRoll Management System

58
Payroll Management System

Form Name: Nation Master

Form Name: State Master

59
Payroll Management System

Form Name : City Master

60
Payroll Management System

Form Name : Holidays Master

Form Name : Scheme Master

61
Payroll Management System

Form Name : Department Master

Form Name : Designation Master

62
Payroll Management System

Form Name : Employee Master

Form Name : Log Form

63
Payroll Management System

Form Name : Leave Entry

Form Name : Calculate Salary


64
Payroll Management System

Salary Slip

65
Payroll Management System

Form Name : User Creation

66
Payroll Management System

Reports
Department Report

Designation Report

67
Payroll Management System

Scheme Report

Employee Report Form

Employee Reports
68
Payroll Management System

Payroll Report Form

Payroll Report – Monthly Salary Report


69
Payroll Management System

Attendance Report

70
Payroll Management System

Sample Code
Log in Page

Imports System.Data.SqlClient
Imports System.Data.Sql
Imports System.Data

Public Class FrmLogIn


Inherits System.Windows.Forms.Form
Dim cmd As New SqlCommand

Dim start, finish As Integer


Dim role As String

Private Sub FrmLogIn_Activated(ByVal sender As Object, ByVal e As System.EventArgs)


Handles Me.Activated
TxtLogin.Focus()
End Sub

Private Sub FrmLogIn_FormClosing(ByVal sender As Object, ByVal e As


System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
''Dim ans As MsgBoxResult
''ans = MsgBox("Are You Sure Want To Quit ???", MsgBoxStyle.YesNo +
MsgBoxStyle.Question, "Beros")
''If ans = MsgBoxResult.Yes Then
'' End
'' Exit Sub
''Else

''End If

End
End Sub

Private Sub FrmLogIn_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Close()
Caution_Frm.Close()
End If
End Sub
Private Sub FrmLogIn_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
'TxtLogin.Focus()
connection()
openconnection()
Timer2.Start()
start = 1
finish = 100
CNm()
TxtLogin.Focus()

If A_Main.Visible = True Then


A_Main.Close()
End If
FillAccountingYear()
Catch ex As Exception

71
Payroll Management System

End Try

End Sub

Sub FillAccountingYear()
''appset.fillcbo(cboAccountingYear, "select AccountingYearId, AccountingYear
from AccountingYear Order By AccountingYearId Desc", "AccountingYear",
"AccountingYear", "AccountingYearId", False)
End Sub
Sub CNm()
Try
''openconnection()
Dim a As String
a = ""
''cmd = New sqlcommand("Select CName from Tbl_Company ", Cn)
''a = cmd.ExecuteScalar
CmbCompany.Text = "KG TRIGGER " '' a
TxtLogin.Focus()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Sub clear()
TxtLogin.Text = ""
TxtLoginPassword.Text = ""
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Timer1.Tick

If start < finish Then


ProgressBar1.Value = start
start = start + 1
Else
Timer1.Enabled = False
If Trim(role) <> "" Then
A_Main.Show()
A_Main.ToolStripStatusLabel5.Text = " User ID: " &
Trim(TxtLogin.Text)
A_Main.Txt_UserId.Text = Trim(TxtLogin.Text)
A_Main.ToolStripStatusLabel5.TextAlign = ContentAlignment.TopRight
Me.Hide()
End If
clear()
start = 0
ProgressBar1.Value = 0
End If
End Sub

Private Sub BtnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles BtnGo.Click

Try

If TxtLogin.Text = "" Then


MsgBox("Please Enter The UserName", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Beros")
TxtLogin.Focus()
Exit Sub

72
Payroll Management System

End If

If TxtLoginPassword.Text = "" Then


MsgBox("Please Enter The Password", MsgBoxStyle.Information +
MsgBoxStyle.OkOnly, "Beros")
TxtLoginPassword.Focus()
Exit Sub
End If

''If Trim(cboAccountingYear.Text) = "" Then Exit Sub


''If Val(cboAccountingYear.Text) = 0 Then Exit Sub

''General.FrmLogIn = Me
''General.AccountingYearId = Val(cboAccountingYear.SelectedValue)
''General.AccountingYear = cboAccountingYear.Text

''getmessage()
''A_Main.Show()
''Me.Hide()

''connection()

cmd = New SqlCommand("Select * from Mas_User where userid='" &


TxtLogin.Text & "'and Password='" & TxtLoginPassword.Text & "'", Cn)
''cmd.Connection = Cn

'' Dim dr11 As SqlDataReader


''dr11 = cmd.ExecuteReader

'' If dr11.Read Then


If IsDBNull(cmd.ExecuteScalar()) = False Then
'' openconnection()
Dim ccmd As New SqlCommand("Select Rights as Role from Mas_User where
userid='" & TxtLogin.Text & "'and Password='" & TxtLoginPassword.Text & "' and
IsActivate=1", Cn)
ccmd.Connection = Cn

If IsDBNull(ccmd.ExecuteScalar) = True Then


role = ""
MsgBox("Sorry UserName\Password Incorrect!", MsgBoxStyle.Critical +
MsgBoxStyle.OkOnly, "Beros")
clear()
TxtLogin.Focus()
Exit Sub
Else
role = ccmd.ExecuteScalar()
If Trim((role)) = "Admin" Then
'' A_Main.UserCreationToolStripMenuItem.Visible = True
ElseIf Trim((role)) = "Sub Admin" Then
A_Main.UserToolStripMenuItem.Visible = False

ElseIf Trim((role)) = "Master" Then


A_Main.MasterToolStripMenuItem.Visible = True

ElseIf Trim((role)) = "Transaction" Then


A_Main.MasterToolStripMenuItem.Visible = False

ElseIf Trim((role)) = "Reports" Then


A_Main.MasterToolStripMenuItem.Visible = False

73
Payroll Management System

End If
End If
Timer1.Enabled = True
Else
MsgBox("Sorry UserName\Password Incorrect!", MsgBoxStyle.Critical +
MsgBoxStyle.OkOnly, "Beros")
clear()
TxtLogin.Focus()
Exit Sub
End If

'' dr11.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Private Sub CmbCompany_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles CmbCompany.KeyDown
If e.KeyCode = Keys.Enter Then
e.Handled = True
TxtLogin.Focus()
End If
End Sub

Private Sub CmbCompany_SelectedIndexChanged(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles CmbCompany.SelectedIndexChanged

End Sub

Private Sub txtLogin_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs)
If e.KeyCode = Keys.Enter Then
e.Handled = True
TxtLoginPassword.Focus()
End If
End Sub

Private Sub txtLogin_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs)

End Sub

Private Sub TxtLoginPassword_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles TxtLoginPassword.KeyPress
If e.KeyChar = Chr(Keys.Enter) Then
e.Handled = True
BtnGo.Focus()
End If
End Sub

Private Sub TxtLoginPassword_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles TxtLoginPassword.TextChanged

End Sub

Private Sub TxtLogin_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)


Handles TxtLogin.GotFocus
Try

74
Payroll Management System

If A_Main.Visible = True Then


''A_Main.Close()

'Dim ret
' ret = Shell("E:\Bero Source\Beros\bin\Debug\Beros.exe",
AppWinStyle.NormalFocus, False)
End If
Catch ex As Exception

End Try
End Sub

Private Sub TxtLogin_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles TxtLogin.KeyPress
If e.KeyChar = Chr(Keys.Enter) Then
e.Handled = True
TxtLoginPassword.Focus()
End If
End Sub

Private Sub TxtLogin_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles TxtLogin.TextChanged

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Timer2.Tick
DTPSystmDate.Value = Format(Today, "dd/MM/yyyy")
txt_time.Text = Format(TimeOfDay, "hh:mm:ss tt")
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_time.TextChanged

End Sub

Private Sub Btn_Exit_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Btn_Exit.Click
Dim ans As MsgBoxResult
ans = MsgBox("Are You Sure Want To Quit ???", MsgBoxStyle.YesNo +
MsgBoxStyle.Question, str_companyname)
If ans = MsgBoxResult.Yes Then
End
Exit Sub
End If
End Sub
End Class

Main Form
Imports System.Windows.Forms

Public Class A_Main

Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs)


' Create a new instance of the child form.
Dim ChildForm As New System.Windows.Forms.Form
' Make it a child of this MDI form before showing it.

75
Payroll Management System

ChildForm.MdiParent = Me

m_ChildFormNumber += 1
ChildForm.Text = "Window " & m_ChildFormNumber

ChildForm.Show()
End Sub

Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs)


Dim OpenFileDialog As New OpenFileDialog
OpenFileDialog.InitialDirectory =
My.Computer.FileSystem.SpecialDirectories.MyDocuments
OpenFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
Dim FileName As String = OpenFileDialog.FileName
' TODO: Add code here to open the file.
End If
End Sub

Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
Dim SaveFileDialog As New SaveFileDialog
SaveFileDialog.InitialDirectory =
My.Computer.FileSystem.SpecialDirectories.MyDocuments
SaveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"

If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then


Dim FileName As String = SaveFileDialog.FileName
' TODO: Add code here to save the current contents of the form to a file.
End If
End Sub

Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
Me.Close()
End Sub

Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
' Use My.Computer.Clipboard to insert the selected text or images into the
clipboard
End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
' Use My.Computer.Clipboard to insert the selected text or images into the
clipboard
End Sub

Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to
retrieve information from the clipboard.
End Sub

Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
Me.LayoutMdi(MdiLayout.Cascade)

76
Payroll Management System

End Sub

Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub

Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e


As EventArgs)
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub

Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
Me.LayoutMdi(MdiLayout.ArrangeIcons)
End Sub

Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As


EventArgs)
' Close all child forms of the parent.
For Each ChildForm As Form In Me.MdiChildren
ChildForm.Close()
Next
End Sub

Private m_ChildFormNumber As Integer

Private Sub NationMasterToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles NationMasterToolStripMenuItem.Click
Nation_Master_Frm.MdiParent = Me
Nation_Master_Frm.Show()
Nation_Master_Frm.Focus()
End Sub

Private Sub StateMasterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles StateMasterToolStripMenuItem.Click
State_Mas_Frm.MdiParent = Me
State_Mas_Frm.Show()
State_Mas_Frm.Focus()
End Sub

Private Sub CityMasterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles CityMasterToolStripMenuItem.Click
City_Mas.MdiParent = Me
City_Mas.Show()
City_Mas.Focus()
End Sub

Private Sub DepartmentMasterToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles DepartmentMasterToolStripMenuItem.Click
Department_Master_Frm.MdiParent = Me
Department_Master_Frm.Show()
Department_Master_Frm.Focus()
End Sub

Private Sub DesignationMasterToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles DesignationMasterToolStripMenuItem.Click
Designation_Master.MdiParent = Me

77
Payroll Management System

Designation_Master.Show()
Designation_Master.Focus()
End Sub

Private Sub EmployeeMasterToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles EmployeeMasterToolStripMenuItem.Click
employee_master.MdiParent = Me
employee_master.Show()
employee_master.Focus()
End Sub

Private Sub A_Main_FormClosing(ByVal sender As Object, ByVal e As


System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End
End Sub

Private Sub A_Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
connection()
End Sub

Private Sub TestPageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs)
'TestingPage.MdiParent = Me
'TestingPage.Show()
'TestingPage.Focus()
End Sub

Private Sub GroupMasterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles GroupMasterToolStripMenuItem.Click
Scheme_Master_Frm.MdiParent = Me
Scheme_Master_Frm.Show()
Scheme_Master_Frm.Focus()
End Sub

Private Sub LogFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles LogFormToolStripMenuItem.Click
''Log_Details_Frm.MdiParent = Me
Log_Details_Frm.Show()
Log_Details_Frm.Focus()
End Sub

Private Sub CreateUserToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles CreateUserToolStripMenuItem.Click
UserCreation_Frm.MdiParent = Me
UserCreation_Frm.Show()
UserCreation_Frm.Focus()
End Sub

Private Sub ChangeUserToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles ChangeUserToolStripMenuItem.Click
Change_User.MdiParent = Me
Change_User.Show()
Change_User.Focus()
End Sub

Private Sub SalaryCalculationToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles SalaryCalculationToolStripMenuItem.Click
SalaryCal_Frm.MdiParent = Me
SalaryCal_Frm.Show()
SalaryCal_Frm.Focus()

78
Payroll Management System

End Sub

Private Sub HolidaysMasterToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles HolidaysMasterToolStripMenuItem.Click
Holi_Master.MdiParent = Me
Holi_Master.Show()
Holi_Master.Focus()
End Sub

Private Sub LeaveEntryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles LeaveEntryToolStripMenuItem.Click
Leave_Entry.MdiParent = Me
Leave_Entry.Show()
Leave_Entry.Focus()
End Sub

Private Sub DepartmentToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles DepartmentToolStripMenuItem.Click

printname = "DEPARTMENT"
Reports_Frm.Show()
End Sub

Private Sub DesignationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles DesignationToolStripMenuItem.Click
printname = "DESIGNATION"
Reports_Frm.Show()
End Sub

Private Sub SchemeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles SchemeToolStripMenuItem.Click
printname = "SCHEME"
Reports_Frm.Show()
End Sub

Private Sub EmployeeReportsToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles EmployeeReportsToolStripMenuItem.Click
Employee_Reports_Frm.MdiParent = Me
Employee_Reports_Frm.Show()
Employee_Reports_Frm.Focus()
End Sub

Private Sub SalaryReportsToolStripMenuItem_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles SalaryReportsToolStripMenuItem.Click
PayRollReports_Frm.MdiParent = Me
PayRollReports_Frm.Show()
PayRollReports_Frm.Focus()
End Sub
End Class

Employee Master
Imports System.Data.SqlClient
Imports System.Data.Sql
Imports System.Data
Imports System.IO
''Imports CrystalDecisions.CrystalReports.Engine
''Imports CrystalDecisions.Shared
Public Class employee_master
Dim str, str1, str2 As String
Dim a1 As String

79
Payroll Management System

''Dim cmd As sqlcommand


Dim ans As String
Dim code As Long
Dim gender As String
Dim cmd As New SqlCommand
Private Sub employee_master_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Top = 0
Me.Left = 0
depname = ""
deptcode = 0
desname = ""
descode = 0
outname = ""
outcode = 0
cityname = ""
citycode = 0
statename = ""
nationname = ""

DTP_DOB.Value = Today
DTP_DOJ.Value = Today

''DTP_DOB.Value = Format(Today, "dd/MM/yyyy")


''DTP_DOJ.Value = Format(Today, "dd/MM/yyyy")
''connection()
''openconnection()
Chk_Activate.CheckState = CheckState.Checked
newno()
view()
OptMale.Checked = True

End Sub

Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnSave.Click

Try

If Trim(txt_empcode.Text) = "" Then Exit Sub

str = ""
If OptMale.Checked = True Then
gender = "Male"
ElseIf OptFemale.Checked = True Then
gender = "FeMale"

ElseIf OptTrans.Checked = True Then


gender = "TransGender"
End If
cmd = New SqlCommand("select empcode from Mas_Employee where empcode='" &
txt_empcode.Text & "' ", Cn)
a1 = cmd.ExecuteScalar()
a1 = Trim(a1)

If a1 = "" Then

str = ""

80
Payroll Management System

str = str & " insert into


Mas_Employee(EmpCode,Code,EmpName,Sex,DOB,Age,Add1,Add2,Add3,CityCode,Mobile,Phone,Emai
lId,OutLet,DeptCode,DesignCode,Activate,pincode,DOJ,Emp_Scheme) values('" &
txt_empcode.Text & "'," & Val(code) & ",'" & Trim(txt_employee.Text) & "','" & gender &
"','" & Format(DTP_DOB.Value, "MM/dd/yyyy") & "'," & Val(txt_Age.Text) & ",'" &
Trim(txt_Add1.Text) & "','" & Trim(txt_Add2.Text) & "','" & Trim(txt_Add3.Text) & "',"
& Val(txt_city.Tag) & ",'" & Trim(txt_mobile.Text) & "','" & Trim(txt_phone.Text) &
"','" & Trim(txt_email.Text) & "','" & Val(txt_outlet.Tag) & "','" & Trim(txt_dept.Tag)
& "','" & Val(txt_design.Tag) & "'," & Val(Chk_Activate.CheckState) & ",'" &
Trim(txt_pin.Text) & "','" & Format(DTP_DOJ.Value, "MM/dd/yyyy") & "','" &
Trim(txt_scheme.Tag) & "')"
str = str & " insert into
Mas_EmployeeHistory(EmpCode,Code,EmpName,Sex,DOB,Age,Add1,Add2,Add3,CityCode,Mobile,Pho
ne,EmailId,OutLet,DeptCode,DesignCode,Activate,pincode,DOJ,Emp_Scheme) values('" &
txt_empcode.Text & "'," & Val(code) & ",'" & Trim(txt_employee.Text) & "','" & gender &
"','" & Format(DTP_DOB.Value, "MM/dd/yyyy") & "'," & Val(txt_Age.Text) & ",'" &
Trim(txt_Add1.Text) & "','" & Trim(txt_Add2.Text) & "','" & Trim(txt_Add3.Text) & "',"
& Val(txt_city.Tag) & ",'" & Trim(txt_mobile.Text) & "','" & Trim(txt_phone.Text) &
"','" & Trim(txt_email.Text) & "','" & Val(txt_outlet.Tag) & "','" & Trim(txt_dept.Tag)
& "','" & Val(txt_design.Tag) & "'," & Val(Chk_Activate.CheckState) & ",'" &
Trim(txt_pin.Text) & "','" & Format(DTP_DOJ.Value, "MM/dd/yyyy") & "','" &
Trim(txt_scheme.Tag) & "')"

str = " Begin Tran " & str & " If @@error<>0 Rollback tran else commit
tran "
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()
SavImg()
MsgBox("Items Saved Successfully", MsgBoxStyle.Information, " ")
clr()
view()

Else

Dim ans As String


ans = MsgBox("Are you sure want to Modify?", MsgBoxStyle.YesNo, " ")
If ans = vbYes Then

str = ""
str = str & " delete from Mas_Employee where empcode='" &
txt_empcode.Text & "' "
str = str & " insert into
Mas_Employee(EmpCode,Code,EmpName,Sex,DOB,Age,Add1,Add2,Add3,CityCode,Mobile,Phone,Emai
lId,OutLet,DeptCode,DesignCode,Activate,pincode,DOJ,Emp_Scheme) values('" &
txt_empcode.Text & "'," & Val(code) & ",'" & Trim(txt_employee.Text) & "','" & gender &
"','" & Format(DTP_DOB.Value, "MM/dd/yyyy") & "'," & Val(txt_Age.Text) & ",'" &
Trim(txt_Add1.Text) & "','" & Trim(txt_Add2.Text) & "','" & Trim(txt_Add3.Text) & "',"
& Val(txt_city.Tag) & ",'" & Trim(txt_mobile.Text) & "','" & Trim(txt_phone.Text) &
"','" & Trim(txt_email.Text) & "','" & Val(txt_outlet.Tag) & "','" & Trim(txt_dept.Tag)
& "','" & Val(txt_design.Tag) & "'," & Val(Chk_Activate.CheckState) & ",'" &
Trim(txt_pin.Text) & "','" & Format(DTP_DOJ.Value, "MM/dd/yyyy") & "','" &
Trim(txt_scheme.Tag) & "')"
str = str & " insert into
Mas_EmployeeHistory(EmpCode,Code,EmpName,Sex,DOB,Age,Add1,Add2,Add3,CityCode,Mobile,Pho
ne,EmailId,OutLet,DeptCode,DesignCode,Activate,pincode,DOJ,Emp_Scheme) values('" &
txt_empcode.Text & "'," & Val(code) & ",'" & Trim(txt_employee.Text) & "','" & gender &
"','" & Format(DTP_DOB.Value, "MM/dd/yyyy") & "'," & Val(txt_Age.Text) & ",'" &
Trim(txt_Add1.Text) & "','" & Trim(txt_Add2.Text) & "','" & Trim(txt_Add3.Text) & "',"
& Val(txt_city.Tag) & ",'" & Trim(txt_mobile.Text) & "','" & Trim(txt_phone.Text) &
"','" & Trim(txt_email.Text) & "','" & Val(txt_outlet.Tag) & "','" & Trim(txt_dept.Tag)
& "','" & Val(txt_design.Tag) & "'," & Val(Chk_Activate.CheckState) & ",'" &

81
Payroll Management System

Trim(txt_pin.Text) & "','" & Format(DTP_DOJ.Value, "MM/dd/yyyy") & "','" &


Trim(txt_scheme.Tag) & "')"

str = " Begin Tran " & str & " If @@error<>0 Rollback tran else
commit tran "
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()
SavImg()
MsgBox("Item Updated Successfully", MsgBoxStyle.Information, " ")
clr()
view()

End If

End If
Catch ex As Exception

End Try
End Sub
Private Sub SavImg()
'Dim myfilelocation As String = "C:\myPictures\myimage.jpg"

''Dim myfilelocation As String = Application.StartupPath & "\Images" & "\" &


txt_empcode.Text & ".Jpg"

' ''If Trim(txtBrowse.Text = "") Then


' '' txtBrowse.Text = myfilelocation
' ''End If

If Trim(txtBrowse.Text = "") Then


imgupdate()
Exit Sub
Else

End If

Dim cmd1 As New SqlCommand("update Mas_Employee set Photo=@Image,ipath='" &


txtBrowse.Text & "' where EmpCode='" & txt_empcode.Text & "'", Cn)
Dim param As New SqlParameter("@Image", SqlDbType.VarBinary)
''''Dim Image As Byte() = IO.File.ReadAllBytes(txtBrowse.Text)
Dim ms As New IO.MemoryStream
picCapture.Image.Save(ms, Imaging.ImageFormat.Jpeg)
Dim Image() As Byte = ms.GetBuffer()
param.Value = Image
cmd1.Parameters.Add(param)
cmd1.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)
cmd1.Parameters.AddWithValue("@ipath", txtBrowse.Text)
'cmd.ExecuteNonQuery()
'End If
Dim cmd2 As New SqlCommand("update Mas_Employee set Photo=@Image,ipath='" &
txtBrowse.Text & "' where EmpCode='" & txt_empcode.Text & "'", Cn)
Dim param2 As New SqlParameter("@Image", SqlDbType.VarBinary)
Dim ms2 As New IO.MemoryStream
picCapture.Image.Save(ms2, Imaging.ImageFormat.Jpeg)
Dim Image2() As Byte = ms.GetBuffer()
param2.Value = Image2
cmd2.Parameters.Add(param2)
cmd2.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)
cmd2.Parameters.AddWithValue("@ipath", txtBrowse.Text)

82
Payroll Management System

Try
cmd1.ExecuteNonQuery()
cmd2.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally

End Try
End Sub
Private Sub imgupdate()

''Dim cmd2 As New SqlCommand("update Student_Master_Tbl set


photo=@Image,ipath='" & txtBrowse.Text & "' where Reg_Id='" & txt_empcode.Text & "'",
Cn)

''Dim param1 As New SqlParameter("@Image", SqlDbType.VarBinary)


''''''Dim Image1 As Byte() = IO.File.ReadAllBytes(txtBrowse.Text)
''Dim ms As New IO.MemoryStream
''picCapture.Image.Save(ms, Imaging.ImageFormat.Jpeg)
''Dim Image1() As Byte = ms.GetBuffer()
''param1.Value = Image1
''If param1.Value = Nothing Then
'' Exit Sub
''End If
''cmd2.Parameters.Add(param1)
''cmd2.Parameters.AddWithValue("@Reg_Id", txt_empcode.Text)
''cmd2.Parameters.AddWithValue("@ipath", txtBrowse.Text) '
''cmd2.ExecuteNonQuery()

If Trim(txtBrowse.Text = "") Then

Exit Sub
Else

End If

Dim cmd1 As New SqlCommand("update Mas_Employee set Photo=@Image,ipath='" &


txtBrowse.Text & "' where EmpCode='" & txt_empcode.Text & "'", Cn)
Dim param As New SqlParameter("@Image", SqlDbType.VarBinary)
''''Dim Image As Byte() = IO.File.ReadAllBytes(txtBrowse.Text)
Dim ms As New IO.MemoryStream
picCapture.Image.Save(ms, Imaging.ImageFormat.Jpeg)
Dim Image() As Byte = ms.GetBuffer()
param.Value = Image
If param.Value = Nothing Then
Exit Sub
End If
cmd1.Parameters.Add(param)
cmd1.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)
cmd1.Parameters.AddWithValue("@ipath", txtBrowse.Text)
cmd1.ExecuteNonQuery()

Dim cmd2 As New SqlCommand("update Mas_Employee set Photo=@Image,ipath='" &


txtBrowse.Text & "' where EmpCode='" & txt_empcode.Text & "'", Cn)
Dim param2 As New SqlParameter("@Image", SqlDbType.VarBinary)
Dim ms2 As New IO.MemoryStream
picCapture.Image.Save(ms2, Imaging.ImageFormat.Jpeg)
Dim Image2() As Byte = ms.GetBuffer()
param2.Value = Image2
If param2.Value = Nothing Then
Exit Sub

83
Payroll Management System

End If
cmd2.Parameters.Add(param2)
cmd2.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)
cmd2.Parameters.AddWithValue("@ipath", txtBrowse.Text)
cmd2.ExecuteNonQuery()

End Sub
Private Sub VwImg()
Try
picCapture.Visible = True
Dim cmd As New SqlCommand("select photo from Mas_Employee where EmpCode='"
& txt_empcode.Text & "' ", Cn)
cmd.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)

picCapture.Image = Image.FromStream(New
IO.MemoryStream(CType(cmd.ExecuteScalar, Byte())))
' or you can save in a file
'IO.File.WriteAllBytes("c:\backup\image3.jpg", CType(cmd.ExecuteScalar,
Byte()))
Catch ex As Exception
''MessageBox.Show(ex.Message)
Finally

End Try
End Sub

Private Sub clr()


Try
txt_scheme.Text = ""
txtBrowse.Text = ""
txt_empcode.Text = ""
txt_employee.Text = ""
txt_email.Text = ""
txt_Add1.Text = ""
txt_Add2.Text = ""
txt_Add3.Text = ""
txt_Age.Text = ""
txt_city.Text = ""
txt_city.Tag = ""
txt_dept.Text = ""
txt_dept.Tag = ""
txt_design.Text = ""
txt_design.Tag = ""
txt_mobile.Text = ""
txt_outlet.Tag = ""
txt_outlet.Text = ""
txt_phone.Text = ""
txt_pin.Text = ""
Txt_Search.Text = ""
txt_nation.Text = ""
txt_state.Text = ""
OptMale.Checked = True
Chk_Activate.CheckState = CheckState.Checked

DTP_DOB.Value = Today
DTP_DOJ.Value = Today

''DTP_DOB.Value = Format(Today, "dd/MM/yyyy")


''DTP_DOJ.Value = Format(Today, "dd/MM/yyyy")

84
Payroll Management System

''DGView.Rows.Clear()
''If DGVIEW.RowCount <= 0 Then
'' DGVIEW.Rows.Add(1)
''End If

view()
newno()

Catch ex As Exception

End Try
End Sub
Sub newno()

Try

Dim a As String

cmd = New SqlCommand("select code as code from Mas_Employee order by Code


desc ", Cn)
If IsDBNull(cmd.ExecuteScalar()) = False Then
a = cmd.ExecuteScalar()

txt_empcode.Text = Val(a) + 1
code = Val(a) + 1
If code.ToString.Length < 3 Then
txt_empcode.Text = "EMP00" & txt_empcode.Text
Else
txt_empcode.Text = "NST" & txt_empcode.Text
End If

Else
code = 1
txt_empcode.Text = "EMP" & "001"
End If
Catch ex As Exception

End Try

End Sub
Sub view()

Try

Dim da As New SqlDataAdapter("select emp.*,dep.department as


department,des.designation as designation,ms.Scheme_Name from mas_employee emp left
outer join mas_department dep on dep.code=deptcode left outer join mas_designation des
on des.code=designcode left outer join mas_scheme ms on ms.Scheme_Code=emp.Emp_Scheme
order by Empcode", Cn)
Dim dt As New DataTable
da.Fill(dt)
DGVIEW.Rows.Clear()
Dim k%
For k = 0 To dt.Rows.Count - 1
DGVIEW.Rows.Add(dt.Rows(k).Item("empcode"), dt.Rows(k).Item("empname"),
dt.Rows(k).Item("department"), dt.Rows(k).Item("designation"),
dt.Rows(k).Item("scheme_name"))
Next
DGVIEW.AllowUserToAddRows = False

85
Payroll Management System

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Private Sub btnprint_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnc_close.Click
Me.Close()
End Sub

Private Sub BtnNew_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnNew.Click
clr()
End Sub

Private Sub btnview_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnview.Click
view()
End Sub

Private Sub txt_outlet_GotFocus(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txt_outlet.GotFocus
txt_outlet.Text = Trim(outname)
txt_outlet.Tag = Val(outcode)
If Trim(txt_outlet.Text) = "" Then
''Search_OutLet.Show()
''Search_OutLet.Focus()
Else
''txt_design.Focus()
End If
End Sub

Private Sub txt_outlet_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txt_outlet.KeyPress
e.Handled = True
End Sub

Private Sub txt_outlet_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_outlet.KeyUp
If e.KeyCode = Keys.F1 Then
''Search_OutLet.Show()
''Search_OutLet.Focus()
Else

End If

If Trim(txt_outlet.Text) = "" Then


outname = ""
outcode = 0
txt_outlet.Tag = ""
End If

If Trim(txt_outlet.Text) = "" Then


''Search_OutLet.Show()
'' Search_OutLet.Focus()
Else
'' txt_dept.Text = depname
End If
End Sub

86
Payroll Management System

Private Sub txt_outlet_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_outlet.TextChanged

End Sub

Private Sub txt_dept_Enter(ByVal sender As Object, ByVal e As System.EventArgs)


Handles txt_dept.Enter

End Sub

Private Sub txt_dept_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)


Handles txt_dept.GotFocus

txt_dept.Text = Trim(depname)
txt_dept.Tag = Val(deptcode)
If Trim(txt_dept.Text) = "" Then
Search_Deaprtment.Show()
Search_Deaprtment.Focus()
Else
''txt_design.Focus()
End If

End Sub

Private Sub txt_dept_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txt_dept.KeyPress
e.Handled = True
End Sub

Private Sub txt_dept_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_dept.KeyUp
If e.KeyCode = Keys.F1 Then
Search_Deaprtment.Show()
Search_Deaprtment.Focus()
Else

End If

If Trim(txt_dept.Text) = "" Then


depname = ""
deptcode = 0
txt_dept.Tag = ""
End If

If Trim(txt_dept.Text) = "" Then


Search_Deaprtment.Show()
Search_Deaprtment.Focus()
Else
'' txt_dept.Text = depname
End If
End Sub

Private Sub txt_dept_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_dept.TextChanged

End Sub

Private Sub txt_design_GotFocus(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txt_design.GotFocus
txt_design.Text = Trim(desname)
txt_design.Tag = Val(descode)

87
Payroll Management System

If Trim(txt_design.Text) = "" Then


Search_Desigination.Show()
Search_Desigination.Focus()
Else
''txt_design.Focus()
End If
End Sub

Private Sub txt_design_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txt_design.KeyPress
e.Handled = True
End Sub

Private Sub txt_design_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_design.KeyUp
If e.KeyCode = Keys.F1 Then
Search_Desigination.Show()
Search_Desigination.Focus()
Else

End If

If Trim(txt_design.Text) = "" Then


desname = ""
descode = 0
txt_design.Tag = ""
End If

If Trim(txt_design.Text) = "" Then


Search_Desigination.Show()
Search_Desigination.Focus()
Else
'' txt_dept.Text = depname
End If
End Sub

Private Sub txt_design_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_design.TextChanged

End Sub

Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnDelete.Click
Dim ans As String
ans = MsgBox("Are you sure want to Delete?", MsgBoxStyle.YesNo, " ")
If ans = vbYes Then

str = ""

str = " delete from Mas_Employee where empcode='" & txt_empcode.Text & "' "

str = " Begin Tran " & str & " If @@error<>0 Rollback tran else commit tran
"
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()

MsgBox("Record Deleted Successfully", MsgBoxStyle.Information, " ")


clr()
view()
End If
End Sub

88
Payroll Management System

Private Sub Txt_Search_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles Txt_Search.KeyUp

Try
Dim da As New SqlDataAdapter("select emp.*,dep.department as
department,des.designation as designation,ms.scheme_name from mas_employee emp inner
join mas_department dep on dep.code=deptcode inner join mas_designation des on
des.code=designcode left outer join mas_scheme ms on ms.Scheme_Code=emp.Emp_Scheme
where emp.empname like '" & Txt_Search.Text & "%' order by Empcode", Cn)
Dim dt As New DataTable
da.Fill(dt)
DGVIEW.Rows.Clear()
Dim k%
For k = 0 To dt.Rows.Count - 1
DGVIEW.Rows.Add(dt.Rows(k).Item("empcode"), dt.Rows(k).Item("empname"),
dt.Rows(k).Item("department"), dt.Rows(k).Item("designation"))
Next
DGVIEW.AllowUserToAddRows = False

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Private Sub Txt_Search_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Txt_Search.TextChanged

End Sub

Private Sub DGVIEW_CellContentClick(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVIEW.CellContentClick

End Sub

Private Sub DGVIEW_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)


Handles DGVIEW.DoubleClick

Try

str = "select emp.*,dep.department as department,des.designation as


designation,cit.city as cityname,st.state as state,nat.nationality as
nation,ms.Scheme_Code,ms.Scheme_name from mas_employee emp left outer join
mas_department dep on dep.code=deptcode left outer join mas_designation des on
des.code=designcode left outer join mas_city cit on cit.city_code=emp.citycode left
outer join mas_state st on st.code=cit.statecode left outer join mas_nation nat on
nat.code=cit.country_code left outer join mas_scheme ms on
ms.Scheme_Code=emp.Emp_Scheme where emp.empcode='" & DGVIEW.CurrentRow.Cells(0).Value &
"' "
Dim da As New SqlDataAdapter(str, Cn)

Dim dt As New DataTable


da.Fill(dt)

Dim k%
clr()
For k = 0 To dt.Rows.Count - 1

If IsDBNull(dt.Rows(k).Item("EmpId")) = False Then


code = dt.Rows(k).Item("EmpId")

89
Payroll Management System

End If

If IsDBNull(dt.Rows(k).Item("empcode")) = False Then


txt_empcode.Text = dt.Rows(k).Item("empcode")
End If
If IsDBNull(dt.Rows(k).Item("EmpName")) = False Then
txt_employee.Text = dt.Rows(k).Item("EmpName")
End If

If IsDBNull(dt.Rows(k).Item("EmailId")) = False Then


txt_email.Text = dt.Rows(k).Item("EmailId")
End If

If IsDBNull(dt.Rows(k).Item("add1")) = False Then


txt_Add1.Text = dt.Rows(k).Item("add1")
End If

If IsDBNull(dt.Rows(k).Item("add2")) = False Then


txt_Add2.Text = dt.Rows(k).Item("add2")
End If
If IsDBNull(dt.Rows(k).Item("add3")) = False Then
txt_Add3.Text = dt.Rows(k).Item("add3")
End If
If IsDBNull(dt.Rows(k).Item("age")) = False Then
txt_Age.Text = dt.Rows(k).Item("age")
End If
If IsDBNull(dt.Rows(k).Item("cityname")) = False Then
txt_city.Text = dt.Rows(k).Item("cityname")
End If
If IsDBNull(dt.Rows(k).Item("citycode")) = False Then
txt_city.Tag = dt.Rows(k).Item("citycode")
End If
If IsDBNull(dt.Rows(k).Item("department")) = False Then
txt_dept.Text = dt.Rows(k).Item("department")
End If
If IsDBNull(dt.Rows(k).Item("deptcode")) = False Then
txt_dept.Tag = dt.Rows(k).Item("deptcode")
End If
If IsDBNull(dt.Rows(k).Item("designation")) = False Then
txt_design.Text = dt.Rows(k).Item("designation")
End If
If IsDBNull(dt.Rows(k).Item("designcode")) = False Then
txt_design.Tag = dt.Rows(k).Item("designcode")
End If

If IsDBNull(dt.Rows(k).Item("mobile")) = False Then


txt_mobile.Text = dt.Rows(k).Item("mobile")
End If
'If IsDBNull(dt.Rows(k).Item("outlet")) = False Then
' txt_outlet.Tag = dt.Rows(k).Item("outlet")
'End If

'If IsDBNull(dt.Rows(k).Item("outletname")) = False Then


' txt_outlet.Text = dt.Rows(k).Item("outletname")
'End If
If IsDBNull(dt.Rows(k).Item("phone")) = False Then
txt_phone.Text = dt.Rows(k).Item("phone")
End If

If IsDBNull(dt.Rows(k).Item("pincode")) = False Then


txt_pin.Text = dt.Rows(k).Item("pincode")

90
Payroll Management System

End If

If IsDBNull(dt.Rows(k).Item("nation")) = False Then


txt_nation.Text = dt.Rows(k).Item("nation")
End If

If IsDBNull(dt.Rows(k).Item("state")) = False Then


txt_state.Text = dt.Rows(k).Item("state")
End If

If IsDate(dt.Rows(k).Item("dob")) = True Then


DTP_DOB.Value = dt.Rows(k).Item("dob")
End If

If IsDate(dt.Rows(k).Item("doj")) = True Then


DTP_DOJ.Value = dt.Rows(k).Item("doj")
End If

If IsDBNull(dt.Rows(k).Item("scheme_code")) = False Then


txt_scheme.Tag = dt.Rows(k).Item("scheme_code")
End If

If IsDBNull(dt.Rows(k).Item("scheme_name")) = False Then


txt_scheme.Text = dt.Rows(k).Item("scheme_name")
End If

Next

VwImg()

Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub txt_city_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs)


Handles txt_city.GotFocus

Try

txt_city.Text = Trim(cityname)
txt_state.Text = Trim(statename)
txt_nation.Text = Trim(nationname)
txt_city.Tag = Val(citycode)
If Trim(txt_outlet.Text) = "" Then
Search_City.Show()
Search_City.Focus()
Else
''txt_design.Focus()
End If

Catch ex As Exception

End Try
End Sub

Private Sub txt_city_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txt_city.KeyPress
e.Handled = True
End Sub

91
Payroll Management System

Private Sub txt_city_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_city.KeyUp
If e.KeyCode = Keys.F1 Then
Search_City.Show()
Search_City.Focus()
Else

End If

If Trim(txt_city.Text) = "" Then


cityname = ""
citycode = 0
txt_city.Tag = ""
txt_nation.Text = ""
txt_state.Text = ""
End If

If Trim(txt_city.Text) = "" Then


Search_City.Show()
Search_City.Focus()
Else
'' txt_dept.Text = depname
End If
End Sub

Private Sub txt_city_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_city.TextChanged

End Sub

Private Sub txt_state_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txt_state.KeyPress
e.Handled = True
End Sub

Private Sub txt_state_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_state.TextChanged

End Sub

Private Sub txt_nation_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles txt_nation.KeyPress
e.Handled = True
End Sub

Private Sub txt_nation_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_nation.TextChanged

End Sub

Private Sub DTP_Dob_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles DTP_DOB.ValueChanged

Dim strDOB As String


strDOB = DTP_DOB.Value
Dim intAge As Integer
intAge = Math.Floor(DateDiff(DateInterval.Month, DateValue(strDOB), Now()) /
12)
txt_Age.Text = intAge
If Val(txt_Age.Text) <= 0 Then
txt_Age.Text = ""

92
Payroll Management System

End If

End Sub

Private Sub btnBrowsePicture_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBrowsePicture.Click
Try
If Directory.Exists(Application.StartupPath & "\Images") Then
'shows message if testdir1 exist
Else
Directory.CreateDirectory(Application.StartupPath & "\Images")
End If

''OpenFileDialog1.Filter = "jpegs|*.jpg|gifs|*.gif|Bitmaps|*.bmp| All


Files|*.*"
OpenFileDialog1.Filter = "Bitmaps |*.bmp| jpegs | *.jpg | GIFs | *.gif |
All Files|*.*"
If OpenFileDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
Dim path As String
picCapture.Show()
If Windows.Forms.DialogResult.OK = Windows.Forms.DialogResult.OK Then
''OpenFileDialog1.FileName = ""
txtBrowse.Text = OpenFileDialog1.FileName
'' txtBrowse.Text = ""
picCapture.Image = Image.FromFile(OpenFileDialog1.FileName)
ElseIf Windows.Forms.DialogResult.Cancel =
Windows.Forms.DialogResult.Cancel Then
path = Application.StartupPath & "\Images\" + txt_empcode.Text +
".Jpg"
txtBrowse.Text = path
End If
End If
BtnSave.Focus()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
picCapture.Image = Nothing
txtBrowse.Text = ""
End Sub

Private Sub txt_scheme_GotFocus(ByVal sender As Object, ByVal e As


System.EventArgs) Handles txt_scheme.GotFocus
Try

If Trim(txt_scheme.Text) = "" Then


Search_Scheme.Show()
Search_Scheme.Focus()
Else

End If

Catch ex As Exception

End Try
End Sub

93
Payroll Management System

Private Sub txt_scheme_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_scheme.KeyUp
If e.KeyCode = Keys.F1 Then
'' repsearch = 1
Search_Scheme.Show()
Search_Scheme.Focus()
ElseIf Trim(txt_scheme.Text) = "" Then
'' repsearch = 1
Search_Scheme.Show()
Search_Scheme.Focus()
Else

End If

If Trim(txt_scheme.Text) = "" Then

txt_scheme.Tag = ""
txt_scheme.Text = ""
''repsearch = 1
Search_Scheme.Show()
Search_Scheme.Focus()
Else

End If
End Sub

Private Sub txt_scheme_Layout(ByVal sender As Object, ByVal e As


System.Windows.Forms.LayoutEventArgs) Handles txt_scheme.Layout

End Sub

Private Sub txt_scheme_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_scheme.TextChanged

End Sub

Private Sub txt_empcode_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_empcode.TextChanged

End Sub
End Class

Log Entry(Attendance)
Imports System.Data.SqlClient
Imports System.Data.Sql
Imports System.Data
Imports System.IO
Public Class Log_Details_Frm
Dim str, str1, str2 As String
Dim a1 As String
Dim ans As String
Dim code As Long
Dim gender As String
Dim cmd As New SqlCommand
Dim d1, d2
Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label5.Click

End Sub

94
Payroll Management System

Private Sub txt_empcode_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_empcode.KeyDown
If e.KeyCode = Keys.Enter Then
searchemp()
insertlog()
End If
End Sub
Private Sub insertlog()

str = "select * from Attendance where Emp_Code='" & Trim(txt_empcode.Text) & "'
and Login_Date between '" & Format(d2, "MM/dd/yyyy") & "' and '" & Format(d1,
"MM/dd/yyyy") & "' and isnull(status,0)=0 "
cmd = New SqlCommand(str, Cn)
a1 = cmd.ExecuteScalar()
a1 = Trim(a1)
If a1 = "" Then
If Trim(txt_employee.Text) = "" Then Exit Sub
If Trim(txt_empcode.Text) = "" Then Exit Sub
str = "insert into
Attendance(Emp_Code,Emp_Name,Department,Designation,Login_Date,Login_Time,Entry_Date,St
atus)values('" & Trim(txt_empcode.Text) & "','" & Trim(txt_employee.Text) & "','" &
Trim(txt_dept.Text) & "','" & Trim(txt_design.Text) & "','" & Format(dtp_date.Value,
"MM/dd/yyyy") & "','" & Trim(txt_time.Text) & "','" & Format(Today, "MM/dd/yyyy") &
"','0')"
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()
Else
str = "update Attendance set Logout_Date='" & Format(dtp_date.Value,
"MM/dd/yyyy") & "',Logout_Time='" & Trim(txt_time.Text) & "',Status='1' where
Login_Date between '" & Format(d2, "MM/dd/yyyy") & "' and '" & Format(d1, "MM/dd/yyyy")
& "' and isnull(status,0)=0 and emp_code='" & Trim(txt_empcode.Text) & "' "
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()
End If

clr()
view()

End Sub
Sub view()

Try
clr()
d1 = dtp_date.Value
d2 = DateAdd(DateInterval.Day, -1, d1)
Dim da As New SqlDataAdapter("select * from Attendance where Login_Date
between '" & Format(d2, "MM/dd/yyyy") & "' and '" & Format(d1, "MM/dd/yyyy") & "' and
isnull(status,0)=0 ", Cn)
Dim dt As New DataTable
da.Fill(dt)
DGVIEW.Rows.Clear()
Dim k%
For k = 0 To dt.Rows.Count - 1
DGVIEW.Rows.Add(k + 1, dt.Rows(k).Item("Emp_Code"),
dt.Rows(k).Item("Emp_Name"), dt.Rows(k).Item("Department"),
dt.Rows(k).Item("Designation"), Format(dt.Rows(k).Item("Login_Date"), "dd/MM/yyyy"),
Format(dt.Rows(k).Item("Login_Time"), "hh:mm:ss"), dt.Rows(k).Item("Logout_Date"),
dt.Rows(k).Item("Logout_Time"))
Next
DGVIEW.AllowUserToAddRows = False
clr()

95
Payroll Management System

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Private Sub txt_empcode_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txt_empcode.KeyPress

End Sub

Private Sub txt_empcode_KeyUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_empcode.KeyUp
searchemp()
End Sub
Private Sub txt_empcode_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txt_empcode.TextChanged
If Trim(txt_empcode.Text) = "" Then Exit Sub
'' searchemp()
End Sub
Private Sub searchemp()
str = "select emp.*,dep.department as department,des.designation as
designation,cit.city as cityname,st.state as state,nat.nationality as
nation,ms.Scheme_Code,ms.Scheme_name from mas_employee emp left outer join
mas_department dep on dep.code=deptcode left outer join mas_designation des on
des.code=designcode left outer join mas_city cit on cit.city_code=emp.citycode left
outer join mas_state st on st.code=cit.statecode left outer join mas_nation nat on
nat.code=cit.country_code left outer join mas_scheme ms on
ms.Scheme_Code=emp.Emp_Scheme where emp.empcode='" & Trim(txt_empcode.Text) & "' "
Dim da As New SqlDataAdapter(Str, Cn)

Dim dt As New DataTable


da.Fill(dt)

Dim k%
'' clr()
txt_employee.Text = ""
txt_design.Text = ""
txt_dept.Text = ""

If dt.Rows.Count < 1 Then


''txt_empcode.Text = ""

Exit Sub
End If
For k = 0 To dt.Rows.Count - 1
clr()
If IsDBNull(dt.Rows(k).Item("EmpId")) = False Then
txt_empcode.Text = dt.Rows(k).Item("EmpId")
End If

If IsDBNull(dt.Rows(k).Item("empcode")) = False Then


txt_empcode.Text = dt.Rows(k).Item("empcode")
End If
If IsDBNull(dt.Rows(k).Item("EmpName")) = False Then
txt_employee.Text = dt.Rows(k).Item("EmpName")
End If

If IsDBNull(dt.Rows(k).Item("department")) = False Then


txt_dept.Text = dt.Rows(k).Item("department")
End If
If IsDBNull(dt.Rows(k).Item("deptcode")) = False Then

96
Payroll Management System

txt_dept.Tag = dt.Rows(k).Item("deptcode")
End If
If IsDBNull(dt.Rows(k).Item("designation")) = False Then
txt_design.Text = dt.Rows(k).Item("designation")
End If
If IsDBNull(dt.Rows(k).Item("designcode")) = False Then
txt_design.Tag = dt.Rows(k).Item("designcode")
End If

Next
VwImg()
End Sub
Private Sub VwImg()
Try
picCapture.Visible = True
Dim cmd As New SqlCommand("select photo from Mas_Employee where EmpCode='"
& txt_empcode.Text & "' ", Cn)
cmd.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)

picCapture.Image = Image.FromStream(New
IO.MemoryStream(CType(cmd.ExecuteScalar, Byte())))
' or you can save in a file
'IO.File.WriteAllBytes("c:\backup\image3.jpg", CType(cmd.ExecuteScalar,
Byte()))
Catch ex As Exception
''MessageBox.Show(ex.Message)
Finally

End Try
End Sub

Private Sub clr()


Try

txt_empcode.Text = ""
txt_employee.Text = ""

txt_dept.Text = ""
txt_dept.Tag = ""
txt_design.Text = ""
txt_design.Tag = ""
picCapture.Image = Nothing

dtp_date.Value = Format(Today, "dd/MM/yyyy")


Dtp_Date1.Value = Format(Today, "dd/MM/yyyy")

Catch ex As Exception

End Try
End Sub
Private Sub Log_Details_Frm_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Close()
End If
End Sub

97
Payroll Management System

Private Sub Log_Details_Frm_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Me.Top = 0
Me.Left = 0
txt_time.Text = TimeOfDay
Timer1.Start()
view()
End Sub

Private Sub txt_employee_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_employee.TextChanged

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Timer1.Tick
txt_time.Text = TimeOfDay
End Sub
End Class

Salary Calculation Form

Imports System.Data.SqlClient
Imports System.Data.Sql
Imports System.Data
Imports System.IO
Public Class SalaryCal_Frm
Dim str, str1, str2 As String
Dim a1 As String
Dim ans As String
Dim code As Long
Dim gender As String
Dim cmd As New SqlCommand
Dim d1, d2
Dim scheme As Integer
Private Sub SalaryCal_Frm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Top = 0
Me.Left = 0
validdate()
newno()
view()
End Sub
Private Sub view()
Dim da As New SqlDataAdapter("select * from Salary_Table where Salary_Month='"
& Trim(Dtp_Month.Text) & "' ", Cn)
Dim dt As New DataTable
da.Fill(dt)
If dt.Rows.Count < 1 Then Exit Sub
DGVIEW.Rows.Clear()
Dim k%
For k = 0 To dt.Rows.Count - 1
DGVIEW.Rows.Add(k + 1, dt.Rows(k).Item("Emp_Code"),
dt.Rows(k).Item("Emp_Name"), dt.Rows(k).Item("Pay_No"),
dt.Rows(k).Item("Total_Salary"), dt.Rows(k).Item("Department"))
Next
DGVIEW.AllowUserToAddRows = False
End Sub
Private Sub validdate()
Dim firstday As Integer

98
Payroll Management System

Dim lastday As Integer


Dim years As Integer
Dim months As Integer

firstday = 1

years = Year(Dtp_Month.Value)
months = Month(Dtp_Month.Value)
lastday = Date.DaysInMonth(years, months)
Dtp_From.Value = firstday & "/" & months & "/" & years
Dtp_To.Value = lastday & "/" & months & "/" & years

End Sub
Private Sub txt_empcode_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txt_empcode.TextChanged

End Sub

Private Sub txt_searchemp_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles txt_searchemp.KeyDown
If e.KeyCode = Keys.Enter Then
searchemp()
End If
End Sub
Private Sub searchemp()
str = "select emp.*,dep.department as department,des.designation as
designation,cit.city as cityname,st.state as state,nat.nationality as
nation,ms.Scheme_Code,ms.Scheme_name from mas_employee emp left outer join
mas_department dep on dep.code=deptcode left outer join mas_designation des on
des.code=designcode left outer join mas_city cit on cit.city_code=emp.citycode left
outer join mas_state st on st.code=cit.statecode left outer join mas_nation nat on
nat.code=cit.country_code left outer join mas_scheme ms on
ms.Scheme_Code=emp.Emp_Scheme where emp.empcode='" & Trim(txt_searchemp.Text) & "' "
Dim da As New SqlDataAdapter(Str, Cn)

Dim dt As New DataTable


da.Fill(dt)

Dim k%
'' clr()
txt_employee.Text = ""
txt_design.Text = ""
txt_dept.Text = ""

If dt.Rows.Count < 1 Then

Exit Sub
End If
For k = 0 To dt.Rows.Count - 1
clr()
If IsDBNull(dt.Rows(k).Item("EmpId")) = False Then
txt_empcode.Text = dt.Rows(k).Item("EmpId")
End If

If IsDBNull(dt.Rows(k).Item("empcode")) = False Then


txt_empcode.Text = dt.Rows(k).Item("empcode")
End If
salary()
If IsDBNull(dt.Rows(k).Item("EmpName")) = False Then

99
Payroll Management System

txt_employee.Text = dt.Rows(k).Item("EmpName")
End If

If IsDBNull(dt.Rows(k).Item("department")) = False Then


txt_dept.Text = dt.Rows(k).Item("department")
End If
If IsDBNull(dt.Rows(k).Item("deptcode")) = False Then
txt_dept.Tag = dt.Rows(k).Item("deptcode")
End If
If IsDBNull(dt.Rows(k).Item("designation")) = False Then
txt_design.Text = dt.Rows(k).Item("designation")
End If
If IsDBNull(dt.Rows(k).Item("designcode")) = False Then
txt_design.Tag = dt.Rows(k).Item("designcode")
End If

If IsDBNull(dt.Rows(k).Item("emp_scheme")) = False Then


scheme = dt.Rows(k).Item("emp_scheme")
End If

Next
VwImg()
searcsalary()

End Sub
Private Sub salary()

str = "select * from Salary_Table where Emp_Code='" & Trim(txt_searchemp.Text)


& "' and Salary_Month='" & Trim(Dtp_Month.Text) & "' "
Dim da As New SqlDataAdapter(str, Cn)

Dim dt As New DataTable


da.Fill(dt)
If dt.Rows.Count < 1 Then Exit Sub
Dim k%

If dt.Rows.Count < 1 Then

Exit Sub
End If
For k = 0 To dt.Rows.Count - 1

If IsDBNull(dt.Rows(k).Item("Pay_No")) = False Then


txt_paycode.Text = dt.Rows(k).Item("Pay_No")
End If

If IsDBNull(dt.Rows(k).Item("Extra_Plus")) = False Then


txt_extraamt.Text = dt.Rows(k).Item("Extra_Plus")
End If

If IsDBNull(dt.Rows(k).Item("Extra_Minus")) = False Then


txt_extraminus.Text = -(dt.Rows(k).Item("Extra_Minus"))
End If

Next
'' VwImg()
''searcsalary()

End Sub
Private Sub searcsalary()

100
Payroll Management System

d1 = Format(Dtp_From.Value, "MM/dd/yyyy")
d2 = Format(Dtp_To.Value, "MM/dd/yyyy")

str = "select * from Attendance inner join Mas_Holidays mh on mh.Month_Name='"


& Dtp_Month.Text & "' inner join Mas_Employee me on me.empcode='" &
Trim(txt_searchemp.Text) & "' inner join Mas_Scheme ms on ms.scheme_code=me.emp_scheme
where emp_code='" & Trim(txt_searchemp.Text) & "' and Login_Date between '" & d1 & "'
and '" & d2 & "' "
Dim da As New SqlDataAdapter(str, Cn)
Dim dt As New DataTable
da.Fill(dt)

Dim k%
'' clr()
txt_working.Text = DateDiff(DateInterval.Day, Dtp_From.Value, Dtp_To.Value)
txt_holidays.Text = ""
txt_cl.Text = ""
txt_hrap.Text = ""
txt_esip.Text = ""
txt_epfp.Text = ""
txt_dedp.Text = ""
txt_taxp.Text = ""
txt_present.Text = ""
txt_holiamt.Text = ""
txt_clamt.Text = ""
txt_absentamt.Text = ""
txt_leaveamt.Text = ""

If dt.Rows.Count < 1 Then


''txt_empcode.Text = ""

Exit Sub
End If

For k = 0 To dt.Rows.Count - 1
''clr()
txt_present.Text = dt.Rows.Count

If IsDBNull(dt.Rows(k).Item("Salary")) = False Then


txt_workingamt.Text = dt.Rows(k).Item("Salary")
End If

If IsDBNull(dt.Rows(k).Item("Salaryp")) = False Then


txt_salary.Text = dt.Rows(k).Item("Salaryp")
End If
findleavs()
If IsDBNull(dt.Rows(k).Item("Holidays")) = False Then
txt_holidays.Text = dt.Rows(k).Item("Holidays")
End If

If IsDBNull(dt.Rows(k).Item("cl")) = False Then


txt_cl.Text = dt.Rows(k).Item("cl")
End If

If IsDBNull(dt.Rows(k).Item("HRAP")) = False Then


txt_hrap.Text = dt.Rows(k).Item("HRAP") '& " %"
End If

If IsDBNull(dt.Rows(k).Item("HRA_Amount")) = False Then

101
Payroll Management System

txt_hraamt.Text = -((Val(dt.Rows(k).Item("HRA_Amount")) *
Val(txt_hrap.Text)) / 100) ''-(Val(dt.Rows(k).Item("HRA_Amount")) * Val(txt_hrap.Text)
/ 100)
End If

If IsDBNull(dt.Rows(k).Item("ESIP")) = False Then


txt_esip.Text = dt.Rows(k).Item("ESIP") '& " %"
End If
If IsDBNull(dt.Rows(k).Item("ESI_Amount")) = False Then
txt_esiamt.Text = -(Val(dt.Rows(k).Item("ESI_Amount")) *
Val(txt_esip.Text) / 100)
End If

If IsDBNull(dt.Rows(k).Item("EPFP")) = False Then


txt_epfp.Text = dt.Rows(k).Item("EPFP") '& " %"
End If
If IsDBNull(dt.Rows(k).Item("EPF_Amount")) = False Then
txt_epfamt.Text = -(Val(dt.Rows(k).Item("EPF_Amount")) *
Val(txt_epfp.Text) / 100)
End If

If IsDBNull(dt.Rows(k).Item("DeductionP")) = False Then


txt_dedp.Text = dt.Rows(k).Item("DeductionP") '& " %"
End If
If IsDBNull(dt.Rows(k).Item("Deduction_Amount")) = False Then
txt_dedamt.Text = -(Val(dt.Rows(k).Item("Deduction_Amount")) *
Val(txt_dedp.Text) / 100)
End If

If IsDBNull(dt.Rows(k).Item("TaxP")) = False Then


txt_taxp.Text = dt.Rows(k).Item("TaxP") '& " %"
End If

If IsDBNull(dt.Rows(k).Item("Tax_Amount")) = False Then


txt_taxamt.Text = -(Val(dt.Rows(k).Item("Tax_Amount")) *
Val(txt_taxp.Text) / 100)
End If

txt_hrap.Text = dt.Rows(k).Item("HRAP") & " %"


txt_esip.Text = dt.Rows(k).Item("ESIP") & " %"
txt_taxp.Text = dt.Rows(k).Item("TaxP") & " %"
txt_dedp.Text = dt.Rows(k).Item("DeductionP") & " %"
txt_epfp.Text = dt.Rows(k).Item("EPFP") & " %"

'' txt_present.Text = ""


txt_holiamt.Text = ""
txt_clamt.Text = ""
txt_absentamt.Text = ""
txt_leaveamt.Text = ""

txt_presentamt.Text = Val(txt_salary.Text) * Val(txt_present.Text)


txt_holiamt.Text = Val(txt_salary.Text) * Val(txt_holidays.Text)
txt_clamt.Text = Val(txt_salary.Text) * Val(txt_usedcl.Text)
txt_absentamt.Text = -(Val(txt_salary.Text) * Val(txt_absent.Text))
txt_leaveamt.Text = -(Val(txt_salary.Text) * Val(txt_leave.Text))
calamt()
Next

End Sub
Private Sub calamt()
Dim totsalary As Double

102
Payroll Management System

totsalary = Val(txt_presentamt.Text) + Val(txt_holiamt.Text) +


Val(txt_clamt.Text) + Val(txt_absentamt.Text) + Val(txt_leaveamt.Text) +
Val(txt_hraamt.Text) + Val(txt_esiamt.Text) + Val(txt_epfamt.Text) +
Val(txt_dedamt.Text) + Val(txt_taxamt.Text) + Val(txt_taxamt.Text) +
+Val(txt_extraamt.Text) - Val(txt_extraminus.Text)
txt_totsal.Text = Format(totsalary, "#.00")
End Sub
Private Sub findleavs()

Dim da As New SqlDataAdapter("select * from Leave_tbl where LType='Leave' and


Emp_code='" & Trim(txt_empcode.Text) & "' and ldate between '" & Format(Dtp_From.Value,
"MM/dd/yyyy") & "' and '" & Format(Dtp_To.Value, "MM/dd/yyyy") & "' ", Cn)
Dim dt As New DataTable
da.Fill(dt)
txt_leave.Text = Val(dt.Rows.Count)

Dim da1 As New SqlDataAdapter("select * from Leave_tbl where LType='Absent' and


Emp_code='" & Trim(txt_empcode.Text) & "' and ldate between '" & Format(Dtp_From.Value,
"MM/dd/yyyy") & "' and '" & Format(Dtp_To.Value, "MM/dd/yyyy") & "' ", Cn)
Dim dt1 As New DataTable
da1.Fill(dt1)
txt_absent.Text = Val(dt1.Rows.Count)

Dim da2 As New SqlDataAdapter("select * from Leave_tbl where LType='CL' and


Emp_code='" & Trim(txt_empcode.Text) & "' and ldate between '" & Format(Dtp_From.Value,
"MM/dd/yyyy") & "' and '" & Format(Dtp_To.Value, "MM/dd/yyyy") & "' ", Cn)
Dim dt2 As New DataTable
da2.Fill(dt2)
txt_usedcl.Text = Val(dt2.Rows.Count)

End Sub
Private Sub VwImg()
Try
picCapture.Visible = True
Dim cmd As New SqlCommand("select photo from Mas_Employee where EmpCode='"
& txt_empcode.Text & "' ", Cn)
cmd.Parameters.AddWithValue("@EmpCode", txt_empcode.Text)

picCapture.Image = Image.FromStream(New
IO.MemoryStream(CType(cmd.ExecuteScalar, Byte())))
' or you can save in a file
'IO.File.WriteAllBytes("c:\backup\image3.jpg", CType(cmd.ExecuteScalar,
Byte()))
Catch ex As Exception
''MessageBox.Show(ex.Message)
Finally

End Try
End Sub

Private Sub txt_searchemp_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_searchemp.TextChanged

End Sub

Private Sub Dtp_Month_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Dtp_Month.ValueChanged
validdate()
End Sub

103
Payroll Management System

Private Sub Btn_OK_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Btn_OK.Click
view()
searchemp()
End Sub

Private Sub txt_extraamt_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_extraamt.TextChanged
calamt()
End Sub

Private Sub txt_extraminus_TextChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles txt_extraminus.TextChanged
calamt()
End Sub

Private Sub btnc_close_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnc_close.Click
Me.Close()
End Sub

Private Sub BtnNew_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnNew.Click
clr()
txt_searchemp.Text = ""
txt_paycode.Text = ""
newno()
view()
End Sub
Private Sub clr()

txt_hraamt.Text = ""
txt_absent.Text = ""
txt_absentamt.Text = ""
txt_cl.Text = ""
txt_clamt.Text = ""
txt_dedamt.Text = ""
txt_dedp.Text = ""
txt_dept.Text = ""
txt_design.Text = ""
txt_empcode.Text = ""
txt_employee.Text = ""
txt_epfamt.Text = ""
txt_epfp.Text = ""
txt_esiamt.Text = ""
txt_esip.Text = ""
txt_extraamt.Text = ""
txt_extraminus.Text = ""
txt_holiamt.Text = ""
txt_holidays.Text = ""
txt_hrap.Text = ""
txt_hrap.Text = ""
txt_leave.Text = ""
txt_leaveamt.Text = ""
scheme = 0
txt_present.Text = ""
txt_presentamt.Text = ""
txt_salary.Text = ""
'' txt_searchemp.Text = ""
txt_taxamt.Text = ""
txt_taxp.Text = ""

104
Payroll Management System

txt_totsal.Text = ""
txt_usedcl.Text = ""
txt_totsal.Text = ""
txt_working.Text = ""
txt_workingamt.Text = ""
picCapture.Image = Nothing

txt_empcode.Text = ""
txt_employee.Text = ""

txt_dept.Text = ""
txt_dept.Tag = ""
txt_design.Text = ""
txt_design.Tag = ""
picCapture.Image = Nothing

dtp_date.Value = Format(Today, "dd/MM/yyyy")

End Sub
Private Sub newno()
Dim a As String
cmd = New SqlCommand("select Pay_No as Pay_No from Salary_Table order by Pay_No
desc", Cn)
If IsDBNull(cmd.ExecuteScalar()) = False Then
a = cmd.ExecuteScalar()
txt_paycode.Text = Val(a) + 1
Else
txt_paycode.Text = 1
End If

End Sub

Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles BtnSave.Click

''Pay_No,Emp_Code,Scheme_ID,Month_Salary,Working_Days,Working_Salary,Present_Days,Prese
nt_Salary,Holidays,Holidays_Salary,CL,CL_Salary,Absent_Days,Absent_Salary,Leave_Days,Le
ave_Salary,HRA,HRA_Amount,ESI,ESI_Amount,EPF,EPF_Amount,Deduction, Deduction_Amount,
Taxp, Tax_Amount, Extra_Plus, Extra_Minus, Total_Salary
If Val(txt_paycode.Text) = 0 Then Exit Sub

Dim explus As Double


Dim exminus As Double

If Val(txt_extraamt.Text) = 0 Then
explus = 0
Else
explus = Val(txt_extraamt.Text)
End If

If Val(txt_extraminus.Text) = 0 Then
exminus = 0
Else
exminus = Val(txt_extraminus.Text)
exminus = -(exminus)
End If

If Val(txt_totsal.Text) = 0 Then

105
Payroll Management System

MsgBox("Not Elgible For Salary")


Exit Sub
End If

If validate_save() = False Then Exit Sub


cmd = New SqlCommand("select Pay_No from Salary_Table where Pay_No=" &
Val(txt_paycode.Text) & " ", Cn)
a1 = cmd.ExecuteScalar()
a1 = Trim(a1)
If a1 = "" Then

strinsert = "insert into


Salary_Table(Pay_No,Emp_Code,Emp_Name,Department,Designation,Salary_Month,From_Date,To_
Date,Salary_Date,Scheme_ID,Month_Salary,Day_Salary,Working_Days,Present_Days,Present_Sa
lary,Holidays,Holidays_Salary,CL,usedcl,CL_Salary,Absent_Days,Absent_Salary,Leave_Days,
Leave_Salary,HRA,HRA_Amount,ESI,ESI_Amount,EPF,EPF_Amount,Deduction, Deduction_Amount,
Taxp, Tax_Amount, Extra_Plus, Extra_Minus, Total_Salary) values(" & txt_paycode.Text &
",'" & txt_empcode.Text & "','" & Trim(txt_employee.Text) & "','" & Trim(txt_dept.Text)
& "','" & Trim(txt_design.Text) & "','" & Dtp_Month.Text & "','" &
Format(Dtp_From.Value, "MM/dd/yyyy") & "','" & Format(Dtp_To.Value, "MM/dd/yyyy") &
"','" & Format(dtp_date.Value, "MM/dd/yyyy") & "'," & scheme & "," &
Val(txt_workingamt.Text) & "," & Val(txt_salary.Text) & "," & Val(txt_working.Text) &
"," & Val(txt_present.Text) & "," & Val(txt_presentamt.Text) & "," &
Val(txt_holidays.Text) & "," & Val(txt_holiamt.Text) & "," & Val(txt_cl.Text) & "," &
Val(txt_usedcl.Text) & "," & Val(txt_clamt.Text) & "," & Val(txt_absent.Text) & "," &
Val(txt_absentamt.Text) & "," & Val(txt_leave.Text) & "," & Val(txt_leaveamt.Text) &
"," & Val(txt_hrap.Text.Replace("%", "")) & "," & Val(txt_hraamt.Text) & "," &
Val(txt_esip.Text.Replace("%", "")) & "," & Val(txt_esiamt.Text) & "," &
Val(txt_epfp.Text.Replace("%", "")) & "," & Val(txt_epfamt.Text) & "," &
Val(txt_dedp.Text.Replace("%", "")) & "," & Val(txt_dedamt.Text) & "," &
Val(txt_taxp.Text.Replace("%", "")) & "," & Val(txt_taxamt.Text) & "," & Val(explus) &
"," & Val(exminus) & "," & Val(txt_totsal.Text) & " ) "

cmd = New SqlCommand(strinsert, Cn)


cmd.ExecuteNonQuery()
MsgBox("Records Successfully Saved", MsgBoxStyle.Information, " ")
'' clr()
''View()
Else
Dim ans As String
ans = MsgBox("Are you sure want to Edit?", MsgBoxStyle.YesNo, " ")
If ans = vbYes Then
str = "Update Salary_Table set Emp_Name='" & Trim(txt_employee.Text) &
"',Department='" & Trim(txt_dept.Text) & "',Designation='" & Trim(txt_design.Text) &
"',Salary_Month='" & Dtp_Month.Text & "',From_Date='" & Format(Dtp_From.Value,
"MM/dd/yyyy") & "',To_Date='" & Format(Dtp_To.Value, "MM/dd/yyyy") & "',Salary_Date='"
& Format(dtp_date.Value, "MM/dd/yyyy") & "',Scheme_ID=" & scheme & ",Month_Salary=" &
Val(txt_workingamt.Text) & ",Working_Days=" & Val(txt_working.Text) & ",Present_Days="
& Val(txt_present.Text) & ",Present_Salary=" & Val(txt_presentamt.Text) & ",Holidays="
& Val(txt_holidays.Text) & ",Holidays_Salary=" & Val(txt_holiamt.Text) & ",CL=" &
Val(txt_cl.Text) & ",usedcl=" & Val(txt_usedcl.Text) & ",CL_Salary=" &
Val(txt_clamt.Text) & ",Absent_Days=" & Val(txt_absent.Text) & ",Absent_Salary=" &
Val(txt_absentamt.Text) & ",Leave_Days=" & Val(txt_leave.Text) & ",Leave_Salary=" &
Val(txt_leaveamt.Text) & ",HRA=" & Val(txt_hrap.Text.Replace("%", "")) & ",HRA_Amount="
& Val(txt_hraamt.Text) & ",ESI=" & Val(txt_esip.Text.Replace("%", "")) & ",ESI_Amount="
& Val(txt_esiamt.Text) & ",EPF=" & Val(txt_epfp.Text.Replace("%", "")) & ",EPF_Amount="
& Val(txt_epfamt.Text) & ",Deduction=" & Val(txt_dedamt.Text.Replace("%", "")) &
",Deduction_Amount=" & Val(txt_dedamt.Text) & ",Taxp=" & Val(txt_taxp.Text.Replace("%",
"")) & ",Tax_Amount=" & Val(txt_taxamt.Text) & ",Extra_Plus=" & Val(explus) &

106
Payroll Management System

",Extra_Minus=" & Val(exminus) & ",Total_Salary=" & Val(txt_totsal.Text) &


",Day_Salary=" & Val(txt_salary.Text) & " where Pay_No=" & Val(txt_paycode.Text) & " "
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()

MsgBox("Records Successfully Updated", MsgBoxStyle.Information, " ")


'' clr()
'' View()
End If

End If
view()
End Sub
Private Function validate_save() As Boolean

cmd = New SqlCommand("select distinct Emp_code as Emp_code from Salary_Table


where Salary_Month='" & Dtp_Month.Text & "' and Emp_code='" & Trim(txt_empcode.Text) &
"' ", Cn)
a1 = cmd.ExecuteScalar()
a1 = Trim(a1)
''If Trim(dtp_date.Value) <> "" Then
If a1 <> "" Then
MsgBox("Salary Alredy Added")
''Dtp_Month.Text = ""
' Exit Function
End If
'' End If
validate_save = True

End Function

Private Sub btnview_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnview.Click
view()
End Sub

Private Sub Btn_Preview_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Btn_Preview.Click
Try

strquery = ""
strquery = "select * from Salary_Table where Pay_No=" &
Val(txt_paycode.Text) & " "
printname = "PAYSLIP"
Report_Viewer_Frm.Show()
Catch ex As Exception
MsgBox("Enter Valid Data/Informations", MsgBoxStyle.Critical)
End Try
End Sub

Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnDelete.Click
Dim ans As String
ans = MsgBox("Do you sure want to Delete?", MsgBoxStyle.YesNo, " ")
If ans = vbYes Then
str = "delete from Salary_Table where Pay_No=" & Val(txt_paycode.Text) & "
"
cmd = New SqlCommand(str, Cn)
cmd.ExecuteNonQuery()

107
Payroll Management System

MsgBox("Records Successfully Updated", MsgBoxStyle.Information, " ")


view()
End If
End Sub

Private Sub DGVIEW_CellContentClick(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.DataGridViewCellEventArgs) Handles DGVIEW.CellContentClick

End Sub

Private Sub DGVIEW_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)


Handles DGVIEW.DoubleClick
If DGVIEW.RowCount >= 1 Then
txt_searchemp.Text = DGVIEW.CurrentRow.Cells(1).Value
searchemp()
txt_searchemp.Text = ""
End If

End Sub

Private Sub DGVIEW_KeyDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyEventArgs) Handles DGVIEW.KeyDown
If e.KeyCode = Keys.Enter Then
If DGVIEW.RowCount >= 1 Then
txt_searchemp.Text = DGVIEW.CurrentRow.Cells(1).Value
searchemp()
txt_searchemp.Text = ""
End If
End If
End Sub
End Class

Salary Report Form

Private Sub Btn_Salary_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Btn_Salary.Click
Try

strquery = ""
If Trim(txt_searchemp.Text) <> "" Then
'' strquery = "select * from Salary_Table where emp_code='" &
Trim(txt_searchemp.Text) & "' "

If Rdo_Date.Checked = True Then


strquery = "select * from Salary_Table where emp_code='" &
Trim(txt_searchemp.Text) & "' and To_date between'" & Format(dtp_Fromdate.Value,
"MM/dd/yyyy") & "' and '" & Format(Dtp_Todate.Value, "MM/dd/yyyy") & "' order by
department,designation "

Else
strquery = "select * from Salary_Table where emp_code='" &
Trim(txt_searchemp.Text) & "' and Salary_Month='" & Trim(Dtp_Month.Text) & "' order by
department,designation "

End If
ElseIf Chk_Department.CheckState = CheckState.Checked And
Chk_Designation.CheckState = CheckState.Checked Then

If Trim(Cmb_Department.Text) = "" Then

108
Payroll Management System

MsgBox("Enter Valid Department")


Exit Sub
End If

If Trim(Cmb_Designation.Text) = "" Then


MsgBox("Enter Valid Designation")
Exit Sub
End If

If Rdo_Date.Checked = True Then


strquery = "select * from Salary_Table where department='" &
Trim(Cmb_Department.Text) & "' and designation='" & Trim(Cmb_Designation.Text) & "' and
To_date between '" & Format(dtp_Fromdate.Value, "MM/dd/yyyy") & "' and '" &
Format(Dtp_Todate.Value, "MM/dd/yyyy") & "' order by department,designation "

Else
strquery = "select * from Salary_Table where department='" &
Trim(Cmb_Department.Text) & "' and designation='" & Trim(Cmb_Designation.Text) & "' and
Salary_Month='" & Trim(Dtp_Month.Text) & "' order by department,designation "

End If

ElseIf Chk_Department.CheckState = CheckState.Checked Then


If Trim(Cmb_Department.Text) = "" Then
MsgBox("Enter Valid Department")
Exit Sub
End If
If Rdo_Date.Checked = True Then
strquery = "select * from Salary_Table where department='" &
Trim(Cmb_Department.Text) & "' and To_date between '" & Format(dtp_Fromdate.Value,
"MM/dd/yyyy") & "' and '" & Format(Dtp_Todate.Value, "MM/dd/yyyy") & "' order by
department,designation "

Else
strquery = "select * from Salary_Table where department='" &
Trim(Cmb_Department.Text) & "' and Salary_Month='" & Trim(Dtp_Month.Text) & "' order
by department,designation "

End If
ElseIf Chk_Designation.CheckState = CheckState.Checked Then
If Trim(Cmb_Designation.Text) = "" Then
MsgBox("Enter Valid Designation")
Exit Sub
End If
If Rdo_Date.Checked = True Then
strquery = "select * from Salary_Table where designation='" &
Trim(Cmb_Designation.Text) & "' and To_date between '" & Format(dtp_Fromdate.Value,
"MM/dd/yyyy") & "' and '" & Format(Dtp_Todate.Value, "MM/dd/yyyy") & "' order by
department,designation "

Else
strquery = "select * from Salary_Table where designation='" &
Trim(Cmb_Designation.Text) & "' and Salary_Month='" & Trim(Dtp_Month.Text) & "' order
by department,designation "

End If
Else
If Rdo_Date.Checked = True Then

109
Payroll Management System

strquery = "select * from Salary_Table where and To_date between


'" & Format(dtp_Fromdate.Value, "MM/dd/yyyy") & "' and '" & Format(Dtp_Todate.Value,
"MM/dd/yyyy") & "' order by department,designation "

Else
strquery = "select * from Salary_Table where Salary_Month='" &
Trim(Dtp_Month.Text) & "' order by department,designation "

End If
End If

printname = "SALARY SUMMERY"


Reports_Frm.Show()
Catch ex As Exception
Reports_Frm.Close()
End Try

End Sub

Report Viewer Form

Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.IO
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine
Public Class Report_Viewer_Frm
Dim pri As Integer
Public invid As Long
Private Sub Report_Viewer_Frm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Private Sub ReportViewer_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ReportViewer.Load

Me.Top = 0
Me.Left = 0
pri = 0
Timer1.Start()
txt_datetime.Text = Format(Today, "dd/MM/yyyy") & " " & TimeOfDay
Me.Refresh()
printrep()
End Sub
Sub printrep()

If printname = "PAYSLIP" Then

''strquery = "Select * from view_estimation where estno=" & estmateid & ""
Dim da As New SqlDataAdapter(strquery, Cn)
Dim dt As New DataTable
da.Fill(dt)

If dt.Rows.Count < 1 Then


Me.Close()
Exit Sub
End If

110
Payroll Management System

Dim report As New SalarySlip_Crpt


report.PrintOptions.PaperSize = PaperSize.PaperA4
'' Dim companyname As New ParameterDiscreteValue
''Dim address1 As New ParameterDiscreteValue

''companyname.Value = "KG TRIGGRES"


''address1.Value = "Mettupalayam"

''report.ParameterFields("companyname").CurrentValues.Add(companyname)
''report.ParameterFields("address1").CurrentValues.Add(address1)

report.SetDataSource(dt)
'report.SetParameterValue(0, companyname)
'report.SetParameterValue(1, address1)

ReportViewer.ReportSource = report
ReportViewer.Refresh()
ReportViewer.Visible = True

If pri = 1 Then
report.PrintToPrinter(1, True, 0, 0)
End If
Exit Sub
End If

End Sub

Private Sub Btn_Close_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Btn_Close.Click
Me.Close()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Timer1.Tick
txt_datetime.Text = Format(Today, "dd/MM/yyyy") & " " & TimeOfDay

End Sub
End Class

111
Payroll Management System

CHAPTER 4 TESTING AND IMPLEMENTATION

4.1 Testing Methodology (Types)


4.2 Unit Testing
4.3 Module Testing
4.4 System Testing
4.5 Alpha/ Beta Testing
4.6 White Box Black Box Testing
4.7 Implementation
4.8 Post Implimentation

112
Payroll Management System

4.1 Testing Methodology (Types)

Test cases are developed using various test techniques to achieve more effective testing. By this, software
completeness is provided and conditions of testing which get the greatest probability of finding errors are
chosen. So, testers do not guess which test cases to chose, and test techniques enable them to design testing
conditions in a systematic way. Also, if one combines all sorts of existing test techniques, one will obtain
better results rather if one uses just one test technique. Software can be tested in two ways, in another words,
one can distinguish two different methods:
1. Black box testing and
2. White box testing.

4.2 Unit Testing

Unit testing, also known as component testing , refers to tests that verify the functionality of a
specific section of code, usually at the function level. In an object-oriented environment, this is
usually at the class level, and the minimal unit tests include the constructors and destructors.

These types of tests are usually written by developers as they work on code (white-box style), to
ensure that the specific function is working as expected. One function might have multiple tests,
to catch corner cases or other branches in the code. Unit testing alone cannot verify the
functionality of a piece of software, but rather is used to assure that the building blocks the
software uses work independently of each other.

Unit testing is a software development process that involves synchronized application of a broad
spectrum of defect prevention and detection strategies in order to reduce software development
risks, time, and costs. It is performed by the software developer or engineer during the
construction phase of the software development lifecycle. Rather than replace traditional QA
focuses, it augments it. Unit testing aims to eliminate construction errors before code is
promoted to QA; this strategy is intended to increase the quality of the resulting software as well
as the efficiency of the overall development and QA process.

113
Payroll Management System

Depending on the organization's expectations for software development, unit testing might
include static code analysis, data flow analysis metrics analysis, peer code reviews, code
coverage analysis and other software verification practices.

4.3Integration Testing

Integration testing is any type of software testing that seeks to verify the interfaces between
components against a software design. Software components may be integrated in an iterative
way or all together ("big bang"). Normally the former is considered a better practice since it
allows interface issues to be located more quickly and fixed .Integration testing works to expose
defects in the interfaces and interaction between integrated components (modules). Progressively
larger groups of tested software components corresponding to elements of the architectural
design are integrated and tested until the software works as a system

4.4System Testing

System testing, or end-to-end testing, tests a completely integrated system to verify that it meets
its requirements. For example, a system test might involve testing a logon interface, then
creating and editing an entry, plus sending or printing results, followed by summary processing
or deletion (or archiving) of entries, then logoff.

In addition, the software testing should ensure that the program, as well as working as expected,
does not also destroy or partially corrupt its operating environment or cause other processes
within that environment to become inoperative (this includes not corrupting shared memory, not
consuming or locking up excessive resources and leaving any parallel processes unharmed by its
presence).

4.5Alpha/ Beta Testing

114
Payroll Management System

Alpha testing

Alpha testing is simulated or actual operational testing by potential users/customers or an


independent test team at the developers' site. Alpha testing is often employed for off-the-shelf
software as a form of internal acceptance testing, before the software goes to beta testing.

Beta testing

Beta testing comes after alpha testing and can be considered a form of external user acceptance
testing. Versions of the software, known as beta versions, are released to a limited audience
outside of the programming team. The software is released to groups of people so that further
testing can ensure the product has few faults or bugs. Sometimes, beta versions are made
available to the open public to increase the feedback field to a maximal number of future user

4.6White Box Black Box Testing

White box testing is highly effective in detecting and resolving problems, because bugs (bug or fault is a
manifestation of an error in a software) can often be found before they cause trouble. We can shortly define
this method as testing software with the knowledge of the internal structure and coding inside the program .
White box testing is also called white box analysis, clear box testing or clear box analysis. It is a strategy for
software debugging (it is the process of locating and fixing bugs in computer program code or the
engineering of a hardware device) in which the tester has excellent knowledge of how the program
components interact. This method can be used for Web services applications, and is rarely practical for
debugging in large systems and networks ). Besides white box testing is considered as a security testing (the
process to determine that an information system protects data and maintains functionality as
intended)method that can be used to validate whether code implementation follows intended design, to
validate implemented security functionality, and to uncover exploitable vulnerabilities Black box testing is
testing software based on output requirements and without any knowledge of the internal structure or coding
in the program .In another words, a black box is any device whose workings are not understood by or
accessible to its user. For example, in telecommunications, it is a resistor connected to a phone line that
makes it impossible for the telephone company’s equipment to detect when a call has been answered. In data
mining, a black box is an algorithm that doesn’t provide an explanation of how it works. In film–making, a

115
Payroll Management System

black box is a dedicated hardware device: equipment that is specifically used for a particular function, but in
the financial world, it is a computerized trading system that doesn’t make its rules easily available.

CHAPTER 5

CONCLUSION AND REFERENCES

5.1 Conclusion
5.2 Limitation of System
5.3 Future Scope for Modification
5.4 References/ Bibliography
5.1 Conclusion

With the theoretical inclination of our syllabus it becomes very essential to take the utmost advantage of any
opportunity of gaining practical experience that comes along. The construction of this Minor Project
“PAYROLL MANAGEMENT SYSTEM” was one of these opportunities. It gave us the requisite practical
knowledge to supplement the already taught theoretical concepts thus making us more competent as a
computer engineer.

The project from a personal point of view also helped us in understanding the following aspects of project
development:

 The planning that goes into implementing a project.


 The importance of proper planning and an organized methodology.
 The key element of team spirit and co-ordination in a successful project

The project also provided us the opportunity of interacting with our teachers and to gain from their vast
experience.

5.2 Limitation of System


 In the present system we cannot search for the report of an employee by entering the name of that
employee. Search is based on the employee id.

116
Payroll Management System

 If the payroll company is understaffed and has an abundance of clients, it may become difficult to
reach someone when you need it immediately such as when paycheck discrepancies arise.
 Because the payroll company is located off-site, it is difficult to always know what’s going on with
your payroll until the actual pay date arrives

5.3 Future Scope for Modification


 Although we tried to be as thorough as possible in the implementation of our project but there were a
large number of features we could not implement due to want of time or for other reasons.

5.4 References/ Bibliography

Bibliography

Sr. No. Name of the Book Author’s Name


1. Beginning (Visual Basic.Net) Richard Blair
2. Project Management John M. Nicholas
3. Learn Sql in 21 Days Ryan K.Stephens, Ronald R.Plew

WEBSITES:
1. http://vb.net-informations.com/

2. http://en.wikipedia.org/wiki/Visual_Basic_.NET

3. http://www.w3schools.com

117

Vous aimerez peut-être aussi