Project Report
NIIT Hanoi CTT Page 1
International IT Institutes
PROJECTREPORT
Project Title: Payroll System
Student Name: Pham Hong HaGroup 3: Pham Hong Ha
Tran Thanh Tung Nguyen Van Vinh
Group Project Number: 3Project Number: Case Study 3Quarter: 5Coordinator: M.Sc Nguyen Truong Giang
May, 2008
Project Report
Table of Contents
Part 1 – Introduction Payroll System
I – What is a Deezy Corp.?
II – What is activities list for Payroll System ?
III – Architecture Diagram for Shell Script
Part 2 – Code for the Shell Script in the Payroll System
Part 3 – Project File Details
NIIT Hanoi CTT Page 2
Project Report
Payroll System
Batch Code: Start date: May 1, 2008End date: May 22, 2008Name of the Coordinator: M.Sc Nguyen Truong GiangName of Developer: Pham Hong HaDate of Submission: May 23,2008
NIIT Hanoi CTT Page 3
Project Report
NIIT
Certificate
This is to certify that this report titled Payroll System embodies the original work done by Pham Hong Ha in partial fulfillment of their course requirement at NIIT.
Coordinator:M.Sc Nguyen Truong Giang
NIIT Hanoi CTT Page 4
Project Report
Acknowledgement
NIIT Hanoi CTT Page 5
Project Report
Introduction
Deezy Corp. is a company associated with auction business for the last ten years. The company is known for providing transparent and secure auctions. Deezy Corp. has its offices in different cities of the US of America. The number of branch offices and employees is constantly increasing with the growing volume of its customer base. In the existing system, Deezy Corp. has different departments, Stores, Accounts, and Maintenance.
NIIT Hanoi CTT Page 6
Project Report
Activities List
The following tasks have been performed to meet the specifications of the project scenario:
1) Create a script file as mainmenu.sh. This file contains the code to display the main menu
2) Create a script file as file_manager.sh. This file contains the code to change information and delete an employee from employee_master file.
3) Create a script file as file_search.sh. This file contains the code to search employees have joined the company in the current year, their date of retirement in the current year and department-wise total number of employees needs to be identified.
4) Create a script file as print_payslips.sh. This file contains the code to generate pay-slips for each employee in the format.
5) Create a script file as print_da.sh. This file contains the code to generate deduction and allowance details report for all grades.
NIIT Hanoi CTT Page 7
Project Report
Architecture DiagramMAINMENU.SH
file_search.sh
mainmenu.sh
print_pay-slips.sh
NIIT Hanoi CTT Page 8
file_manager.sh
print_da.sh
Project Report
Architecture Diagramfile_manager.sh
add_new_employee
file_manager.sh
update_information_employee
delete_an_employee
NIIT Hanoi CTT Page 9
Project Report
Architecture Diagramfile_search.sh
NIIT Hanoi CTT Page 10
file_search.sh
search_join_current_year
search_retirement_current_year
search_same_department
Project Report
Architecture Diagramprint_payslips.sh
employee_ID
print_payslips.sh
department
basic_salary
E_name
grade
gross_salary
ManagerAcounts Department
NIIT Hanoi CTT Page 11
Project Report
Architecture Diagramprint_da.sh
NIIT Hanoi CTT Page 12
print_da.sh
print_deduction
print_allowance
print_grade
Project Report
Code for the mainmenu.sh file
#!/bin/bashget_return(){echo -e "Press return \c"read xreturn 0}get_confirm(){echo -e "Are you sure? \c"while truedoread xcase "$x" iny | yes | Y | Yes | YES )return 0;;n | no | N | No | NO )echoecho "Cancelled"return 1;;*) echo "Please enter yes or no" ;;esacdone}mainmenu(){OPT=0while [ "$OPT" != "5" ]doclearechoechoechoecho -e "\033[30;1m MAIN MENU \033[0m"echoecho " 1. Manager Employee Informations"echo " 2. Search Employee Informations"echo " 3. Generate pay-slips for Employees"echo " 4. Generate Deduction and Allowance Informations"echo " 5. Quit"echo echo -n " Please enter choice then press return: "read OPTcase $OPT in"1") . file_manager.sh ;;"2") . file_search.sh ;;"3") . Print_payslip.sh ;;"4") . print_da.sh ;;
NIIT Hanoi CTT Page 13
Project Report
"5") exit;;*) echo -e "\n\t\t\t\tInvailid Input" echo -e "\n\t\t\t\tPress <Enter> key to continue...\c" read;; esacdoneecho "Option chosed: [$OPT]"return $OPT}mainmenu
Code for the file_manager.sh file
NIIT Hanoi CTT Page 14
Project Report
file_manager(){clearOPT=0while [ "$OPT" != "4" ]doclearechoechoechoecho -e "\033[30;1m Manager Employee Informations\033[0m"echoecho " 1. Add New Employees "echo " 2. Update Employee Informations"echo " 3. Delete Record's Employee Informations "echo " 4. Back"echo echo -n " Please enter choice: "read OPTcase $OPT in"1") add_em;;"2") update_em;;"3") delete_em;;"4") return;;*) echo -e "\n\t\t\t\tInvailid Input" echo -e "\n\t\t\t\tPress <Enter> key to continue...\c" read;; esacdonereturn $OPTexit 0}
add_em(){# Kiem tra File Employee_Master ton tai chuasort_id=`sort Employee_Master`echo "$sort_id" > E_id.txtset_id=`tail -1 E_id.txt`echo "$set_id" > E_id.txtfirstline=`cut -d : -f1 E_id.txt`
if [ -z "$firstline" ]then e_id="E001"else
numid=`expr substr $firstline 3 3` numid=`expr $numid + 1` if [ $numid -gt 1 -a $numid -le 9 ] then e_id="E00${numid}" elif [ $numid -ge 10 -a $numid -le 99 ] then
NIIT Hanoi CTT Page 15
Project Report
e_id="E0${numid}" elif [ $numid -ge 100 -a $numid -le 999 ] then e_id="E${numid}" else echo "Data Invailid Input" exit fi
fi
echo -e "Enter Employee Informations"echo -e "Enter First Name: \c"read F_nameecho -e "Enter Last Name: \c"echo -e "Enter Department: \c"read departread L_nameecho -e "Enter Date of Birth(D/M/Y): \c"read DoBecho -e "Enter Date of Joinning(D/M/Y): \c"read DoJecho -e "Enter Grade: \c"read gradeecho -e "Enter Basic Salary: \c"read basic_salarycase "$grade" in
SSK | ssk ) Gr_Sa1=$(($basic_salary*110));;HSK | hsk ) Gr_Sa1=$(($basic_salary*108));;SK | sk ) Gr_Sa1=$(($basic_salary*107));;SMSK | smsk ) Gr_Sa1=$(($basic_salary*105));;UNSK | unsk ) Gr_Sa1=$(($basic_salary*103));;esac
Gr_Sa=`expr $Gr_Sa1 / 100`if get_confirm ; thenecho "$e_id:$F_name:$L_name:$depart:$DoB:$DoJ:$grade:$basic_salary:$Gr_Sa" >> Employee_Masterelseremove_emfiecho -e -n "\t\tDo you want input more Employees (y/n)? : \033[0m"read ansif [ $ans == 'Y' -o $ans == 'y' ]thenadd_emelsereturn 0fi
}
# Find a Employee to update or Delete Information
NIIT Hanoi CTT Page 16
Project Report
find_em(){e_id=""echo -e "Enter a ID of Employee to search for in the Employee Informations"read SearchStrif [ "$SearchStr" = "" ]; thenreturn 0fi
grep "^$SearchStr" Employee_Master > temp_file.txtIFS=":"read E_id F_Name L_Name DoB DoJ grade Ba_Sa Gr_Sa < temp_file.txtIFS=":"if [ -z "$E_id" ]; thenecho -e "Sorry! Employee has ID is $SearchStr nothing found"return 0fiechoecho "ID of Employee: $E_id"echo "First Name: $F_Name"echo "Last Name: $L_Name"echo "Date of Birth: $DoB"echo "Date of Joining: $DoJ"echo "Grade: $grade"echo "Basic Salary: $Ba_Sa"echo "Gross Salary: $Gr_Sa"echoreturn 1}update_em() { if [ -z "$E_id" ]; then echo "You must select a Employee first" find_em n fi if [ -n "$E_id" ]; then
get_confirm && {grep -v "^$E_id" Employee_Master > temp_file.txtmv temp_file.txt Employee_Masterechoadd_em}
figet_returnreturn }delete_em(){if [ -z "$E_id" ]; then echo "You must select a Employee first" find_em nfi
if [ -n "$E_id" ]; thenecho -e "You are about to delete $E_id"
NIIT Hanoi CTT Page 17
Project Report
get_confirm && {grep -v "^$E_id" Employee_Master > temp_file.txtmv temp_file.txt Employee_Masterecho -e "Employee Informations deleted"E_id=""}
figet_returnreturn}file_manager
Code for the file_search.sh file
NIIT Hanoi CTT Page 18
Project Report
file_search(){clearOPT=0while [ "$OPT" != "4" ]doclearechoechoechoecho -e "\033[30;1m Search Employee Informations\033[0m"echoecho " 1. Search Employees joined the company in the current year "echo " 2. Search Employees have their date of retirement in the current year"echo " 3. Search Employees in same Depatment"echo " 4. Back"echo echo -n " Please enter choice then you need search: "read OPTcase $OPT in"1") search_join;;"2") retirement_em;;"3") department_em;;"4") return;;*) echo -e "\n\t\t\t\tInvailid Input" echo -e "\n\t\t\t\tPress <Enter> key to continue...\c" read;; esacdoneecho "Option chosed: [$OPT]"return $OPT}search_join(){clearyear_cur=$(date "+%Y")grep "$year_cur" Employee_Master > temp_file.txtread bien < temp_file.txtif [ -z "$bien" ]; thenecho -e "Khong co nhan vien vao cong ty trong nam nay"elsenum_join=$(wc -l temp_file.txt)echo -e "So nhan vien gia nhap cong ty trong nam nay: $num_join"echo -e ""echo -e "Danh sach nhan vien:"cat temp_file.txtfiecho -e ""
NIIT Hanoi CTT Page 19
Project Report
get_return}department_em(){clearechoecho -e " Enter Department"read departgrep "$depart" Employee_Master > temp_file.txtread bien1 < temp_file.txtif [ -z "$bien1" ]; thenecho -e "Phong ban go khong co trong cong ty"get_returnelsenum_join=$(wc -l temp_file.txt)echo -e "Tong so nhan vien trong phong $depart la: $num_join"echo ""echo -e " Danh sach nhan vien trong phong $depart gom:"cat temp_file.txtbien1=""get_returnfi}
file_search
NIIT Hanoi CTT Page 20
Project Report
Code for the print_paysips.sh file
Print_payslip(){echo -e "Enter a ID of Employee to generate Pay-slip"read Strif [ "$Str" = "" ]; thenreturn 0figrep "^$Str" Employee_Master > temp_file.txtIFS=":"read E_id F_Name L_Name depart DoB DoJ grade Ba_Sa Gr_Sa < temp_file.txtIFS=":"if [ -z "$E_id" ]; thenecho -e "Sorry! Employee has ID is $Str nothing found"return 0fiecho ""echo " Deezy Corp, Pay-Slip"echo ""echo "Employee ID: $E_id F_Name: $F_Name L_Name: $L_Name"echo "Department: $depart Grade: $grade"echo "Basic Salary: $Ba_Sa Gross Salary: $Gr_Sa"echo ""echo " Manager"echo " Accounts Department"echo""get_return}Print_payslip
NIIT Hanoi CTT Page 21
Project Report
Code for the print_da.sh file
print_da(){echo -e "Enter a Grade to Generate details report for Dedution and Allowance"read Strif [ "$Str" = "" ]; thenreturn 0figrep "^$Str" Grade.txt > temp_file.txtIFS=":"read grade deduc allow < temp_file.txtIFS=":"if [ -z "$grade" ]; thenecho -e "Sorry! Grade is $Str nothing found"return 0fiecho ""echo " Deduction and Allowance of $grade"echo ""echo " Grade Deduction Allowance"echo " $grade $deduc $allow"echo ""get_return}print_da
NIIT Hanoi CTT Page 22
Project Report
Execute the Application
To execute the Payroll System shell script application:
1. Create a directory, ps, under your home directory and copy all the Payroll System realated shell script to the ps directory.
2. Issue the following command to change the permission of the shell script such that the current user has execute permission on them:$ chmod 744 ~/ps/*.sh
3. Add the PATH, $HOME/PS to the environment variable, PATH, of the current user in the file, .bash_profile, as shown in the flowing code: PATH=$PATH:$HOME/bin:$HOME/PSExport $PATH
4. Save file, .bash_profile and logout
NIIT Hanoi CTT Page 23
Project Report
SYSTEM CONFIGURATION
Hardware: PC compatible with a Intel Pentium- III processor, 256-MB RAM, and 10GB of hard disk.
Operating System:Server: Fedora Core 2 operating systemClient: Fedora Core 2 operating system
Software:Server: Customize Personal Desktop type of installation of Fedora Core 2 operating system with send mail server and print server configuredClient: Customize Personal Desktop type of installation of Fedora Core 2 operating system with pine and compress utilities installed.
NIIT Hanoi CTT Page 24
Project Report
PROJECT FILE DETAILS
S.NO File Name Description1 mainmenu.sh Contains the code to
display the main menu.2 file_manager.sh Contains the code to
change information and delete an employee from employee_master file.
3 file_search.sh Contains the code to search employees have joined the company in the current year, their date of retirement in the current year and department-wise total number of employees needs to be identified.
4 print_payslips.sh Contains the code to generate pay-slips for each employee in the format.
5 print_da.sh Contains the code to generate deduction and allowance details report for all grades.
NIIT Hanoi CTT Page 25