You are on page 1of 56

Mini Project 2016 | CEK Salary Management System

CHAPTER 1
INTRODUCTION
The project titled CEK Salary management System is salary calculation software for a any
organization. The project CEK salary management system is developed in java.
This software

is used for an idea to satisfy the customer needs of a college/any

organization .which focuses on basic operations in a organization like Salary calculation,


Staff Registration, Attendance management, Complaint registration, Print Salary receipts, and
Generate Different types of Salary Report
CEK Salary management System is an application written for Windows operating systems,
designed to help users maintain and organize the staff in a organization, Our software is easy
to use for both beginners and advanced users. It features a familiar and well thought-out, an
attractive user interface, combined with strong searching, insertion and reporting capabilities.
The software will consist of two modules: Manager (admin) Module and Staff
module .The manager module can view all the details, update, delete and insert staff details.
Salary management system is a JAVA application that is designed to be implemented for
small to medium level organization this application we add the user data and this data can be
view by the manager .We have to computerization of existing system in order to overcome
the difficulties and make the proposed system efficient. This system is menu driven.
My project is developed using JAVA with MYSQL as database JAVA is a powerful tool and
act as front end of this project with MYSQL as backend

CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

CHAPTER 02
SYSTEM STUDY

2.1SYSTEM ANALYSIS
Major task of CEK Salary Management System is Salary calculation of the staff in a college
or any organization .this system helps to overcome all the problem are facing by the manual
system.

2.1.1 EXISTING SYSTEM

Lack of security of data


More man power
Time consuming
Data duplication
Needs manual Calculation
Common error

2.1.2 PROPOSED SYSTEM


To overcome the drawbacks of existing system, a new system has to be implemented.
Complex procedures are avoided to make the system easy to use.

Security of data
Ensure the data accuracy
Common error can be avoided
Minimize manual data entry
Greater efficiency
Better service
User friendless & interactive
Better Service

2.2 INPUT and OUTPUT


2.2.1 INPUT
CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

The inputs given into the system are:

Staff register
o all information of the staff ie, name,photo,personal information
,position,section,bank details
Authorization details-Login
o Username
o Password
Attendance register contain daily attendance of staff
Complaints
Salary calculation
o AGP
o BP
o DP
o DA
o DP
o HRA
o Month, year
Deductions
o Pf subscription
o Pf loan
o Pf arrier
o Society loan repayment
o LIC
o TAX
o Other recoveries

2.2.1 OUTPUT

The system get accurate salary for each user


Generate salary reports
Salary receipts
Provide staff information
Attendance report

CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

2.3 SALARY CALCULATION OF EXISTING SYSTEM


1. AGP (Academic grade pay) :
-LGS

-9690

-LIB

-12880

-Trade Instructor

-16180

-Professor

Associative professor

9000

Assistant professor

6000

2. BP (basic pay): each employee salary in a particular range

CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

Example: 8000 to 16000


Type of Wages:

Daily wages-400/day
HB-3500/day(max 7500)
Demonstrator-410/day
Sweepers -140/day
Administrative assistive-14000/month
Security-400/day
Adhoc basic-9000/month
Computer programmer-410/day-max 9500/month
Junior system analyst-410/day max 9500/month
Hourly -250/hr max-12000

3. (BP+DP (AGP)):
4. DA (Dearness Allowance):
5. HRA (House Rent Allowance):
a) Actual HRA
b) Actual HRA-1/10 of salary
c) 50%salary
HRA=Actual-least one of (a/b/c)

---------------------------------------------------------------------------------------------------------------Gross Amount: =AGP+DA+ (BP+DP) +HRA


----------------------------------------------------------------------------------------------------------------

DEDUCTIONS
1.
2.
3.
4.
5.
6.

PF Subscription = (12% of Gross Amount)


Pf Loan:
Pf Arrier:
Society Loan Repayment:
LIC:
Income Tax:
Gross(lac)
2
2.5-5
5-10
10-above

CEK SALARY MANAGEMENT SYSTEM

TAX (%)
No tax
10%
20%
30%

Mini Project 2016 | CEK Salary Management System

Sess (common for all employees)


2% education Sess
1% higher education
Example: calculate tax
Salary:5 lac
Tax=(5 lac - 2 lac)*20%
7. Other Recoveries:
Total = (PF Subscription+ PF Loan+ PF Arrier+Society Loan Repayment+LIC+Income Tax+
Other Recoveries)

---------------------------------------------------------------------------------------------------------------Net Amount of payable: =Gross Amount Total


---------------------------------------------------------------------------------------------------------------Date of payment:
Remarks:

CHAPTER 03
SYSTEM REQUIREMENTS
3.1 Software Requirements
3.1.1Front End:

JAVA
Java is a language which is simpler to understand, easier to implement and yet portable across
different platforms, than any other oops language. It is currently popular because it is
compiled to machine independent byte code. This allows programmers to write one kind of
CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

program code for all platforms. Not only it is a powerful programming language built to
secure , cross- platform and international , but also java is being continually extended to
provide language feature and libraries that elegantly handle problems that are difficult in
traditional programming languages .
Java based systems are easier to understand and
express. Classes designed to fit the problem tend to express it better. Java produces a
maximum leverage with libraries .This is accomplished by casting libraries into new data
types (classes),so that bringing a library means adding new types to the language. Another
feature of java is its efficient error handling system, which adds to the robustness to the
system. Java exception handling is a way to guarantee that an error Is noticed, and that
something happens as a result . The primary motivation for selecting java is the easy use of
existing code in the form of class libraries.
Java was developed at sun Microsystems. Work on
java initially began with the goal of creating a platform-independent and OS for consumer
electronics . The original intent was to use C++, but as work progressed in this direction ,
developers identified that creating their own language would serve them better . The effort
towards consumer electronics led the java team , them known as First Person Inc .,towards
developing hardware and software for the delivery of video-on-demand with Time Warne
Today Java is both a programming language and an
environment for executing programs written in java language. Unlike traditional compilers ,
which convert source code into machine level instructions , the java compiler translates java
source code into instructions that are interpreted by the runtime java virtual machine. Java is
an interpreted language.
Java is the first programming language designed from
ground up with network programming in mind .The core API java includes classes and
interfaces that provide uniform access to a diverse set of a network protocols. As the internet
and network programming have evolved, java has maintained its cadence. New APIs and
toolkits have expanded the available options for the java network programmer
Features of java languages as follows :

OBJECT ORIENTED
INTERPRETED

CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

ARCHITECTURE NEUTRAL AND PORTABLE


DYNAMIC AND DISTRIBUTED
SIMPLE
ROBUST
SECURE
HIGH-PERFORMANCE
MULTITHREADED

JAVA RUNTIME ENVIORNMENT


The runtime environment used to execute the code . It is made up of the java language
and java virtual machine. It is portable and it is platform neutral.

Java
It is used by the developers to create java code. They include java

compiler , java interpreter, classes, libraries and applet viewer.


Java Application
Applications are programs written in java to carry out certain tasks
on standalone local computer. Execution of a standalone program

involves two steps.


1. Compiling the source code into byte code using Javac .
2.
Executing byte code program using java interpreter
Java Applets
Java applets are pieces of java code that are embedded in HTML
document using the applet tag. When the browser encounters such code it

download it and execute it.


Java Virtual machine
It is a specification to which java codes must be written. All java
code is to be compiled to be used in this nonexistent virtual machine.
Writing the code, which compiles in JVM ensure platform independent.

Net Beans IDE


The Net Beans IDE is a free, open source integrated Development Environment for
software developers. You get all the tools you need to create professional desktop, enterprise,
web and mobile application, in java, C/C++ and even ruby. The IDE runs on many platforms
including Windows, Linux, Mac OS X and Solaris; it is easy to install and use straight out of
the box.

CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

The 7.1.2 release includes significant enhancements and new features, including a
completely rewritten editor infrastructure support for additional languages, new productivity
features and simplified installation process that allows you to easily installed and configures
the IDE to meet your exact needs. Net Beans plugins allows you to extend the functionality
of Net Beans IDE as well as any other applications built on the top of Net Beans Platform.
The Net Beans Platform provides an application common requirement such as
menus document management and settings right out of the box. The Net Beans API are the
public interfaces and classes which are available to module writers they are divided into
specific APIs for dealing with different types of functionality. The condense and behavior of
the java source packages and its sub packages as classifies in the Net Beans API are the Net
Beans APIs

3.1.2 Back End


MYSQL
MYSQL is a relational database management system (RDMS) that runs as a server
providing multi-user access to a number of databases. MYSQL is the worlds most popular
open source database software. It eliminates the major problems associated with downtime,
maintenance and administration for modern, online applications. MYSQL, the most popular
Open Source SQL database management system, is developed, distributed, and supported by
oracle corporation .MYSQL offers standard database driver connectively for using MYSQL
with applications and tools that are compatible with industry standards ODBC and JDBC.
Any system that works with ODBC or JDBC can use MYSQL.
This software is developed for general use in a variety of
information management applications. It is not developed or intended for use in any
inherently dangerous applications, including applications which may create a risk of personal
injury. If you use this software in dangerous applications, and other measures to ensure the
safe use of this software.
CEK SALARY MANAGEMENT SYSTEM

Mini Project 2016 | CEK Salary Management System

MYSQL is a database management system. A database is a


structured collection of data. It may be anything. MYSQL is a relational database
management system. A relational database stores data in separate tables rather than putting all
the data in one. The MYSQL Server design is multi-layered with independent modules. Many
of the worlds largest and fastest-growing organizations use MYSQL to save time and money
powering their high-volume Web sites, critical business systems, and packaged software.
MYSQL is a key part of LAMP (Linux, Apache, MYSQL,
PHP/Perl/Python),the fast-growing open source enterprise software pack.
More and more companies are using LAMP as an
alternative to expensive proprietary software stacks because of its lower cost and freedom
from platform lock-in.

The features of MYSQL server are:

A very thread-based memory allocation system.


Very fast joins using an optimized one-sweep multi-join.
In-memory hash tables, which are used as temporary tables.
SQL functions are implemented using a highly optimized class library
and should be as fast as possible. Usually there is no memory allocation

at all after query initialization.


The best and the most-used database in the world for online applications.
Available and affordable for all.
Easy to use.
Continuously improved while remaining fast, secure and reliable.
Fun to use and improve.
Free from bugs.

3.2 Hardware Specification:


CPU
Intel Pentium 4 or equivalent
CEK SALARY MANAGEMENT SYSTEM

10

Mini Project 2016 | CEK Salary Management System

Operation speed

1.8GHz

Memory
RAM

2GB

Hard disk drive

40GB,1GB free space

Disk Storage:

Peripherals:
Keyboard
Mouse
Monitor

104 keys
Optical
Proper Resolution-1336*720

CHAPTER 04
DESIGN
4.1 Block Diagram

Manager

Attendanc
e

SALARY

Staf
Information

Complaints

11

CEK SALARY MANAGEMENT SYSTEM

Staf

Mini Project 2016 | CEK Salary Management System

Block diagram depicts the main activities of Staff and Manager

4.2 ER DIAGRAM
Username

Password

Name
S_id

Department

Add/ remove

Password

Username

SALARY

Staf
Bank Name

View

Manage
r

Bank account
number

Register

View

IFSC

Complain
ts
S id

Reason

S id

AGP
BP

Add
Calculate
BP+DP

Salary
FN

HRA

AN
Gross Pay

12

CEK SALARY MANAGEMENT SYSTEM

Total

Mini Project 2016 | CEK Salary Management System

Salary Type

Attendance
Date of pay
S id

Name

LIC

PF arrier

Read

Deductions

S_ID

TAX

Other Recoveries
PF Loan

4.3 DATAFLOW DIAGRAM


Level 0

STAFF

Logi
n
View
salary

Salary
management
system

Complai
nts
Login,
Calculate
salary
Create staf,
cashier

MANAGER

Level 1
Add
staf

Manager

Username,

Staf

S_ID

View Salary
CEK SALARY MANAGEMENT SYSTEM

Actual

Salary
13

Mini Project 2016 | CEK Salary Management System

S_ID

LOGIN
S_I
D

Manage
r

S_I
D

Add Attendance

Calculate
Salary

Dat

Attendance

S_ID, BP, DP,


DA, HRA,

Salary

S_I
D

Read
Complaints

Reason

Complaints

Staf

Staf

Userna
me
passwo

View Salary

LOGIN
Da
Da
te

Total

View
attendance

SI
D

Register
Complaints

CEK SALARY MANAGEMENT SYSTEM

Date

Reason

Salary

Attendanc
e

Complaint
s

14

Mini Project 2016 | CEK Salary Management System

CHAPTER 5
CODING
Includes implementation of the design specified in the design document into executable
programming language code. The output of the coding phase is the source code for the
software that acts as input to the testing and maintenance phase.
5.1 MANAGER MODULE
Manager can access the system to control all details of the staff .i.e., staff Personal
information, salary information, attendance information.etc
1. Register Staff Add/Remove/Update Staff
2. Calculate Salary
3. Add Attendance
4. View Complaints
5. Manage User
6. Manage Payment
5.2 STAFF MODULE
Staff view only own personal information, salary information, attendance.etc
1. Registration(Login)
2. View Salary
3. View Attendance
4. Register Complaints
5. View Profile
6. Change password
CEK SALARY MANAGEMENT SYSTEM

15

Mini Project 2016 | CEK Salary Management System

7. Change photo

CHAPTER 6
SYSTEM TESTING

The purpose of testing is to discover errors. Testing is the process of trying


to discover every conceivable fault or weakness in a work product. It provides a way to check
the functionality of components, sub-assemblies, assemblies and/or a finished product. It is
the process of exercising software with the intent of ensuring that the Software system meets
its requirements and user expectations and does not fail in an unacceptable manner. There are
various types of test. Each test type addresses a specific testing requirement.
6.1 TYPES OF TESTING
6.1.1 UNIT TESTING
Unit testing involves the design of test cases that validate that the internal
program logic is functioning properly, and that program inputs produce valid outputs. All
decision branches and internal code flow should be validated. It is the testing of individual
software units of the application .it is done after the completion of an individual unit before
integration. This is a structural testing, that relies on knowledge of its construction and is
invasive. Unit tests perform basic tests at component level and test a specific business
process, application, and/or system configuration. Unit tests ensure that each unique path of a
CEK SALARY MANAGEMENT SYSTEM

16

Mini Project 2016 | CEK Salary Management System

business process performs accurately to the documented specifications and contains clearly
defined inputs and expected results.
6.1.2 INTEGRATION TESTING
Integration tests are designed to test integrated software components to
determine if they actually run as one program. Testing is event driven and is more concerned
with the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically aimed
at exposing the problems that arise from the combination of components.

6.1.3 FUNCTIONAL TESTING


Functional tests provide systematic demonstrations that functions tested are
available as specified by the business and technical requirements, system documentation, and
user manuals.
Functional testing is centered on the following items:
Valid Input

: identified classes of valid input must be accepted.

Invalid Input

: identified classes of invalid input must be rejected.

Functions

: identified functions must be exercised.

Output

: identified classes of application outputs must be exercised.

Systems/Procedures: interfacing systems or procedures must be invoked.


Organization and preparation of functional tests is focused on requirements,
key functions, or special test cases. In addition, systematic coverage pertaining to identify
Business process flows; data fields, predefined processes, and successive processes must be
considered for testing. Before functional testing is complete, additional tests are identified
and the effective value of current tests is determined.

CEK SALARY MANAGEMENT SYSTEM

17

Mini Project 2016 | CEK Salary Management System

6.1.4 SYSTEM TESTING


System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An example of
system testing is the configuration oriented system integration test. System testing is based on
process descriptions and flows, emphasizing pre-driven process links and integration points.
6.1.5 WHITE BOX TESTING
White Box Testing is a testing in which in which the software tester has
knowledge of the inner workings, structure and language of the software, or at least its
purpose. It is purpose. It is used to test areas that cannot be reached from a black box level.

6.1.6 BLACK BOX TESTING


Black Box Testing is testing the software without any knowledge of the
inner workings, structure or language of the module being tested. Black box tests, as most
other kinds of tests, must be written from a definitive source document, such as specification
or requirements document, such as specification or requirements document. It is a testing in
which the software under test is treated, as a black box .you cannot see into it. The test
provides inputs and responds to outputs without considering how the software works.

6.2 TEST STRATEGY AND APPROACH


Field testing will be performed manually and functional tests will be written in detail.
TEST OBJECTIVES
All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.
FEATURES TO BE TESTED
Verify that the entries are of the correct format
No duplicate entries should be allowed.
All links should take the user to the correct page.
INTEGRATION TESTING

CEK SALARY MANAGEMENT SYSTEM

18

Mini Project 2016 | CEK Salary Management System

Software integration testing is the incremental integration testing of two or


more integrated software components on a single platform to produce failures caused by
interface defects.
The task of the integration test is to check that components or software
applications, e.g. components in a software system or one step up software applications at
the company level interact without error.
TEST RESULTS
All the test cases mentioned above passed successfully. No defects
encountered.
ACCEPTANCE TESTING
User Acceptance Testing is a critical phase of any project and requires
significant participation by the end user. It also ensures that the system meets the functional
requirements.
TEST RESULTS
All the test cases mentioned above passed successfully. No defects
encountered.

CEK SALARY MANAGEMENT SYSTEM

19

Mini Project 2016 | CEK Salary Management System

CHAPTER 7
IMPLEMENTATION AND MAINTENANCE
Implementation is the process of bringing developed system into operational use and
turning it over to the user. An implementation plan is necessary, its major elements are
Training plans
Equivalent installation plans
Conversion plans
Training plan is necessary to ensure that all persons who are associated with the
system have the necessary knowledge and skills. An important activity in training is
management orientation.
Equipment implementation is an activity that is completed during the
development phase. The equipment related activities are: site operation, equipment
installation and hardware and software check out.
Conversion is the process of initiating all of the physical operations that
results directly in the turn over if the new system to the user. There are two parts:
Conversion plan
Changeover plan
Conversion plan includes procedure conversion, program conversion and file
conversion. Changeover plan specifies the method of change over from the old to new
system.
Implementation is the stage of project where the theoretical design is turned into
working system. In this stage the installation of the package in the real environment, to the

CEK SALARY MANAGEMENT SYSTEM

20

Mini Project 2016 | CEK Salary Management System

satisfaction of the intended user and the operation of the system. Implementation includes all
those activities that take place to convert from the old system to new one.
The implementation phase ends with an evaluation of the system after placing it into
operation for a period of time. Implementation is the third phase of the system process .In
order to achieve the objective and the expected performance the system has been developed
in a highly interactive and user-friendly manner.

The Maintenance phase requires much more effort and it has 3 kinds of activities
1. Corrective maintenance:
Correcting errors that were not discovered during the product development phase.
2. Perfective maintenance:
Improve the functionalities of the system according to the customers
requirements.
3. Adaptive maintenance:
Porting the software to work in a new environment.

CHAPTER 8
CEK SALARY MANAGEMENT SYSTEM

21

Mini Project 2016 | CEK Salary Management System

CONCLUSION
Our project is only a humble venture to satisfy the needs in the College staff salary
calculation. After we have completed the project we are sure the problems in the existing
system would overcome. The CEK SALARY MANAGEMENT SYSTEM process made
computerized to reduce human errors and to increase the efficiency. The main focus of this
project is to reduce human efforts. The maintenance of the records is made efficient, as all the
records are stored in the database, through which data can be retrieved easily. The navigation
control is provided and all the forms to navigate through the large amount of records. If the
numbers of records are very large then user has to just type in the search string and user gets
the results immediately. The editing is also made simpler. The system has been developed
using JAVA and My SQL, thus the system was able to process and update the database with
more ease. It helped in developing a total integrated system. The user has to just type in the
required field and press the update button to update the desired field.
Thus the project CEK SALARY MANAGEMENT SYSTEM can be altered in accordance
with the future requirements of the organization.

REFERANCES
CEK SALARY MANAGEMENT SYSTEM

22

Mini Project 2016 | CEK Salary Management System

Rajib Mall, Fundamentals of Software Engineering Second Edition Prentice Hall of

Indian Private Limited NewDelhi2004


Dr.k.Somasundaram,Programming in Java2,JaicoPublishing House Mumbai2006
Ivan Bayross,SQL,PL/SQL Third Edition, BPB Publications NewDelhi2005
Ramon A.Mata-Toledo,PaulineK.Cushman,Fundamentals of Relational Database Tata

McGraw-Hill Publishing Company Limitted2001


www.youtube.com
www.stackoverflow.com

ANNEXURE A

CEK SALARY MANAGEMENT SYSTEM

23

Mini Project 2016 | CEK Salary Management System

DATABASE TABLES
Server: localhost

Database: smgmt

Table: staf
Field

username
password
sid
name
dob
gender
address
email
qualification
department
position
dateofjoin
joblevel
bank
ifsc
accno

Type

Description

varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)

Unique
not null
Primary key
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null

Type
varchar(50)
Longblob

Description
Primary key
Not null

Type
int(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)
varchar(50)

Description
Primary key
Not null
Not null
Not null
Not null
Not null

Table: image
Field
SID
image

Table: attendence
Field
slno
Date
SID
Name
FN
AN

CEK SALARY MANAGEMENT SYSTEM

24

Mini Project 2016 | CEK Salary Management System


Table: complaints
Field
SID
Date
Reason

Type
int(50)
varchar(50)
varchar(500)

Description
Primary key
Not null
Not null

Table: salary
Field
SID
Name
pf_subs
pf_loan
pf_arrier
society_loan_repayme
nt
LIC
TAX
other
month
year
Total

Type
varchar(50)
varchar(50)
int(11)
int(11)
int(11)
int(11)
int(11)
int(11)
int(11)
varchar(11)
varchar(20)
int(11)

Description

Primary key
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null

Table: deductions
Field
SID
Name
pf_subs
pf_loan
pf_arrier
society_loan_repayme
nt
LIC
TAX
other
month
year

Type
varchar(50)
varchar(50)
int(11)
int(11)
int(11)
int(11)
int(11)
int(11)
int(11)
varchar(11)
varchar(20)

CEK SALARY MANAGEMENT SYSTEM

Description

Primary key
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
25

Mini Project 2016 | CEK Salary Management System


Total

int(11)

not null

Table: salaryreports
Field
SLNO
Month
Year
SID
Name
AGP
BP
DP
BP_p_DP
DA
HRA
Gross_Amount
PF_Subscription
PF_Loan
PF_arrier
Society_Loan_Repaym
ent

Type
int(20)
varchar(20)
varchar(20)
int(20)
varchar(20)
float
float
float
float
float
float
float
float
float
float
float

CEK SALARY MANAGEMENT SYSTEM

Description

Primary key
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null
not null

26

Mini Project 2016 | CEK Salary Management System


LIC
TAX
Other
Total
Netamount_Payable

float
float
float
float
float

not null
not null
not null
not null
not null

ANNEXURE B
SOURCE CODE
1.Staff module
package minismc;
import java.awt.Image;
import java.io.File;
import java.io.FileInputStream;
import java.sql.*;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class Register_Staff extends javax.swing.JFrame {
public Register_Staff() {
initComponents();
CEK SALARY MANAGEMENT SYSTEM

27

Mini Project 2016 | CEK Salary Management System


sidgen();
jLabel1.setVisible(false);
jTable2.setEnabled(false);
jLabel20.setVisible(false);
String url="jdbc:mysql://localhost:3306/smgmt";
String user="root";
String pwd="";
try{
Connection con=DriverManager.getConnection(url,user,pwd);
String query="SELECT sid,username,name,department FROM `smgmt`.`staff`";
PreparedStatement Psmt=con.prepareStatement(query);
ResultSet rs=Psmt.executeQuery();
while (rs.next()) {
String val1=rs.getString("username");
String val0=rs.getString("sid");
String val2=rs.getString("name");
String val3=rs.getString("department");
DefaultTableModel model= (DefaultTableModel) jTable2.getModel();
model.addRow(new Object[] {val0,val1,val2,val3});
}}
catch(Exception e){
System.out.println(e);
}}
//generate Sid
void sidgen(){
int leftLimit = 65; // letter 'a'
int rightLimit = 90; // letter 'z'
int targetStringLength = 0;
StringBuilder buffer = new StringBuilder(targetStringLength);
for (int i = 0; i < targetStringLength; i++) {
int randomLimitedInt = leftLimit + (int)
(new Random().nextFloat() * (rightLimit - leftLimit));
buffer.append((char) randomLimitedInt);}
String generatedString = buffer.toString();
Random rand = new Random();
int min=10000;
int max=99999;// nextInt is normally exclusive of the top value, so add 1 to make it inclusive
int randomNum = rand.nextInt((max - min) + 1) + min;
generatedString+=String.valueOf(randomNum);
sid.setText(generatedString); }
CEK SALARY MANAGEMENT SYSTEM

28

Mini Project 2016 | CEK Salary Management System


//date validation
public boolean getDateValid( String sEmail )
{
String

expression = "(0[1-9]|[1][0-9]|[2][0-9]|[3][0-1])+/(0[1-9]|1[012])+/[0[1-9]|[12][0-9]|3[01])]{2,4}";
Pattern pattern = Pattern.compile ( expression , Pattern.CASE_INSENSITIVE );

Matcher matcher = pattern.matcher ( sEmail );


return matcher.matches ();
}
if( getDateValid( dob.getText())==false&&dob.getText().equals(""))
{
JOptionPane.showMessageDialog(null, "Please enter Valid Date of birth-DD/MM/YYYY");
}
else if(addr.getText().equals(""))
{
JOptionPane.showMessageDialog(null, "Address field is null");
}
else if(email.getText().equals(""))
{
JOptionPane.showMessageDialog(null, "Email field is null");
}
else if( getEmailisValid( email.getText())==false)
{
JOptionPane.showMessageDialog(null, "Please enter Valid Email");
}
//add staff
else
{
String gen = null;
if(jRadioButton1.isSelected())
{
gen="female";
}
else if(jRadioButton2.isSelected())
{
gen="male";
}
String jlevel = "";
if(jRadioButton3.isSelected())
{
jlevel="permenent";
}
else if(jRadioButton4.isSelected())
{
jlevel="temporary";
}
String qual="";
if (jCheckBox1.isSelected())
{
qual+="UG";
CEK SALARY MANAGEMENT SYSTEM

29

Mini Project 2016 | CEK Salary Management System


}
if (jCheckBox2.isSelected())
{
qual+=",PG";
}
if (jCheckBox3.isSelected())
{
qual+=",Diploma";
}
if (jCheckBox4.isSelected())
{
qual+=",others";
}
String url="jdbc:mysql://localhost:3306/smgmt";
String user="root";
String pwd="";
try {
Connection con=DriverManager.getConnection(url,user,pwd);
Connection conn=DriverManager.getConnection(url,user,pwd);
String
query
=
"INSERT
INTO
`SMGMT`.`staff`(username
,password,sid,name,dob,gender,address,email,qualification,department,position,dateofjoin,joblevel,bank,ifsc,acc
no)
VALUES
('"+username.getText()+"','"+String.valueOf(pass.getPassword())+"','"+sid.getText()
+"','"+name.getText()+"','"+dob.getText()+"','"+gen+"','"+addr.getText()+"','"+email.getText()
+"','"+qual+"','"+depart.getSelectedItem()+"','"+pp.getSelectedItem()+"','"+doj.getText()
+"','"+jlevel+"','"+bank.getSelectedItem()+"','"+ifsc.getText()+"','"+acno.getText()+"')";
String query1="INSERT INTO `smgmt`.`image` (`SID`, `image`) VALUES ('"+sid.getText()+"',?)";
PreparedStatement prsmt=conn.prepareStatement(query);
int i=prsmt.executeUpdate();
int m=Integer.parseInt(sid.getText());
PreparedStatement psmt=null;
psmt=con.prepareStatement(query1);
File f1=new File(File_Path1.getText());
FileInputStream fis=new FileInputStream(f1);
psmt.setBinaryStream(1, fis,(int) f1.length());
int j=psmt.executeUpdate();
con.close();
if(sid.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "SID IS NULL,You must enter this");
}
if(i>0){
Register_Staff st1=new Register_Staff();
st1.setVisible(true);
this.dispose();
JOptionPane.showMessageDialog(this, "SID : "+m+"-"+username.getText()+" is SAVED!");
System.out.println("INSERTED!");
}
else{
JOptionPane.showMessageDialog(this,+m+"is NOT SAVED!");
System.err.println("NOT INSERTED!");}}
catch (Exception e) {
JOptionPane.showMessageDialog(this,"NOT SAVED!");
JOptionPane.showMessageDialog(this,e);
System.err.println(e);}}}
//update
try{
Connection con=DriverManager.getConnection(url,user,pwd);
CEK SALARY MANAGEMENT SYSTEM

30

Mini Project 2016 | CEK Salary Management System


String
query="UPDATE
`SMGMT`.`staff`
SET
username='"+username.getText()
+"',password='"+String.valueOf(this.pass.getPassword())+"',name='"+name.getText()+"', dob='"+dob.getText()
+"',
gender='"+gen+"',
address='"+addr.getText()+"',email='"+email.getText()+"',qualification='"+qual+"',
department='"+depart.getSelectedItem().toString()+"',position='"+pp.getSelectedItem().toString()
+"',dateofjoin='"+doj.getText()+"',joblevel='"+jlevel+"',bank='"+bank.getSelectedItem()
+"',ifsc='"+ifsc.getText()+"',accno='"+acno.getText()+"' where sid="+i+"";
PreparedStatement Psmt=con.prepareStatement(query);
Psmt.executeUpdate();
JOptionPane.showMessageDialog(null,username.getText()+" is Updated!");
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
System.out.println(e);
}
}
//view details
int i=Integer.parseInt(sid.getText());
try{
Connection con=DriverManager.getConnection(url,user,pwd);
String query="SELECT * FROM `smgmt`.`staff` WHERE sid="+i+"";
PreparedStatement Psmt=con.prepareStatement(query);
ResultSet rs=Psmt.executeQuery();
while (rs.next()) {
String val1=rs.getString("username");
String val2=rs.getString("password");
username.setText(val1);
pass.setText(val2);
jPasswordField2.setText(val2);
name.setText(rs.getString("name"));
dob.setText(rs.getString("dob"));
addr.setText(rs.getString("address"));
email.setText(rs.getString("email"));
if(rs.getString("gender").equals("male"))
{jRadioButton2.setSelected(true);}
else if(rs.getString("gender").equals("female"))
{jRadioButton1.setSelected(true);}
depart.setSelectedItem(rs.getString("department"));
if(rs.getString("joblevel").equals("permenent"))
{jRadioButton3.setSelected(true);}
else
{jRadioButton4.setSelected(true);
}
depart.setSelectedItem(rs.getString("department"));
pp.setSelectedItem(rs.getString("position"));
bank.setSelectedItem(rs.getString("bank"));
doj.setText(rs.getString("dateofjoin"));
ifsc.setText(rs.getString("ifsc"));
acno.setText(rs.getString("accno"));
}
}
catch(Exception e){
System.out.println(e);
CEK SALARY MANAGEMENT SYSTEM

31

Mini Project 2016 | CEK Salary Management System


}
//delete Staff
int i=Integer.parseInt(sid.getText());
try {
Connection con=DriverManager.getConnection(url,user,pass);//
String query="DELETE FROM `smgmt`.`staff` WHERE sid="+i+"";
String query1="DELETE FROM `smgmt`.`image` WHERE `image`.`SID` = '"+i+"'" ;
PreparedStatement Psmt=con.prepareStatement(query);
PreparedStatement Psmt1=con.prepareStatement(query1);
Psmt.executeUpdate();
Psmt1.executeUpdate();
JOptionPane.showMessageDialog(null,"removed!");
con.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null,e);
System.err.println(e);
}
Register_Staff st1=new Register_Staff();
st1.setVisible(true);
this.dispose();
}

2.Salary Calculation
package minismc;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import static java.awt.Component.CENTER_ALIGNMENT;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
CEK SALARY MANAGEMENT SYSTEM

32

Mini Project 2016 | CEK Salary Management System


import javax.swing.Timer;
public class calc extends javax.swing.JFrame {
public calc() {
initComponents();
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
shdate();
shtime();
String url1="jdbc:mysql://localhost:3306/smgmt";
String user1="root";
String pwd1="";
try{
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query="SELECT sid,name FROM `staff`";
PreparedStatement Psmt=con.prepareStatement(query);
ResultSet rs=Psmt.executeQuery();
while (rs.next()) {
JSID.addItem(rs.getString("sid"));
}
Psmt.close();
} catch (SQLException ex) {
Logger.getLogger(calc.class.getName()).log(Level.SEVERE, null, ex);
}
}
void shdate()
{
Date d=new Date();
SimpleDateFormat s=new SimpleDateFormat("dd-MM-yyyy");
jLabel22.setText(s.format(d));
}
void shtime()
{
new Timer(0,new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Date d=new Date();
SimpleDateFormat s=new SimpleDateFormat("hh:mm:ss a");
jLabel21.setText(s.format(d));
}

CEK SALARY MANAGEMENT SYSTEM

33

Mini Project 2016 | CEK Salary Management System


}).start();
}
private void jGAMouseClicked(java.awt.event.MouseEvent evt) {
int agp=Integer.parseInt(lagp.getText());
int da=Integer.parseInt(e.getText());
int bpdp=Integer.parseInt(d.getText());
int hra=Integer.parseInt(f.getText());
int ga=agp+da+bpdp+hra;
jGA.setText(String.valueOf(ga));
}
//deductions
float ll1=Float.valueOf(l1.getText());
float ll2=Float.valueOf(l2.getText());
float ll3=Float.valueOf(l3.getText());
float ll4=Float.valueOf(l4.getText());
float ll5=Float.valueOf(l5.getText());
float ll6=Float.valueOf(l6.getText());
float ll7=Float.valueOf(l8.getText());
float ddct=ll1+ll2+ll3+ll4+ll5+ll6+ll7;
l7.setText(String.valueOf(ddct));
}
//pf subscription
private void l1MouseClicked(java.awt.event.MouseEvent evt) {
float a=Float.parseFloat(jGA.getText());
a=(float) (a*0.12);
l1.setText(String.valueOf(a));
}
//NET amount
private void NAMouseClicked(java.awt.event.MouseEvent evt) {
float a=Float.parseFloat(jGA.getText());
float b=Float.parseFloat(l7.getText());
float c=a-b;
NA.setText(String.valueOf(c));)
}
//agp
private void dMouseClicked(java.awt.event.MouseEvent evt) {
/**
* CALCULATE AGP AND BP DP
*/
int agp=0;

CEK SALARY MANAGEMENT SYSTEM

34

Mini Project 2016 | CEK Salary Management System


if(jAGP.getSelectedIndex()==0)
{
JOptionPane.showMessageDialog(null, "Select AGP");
}
else if(jAGP.getSelectedIndex()==1)
{
agp=9600;
}
else if(jAGP.getSelectedIndex()==2)
{
agp=12880;
}
else if(jAGP.getSelectedIndex()==3)
{
agp=16180;
}
else if(jAGP.getSelectedIndex()==4)
{
agp=9000;
}
else if(jAGP.getSelectedIndex()==5)
{
agp=6000;
}
else
{
agp=0;
}
lagp.setText(String.valueOf(agp));
int bp=Integer.parseInt(c.getText());
int dp1=Integer.parseInt(dp.getText());
int bpdp=dp1+bp;
d.setText(String.valueOf(bpdp));
}
//save
if(JSID.getSelectedIndex()==0)
{
JOptionPane.showMessageDialog(this, "Select SID");
}
else if(a.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the Name field system will automatically generate name");
}
else if(jAGP.getSelectedIndex()==0)
{
JOptionPane.showMessageDialog(this, "Pls Select AGP");
}
else if(c.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter BP(basic Pay)");
CEK SALARY MANAGEMENT SYSTEM

35

Mini Project 2016 | CEK Salary Management System


}
else if(dp.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter DP");
}
else if(d.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the BP+DP field system will automatically generate");
}
else if(e.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter DA");
}
else if(f.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter HRA");
}
else if(mnth.getSelectedIndex()==0&&yr.getSelectedIndex()==0)
{
JOptionPane.showMessageDialog(this, "pls select Month and year");
}
else if(jGA.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the Gross Amount field system will automatically generate");
}
else if(l1.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the PF Subscription field system will automatically
generate");
}
else if(l2.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter PF Loan");
}
else if(l3.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter PF Arrier");
}
else if(l4.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter Society Loan Repayment");
}
else if(l5.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter LIC");
}
else if(l6.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the income tax field system will automatically generate");
CEK SALARY MANAGEMENT SYSTEM

36

Mini Project 2016 | CEK Salary Management System


}
else if(l8.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls enter others");
}
else if(l7.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the Deduction field system will automatically generate");
}
else if(NA.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Pls click the NET Amount field system will automatically generate");
}
else{
String url="jdbc:mysql://localhost:3306/smgmt";
String user="root";
String pwd="";
try {
Connection conn=DriverManager.getConnection(url,user,pwd);
String query1 = "INSERT INTO `smgmt`.`salary` (`SID`, `name`, `AGP`, `Salary_type`, `BP`, `BP_DP`,
`HRA`, `DA`, `Gross_amount`, `month`, `year`, `Netamount_payable`) VALUES ('"+JSID.getSelectedItem()
+"','"+a.getText()+"','"+lagp.getText()+"','"+c.getText()+"','"+dp.getText()+"','"+d.getText()+"','"+e.getText()
+"','"+f.getText()+"','"+jGA.getText()+"','"+mnth.getSelectedItem()+"','"+yr.getSelectedItem()
+"','"+NA.getText()+"')";
String query2 = "INSERT INTO `smgmt`.`deductions` (`SID`, `Name`, `pf_subs`, `pf_loan`, `pf_arrier`,
`society_loan_repayment`, `LIC`, `TAX`, `other`, `month`, `year`, `Total`) VALUES ('"+JSID.getSelectedItem()
+"','"+a.getText()+"','"+l1.getText()+"','"+l2.getText()+"','"+l3.getText()+"','"+l4.getText()+"','"+l5.getText()
+"','"+l6.getText()+"','"+l8.getText()+"','"+mnth.getSelectedItem()+"','"+yr.getSelectedItem()+"','"+l7.getText()
+"')";
String query3="INSERT INTO `smgmt`.`salaryreports` (`SLNO`, `Month`, `Year`, `SID`, `Name`, `AGP`, `BP`,
`DP`, `BP_p_DP`, `DA`, `HRA`, `Gross_Amount`, `PF_Subscription`, `PF_Loan`, `PF_arrier`,
`Society_Loan_Repayment`, `LIC`, `TAX`, `Other`, `Total`, `Netamount_Payable`) VALUES (NULL,
'"+mnth.getSelectedItem()+"', '"+yr.getSelectedItem()+"', '"+JSID.getSelectedItem()+"', '"+a.getText()+"',
'"+lagp.getText()+"', '"+c.getText()+"', '"+dp.getText()+"', '"+d.getText()+"', '"+e.getText()+"', '"+f.getText()+"',
'"+jGA.getText()+"', '"+l1.getText()+"', '"+l2.getText()+"', '"+l3.getText()+"', '"+l4.getText()+"', '"+l5.getText()
+"', '"+l6.getText()+"', '"+l8.getText()+"', '"+l7.getText()+"', '"+NA.getText()+"')";
PreparedStatement prsmt1=conn.prepareStatement(query1);
PreparedStatement prsmt2=conn.prepareStatement(query2);
PreparedStatement prsmt3=conn.prepareStatement(query3);
int i=prsmt1.executeUpdate();
int j=prsmt2.executeUpdate();
int k=prsmt3.executeUpdate();
if(i>0&&j>0&&k>0){
JOptionPane.showMessageDialog(this, "SAVED!");
System.out.println("INSERTED!");
}
else{
CEK SALARY MANAGEMENT SYSTEM

37

Mini Project 2016 | CEK Salary Management System


JOptionPane.showMessageDialog(this,"is NOT SAVED!");
System.err.println("NOT INSERTED!");
}
conn.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(this,"DATABASE PROBLEMS!");JOptionPane.showMessageDialog(this,e);
System.err.println(e);
}
//Print Recipt
Document document = new Document();
try
{
PdfWriter
writer
=
PdfWriter.getInstance(document,
new
FileOutputStream("REC"+a.getText()
+"-"+jLabel22.getText()+mnth.getSelectedItem()+","+yr.getSelectedItem()+".pdf"));
document.open();
document.add(new Paragraph(Chunk.ALIGN_CENTER,"
SALARY RECIPT
"));
PdfPTable table = new PdfPTable(2); // 3 columns.
table.setWidthPercentage(100); //Width 100%
table.setSpacingBefore(10f); //Space before table
table.setSpacingAfter(10f); //Space after table
//Set Column widths
float[] columnWidths = {2f, 3f};
table.setWidths(columnWidths);
PdfPCell cell11 = new PdfPCell(new Paragraph("Month & Year"));
cell11.setPaddingLeft(10);
PdfPCell cell12 = new PdfPCell(new Paragraph(mnth.getSelectedItem()+","+yr.getSelectedItem()));
cell12.setPaddingLeft(10);
PdfPCell cell21 = new PdfPCell(new Paragraph("SID"));
cell21.setPaddingLeft(10);
PdfPCell cell22 = new PdfPCell(new Paragraph((String) JSID.getSelectedItem()));
cell22.setPaddingLeft(10);
PdfPCell cell31 = new PdfPCell(new Paragraph("NAME"));
cell31.setPaddingLeft(10);
PdfPCell cell32 = new PdfPCell(new Paragraph((String) a.getText()));
cell32.setPaddingLeft(10);
PdfPCell cell41 = new PdfPCell(new Paragraph("AGP"));
cell41.setPaddingLeft(10);
PdfPCell cell42 = new PdfPCell(new Paragraph((String) jAGP.getSelectedItem()));
cell42.setPaddingLeft(10);
PdfPCell cell51 = new PdfPCell(new Paragraph("BP"));
cell51.setPaddingLeft(10);
PdfPCell cell52 = new PdfPCell(new Paragraph((String) c.getText()));
cell52.setPaddingLeft(10);
PdfPCell cell61 = new PdfPCell(new Paragraph("DP"));
cell61.setPaddingLeft(10);
PdfPCell cell62 = new PdfPCell(new Paragraph((String) dp.getText()));
cell62.setPaddingLeft(10);
PdfPCell cell71 = new PdfPCell(new Paragraph("BP+DP"));
cell71.setPaddingLeft(10);
CEK SALARY MANAGEMENT SYSTEM

38

Mini Project 2016 | CEK Salary Management System


PdfPCell cell72 = new PdfPCell(new Paragraph((String) d.getText()));
cell72.setPaddingLeft(10);
PdfPCell cell81 = new PdfPCell(new Paragraph("DA"));
cell81.setPaddingLeft(10);
PdfPCell cell82 = new PdfPCell(new Paragraph((String) e.getText()));
cell82.setPaddingLeft(10);
PdfPCell cell91 = new PdfPCell(new Paragraph("HRA"));
cell91.setPaddingLeft(10);
PdfPCell cell92 = new PdfPCell(new Paragraph((String) f.getText()));
cell92.setPaddingLeft(10);
PdfPCell cell101 = new PdfPCell(new Paragraph("GROSS AMOUNT"));
cell101.setPaddingLeft(10);
PdfPCell cell102 = new PdfPCell(new Paragraph((String) jGA.getText()));
PdfPCell cell201 = new PdfPCell(new Paragraph("DEDUCTION"));
cell201.setPaddingLeft(10);
PdfPCell cell202 = new PdfPCell(new Paragraph((String) l7.getText()));
cell202.setPaddingLeft(10);
PdfPCell cell911 = new PdfPCell(new Paragraph("Net Amount"));
cell91.setPaddingLeft(10);
PdfPCell cell922 = new PdfPCell(new Paragraph((String) NA.getText()));
cell92.setPaddingLeft(10);
table.addCell(cell11);
table.addCell(cell12);
table.addCell(cell21);
table.addCell(cell22);
table.addCell(cell31);
table.addCell(cell32);
table.addCell(cell41);
table.addCell(cell42);
table.addCell(cell51);
table.addCell(cell52);
table.addCell(cell61);
table.addCell(cell62);
table.addCell(cell71);
table.addCell(cell72);
table.addCell(cell81);
table.addCell(cell82);
table.addCell(cell91);
table.addCell(cell92);
table.addCell(cell101);
table.addCell(cell102);
table.addCell(cell201);
table.addCell(cell202);
table.addCell(cell911);
table.addCell(cell922);
document.add(table);
document.close();
writer.close();
} catch (Exception e)
{
e.printStackTrace();
}
CEK SALARY MANAGEMENT SYSTEM

39

Mini Project 2016 | CEK Salary Management System


}
}

3. Attendance
package minismc;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.Timer;
import net.proteanit.sql.DbUtils;
public class AddAttendence extends javax.swing.JFrame {
public AddAttendence() throws SQLException {
initComponents();
comb();
shdate();
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
A();
}
public void A() throws SQLException
{
String url1="jdbc:mysql://localhost:3306/smgmt";
String user1="root";
String pwd1="";
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query="SELECT * FROM `attendence`";
PreparedStatement Psmt=con.prepareStatement(query);
ResultSet rs=Psmt.executeQuery();
do {
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}while (rs.next());
}
public void comb() throws SQLException
{
String url1="jdbc:mysql://localhost:3306/smgmt";
CEK SALARY MANAGEMENT SYSTEM

40

Mini Project 2016 | CEK Salary Management System


String user1="root";
String pwd1="";
try{
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query="SELECT sid FROM `staff`";
PreparedStatement Psmt=con.prepareStatement(query);
ResultSet rs=Psmt.executeQuery();
while (rs.next()) {
jComboBox3.addItem(rs.getString("sid"));
}
Psmt.close();
} finally {
}
}
void shdate()
{
Date d=new Date();
SimpleDateFormat s=new SimpleDateFormat("dd-MM-yyyy");
jTextField3.setText(s.format(d));
}
void shtime()
{
new Timer(0,new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Date d=new Date();
SimpleDateFormat s=new SimpleDateFormat("hh:mm:ss a");
jLabel2.setText(s.format(d));
}
}).start();
}
private void jComboBox3ItemStateChanged(java.awt.event.ItemEvent evt) {
String url1="jdbc:mysql://localhost:3306/smgmt";
String user1="root";
String pwd1="";
try{
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query="SELECT name FROM `staff` where sid='"+jComboBox3.getSelectedItem()+"'";
PreparedStatement Psmt=con.prepareStatement(query);
ResultSet rs=Psmt.executeQuery();
CEK SALARY MANAGEMENT SYSTEM

41

Mini Project 2016 | CEK Salary Management System


while (rs.next()) {
jTextField2.setText(rs.getString("name"));
}
Psmt.close();
} catch (SQLException ex) {
Logger.getLogger(calc.class.getName()).log(Level.SEVERE, null, ex);
}
}
//Add attendence
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String url1="jdbc:mysql://localhost:3306/smgmt";
String user1="root";
String pwd1="";
try{
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query1="INSERT INTO `smgmt`.`attendence` (`slno`, `Date`, `SID`, `Name`, `FN`, `AN`) VALUES
(NULL, '"+jTextField3.getText()+"', '"+jComboBox3.getSelectedItem().toString()+"', '"+jTextField2.getText()
+"', '"+jComboBox1.getSelectedItem().toString()+"', '"+jComboBox2.getSelectedItem().toString()+"')";
String query="SELECT * FROM `attendence`";
PreparedStatement Psmt=con.prepareStatement(query);
PreparedStatement prsmt=con.prepareStatement(query1);
int i=prsmt.executeUpdate();
if(i>0)
{
JOptionPane.showMessageDialog(this, "Saved");
}
else
{
JOptionPane.showMessageDialog(this, "NOT Saved");
}
ResultSet rs=Psmt.executeQuery();
do {
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}while (rs.next());
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this, "Already Registered");
Logger.getLogger(AddAttendence.class.getName()).log(Level.SEVERE, null, ex);
}
//delete Attendence
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
if(jTextField3.getText().equals("")||jComboBox3.getSelectedIndex()==0)
{
JOptionPane.showMessageDialog(this, "Pls Enter Date & SID");
}
else
CEK SALARY MANAGEMENT SYSTEM

42

Mini Project 2016 | CEK Salary Management System


{
String url="jdbc:mysql://localhost:3306/smgmt";
String user="root";
String pass="";
try {
Connection con=DriverManager.getConnection(url,user,pass);//
String
query="DELETE
FROM
`smgmt`.`attendence`
WHERE
`attendence`.`SID`='"+jComboBox3.getSelectedItem().toString()+"'
AND
`attendence`.`Date`=
'"+jTextField3.getText()+"'";
PreparedStatement Psmt=con.prepareStatement(query);
Psmt.executeUpdate();
JOptionPane.showMessageDialog(null,"removed!");
this.dispose();
new AddAttendence().setVisible(true);
con.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null,e);
System.err.println(e);
}
}
}
}

4.COMPLAINTS
package minismc;
import java.sql.*;
import javax.swing.JOptionPane;
public class complaints extends javax.swing.JFrame {
public complaints() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String url="jdbc:mysql://localhost:3306/smgmt";
String user="root";
String pass="";
try {
Connection con=DriverManager.getConnection(url,user,pass);//

CEK SALARY MANAGEMENT SYSTEM

43

Mini Project 2016 | CEK Salary Management System


String

query="INSERT

INTO

`SMGMT`.`complaints`

(`SID`,

`Date`,

`Reason`)

VALUES

('"+jTextField1.getText()+"','"+jDate.getText()+"', '"+jTextArea1.getText()+"')";
PreparedStatement prsmt;
prsmt = con.prepareStatement(query);
int i=prsmt.executeUpdate();
if(i>0){
JOptionPane.showMessageDialog(null,"Complaint is Registered!");
System.out.println("Complaint is Registered!");
}
else {
JOptionPane.showMessageDialog(null,"Complaint is NOT Registered!");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null,e);
System.err.println(e);
}
}
}

5. SALARY REPORT
package minismc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import net.proteanit.sql.DbUtils;
public class monthlySalaryreport extends javax.swing.JFrame {
public monthlySalaryreport() {
initComponents();
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
sidcomp();
}
void sidcomp()
{
String url1="jdbc:mysql://localhost:3306/smgmt";

CEK SALARY MANAGEMENT SYSTEM

44

Mini Project 2016 | CEK Salary Management System


String user1="root";
String pwd1="";
try{
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query="SELECT * FROM `staff`";
String query1="SELECT * FROM `salaryreports`";
PreparedStatement Psmt=con.prepareStatement(query);
PreparedStatement Psmt1=con.prepareStatement(query1);
ResultSet rs=Psmt.executeQuery();
ResultSet rs2=Psmt1.executeQuery();
while (rs.next()) {
jComboBox3.addItem(rs.getString("sid"));
}
do {
jTable1.setModel(DbUtils.resultSetToTableModel(rs2));
}while (rs2.next());
Psmt.close();
} catch (SQLException ex) {
Logger.getLogger(calc.class.getName()).log(Level.SEVERE, null, ex);
}
//delete
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
String url1="jdbc:mysql://localhost:3306/smgmt";
String user1="root";
String pwd1="";
try{
Connection con=DriverManager.getConnection(url1,user1,pwd1);
String query="DELETE FROM `salaryreports` WHERE `SID`='"+jComboBox3.getSelectedItem().toString()
+"'";
`SID`='"+jComboBox3.getSelectedItem().toString()+"'";
PreparedStatement Psmt=con.prepareStatement(query);
int i=Psmt.executeUpdate();
if(i>1) {
sidcomp();
}
Psmt.close();
} catch (SQLException ex) {
Logger.getLogger(calc.class.getName()).log(Level.SEVERE, null, ex);
}
}
CEK SALARY MANAGEMENT SYSTEM

45

Mini Project 2016 | CEK Salary Management System


}

ANNEXURE C
SCREEN SHOTS
1. Start page

2. Home page

CEK SALARY MANAGEMENT SYSTEM

46

Mini Project 2016 | CEK Salary Management System

3.About

CEK SALARY MANAGEMENT SYSTEM

47

Mini Project 2016 | CEK Salary Management System

4. Login

CEK SALARY MANAGEMENT SYSTEM

48

Mini Project 2016 | CEK Salary Management System

5.Manager home

6. Staff Module
CEK SALARY MANAGEMENT SYSTEM

49

Mini Project 2016 | CEK Salary Management System

7.Calculate Salary

CEK SALARY MANAGEMENT SYSTEM

50

Mini Project 2016 | CEK Salary Management System

8.Attendace

CEK SALARY MANAGEMENT SYSTEM

51

Mini Project 2016 | CEK Salary Management System

9.Salary Report
CEK SALARY MANAGEMENT SYSTEM

52

Mini Project 2016 | CEK Salary Management System

10.View complaints

CEK SALARY MANAGEMENT SYSTEM

53

Mini Project 2016 | CEK Salary Management System

11.Staff Home

12.User profile

CEK SALARY MANAGEMENT SYSTEM

54

Mini Project 2016 | CEK Salary Management System

13.User Salary

14.User Attendance

CEK SALARY MANAGEMENT SYSTEM

55

Mini Project 2016 | CEK Salary Management System

15. Complaints

CEK SALARY MANAGEMENT SYSTEM

56