Payroll Management
Payroll Management
Payroll Management
INTRODUCTION
1
Introduction
Payroll system is the heart of any Human Resource System of an organization. The
solution has to take care of the calculation of salary as per rules of the company,
income tax calculation and various deductions to be done from the salary
including statutory deductions like Income tax and provident fund deductions. It
has to generate pay-slip, cheque summary and MIS reports.
It is understood that we are tired of managing thousand of odd papers, pay slips,
payroll reports, and salary details and so on. Imagine that we have a payroll
processing system which will generate our pay slips and payroll reports within
seconds. We can help others automated your payroll system by developing a
customized payroll application that suits your specific requirements.
Purpose
Main aim of developing Employee Payroll Management is to provide an easy way
not only to automate all functionalities involved managing leaves and Payroll for
the employees of Company, but also to provide full functional reports to
management of Company with the details about usage of leave facility.
We are committed to bring the best way of management in the various forms of
EPM. We understand that EPM in not a product to be sold, it is a tool to manage
the inner operation of Company related to employee leave and Payroll.
2
Objectives And Scope Of The Project
But in future we can make the Application where the database will be
hosted in order to manage the all departments which will be located in different
places and by keeping domain of Application as Online.
3
CHAPTER 2
SYSTEM ANALYSIS
4
Requirements analysis and specification
5
not involve the use of computers at all. The purpose of the design phase is to
specify a particular software system that will meet the stated requirements.
Again there are usually many ways to build the specified system. In the coding
phase, which follows the design phase, a particular System is coded to meet the
design specification.
6
Employees can make fraud by writing wrong entries on register and take
away the money and it is simply impossible to catch the defaulter
because there is no proof.
With the shortcomings in the existing system at every area of work a new system
has to be worked upon which may overcome all the inefficiencies that the present
system has.In today’s high-tech world all the above mentioned characteristics of
the system is outdated and a need for a new, powerful, stable and result oriented
software is required which is why a new system based on Visual Basic & Oracle is
formulated. Visual Basic is used to provide front-end application for userfriendly
ambience and Oracle is used to maintain & update database for fast and reliable
retrieval of data and processing of queries.
7
Can quickly produce required reports related to Daily, Weakly, monthly,
Yearly etc
Modules
Login Page
The page where the admin users will log in their system credentials
to access the system.
Home Page
The page where the admin will be redirected by default after logging
into the payroll management system.
The page where the admin can admin/staff will manage the list of
their company’s departments.
The page where the admin/staff will manage the list of their
company’s positions per department.
The page where the admin/staff will manage the list of allowances.
The page where the admin/staff will manage the list of deductions.
8
The page where the admin will manage the list of the employees.
This also the page where the admin will manage the employees’
allowances and deductions.
The page where the admin will encode and manage the employees’
daily time records.
The page where all payroll cut-offs are listed and can be managed.
This also the page where can admin calculate the payroll of
employees.
9
H/W and S/W Specifications
HARDWARE REQUIREMENTS:
RAM : 1GB
Database : MySQL
Server : Apache
Frontend : HTML
IDE : Sublime
Technology : PHP
10
CHAPTER 3
SYSTEM DEVELOPMENT
ENVIRONMENT
11
SYSTEM DEVELOPMENT ENVIRONMENT
1. HTML
WHAT IS HTML?
1. Publish online documents with headings, text, tables, list, photos etc.
12
<HTML> :Starting an HTML tag
13
<INPUT TYPE=SUBMIT> : Creating a submit button
HTML 4.0
14
EX: <HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=”JavaScript”>
</SCRIPT>
</BODY></HTML>
JAVASCRIPTS OBJECTS
15
all links, images and anchors in it.
2. Form: Holds information about HTML forms in the current page.
4. History: Holds the records of sites the Web browser has visited
before reaching the current page.
5. Location: Holds information about the location of the current web page.
JAVASCRIPTS EVENTS
16
JAVASCRIPTS FUNCTIONS
Declaration of function
The term PHP is an acronym for PHP: Hypertext Preprocessor. PHP is a server-
side scripting language designed specifically for web development. It is open-
source which means it is free to download and use. It is very simple to learn and
use. The files have the extension “.php”.
17
Rasmus Lerdorf inspired the first version of PHP and participating in the later
versions. It is an interpreted language and it does not require a compiler.
18
4.RDBMS CONCEPTS
1. DATA ABSTRACTION
2. CLASSIFICATION OF DATABASE
a. Hierarchical Database:
b. Network Database:
19
In a Network database, data is represented by Network
structure. In this approach record occurrence can have any
number of superiors as well as any number of immediate
dependents thus allow many to many correspondence
directly than an hierarchical approach.
c. Relational Database:
Features Of SQL
20
3. SQL is a database programming language.
21
Basic SQL Commands
XAMPP
22
CHAPTER 4
SYSTEM DESIGN
23
PROJECT DESIGNING
Design Document
24
Data flows are data structures in motion, while data stores are data
structures. Data flows are paths or ‘pipe lines’, along which data structures
travel, where as the data stores are place where data structures are kept
until needed.
Data flows are data structures in motion, while data stores are data
structures at rest. Hence it is possible that the data flow and the data store
would be made up of the same data structure.
Data flow diagrams is a very handy tool for the system analyst because it
gives the analyst the overall picture of the system, it is a diagrammatic
approach.
A DFD is a pictorial representation of the path which data takes From its
initial interaction with the existing system until it completes any
interaction. The diagram will describe the logical data flows dealing the
movements of any physical items. The DFD also gives the insight into the
data that is used in the system i.e., who actually uses it is temporarily
stored.
A DFD does not show a sequence of steps. A DFD only shows what the
different process in a system is and what data flows between them.
25
External entities
26
destinations or another data store with just a data
flow arrow.
27
LEVELS OF DFD:
The input and output data shown should be consistent from one level to the
next.
28
LEVEL-1: SUBSYSTEM LEVEL DATA FLOW
A level-1 DFD describes the next level of details within the system, detailing
the data flows between subsystems, which makeup the whole.
All the projects are feasible given unlimited resources and infinite time. It is
both necessary and prudent to evaluate the feasibility of the project at the
earliest possible time. Feasibility and the risk analysis are pertained in
many ways. If project risk is great.
29
DB Design
30
31
SCREENSHOTS
32
33
34
35
36
37
38
SOURCE CODE
INDEX.PHP
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<?php
session_start();
if(!isset($_SESSION['login_id']))
header('location:login.php');
include('./header.php');
// include('./auth.php');
39
?>
</head>
<style>
body{
background: #80808045;
.modal-dialog.large {
max-width: unset;
.modal-dialog.mid-large {
max-width: unset;
div#confirm_modal {
z-index: 9991;
</style>
<body>
40
<?php include 'topbar.php' ?>
</div>
</div>
</main>
<div id="preloader"></div>
<div class="modal-content">
<div class="modal-header">
41
<h5 class="modal-title">Confirmation</h5>
</div>
<div class="modal-body">
<div id="delete_content"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"></h5>
</div>
<div class="modal-body">
42
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
<script>
window.start_load = function(){
$('body').prepend('<di id="preloader2"></di>')
window.end_load = function(){
$('#preloader2').fadeOut('fast', function() {
$(this).remove();
})
43
window.uni_modal = function($title = '' , $url='',$size=""){
start_load()
$.ajax({
url:$url,
error:err=>{
console.log()
},
success:function(resp){
if(resp){
$('#uni_modal .modal-title').html($title)
$('#uni_modal .modal-body').html(resp)
if($size != ''){
$('#uni_modal .modal-dialog').addClass($size)
}else{
$('#uni_modal .modal-
dialog').removeAttr("class").addClass("modal-dialog modal-md")
$('#uni_modal').modal({
show:true,
backdrop:'static',
44
keyboard:false,
focus:true
})
end_load()
})
$('#confirm_modal #confirm').attr('onclick',$func+"("+$params.join(',')+
")")
$('#confirm_modal .modal-body').html($msg)
$('#confirm_modal').modal({
show:true,
backdrop:'static',
keyboard:false,
focus:true
})
$('#alert_toast').removeClass('bg-success')
45
$('#alert_toast').removeClass('bg-danger')
$('#alert_toast').removeClass('bg-info')
$('#alert_toast').removeClass('bg-warning')
if($bg == 'success')
$('#alert_toast').addClass('bg-success')
if($bg == 'danger')
$('#alert_toast').addClass('bg-danger')
if($bg == 'info')
$('#alert_toast').addClass('bg-info')
if($bg == 'warning')
$('#alert_toast').addClass('bg-warning')
$('#alert_toast .toast-body').html($msg)
$('#alert_toast').toast({delay:3000}).toast('show');
$(document).ready(function(){
$('#preloader').fadeOut('fast', function() {
$(this).remove();
})
})
$('.datetimepicker').datetimepicker({
46
format:'Y/m/d H:i',
startDate: '+3d'
})
$('.select2').select2({
width: "100%"
})
</script>
</html>
EMPLOYEE.PHP
<br />
<br />
<div class="card">
<div class="card-header">
<span><b>Employee List</b></span>
<button class="btn btn-primary btn-sm btn-block col-md-3 float-
right" type="button" id="new_emp_btn"><span class="fa fa-
plus"></span> Add Employee</button>
</div>
47
<div class="card-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<th>Employee No</th>
<th>Firstname</th>
<th>Middlename</th>
<th>Lastname</th>
<th>Department</th>
<th>Position</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$d_arr[0] = "Unset";
$p_arr[0] = "Unset";
$dept = $conn-
>query("SELECT * from department order by name asc");
while($row=$dept->fetch_assoc()):
$d_arr[$row['id']] = $row['name'];
endwhile;
$pos = $conn-
>query("SELECT * from position order by name asc");
while($row=$pos->fetch_assoc()):
$p_arr[$row['id']] = $row['name'];
48
endwhile;
$employee_qry=$conn-
>query("SELECT * FROM employee") or die(mysqli_error());
while($row=$employee_qry->fetch_array()){
?>
<tr>
<td><?php echo $row['employee_no']?></td>
<td><?php echo $row['firstname']?></td>
<td><?php echo $row['middlename']?></td>
<td><?php echo $row['lastname']?></td>
<td><?php echo $d_arr[$row['department_id']]?></td>
<td><?php echo $p_arr[$row['position_id']]?></td>
<td>
<center>
<button class="btn btn-sm btn-outline-
primary view_employee" data-
id="<?php echo $row['id']?>" type="button"><i class="fa fa-
eye"></i></button>
<button class="btn btn-sm btn-outline-
primary edit_employee" data-
id="<?php echo $row['id']?>" type="button"><i class="fa fa-
edit"></i></button>
<button class="btn btn-sm btn-outline-
danger remove_employee" data-
id="<?php echo $row['id']?>" type="button"><i class="fa fa-
trash"></i></button>
</center>
</td>
</tr>
49
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#table').DataTable();
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('.edit_employee').click(function(){
var $id=$(this).attr('data-id');
uni_modal("Edit Employee","manage_employee.php?id="+$id)
50
});
$('.view_employee').click(function(){
var $id=$(this).attr('data-id');
uni_modal("Employee Details","view_employee.php?id="+$id,"mid-
large")
});
$('#new_emp_btn').click(function(){
uni_modal("New Employee","manage_employee.php")
})
$('.remove_employee').click(function(){
_conf("Are you sure to delete this employee?","remove_employee",[$
(this).attr('data-id')])
})
});
function remove_employee(id){
start_load()
$.ajax({
url:'ajax.php?action=delete_employee',
method:"POST",
data:{id:id},
error:err=>console.log(err),
success:function(resp){
if(resp == 1){
alert_toast("Employee's data successfully deleted","success");
51
setTimeout(function(){
location.reload();
},1000)
}
}
})
}
</script>
ALLOWANCES.PHP
<?php include('db_connect.php');?>
<div class="container-fluid">
<div class="col-lg-12">
<div class="row">
<!-- FORM Panel -->
<div class="col-md-4">
<form action="" id="manage-allowances">
<div class="card">
<div class="card-header">
Allowances Form
</div>
<div class="card-body">
<input type="hidden" name="id">
52
<div class="form-group">
<label class="control-label">Allowance</label>
<textarea name="allowance" id="" cols="30" rows="2" class=
"form-control" required></textarea>
</div>
<div class="form-group">
<label class="control-label">Description</label>
<textarea name="description" id="" cols="30" rows="2" class
="form-control" required></textarea>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-primary col-sm-3 offset-md-
3"> Save</button>
<button class="btn btn-sm btn-default col-sm-
3" type="button" onclick="_reset()"> Cancel</button>
</div>
</div>
</div>
</div>
</form>
53
</div>
<!-- FORM Panel -->
<td class="">
54
<p>Name: <b><?php echo $row['allowance'] ?></b></p
>
<p class="truncate"><small>Description: <b><?php echo
$row['description'] ?></b></small></p>
</td>
<td class="text-center">
<button class="btn btn-sm btn-
primary edit_allowances" type="button" data-
id="<?php echo $row['id'] ?>" data-
allowance="<?php echo $row['allowance'] ?>" data-
description="<?php echo $row['description'] ?>" >Edit</button>
<button class="btn btn-sm btn-
danger delete_allowances" type="button" data-
id="<?php echo $row['id'] ?>">Delete</button>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Table Panel -->
</div>
</div>
</div>
<style>
55
td{
vertical-align: middle !important;
}
td p{
margin: unset
}
img{
max-width:100px;
max-height: :150px;
}
</style>
<script>
function _reset(){
$('[name="id"]').val('');
$('#manage-allowances').get(0).reset();
}
$('#manage-allowances').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'ajax.php?action=save_allowances',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
56
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp==1){
alert_toast("Data successfully added",'success')
setTimeout(function(){
location.reload()
},1500)
}
else if(resp==2){
alert_toast("Data successfully updated",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
})
$('.edit_allowances').click(function(){
start_load()
var cat = $('#manage-allowances')
cat.get(0).reset()
cat.find("[name='id']").val($(this).attr('data-id'))
57
cat.find("[name='allowance']").val($(this).attr('data-allowance'))
cat.find("[name='description']").val($(this).attr('data-description'))
end_load()
})
$('.delete_allowances').click(function(){
_conf("Are you sure to delete this allowances?","delete_allowances",[$(thi
s).attr('data-id')])
})
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cimg').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
function delete_allowances($id){
start_load()
$.ajax({
url:'ajax.php?action=delete_allowances',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
58
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
}
</script>
ATTENDANCE.PHP
<?php include('db_connect.php') ?>
<div class="container-fluid " >
<div class="col-lg-12">
<br />
<br />
<div class="card">
<div class="card-header">
<span><b>Attendance List</b></span>
<button class="btn btn-primary btn-sm btn-block col-md-3 float-
right" type="button" id="new_attendance_btn"><span class="fa fa-
plus"></span> Add Attendance</button>
</div>
<div class="card-body">
59
<table id="table" class="table table-bordered table-striped">
<colgroup>
<col width="10%">
<col width="20%">
<col width="30%">
<col width="30%">
<col width="10%">
</colgroup>
<thead>
<tr>
<th>Date</th>
<th>Employee No</th>
<th>Name</th>
<th>Time Record</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$att=$conn-
>query("SELECT a.*,e.employee_no, concat(e.lastname,', ',e.firstname,' ',e.mid
dlename) as ename FROM attendance a inner join employee e on a.employee_
id = e.id order by UNIX_TIMESTAMP(datetime_log) asc ") or die(mysqli_error()
);
$lt_arr = array(1 => " Time-in AM",2=>"Time-
out AM",3 => " Time-in PM",4=>"Time-out PM");
while($row=$att->fetch_array()){
60
$date = date("Y-m-d",strtotime($row['datetime_log']));
$attendance[$row['employee_id']."_".$date]['details'] =
array("eid"=>$row['employee_id'],"name"=>$row['ename'],"eno"=>$row['em
ployee_no'],"date"=>$date);
if($row['log_type'] == 1 || $row['log_type'] == 3){
if(!isset($attendance[$row['employee_id']."_".$date]['
log'][$row['log_type']]))
$attendance[$row['employee_id']."_".$date]['log'][$r
ow['log_type']] = array('id'=>$row['id'],"date" => $row['datetime_log']);
}else{
$attendance[$row['employee_id']."_".$date]['log'][$r
ow['log_type']] =array('id'=>$row['id'],"date" => $row['datetime_log']);
}
}
foreach ($attendance as $key => $value) {
?>
<tr>
<td><?php echo date("M d,Y",strtotime($attendance[$key
]['details']['date'])) ?></td>
<td><?php echo $attendance[$key]['details']['eno'] ?></td
>
<td><?php echo $attendance[$key]['details']['name'] ?></t
d>
<td>
<div class="row">
<?php
$att_ids = array();
61
foreach($attendance[$key]['log'] as $k => $v) :
?>
<div class="col-sm-6" style="">
<p>
<small><b><?php echo $lt_arr[$k].": <br/>" ?>
</td>
<td>
<center>
<button class="btn btn-sm btn-outline-
danger remove_attendance" data-
id="<?php echo $key ?>" type="button"><i class="fa fa-trash"></i></button>
</center>
</td>
</tr>
62
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<style>
td p{
margin: unset;
}
.rem_att{
cursor: pointer;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('#table').DataTable();
});
</script>
<script type="text/javascript">
63
$(document).ready(function(){
$('.edit_attendance').click(function(){
var $id=$(this).attr('data-id');
uni_modal("Edit Employee","manage_attendance.php?id="+$id)
});
$('.view_attendance').click(function(){
var $id=$(this).attr('data-id');
uni_modal("Employee Details","view_attendance.php?id="+$id,"mid-
large")
});
$('#new_attendance_btn').click(function(){
uni_modal("New Time Record/s","manage_attendance.php",'mid-
large')
})
$('.remove_attendance').click(function(){
var d = '"'+($(this).attr('data-id')).toString()+'"';
_conf("Are you sure to delete this employee's time log record?","rem
ove_attendance",[d])
})
$('.rem_att').click(function(){
var $id=$(this).attr('data-id');
64
_conf("Are you sure to delete this time log?","rem_att",[$id])
})
});
function remove_attendance(id){
// console.log(id)
// return false;
start_load()
$.ajax({
url:'ajax.php?action=delete_employee_attendance',
method:"POST",
data:{id:id},
error:err=>console.log(err),
success:function(resp){
if(resp == 1){
alert_toast("Selected employee's time log data successfully del
eted","success");
setTimeout(function(){
location.reload();
},1000)
}
}
})
}
function rem_att(id){
65
start_load()
$.ajax({
url:'ajax.php?action=delete_employee_attendance_single',
method:"POST",
data:{id:id},
error:err=>console.log(err),
success:function(resp){
if(resp == 1){
alert_toast("Selected employee's time log data successfully del
eted","success");
setTimeout(function(){
location.reload();
},1000)
}
}
})
}
</script>
DEDUCTION.PHP
<?php include('db_connect.php');?>
<div class="container-fluid">
<div class="col-lg-12">
66
<div class="row">
<!-- FORM Panel -->
<div class="col-md-4">
<form action="" id="manage-deductions">
<div class="card">
<div class="card-header">
Deductions Form
</div>
<div class="card-body">
<input type="hidden" name="id">
<div class="form-group">
<label class="control-label">Deduction Name</label>
<textarea name="deduction" id="" cols="30" rows="2" class=
"form-control" required></textarea>
</div>
<div class="form-group">
<label class="control-label">Description</label>
<textarea name="description" id="" cols="30" rows="2" class
="form-control" required></textarea>
</div>
</div>
<div class="card-footer">
67
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-primary col-sm-3 offset-md-
3"> Save</button>
<button class="btn btn-sm btn-default col-sm-
3" type="button" onclick="_reset()"> Cancel</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- FORM Panel -->
68
<tbody>
<?php
$i = 1;
$deductions = $conn-
>query("SELECT * FROM deductions order by id asc");
while($row=$deductions->fetch_assoc()):
?>
<tr>
<td class="text-center"><?php echo $i++ ?></td>
<td class="">
<p>Name: <b><?php echo $row['deduction'] ?></b></p
>
<p class="truncate"><small>Description: <b><?php echo
$row['description'] ?></b></small></p>
</td>
<td class="text-center">
<button class="btn btn-sm btn-
primary edit_deductions" type="button" data-
id="<?php echo $row['id'] ?>" data-
deduction="<?php echo $row['deduction'] ?>" data-
description="<?php echo $row['description'] ?>" >Edit</button>
<button class="btn btn-sm btn-
danger delete_deductions" type="button" data-
id="<?php echo $row['id'] ?>">Delete</button>
</td>
</tr>
<?php endwhile; ?>
69
</tbody>
</table>
</div>
</div>
</div>
<!-- Table Panel -->
</div>
</div>
</div>
<style>
td{
vertical-align: middle !important;
}
td p{
margin: unset
}
img{
max-width:100px;
max-height: :150px;
}
</style>
<script>
function _reset(){
$('[name="id"]').val('');
70
$('#manage-deductions').get(0).reset();
}
$('#manage-deductions').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'ajax.php?action=save_deductions',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp==1){
alert_toast("Data successfully added",'success')
setTimeout(function(){
location.reload()
},1500)
}
else if(resp==2){
alert_toast("Data successfully updated",'success')
setTimeout(function(){
location.reload()
71
},1500)
}
}
})
})
$('.edit_deductions').click(function(){
start_load()
var cat = $('#manage-deductions')
cat.get(0).reset()
cat.find("[name='id']").val($(this).attr('data-id'))
cat.find("[name='deduction']").val($(this).attr('data-deduction'))
cat.find("[name='description']").val($(this).attr('data-description'))
end_load()
})
$('.delete_deductions').click(function(){
_conf("Are you sure to delete this deduction ?","delete_deductions",[$(thi
s).attr('data-id')])
})
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cimg').attr('src', e.target.result);
}
72
reader.readAsDataURL(input.files[0]);
}
}
function delete_deductions($id){
start_load()
$.ajax({
url:'ajax.php?action=delete_deductions',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
}
</script>
DEPARTMENT.PHP
<?php include('db_connect.php');?>
73
<div class="container-fluid">
<div class="col-lg-12">
<div class="row">
<!-- FORM Panel -->
<div class="col-md-4">
<form action="" id="manage-department">
<div class="card">
<div class="card-header">
Department Form
</div>
<div class="card-body">
<input type="hidden" name="id">
<div class="form-group">
<label class="control-label">Name</label>
<textarea name="name" id="" cols="30" rows="2" class="for
m-control"></textarea>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-md-12">
74
<button class="btn btn-sm btn-primary col-sm-3 offset-md-
3"> Save</button>
<button class="btn btn-sm btn-default col-sm-
3" type="button" onclick="_reset()"> Cancel</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- FORM Panel -->
75
$i = 1;
$department = $conn-
>query("SELECT * FROM department order by id asc");
while($row=$department->fetch_assoc()):
?>
<tr>
<td class="text-center"><?php echo $i++ ?></td>
<td class="">
<p> <b><?php echo $row['name'] ?></b></p>
</td>
<td class="text-center">
<button class="btn btn-sm btn-
primary edit_department" type="button" data-
id="<?php echo $row['id'] ?>" data-
name="<?php echo $row['name'] ?>" >Edit</button>
<button class="btn btn-sm btn-
danger delete_department" type="button" data-
id="<?php echo $row['id'] ?>">Delete</button>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
76
<!-- Table Panel -->
</div>
</div>
</div>
<style>
td{
vertical-align: middle !important;
}
td p{
margin: unset
}
img{
max-width:100px;
max-height: :150px;
}
</style>
<script>
function _reset(){
$('[name="id"]').val('');
$('#manage-department').get(0).reset();
}
$('#manage-department').submit(function(e){
e.preventDefault()
77
start_load()
$.ajax({
url:'ajax.php?action=save_department',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp==1){
alert_toast("Data successfully added",'success')
setTimeout(function(){
location.reload()
},1500)
}
else if(resp==2){
alert_toast("Data successfully updated",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
78
})
$('.edit_department').click(function(){
start_load()
var cat = $('#manage-department')
cat.get(0).reset()
cat.find("[name='id']").val($(this).attr('data-id'))
cat.find("[name='name']").val($(this).attr('data-name'))
end_load()
})
$('.delete_department').click(function(){
_conf("Are you sure to delete this department?","delete_department",[$(t
his).attr('data-id')])
})
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cimg').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
function delete_department($id){
start_load()
$.ajax({
79
url:'ajax.php?action=delete_department',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
}
</script>
PAYROLL.PHP
<br />
<br />
<div class="card">
<div class="card-header">
<span><b>Payroll List</b></span>
80
<button class="btn btn-primary btn-sm btn-block col-md-3 float-
right" type="button" id="new_payroll_btn"><span class="fa fa-
plus"></span> Add Payroll</button>
</div>
<div class="card-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<th>Ref No</th>
<th>Date From</th>
<th>Date To</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$payroll=$conn-
>query("SELECT * FROM payroll order by date(date_from) desc") or die(mysqli
_error());
while($row=$payroll->fetch_array()){
?>
<tr>
<td><?php echo $row['ref_no']?></td>
<td><?php echo date("M d, Y",strtotime($row['date_from'
])) ?></td>
81
<td><?php echo date("M d, Y",strtotime($row['date_to']))
?></td>
<?php if($row['status'] == 0): ?>
<td class="text-center"><span class="badge badge-
primary">New</span></td>
<?php else: ?>
<td class="text-center"><span class="badge badge-
success">Calculated</span></td>
<?php endif ?>
<td>
<center>
<?php if($row['status'] == 0): ?>
<button class="btn btn-sm btn-outline-
primary calculate_payroll" data-
id="<?php echo $row['id']?>" type="button">Calculate</button>
<?php else: ?>
<button class="btn btn-sm btn-outline-
primary view_payroll" data-
id="<?php echo $row['id']?>" type="button"><i class="fa fa-
eye"></i></button>
<?php endif ?>
82
</center>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#table').DataTable();
});
</script>
<script type="text/javascript">
$(document).ready(function(){
83
$('.edit_payroll').click(function(){
var $id=$(this).attr('data-id');
uni_modal("Edit Employee","manage_payroll.php?id="+$id)
});
$('.view_payroll').click(function(){
var $id=$(this).attr('data-id');
location.href = "index.php?page=payroll_items&id="+$id;
});
$('#new_payroll_btn').click(function(){
uni_modal("New Payroll","manage_payroll.php")
})
$('.remove_payroll').click(function(){
_conf("Are you sure to delete this payroll?","remove_payroll",[$(this).
attr('data-id')])
})
$('.calculate_payroll').click(function(){
start_load()
$.ajax({
url:'ajax.php?action=calculate_payroll',
method:"POST",
data:{id:$(this).attr('data-id')},
error:err=>console.log(err),
success:function(resp){
if(resp == 1){
84
alert_toast("Payroll successfully computed","success");
setTimeout(function(){
location.reload();
},1000)
}
}
})
})
});
function remove_payroll(id){
start_load()
$.ajax({
url:'ajax.php?action=delete_payroll',
method:"POST",
data:{id:id},
error:err=>console.log(err),
success:function(resp){
if(resp == 1){
alert_toast("Employee's data successfully deleted","success");
setTimeout(function(){
location.reload();
},1000)
}
}
85
})
}
</script>
POSITION.PHP
<?php include('db_connect.php');?>
<div class="container-fluid">
<div class="col-lg-12">
<div class="row">
<!-- FORM Panel -->
<div class="col-md-4">
<form action="" id="manage-position">
<div class="card">
<div class="card-header">
Position Form
</div>
<div class="card-body">
<input type="hidden" name="id">
<div class="form-group">
<label class="control-label">Department</label>
<select class="custom-select browser-
default select2" name="department_id">
<option value=""></option>
<?php
86
$dept = $conn-
>query("SELECT * from department order by name asc");
while($row=$dept->fetch_assoc()):
?>
<option value="<?php echo $row['id'] ?>"><?php echo $ro
w['name'] ?></option>
<?php endwhile; ?>
</select>
</div>
<div class="form-group">
<label class="control-label">Name</label>
<textarea name="name" id="" cols="30" rows="2" class="for
m-control"></textarea>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-primary col-sm-3 offset-md-
3"> Save</button>
<button class="btn btn-sm btn-default col-sm-
3" type="button" onclick="_reset()"> Cancel</button>
</div>
</div>
</div>
87
</div>
</form>
</div>
<!-- FORM Panel -->
88
<td class="">
<p> <b><?php echo $row['name'] ?></b></p>
</td>
<td class="text-center">
<button class="btn btn-sm btn-
primary edit_position" type="button" data-id="<?php echo $row['id'] ?>" data-
name="<?php echo $row['name'] ?>" data-
department_id="<?php echo $row['department_id'] ?>" >Edit</button>
<button class="btn btn-sm btn-
danger delete_position" type="button" data-
id="<?php echo $row['id'] ?>">Delete</button>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Table Panel -->
</div>
</div>
</div>
<style>
89
td{
vertical-align: middle !important;
}
td p{
margin: unset
}
img{
max-width:100px;
max-height: :150px;
}
</style>
<script>
function _reset(){
$('[name="id"]').val('');
$('#manage-position').get(0).reset();
$('.select2').val('').select2({
placeholder:"Please Select Here",
width:"100%"
})
}
$('.select2').select2({
placeholder:"Please Select Here",
width:"100%"
})
$('#manage-position').submit(function(e){
e.preventDefault()
90
start_load()
$.ajax({
url:'ajax.php?action=save_position',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp==1){
alert_toast("Data successfully added",'success')
setTimeout(function(){
location.reload()
},1500)
}
else if(resp==2){
alert_toast("Data successfully updated",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
91
})
$('.edit_position').click(function(){
start_load()
var cat = $('#manage-position')
cat.get(0).reset()
cat.find("[name='id']").val($(this).attr('data-id'))
cat.find("[name='name']").val($(this).attr('data-name'))
$('[name="department_id"]').val($(this).attr('data-
department_id')).select2({
width:"100%"
})
end_load()
})
$('.delete_position').click(function(){
_conf("Are you sure to delete this position?","delete_position",[$(this).att
r('data-id')])
})
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cimg').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
92
}
function delete_position($id){
start_load()
$.ajax({
url:'ajax.php?action=delete_position',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
}
</script>
93
CHAPTER 5
testing
94
Testing
Psychology of Testing
Testing Objectives:
A good test case is one that has a high probability of finding error, if it
exists.
95
The software more or less confirms to the quality and reliable
standards.
LEVELS OF TESTING
A series of testing is done for the proposed system before the system is
ready for the user acceptance testing.
96
Unit testing focuses verification efforts on the smallest unit of the software
design, the module. This is also known as “Module Testing”. The modules
are tested separately. This testing carried out during programming stage
itself. In this testing each module is found to be working satisfactorily as
regards to the expected output from the module.
97
The four major system testing are
i. Recovery Testing
ii.Security Testing
iii.Stress Testing
iv.Performance Testing
Recovery Testing
Recovery testing is a system test that forces the software to fail in a variety
of ways and verifies that recovery is properly performed. If recovery is
automatic, re-initialization, checkpoint mechanisms, data recovery, and
restart are each evaluated for correctness. If recovery requires human
intervention, the mean time to repair is evaluated to determine whether it
is within acceptable limits.
Security Testing
98
Stress Testing
During earlier software testing steps, white box and black box techniques
resulted in a thorough evaluation of normal program functions and
performance. Stress tests are designed to confront programs with
abnormal situations.
99
Performance Testing
Performance tests are sometimes coupled with stress testing and often
require both hardware and software instrumentation. That is, it is often
necessary to measure resource utilization. By instrumenting a system, the
tester can uncover situations that lead to degradation and possible system
failure.
100
been tested by using validation testing and found to be working
satisfactorily.
specified format. Asking the users about the format required by them tests
the outputs generated by the system under consideration. Here the output
format is considered in two ways, one is on the screen and other is the
printed format. The output format on the screen is found to be correct as
the format was designed in the system designed phase according to the
user needs. For the hard copy also the output comes as the specified
requirements by the users. Hence output testing does not result any
corrections in the system.
User acceptance of a system is the key factor of the success of any system.
The system under study is tested for the user acceptance by constantly
keeping in touch with the prospective system users at the time of
developing and making changes wherever required.
Test Data:
101
Taking various kinds of test data does the above testing. Preparation of test
data plays a vital role in the system testing after preparing the test data the
system under study is tested using the test data. While testing the system
by using the test data errors are again uncovered and corrected by using
above testing steps and corrections are also noted from the future use.
Testing:
Mobile App
Build email facilities.
Employee Dashboard
Biometric Integration
Payment Gateway
102
BIBILIOGRAPHY
www.w3schools.com
php.net
en.wikipedia.org/wiki/PHP
www.hotscripts.com/category/php/
www.apache.org
www.mysql.com/click.php?e=35050
103