Search

Pages

Payroll Management System Project in C++



Payroll Management System Project in C++

Payroll Management System Project in C++. Download this complete code from given link.

/**************************************************
Project On
P A Y R O L L S Y S T E M
Prepared By:-
Name : HITESH
*****************************************************/
/******************************************************
DECLARATION OF THE HEADER FILES
*******************************************************/
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>/***********************************************
DECLARATIONS OF THE CLASSES
**********************************************/
/**************************************************
DECLARATIONS OF EMPLOYEE CLASSES
***************************************************/
class employee
{
public:
struct date_of_birth
{
int d,m;
long y;
}dob;
struct address
{
int house_no;
char block[2],colony[15],city[10],state[10],pin_code[6];
}add;
int emp_no;
char emp_name[25],desig[10],gender,mobile_no[10];
void add_emp();
void modi_emp();
void del_emp();
void disp_emp();
int found_emp(int);
};
employee emp;
/****************************************************************************
DECLARATIONS OF SALARY CLASS
****************************************************************************/
class salary
{
public:
long int basic_sal,net_sal;
int da,hra,ta,pf,tax;
int emp_no;
void get_sal();
void disp_sal();
};
salary sal;
/****************************************************************************
DECLARATIONS OF ATTENDANCE CLASS
*****************************************************************************/
class attendance
{
public:
int emp_no,el,eol,att_amt;
void get_att();
void disp_att();
};
attendance att;
/****************************************************************************
DECLARATIONS OF PAYSLIP CLASS
*****************************************************************************/
class payslip
{
public:
void print_pay();
};
payslip pay;
/****************************************************************************
DECLARATIONS OF MENU CLASS
*****************************************************************************/
class menu
{
int chs,ch;
char c;
public:
void wel_menu();
void main_menu();
void emp_menu();
void sal_menu();
void att_menu();
void print_menu();
void disp_menu();
};
menu m;
/****************************************************************************
DECLARATION OF THE CLASS TO MAKE SHAPES
****************************************************************************/
class shape
{
public:
void box(int x1,int x2,int y1,int y2);
void ver(int x1,int y1,int y2);
void hor(int x1,int x2,int y1);
};
shape sh;
/***************************************************************************
FUNCTION TO MAKE SHAPE OF BOX
***************************************************************************/
void shape::box(int x1,int x2,int y1,int y2)
{
int a,b,c,d;
char v=179;
char h=219;
a=x1;
b=x2;
c=y1;
d=y2;
for(;a<=b;a++)
{
gotoxy(a,c-1);
cout<<h;
}
a=x1;
for(;a<=b;a++)
{
gotoxy(a,d);
cout<<h;
}
a=x1;
for(;c<d;c++)
{
gotoxy(a,c);
cout<<v;
}
c=y1;
for(;c<d;c++)
{
gotoxy(b,c);
cout<<v;
}
c=y1;
}
/***************************************************************************
FUNCTION TO MAKE VERTICAL LINE
****************************************************************************/
void shape::ver(int x1,int y1,int y2)
{
int a,b,c;
char d=179;
a=x1;
b=y1;
c=y2;
for(;b<c;b++)
{
gotoxy(a,b);
cout<<d;
}
}
/***************************************************************************
FUNCTION TO MAKE HORIZONTAL LINE
****************************************************************************/
void shape::hor(int x1,int x2,int y1)
{
int a,b,c;
a=x1;
b=x2;
c=y1;
char d=219;
for(;a<b;a++)
{
gotoxy(a,c);
cout<<d;
}
}
/***************************************************************************
FUNCTION TO ADD EMPLOYEES' DETAILS
***************************************************************************/
void employee::add_emp()
{
int i,temp_no,mob,pin,flag=0;
clrscr();
fstream fout;
fout.open("emp.dat",ios::in);
fout.seekg(0,ios::beg);
gotoxy(20,10);
cout<<"Enter the employee number(In digits) - ";
cin>>temp_no;
while(fout.read((char *)this,sizeof(employee)))
{
if(emp_no==temp_no)
{
flag=1;
break;
}
}
fout.close();
if(flag==0)
{
fstream fout;
emp_no=temp_no;
clrscr();
sh.box(15,70,7,47);
gotoxy(20,10);
cout<<"Employee Number "<<emp_no;
gotoxy(20,12);
cout<<"Enter the employee name - ";
gets(emp_name);
gotoxy(20,14);
cout<<"Enter the gender(M/F) - ";
cin>>gender;
if(gender=='M' || gender=='m' || gender=='F' || gender=='f')
{
gotoxy(20,16);
cout<<"Enter the designation - ";
gets(desig);
gotoxy(20,18);
cout<<"Enter the date of birth:-";
gotoxy(20,19);
cout<<"Date - ";
cin>>dob.d;
gotoxy(20,20);
cout<<"Month - ";
cin>>dob.m;
gotoxy(20,21);
cout<<"Year - ";
cin>>dob.y;
gotoxy(20,23);
cout<<"Enter the Address";
gotoxy(20,24);
cout<<"Block(in alfabate) - ";
gets(add.block);
gotoxy(20,25);
cout<<"House Number(In Digits) - ";
cin>>add.house_no;
gotoxy(20,26);
cout<<"Colony - ";
gets(add.colony);
gotoxy(20,27);
cout<<"City - ";
gets(add.city);
gotoxy(20,28);
cout<<"State - ";
gets(add.state);
gotoxy(20,29);
cout<<"Pin Code(In 6 Digits) - ";
gets(add.pin_code);
pin=strlen(add.pin_code);
if(pin==6)
{
gotoxy(20,31);
cout<<"Enter mobile number(In 10 Digits) - ";
gets(mobile_no);
mob=strlen(mobile_no);
if(mob==10)
{
fout.open("emp.dat",ios::out|ios::app);
fout.write((char *)this,sizeof(employee));
fout.close();
clrscr();
gotoxy(25,12);
cout<<"RECORD IS ADDED";
getch();
m.main_menu();
}
else
{
clrscr();
gotoxy(25,15);
cout<<"MOBILE NUMBER IS NOT VALID";
getch();
m.emp_menu();
}
}
else
{
clrscr();
gotoxy(25,15);
cout<<"PIN CODE IS NOT VALID";
getch();
m.emp_menu();
}
}
else
{
clrscr();
gotoxy(25,15);
cout<<"WRONG GENDER";
getch();
m.emp_menu();
}
}
else
{
clrscr();
gotoxy(25,15);
cout<<"RECORD ALREADY ENTERED";
getch();
m.emp_menu();
}
}
/***************************************************************************
FUNCTION TO MODIFY EMPLOYEES' DETAILS
***************************************************************************/
void employee::modi_emp()
{
int temp_no,pin,mob,flag=0;
char t,temp_name[25],t_desig[10],t_gender,t_mobile[11];
struct t_date
{
int d,m,y;
}t_dob;
struct t_address
{
int house_no;
char block[2],colony[15],city[10],state[10],pin_code[6];
}t_add;
clrscr();
fstream fout;
gotoxy(20,10);
fout.open("emp.dat",ios::in);
fout.seekg(0,ios::beg);
cout<<"Enter the employee number to be modified(In Digit) - ";
cin>>temp_no;
while(fout.read((char *)this,sizeof(employee)))
{
if(emp_no==temp_no)
{
clrscr();
sh.box(15,70,5,45);
gotoxy(20,10);
cout<<"Employee Number - "<<emp_no;
gotoxy(20,12);
cout<<"Employee Name - "<<emp_name;
gotoxy(20,14);
cout<<"Gender - "<<gender;
gotoxy(20,16);
cout<<"Designation - "<<desig;
gotoxy(20,18);
cout<<"The Date of Birth is - ";
gotoxy(20,19);
cout<<"Date - "<<dob.d;
gotoxy(20,20);
cout<<"Month - "<<dob.m;
gotoxy(20,21);
cout<<"Year - "<<dob.y;
gotoxy(20,23);
cout<<"Address -";
gotoxy(20,24);
cout<<"Block - "<<add.block;
gotoxy(20,25);
cout<<"House Number - "<<add.house_no;
gotoxy(20,26);
cout<<"Colony - "<<add.colony;
gotoxy(20,27);
cout<<"City - "<<add.city;
gotoxy(20,28);
cout<<"State - "<<add.state;
gotoxy(20,29);
cout<<"Pin Code - "<<add.pin_code;
gotoxy(20,31);
cout<<"Mobile Number - "<<mobile_no;
gotoxy(20,35);
cout<<"Do you want to modify this(Y/N) - ";
cin>>t;
if(t=='y' || t=='Y')
{
clrscr();
gotoxy(20,10);
cout<<"Enter the employee number(In Digits) - ";
cin>>temp_no;
while(fout.read((char *)this,sizeof(employee)))
{
if(emp_no==temp_no)
{
flag=1;
break;
}
}
fout.close();
if(flag==0)
{
fstream fout;
emp_no=temp_no;
clrscr();
sh.box(15,65,7,45);
gotoxy(20,10);
cout<<"Employee Number "<<emp_no;
gotoxy(20,12);
cout<<"Enter the employee name - ";
gets(temp_name);
gotoxy(20,14);
cout<<"Enter the gender(M/F) - ";
cin>>t_gender;
if(gender=='M' || gender=='m' || gender=='F' || gender=='f')
{
gotoxy(20,16);
cout<<"Enter the designation - ";
gets(t_desig);
gotoxy(20,18);
cout<<"Enter the date of birth:-";
gotoxy(20,19);
cout<<"Date - ";
cin>>t_dob.d;
gotoxy(20,20);
cout<<"Month - ";
cin>>t_dob.m;
gotoxy(20,21);
cout<<"Year - ";
cin>>t_dob.y;
gotoxy(20,23);
cout<<"Enter the Address";
gotoxy(20,24);
cout<<"Block - ";
gets(t_add.block);
gotoxy(20,25);
cout<<"House Number(In Digits) - ";
cin>>t_add.house_no;
gotoxy(20,26);
cout<<"Colony - ";
gets(t_add.colony);
gotoxy(20,27);
cout<<"City - ";
gets(t_add.city);
gotoxy(20,28);
cout<<"State - ";
gets(t_add.state);
gotoxy(20,29);
cout<<"Pin Code(In 6 Digits) - ";
gets(t_add.pin_code);
pin=strlen(t_add.pin_code);
if(pin==6)
{
gotoxy(20,31);
cout<<"Enter mobile number(In 10 Digits) - ";
gets(t_mobile);
mob=strlen(t_mobile);
if(mob==10)
{
int find_rec=0;
fout.open("emp.dat",ios::in);
fout.seekg(0,ios::beg);
while(fout.read((char *)this,sizeof(employee)))
{
find_rec++;
if(emp_no==temp_no);
break;
}
fout.close();
fstream fout;
fout.open("emp.dat",ios::out|ios::ate);
emp_no=temp_no;
strcpy(emp_name,temp_name);
gender=t_gender;
strcpy(desig,t_desig);
dob.d=t_dob.d;
dob.m=t_dob.m;
dob.y=t_dob.y;
strcpy(add.block,t_add.block);
add.house_no=t_add.house_no;
strcpy(add.colony,t_add.colony);
strcpy(add.city,t_add.city);
strcpy(add.state,t_add.state);
strcpy(add.pin_code,t_add.pin_code);
strcpy(mobile_no,t_mobile);
int location;
location=(find_rec-1)*sizeof(employee);
fout.seekp(location);
fout.write((char *)this,sizeof(employee));
fout.close();
clrscr();
gotoxy(25,15);
cout<<"RECORD MODIFIED";
getch();
m.main_menu();
}
else
{
clrscr();
gotoxy(25,15);
cout<<"MOBILE NUMBER IS NOT VALID";
getch();
m.emp_menu();
}
}
else
{
clrscr();
gotoxy(25,15);
cout<<"PIN CODE IS NOT VALID";
getch();
m.emp_menu();
}
}
else
{
clrscr();
gotoxy(25,15);
cout<<"WRONG GENDER";
getch();
m.emp_menu();
}
}
else
{
clrscr();
gotoxy(25,15);
cout<<"RECORD ALREADY ENTERED";
getch();
m.emp_menu();
}
}
else
{
clrscr();
cout<<"RECORD NOT MODIFIED";
getch();
m.emp_menu();
}
}
else
{
clrscr();
cout<<"NO RECORD FOUND";
getch();
m.emp_menu();
}
}
}
/***************************************************************************
FUNCTION TO DELETE EMPLOYEES' DETAILS
***************************************************************************/
void employee::del_emp()
{
int t_emp,found=0;
clrscr();
sh.box(15,65,7,20);
gotoxy(20,10);
cout<<"Enter the employee number(In Digits) - ";
cin>>t_emp;
fstream fout;
fout.open("emp.dat",ios::in);
fstream tem;
tem.open("temp.dat",ios::out);
fout.seekg(0,ios::beg);
while(!fout.eof())
{
fout.read((char *)this,sizeof(employee));
if(fout.eof())
break;
if(emp_no!=t_emp)
{
tem.write((char *)this,sizeof(employee));
found=1;
}
}
fout.close();
tem.close();
fout.open("emp.dat",ios::out);
tem.open("temp.dat",ios::in);
if(!fout)
cout<<"File cannot open";
if(!tem)
cout<<"File temp cannot open";
tem.seekg(0,ios::beg);
while(!tem.eof())
{
tem.read((char *)this,sizeof(employee));
if(tem.eof())
break;
if(emp_no!=t_emp)
fout.write((char *)this,sizeof(employee));
}
fout.close();
tem.close();
fstream fout1;
fout1.open("sal.dat",ios::in);
fstream tem1;
tem1.open("temp1.dat",ios::out);
fout1.seekg(0,ios::beg);
while(!fout1.eof())
{
fout1.read((char *)&sal,sizeof(salary));
if(fout1.eof())
break;
if(sal.emp_no!=t_emp)
tem1.write((char *)&sal,sizeof(sal));
}
fout1.close();
tem1.close();
fout1.open("sal.dat",ios::out);
tem1.open("temp1.dat",ios::in);
if(!fout1)
cout<<"File cannot open";
if(!tem1)
cout<<"File temp cannot open";
tem1.seekg(0,ios::beg);
while(!tem1.eof())
{
tem1.read((char *)&sal,sizeof(salary));
if(tem1.eof())
break;
if(sal.emp_no!=t_emp)
fout1.write((char *)&sal,sizeof(salary));
}
fout1.close();
tem1.close();
fstream fout2;
fout2.open("att.dat",ios::in);
fstream tem2;
tem2.open("temp2.dat",ios::out);
fout2.seekg(0,ios::beg);
while(!fout2.eof())
{
fout2.read((char *)&att,sizeof(attendance));
if(fout2.eof())
break;
if(att.emp_no!=t_emp)
tem2.write((char *)&att,sizeof(attendance));
}
fout2.close();
tem2.close();
fout2.open("att.dat",ios::out);
tem2.open("temp2.dat",ios::in);
if(!fout2)
cout<<"File cannot open";
if(!tem2)
cout<<"File temp cannot open";
tem2.seekg(0,ios::beg);
while(!tem2.eof())
{
tem2.read((char *)&att,sizeof(attendance));
if(tem2.eof())
break;
if(att.emp_no!=t_emp)
fout2.write((char *)&att,sizeof(attendance));
clrscr();
gotoxy(25,15);
cout<<"RECORD IS DELETED";
}
fout2.close();
tem2.close();
if(found==0)
{
clrscr();
gotoxy(25,15);
cout<<"RECORD NOT FOUND";
getch();
m.main_menu();
}
getch();
m.main_menu();
}
/***************************************************************************
FUNCTION TO DISPLAY EMPLOYEES' DETAILS
***************************************************************************/
void employee::disp_emp()
{
int j=2,k=3;
clrscr();
_setcursortype(_NOCURSOR);
sh.box(1,80,2,30);
gotoxy(j,k);
cout<<"Employee";
gotoxy(j,k+1);
cout<<"Number";
sh.ver(10,2,30);
gotoxy(j+9,k);
cout<<"Employee";
gotoxy(j+11,k+1);
cout<<"Name";
sh.ver(19,2,30);
gotoxy(j+18,k);
cout<<"Gender";
sh.ver(26,2,30);
gotoxy(j+25,k);
cout<<"Designation";
sh.ver(38,2,30);
gotoxy(j+37,k);
cout<<"Date of";
gotoxy(j+38,k+1);
cout<<"Birth";
sh.ver(49,2,30);
gotoxy(j+48,k);
cout<<"Address";
sh.ver(69,2,30);
gotoxy(j+68,k);
cout<<"Mobile No";
fstream fout;
fout.open("emp.dat",ios::in);
if(!fout)
cout<<"File cannot open";
fout.seekg(0,ios::beg);
while(fout.read((char *)this,sizeof(employee)))
{
gotoxy(j,k+3);
cout<<emp_no;
gotoxy(j+9,k+3);
cout<<emp_name;
gotoxy(j+18,k+3);
cout<<gender;
gotoxy(j+25,k+3);
cout<<desig;
gotoxy(j+37,k+3);
cout<<dob.d<<"/"<<dob.m<<"/"<<dob.y;
gotoxy(j+48,k+3);
cout<<add.block<<"-"<<add.house_no<<", ";
gotoxy(j+48,k+4);
cout<<add.colony<<",";
gotoxy(j+48,k+5);
cout<<add.city<<", ";
gotoxy(j+48,k+6);
cout<<add.state<<"-"<<add.pin_code;
gotoxy(j+68,k+3);
cout<<mobile_no;
k=k+4;
}
getch();
m.main_menu();
}
/***************************************************************************
FUNCTION TO ADD EMPLOYEES' ATTENDANCE
***************************************************************************/
void attendance::get_att()
{
int temp_no,found=0,flag=0;
clrscr();
sh.box(15,70,7,30);
fstream fout;
fstream fout1;
gotoxy(20,10);
cout<<"Enter the Employee Number(In Digits) - ";
cin>>temp_no;
fout1.open("emp.dat",ios::in);
fout1.seekg(0,ios::beg);
while(fout1.read((char *)&emp,sizeof(employee)))
{
if(emp.emp_no==temp_no)
{
found=1;
break;
}
}
fout1.close();
if(found==1)
{
fout.open("att.dat",ios::in);
while(fout.read((char *)this,sizeof(attendance)))
{
if(emp_no==temp_no)
{
flag=1;
break;
}
}
if(flag==0)
{
fout.close();
fout.open("att.dat",ios::out|ios::app);
if(!fout)
cout<<"File Cannot Open";
emp_no=temp_no;
clrscr();
gotoxy(20,10);
cout<<"RECORD FOUND";
getch();
clrscr();
sh.box(15,70,7,30);
gotoxy(20,10);
cout<<"Employee Number "<<emp_no;
gotoxy(20,12);
cout<<"Enter the Earn Leaves(In Digits) - ";
cin>>el;
gotoxy(20,14);
cout<<"Enter the Extra Ordinary Leaves(In Digits) - ";
cin>>eol;
att_amt=(eol*50);
gotoxy(20,16);
cout<<"Amount is - "<<att_amt;
fout.write((char *)this,sizeof(attendance));
fout.close();
getch();
m.att_menu();
}
else
{
fout.close();
clrscr();
gotoxy(25,15);
cout<<"RECORD ALREADY ENTERED";
getch();
m.att_menu();
}
}
else
{
fout.close();
clrscr();
gotoxy(20,10);
cout<<"RECORD NOT FOUND";
getch();
m.att_menu();
}
}
/***************************************************************************
FUNCTION TO DISPLAY EMPLOYEES' ATTENDANCE
***************************************************************************/
void attendance::disp_att()
{
int j=20,k=3;
_setcursortype(_NOCURSOR);
clrscr();
sh.box(18,60,2,25);
fstream fout;
gotoxy(j,k);
cout<<"Employee";
gotoxy(j,k+1);
cout<<"Number";
sh.ver(28,2,25);
gotoxy(j+10,k);
cout<<"EL";
sh.ver(33,2,25);
gotoxy(j+15,k);
cout<<"EOL";
sh.ver(38,2,25);
gotoxy(j+20,k);
cout<<"Amount";
fout.open("att.dat",ios::in);
fout.seekg(0,ios::beg);
while(fout.read((char *)this,sizeof(attendance)))
{
gotoxy(j,k+3);
cout<<emp_no;
gotoxy(j+10,k+3);
cout<<el;
gotoxy(j+15,k+3);
cout<<eol;
gotoxy(j+20,k+3);
cout<<att_amt;
k=k+2;
}
fout.close();
sh.hor(1,75,40);
sh.hor(1,75,44);
gotoxy(25,42);
cout<<"I N S T R U C T I O N S";
gotoxy(3,46);
cout<<"EOL stands for Extra Ordinary Leave";
gotoxy(3,48);
cout<<"EL stands for Earn Leave";
gotoxy(3,50);
cout<<"Amount is to be deduct from the salary because of excess leaves";
getch();
m.att_menu();
}
/***************************************************************************
FUNCTION TO ADD EMPLOYEES' SALARY
***************************************************************************/
void salary::get_sal()
{
int temp_no,found=0,flag=0;
clrscr();
sh.box(15,70,7,20);
fstream fout;
fstream fout1;
gotoxy(20,10);
cout<<"Enter the employee number(In Digits) - ";
cin>>temp_no;
fout1.open("emp.dat",ios::in);
fout1.seekg(0,ios::beg);
while(fout1.read((char *)&emp,sizeof(employee)))
{
if(emp.emp_no==temp_no)
{
found=1;
break;
}
}
fout1.close();
if(found==1)
{
fstream fout;
fout.open("sal.dat",ios::in);
while(fout.read((char *)this,sizeof(salary)))
{
if(emp_no==temp_no)
{
flag=1;
break;
}
}
if(flag==0)
{
fout.close();
emp_no=temp_no;
clrscr();
gotoxy(20,10);
cout<<"RECORD FOUND";
getch();
clrscr();
sh.box(15,70,7,30);
gotoxy(20,10);
cout<<"Employee Number "<<emp_no;
gotoxy(20,12);
cout<<"Enter the Basic Salary - ";
cin>>basic_sal;
da=(basic_sal*.15);
hra=(basic_sal*.20);
ta=(basic_sal*.10);
pf=(basic_sal*.25);
gotoxy(20,14);
cout<<"Dearness Allownces - "<<da;
gotoxy(20,16);
cout<<"House Rent Allownces - "<<hra;
gotoxy(20,18);
cout<<"Travel Allownces - "<<ta;
gotoxy(20,20);
net_sal=basic_sal+da+hra+ta-pf-att.att_amt;
cout<<"Net Salary before Tax - "<<net_sal;
getch();
if(net_sal<=10000)
tax=0;
else if(10000<net_sal && net_sal<=20000)
tax=(net_sal*.10);
else if(20000<net_sal && net_sal<=30000)
tax=(net_sal*.15);
else if(30000<net_sal && net_sal<=50000)
tax=(net_sal*.20);
else
tax=(net_sal*.25);
net_sal=net_sal-tax;
gotoxy(20,22);
cout<<"Net Salary after Tax - "<<net_sal;
getch();
fout.open("sal.dat",ios::out|ios::app);
fout.write((char *)this,sizeof(salary));
if(!fout)
cout<<"File Cannot Open";
clrscr();
gotoxy(25,20);
cout<<"SALARY ADDED";
fout.close();
getch();
m.sal_menu();
}
else
{
clrscr();
gotoxy(25,15);
cout<<"RECORD ALREADY ENTERED";
getch();
m.sal_menu();
}
}
else
{
clrscr();
gotoxy(20,10);
cout<<"RECORD NOT FOUND";
getch();
m.sal_menu();
}
}
/***************************************************************************
FUNCTION TO DISPLAY EMPLOYEES' SALARY
***************************************************************************/
void salary::disp_sal()
{
int j=3,k=3;
clrscr();
_setcursortype(_NOCURSOR);
sh.box(2,65,2,30);
fstream fout;
gotoxy(j,k);
cout<<"Employee";
gotoxy(j+1,k+1);
cout<<"Number";
sh.ver(11,2,30);
gotoxy(j+9,k);
cout<<"BASIC SALARY";
sh.ver(24,2,30);
gotoxy(j+22,k);
cout<<"DA";
sh.ver(31,2,30);
gotoxy(j+29,k);
cout<<"HRA";
sh.ver(38,2,30);
gotoxy(j+36,k);
cout<<"TA";
sh.ver(45,2,30);
gotoxy(j+43,k);
cout<<"Tax";
sh.ver(52,2,30);
gotoxy(j+50,k);
cout<<"Net Salary";
fout.open("sal.dat",ios::in);
if(!fout)
cout<<"Cannot open file";
fout.seekg(0,ios::beg);
while(fout.read((char *)this,sizeof(salary)))
{
gotoxy(j,k+3);
cout<<emp_no;
gotoxy(j+9,k+3);
cout<<basic_sal;
gotoxy(j+22,k+3);
cout<<da;
gotoxy(j+29,k+3);
cout<<hra;
gotoxy(j+36,k+3);
cout<<ta;
gotoxy(j+43,k+3);
cout<<tax;
gotoxy(j+50,k+3);
cout<<net_sal;
k=k+2;
}
fout.close();
getch();
m.sal_menu();
}
/***************************************************************************
FUNCTION TO PRINT EMPLOYEES' PAYSLIP
***************************************************************************/
void payslip::print_pay()
{
date d;
getdate(&d);
int d1,m1,y1,temp_no;
d1=d.da_day;
m1=d.da_mon;
y1=d.da_year;
clrscr();
int found=0;
fstream fout,fout1,fout2;
cout<<"Enter the Employee Number - ";
cin>>temp_no;
fout.open("emp.dat",ios::in);
fout1.open("sal.dat",ios::in);
fout2.open("att.dat",ios::in);
if(!fout)
cout<<"File Emp cannot open";
if(!fout1)
cout<<"File salary cannot open";
if(!fout2)
cout<<"File attendance cannot open";
fout.seekg(0,ios::beg);
fout1.seekg(0,ios::beg);
fout2.seekg(0,ios::beg);
_setcursortype(_NOCURSOR);
clrscr();
sh.box(15,75,2,32);
gotoxy(65,3);
cout<<" WELCOME";
gotoxy(40,6);
cout<<"P A Y S L I P";
gotoxy(65,6);
cout<<d1<<"/"<<m1<<"/"<<y1;
while(fout.read((char *)&emp,sizeof(employee)))
{
if(emp.emp_no==temp_no)
{
gotoxy(20,9);
cout<<emp.emp_name;
gotoxy(41,11);
cout<<"Emp No : "<<emp.emp_no;
gotoxy(20,12);
cout<<emp.desig;
found=1;
}
}
while(fout1.read((char *)&sal,sizeof(salary)))
{
if(sal.emp_no==temp_no)
{
sh.ver(37,14,27);
gotoxy(23,14);
cout<<"EARNING";
gotoxy(20,16);
cout<<"BASIC : "<<sal.basic_sal;
gotoxy(20,18);
cout<<"DA : "<<sal.da;
gotoxy(20,20);
cout<<"TA : "<<sal.ta;
gotoxy(20,22);
cout<<"HRA : "<<sal.hra;
gotoxy(20,25);
cout<<"TOTAL : "<<sal.basic_sal+sal.da+sal.ta+sal.hra;
sh.ver(55,14,27);
gotoxy(41,14);
cout<<"DEDUCTIONS";
gotoxy(41,16);
cout<<"PF : "<<sal.pf;
gotoxy(41,18);
cout<<"TAX : "<<sal.tax;
gotoxy(41,25);
cout<<"TOTAL : "<<sal.pf+sal.tax;
sh.hor(19,72,27);
gotoxy(37,29);
cout<<"NET SALARY : "<<sal.net_sal;
found=1;
}
}
while(fout2.read((char *)&att,sizeof(attendance)))
{
if(att.emp_no==temp_no)
{
gotoxy(58,14);
cout<<"ATTENDANCE";
gotoxy(58,16);
cout<<"EOL : "<<att.eol;
gotoxy(58,18);
cout<<"AMOUNT : "<<att.att_amt;
found=1;
}
}
fout.close();
fout1.close();
fout2.close();
getch();
if(found==0)
{
clrscr();
gotoxy(25,15);
cout<<"RECORD NOT FOUND";
getch();
m.main_menu();
}
getch();
m.main_menu();
}
/***************************************************************************
FUNCTION TO SHOW WELCOME MENU
***************************************************************************/
void menu::wel_menu()
{
_setcursortype(_NOCURSOR);
int i,a=20,c=5;
char v=179,h=219;
clrscr();
delay(500);
for(a=20;a<=55;a++)
{
gotoxy(a,4);
cout<<h;
delay(20);
}
for(c=5;c<25;c++)
{
gotoxy(55,c);
cout<<v;
delay(50);
}
for(a=55;a>=20;a--)
{
gotoxy(a,25);
cout<<h;
delay(30);
}
for(c=24;c>=5;c--)
{
gotoxy(20,c);
cout<<v;
delay(40);
}
delay(1000);
gotoxy(33,10);
cout<<"W";
delay(50);
cout<<"E";
delay(50);
cout<<"L";
delay(50);
cout<<"C";
delay(50);
cout<<"O";
delay(50);
cout<<"M";
delay(50);
cout<<"E";
delay(50);
cout<<" ";
delay(50);
cout<<"T";
delay(50);
cout<<"O";
delay(50);
cout<<" ";
delay(50);
gotoxy(30,14);
cout<<"A";
delay(50);
cout<<"U";
delay(50);
cout<<"T";
delay(50);
cout<<"O";
delay(50);
cout<<"M";
delay(50);
cout<<"A";
delay(50);
cout<<"T";
delay(50);
cout<<"E";
delay(50);
cout<<"D";
delay(50);
cout<<" ";
delay(50);
cout<<"S";
delay(50);
cout<<"A";
delay(50);
cout<<"L";
delay(50);
cout<<"A";
delay(50);
cout<<"R";
delay(50);
cout<<"Y";
delay(50);
gotoxy(29,18);
cout<<"P";
delay(50);
cout<<"R";
delay(50);
cout<<"O";
delay(50);
cout<<"C";
delay(50);
cout<<"E";
delay(50);
cout<<"S";
delay(50);
cout<<"S";
delay(50);
cout<<"I";
delay(50);
cout<<"N";
delay(50);
cout<<"G";
delay(50);
cout<<" ";
cout<<" ";
delay(50);
cout<<"S";
delay(50);
cout<<"Y";
delay(50);
cout<<"S";
delay(50);
cout<<"T";
delay(50);
cout<<"E";
delay(50);
cout<<"M";
delay(50);;
delay(1000);
sh.box(50,80,30,38);
delay(500);
gotoxy(51,32);
cout<<"PREPARED By:-";
delay(500);
gotoxy(51,34);
cout<<"NAME : HITESH KUMAR ";
delay(500);
gotoxy(51,36);
cout<<"Enrol No. : ODL/1096/401/0701";
delay(1000);
gotoxy(22,45);
cout<<"Press any key to continue.........";
getch();
gotoxy(22,45);
clreol();
gotoxy(22,33);
cout<<"Please wait";
for(i=33;i<45;i++)
{
gotoxy(i,33);
cout<<".";
delay(200);
}
gotoxy(22,45);
clreol();
cout<<"Press any key to continue.........";
getch();
main_menu();
}
/***************************************************************************
FUNCTION TO SHOW MAIN MENU
***************************************************************************/
void menu::main_menu()
{
clrscr();
textcolor(RED);
sh.box(25,55,7,27);
_setcursortype(_NORMALCURSOR);
gotoxy(30,10);
cprintf("1. Employee Details");
gotoxy(30,12);
cprintf("2. Attendance Record");
gotoxy(30,14);
cprintf("3. Calculate Salary");
gotoxy(30,16);
cprintf("4. Print Pay-Slip");
gotoxy(30,18);
cprintf("5. Display all details");
gotoxy(30,20);
cprintf("6. Exit");
gotoxy(30,23);
cprintf("Enter your choice - ");
cin>>chs;
switch(chs)
{
case 1:
emp_menu();
break;
case 2:
att_menu();
break;
case 3:
sal_menu();
break;
case 4:
print_menu();
break;
case 5:
disp_menu();
break;
case 6:
exit(0);
default:
clrscr();
gotoxy(20,10);
cout<<"WRONG CHOICE";
getch();
main_menu();
}
}
/***************************************************************************
FUNCTION TO SHOW EMPLOYEES' DETAILS MENU
***************************************************************************/
void menu::emp_menu()
{
clrscr();
textcolor(GREEN);
sh.box(25,60,7,37);
_setcursortype(_NORMALCURSOR);
gotoxy(30,10);
cprintf("1. Add employee details");
gotoxy(30,12);
cprintf("2. Modify employee details");
gotoxy(30,14);
cprintf("3. Delete employee details");
gotoxy(30,16);
cprintf("4. Display employee details");
gotoxy(30,18);
cprintf("5. To go previous menu");
gotoxy(30,20);
cprintf("6. Exit");
gotoxy(30,23);
cprintf("Enter your choice - ");
cin>>ch;
switch(ch)
{
case 1:
emp.add_emp();
break;
case 2:
emp.modi_emp();
break;
case 3:
emp.del_emp();
break;
case 4:
emp.disp_emp();
break;
case 5:
main_menu();
break;
case 6:
exit(0);
default:
clrscr();
gotoxy(20,10);
cout<<"WRONG CHOICE";
getch();
emp_menu();
}
}
/***************************************************************************
FUNCTION TO SHOW EMPLOYEES' ATTENDANCE MENU
***************************************************************************/
void menu::att_menu()
{
clrscr();
sh.box(15,65,7,23);
_setcursortype(_NORMALCURSOR);
int c;
textcolor(GREEN);
gotoxy(20,10);
cprintf("1. To add attendance of the Employee");
gotoxy(20,12);
cout<<"2. To display attendance of the Employee";
gotoxy(20,14);
cout<<"3. To go previous menu";
gotoxy(20,16);
cout<<"4. Exit";
gotoxy(20,19);
cout<<"Enter your choice ";
cin>>c;
switch(c)
{
case 1:
att.get_att();
break;
case 2:
att.disp_att();
break;
case 3:
main_menu();
break;
case 4:
exit(0);
default:
cout<<"WRONG CHOICE";
getch();
break;
}
}
/***************************************************************************
FUNCTION TO SHOW EMPLOYEES' SALARY MENU
***************************************************************************/
void menu::sal_menu()
{
clrscr();
sh.box(15,65,7,23);
_setcursortype(_NORMALCURSOR);
int c;
gotoxy(20,10);
cout<<"1. Add salary details of the employee";
gotoxy(20,12);
cout<<"2. Display salary details of the employee";
gotoxy(20,14);
cout<<"3. Back to main menu";
gotoxy(20,16);
cout<<"4. Exit";
gotoxy(20,19);
cout<<"Enter your choice ";
cin>>c;
switch(c)
{
case 1:
sal.get_sal();
break;
case 2:
sal.disp_sal();
break;
case 3:
m.main_menu();
break;
case 4:
exit(0);
default:
cout<<"WRONG CHOICE";
break;
}
}
/***************************************************************************
FUNCTION TO SHOW EMPLOYEES' PAYSLIP MENU
***************************************************************************/
void menu::print_menu()
{
clrscr();
pay.print_pay();
}
/***************************************************************************
FUNCTION TO SHOW ALL DETAILS OF EMPLOYEES'
***************************************************************************/
void menu::disp_menu()
{
int j=2,k=3;
clrscr();
sh.box(1,80,2,35);
_setcursortype(_NOCURSOR);
gotoxy(j,k);
cout<<"Emp No";
sh.ver(8,2,35);
gotoxy(j+7,k);
cout<<"Employee";
gotoxy(j+9,k+1);
cout<<"Name";
sh.ver(17,2,35);
gotoxy(j+16,k);
cout<<"Designation";
sh.ver(29,2,35);
gotoxy(j+28,k);
cout<<"Pin Code";
sh.ver(38,2,35);
gotoxy(j+37,k);
cout<<"Mobile No";
sh.ver(49,2,35);
gotoxy(j+48,k);
cout<<"EARNING";
sh.ver(57,2,35);
gotoxy(j+56,k);
cout<<"DEDUCTION";
sh.ver(67,2,35);
gotoxy(j+66,k);
cout<<"Net";
gotoxy(j+66,k+1);
cout<<"Salary";
sh.ver(76,2,35);
gotoxy(j+75,k);
cout<<"EOL";
fstream fout,fout1,fout2;
fout.open("emp.dat",ios::in);
fout1.open("sal.dat",ios::in);
fout2.open("att.dat",ios::in);
if(!fout)
cout<<"File Employee cannot open";
if(!fout1)
cout<<"File Salary cannot open";
if(!fout2)
cout<<"File Attendance cannot open";
fout.seekg(0,ios::beg);
fout1.seekg(0,ios::beg);
fout2.seekg(0,ios::beg);
while(fout.read((char *)&emp,sizeof(employee)))
{
j=2;
while(fout1.read((char *)&sal,sizeof(salary)))
{
j=2;
if(emp.emp_no==sal.emp_no)
{
while(fout2.read((char *)&att,sizeof(attendance)))
{
j=2;
if(att.emp_no==emp.emp_no)
{
gotoxy(j,k+3);
cout<<emp.emp_no;
gotoxy(j+7,k+3);
cout<<emp.emp_name;
gotoxy(j+16,k+3);
cout<<emp.desig;
gotoxy(j+28,k+3);
cout<<emp.add.pin_code;
gotoxy(j+37,k+3);
cout<<emp.mobile_no;
gotoxy(j+48,k+3);
cout<<sal.basic_sal+sal.da+sal.hra+sal.ta;
gotoxy(j+56,k+3);
cout<<sal.pf+sal.tax;
gotoxy(j+66,k+3);
cout<<sal.net_sal;
gotoxy(j+75,k+3);
cout<<att.eol;
k=k+2;
}
}
}
}
}
fout.close();
fout1.close();
fout2.close();
sh.hor(1,75,40);
sh.hor(1,75,44);
gotoxy(25,42);
cout<<"I N S T R U C T I O N S";
gotoxy(2,46);
cout<<"The above table will show the data which have unique employee number";
cout<<"that is in all three files. In this table ";
cout<<"EMP NO stands for Earn Leave, ";
cout<<"EOL stands for Extra Ordinary Leave. ";
cout<<"Earning includes DA(Dearness Allownces), HRA(House Rent Allownces), ";
cout<<"TA(Travel Allownces) and Basic Salary. ";
cout<<"Deductions include PF(Provident Fund and Tax";
getch();
m.main_menu();
}
/***************************************************************************
MAIN FUNCTION
***************************************************************************/
void main()
{
clrscr();
m.wel_menu();
getch();
}



For Documentation of this project drop a comment with your mail id, we provides full documentation soon........ as possible.


2 comments

  1. Really, these quotes are the holistic approach towards mindfulness. In fact, all of your posts are. Proudly saying I’m getting fruitfulness out of it what you write and share. Thank you so much to both of you.
    HRMS Software in Dubai
    HRMS Software Dubai
    HRMS Software in UAE
    HRMS Software
    HR Management Software
    Payroll Software

    ReplyDelete
  2. The project is a C++ implementation of a payroll management system in the form of an application for managing payroll. The main purpose of this project is to provide a framework for developing and implementing customisable payroll systems.

    ReplyDelete

 

Popular Posts