Anda di halaman 1dari 55

#include<iostream.

h>
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<string.h>
#include<dos.h>
#include<fstream.h>
#include<time.h>
#define password "yn"
#define cas_total 10
#define sick_total 15
#define earn_total 18
#define MYPATH "E:\\FILES"
void function();
char path[200];
char path1[200];
char path2[200];
char path3[200];
class salary
{
public:
long int b_sal,da,hra,conv_allowance,med_allowance;
};
class dob
{
public:
int day,month,yr;
};
class employee
{
char name[30],ph_no[10],address[30],dept[30],post[30],r_manager[30];
int emp_id;
long int acc_no;
salary emp_salary;
dob emp_dob,emp_doj;
public:
void entry();
void modify();
void del();
void display();
void search();
}emp;
class cas_leav
{
public:
char name[30];
int leav_taken,emp_id;
void show();
void get_c();
}cl;
class sick_leav
{
public:
char name[30];
int leav_taken,emp_id;

void show();
void get_s();
}sl;
class earn_leav
{
public:
char name[20];
int leav_taken,emp_id;
void show();
void get_e();
}el;
class attendance
{
public:
char name[20],att[11];
int emp_id,day,mon,yr;
void enter();
void show();
}attend;
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:/tc/bgi") ;
char ch='y';
int ch1;
function();
settextstyle(DEFAULT_FONT,HORIZ_DIR,01);
setbkcolor(15);
while(ch=='y')
{
cleardevice();
settextstyle(0,0,1.9);
setcolor(5);
int p,q;
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;

q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
setfillstyle(SOLID_FILL,21);
bar(60,140,590,110);
bar(60,400,590,370);
bar(30,400,60,110);
bar(560,400,590,110);
settextstyle(7,0,1);
outtextxy(100,178,"For Employee's Personal Record

Press 1")

outtextxy(100,218,"For Employee's Leave Record

Press 2")

;
;
outtextxy(100,258,"For Employee's Attendance Record
outtextxy(100,295,"To quit

Press 3");
Press 4

");
int j=1;
while(!kbhit())
{
delay(1000);
setcolor(j);
settextstyle(4,0,4);
outtextxy(10,18,"::Employee Information Management System::");
settextstyle(4,0,5);
outtextxy(10,415,"tp");
j++;
}
cin>>ch1;
switch(ch1)
{
case 1:
cleardevice();
settextstyle(DEFAULT_FONT,HORIZ_DIR,01);
//setbkcolor(15);
setcolor(4);
settextstyle(0,0,1.9);
int p;
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");

q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
setfillstyle(SOLID_FILL,20);
bar(60,140,590,110);
bar(60,400,590,370);
bar(30,400,60,110);
bar(560,400,590,110);
settextstyle(7,0,1);
outtextxy(100,170,"For New Record Entry
Press 5");
outtextxy(100,200,"For Record Display
Press 6");
outtextxy(100,230,"For Modifying Record
Press 7");
outtextxy(100,260,"For Deleting An Existing Reco
rd

Press 8");
outtextxy(100,290,"For Searching A Record
Press 9");
outtextxy(100,320,"To quit
Press 10");
int j=1;
while(!kbhit())
{
delay(1000);
setcolor(j);
settextstyle(4,0,4);
outtextxy(120,18,"::Employee Personal Re

cord::");
settextstyle(4,0,5);
outtextxy(10,415,"tp");
j++;
}
cin>>ch1;
switch(ch1)
{
case 5:
while(ch=='y')
{

cleardevice();
setfillstyle(SOLID_FILL,
22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
outtextxy(120,18,":::Emp
loyee Record Entry:::");
settextstyle(0,0,1);
//setcolor(2);
emp.entry();
cleardevice();
settextstyle(0,0,1.9);
setcolor(1);
int p;
p=1;
int q;
q=478;
while(q>5)
{
outtextxy(p,q,"*
");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*
");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*
");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*
");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
setcolor(1);
outtextxy(160,50,"Record
has been entered.");

outtextxy(40,90,"Do you
want to enter another record(y/n)?");
cin>>ch;
}
break;
case 6:
cleardevice();
setfillstyle(SOLID_FILL,22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
outtextxy(120,25,":::Employee Re
cord Display:::");
emp.display();
break;
case 7:
while(ch=='y')
{
cleardevice();
setfillstyle(SOLID_FILL,
22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
setcolor(8);
outtextxy(120,25,":::Emp
loyee Record Modification:::");
emp.modify();
cleardevice();
setcolor(8);
settextstyle(0,0,1.9);
int p;
p=1;
int q;
q=478;
while(q>5)
{
outtextxy(p,q,"*
");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*
");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*
");
p=p+7;
}
p=2;
q=3;
while(p<632)

{
outtextxy(p,q,"*
");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
setcolor(8);
outtextxy(85,160,"Do you
want to modify another record(y/n)?");
cin>>ch;
}
break;
case 8:
while(ch=='y')
{
cleardevice();
setfillstyle(SOLID_FILL,
22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
outtextxy(180,25,":::Emp
loyee Record Deletion:::");
emp.del();
cleardevice();
setcolor(6);
settextstyle(0,0,1.9);
int p,q;
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*
");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*
");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*
");
p=p+7;
}

p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*
");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
setcolor(1);
outtextxy(70,150,"Do you
want to delete another record(y/n)?");
cin>>ch;
}
break;
case 9:
while(ch=='y')
{
cleardevice();
setfillstyle(SOLID_FILL,
22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
outtextxy(180,25,":::Emp
loyee Record Search:::");
emp.search();
cleardevice();
setcolor(6);
settextstyle(0,0,1.9);
int p,q;
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*
");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*
");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*

");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*
");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
setcolor(2);
outtextxy(85,150,"Do you
want to search another record(y/n)?");
cin>>ch;
}
break;
case 10:break;
default:
cleardevice();
setcolor(5);
settextstyle(4,0,4);
outtextxy(90,70,"You have entered an invalid cho
ice.");
outtextxy(100,120,"Please enter your choice agai
n.");
getch();
}
break;
case 2:
cleardevice();
setcolor(12);
settextstyle(0,0,1.9);
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)

{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
setfillstyle(SOLID_FILL,28);
bar(60,140,590,110);
bar(60,400,590,370);
bar(30,400,60,110);
bar(560,400,590,110);
settextstyle(7,0,1);
outtextxy(75,180,"For any query related to Leave
Entry

Press 11");

Display

Press 12");

outtextxy(75,230,"For any query related to Leave


outtextxy(75,280,"To quit
Press 13");
while(!kbhit())
{
delay(1000);
setcolor(j);
settextstyle(4,0,4);
outtextxy(120,18,":::Employee Leave Reco
rd:::");
settextstyle(4,0,5);
outtextxy(10,415,"tp");
j++;
}
cin>>ch1;
switch(ch1)
{
case 11:
cleardevice();
setcolor(2);
settextstyle(0,0,1.9);
int p;
p=1;
int q;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;

while(q>1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
//outtextxy(200,25,":::Employee
Leave Record Entry:::");
setfillstyle(SOLID_FILL,18);
bar(60,140,590,110);
bar(60,400,590,370);
bar(30,400,60,110);
bar(560,400,590,110);
settextstyle(7,0,1);
setcolor(2);
outtextxy(195,180,"To enter casu
al leave record

Press 14");
outtextxy(195,210,"To enter sick

leave record

Press 15");

leave record

Press 16");

outtextxy(195,240,"To enter earn


outtextxy(195,270,"To quit
Press 17");
int j=1;
while(!kbhit())
{
delay(1000);
setcolor(j);
settextstyle(4,0,4);
outtextxy(120,18,":::Emp
loyee Leave Record Entry:::");
settextstyle(4,0,5);
outtextxy(10,415,"tp");
j++;
}
cin>>ch1;
switch(ch1)
{

case 14:
while(ch=='y')
{
cleardev
ice();
setfills
tyle(SOLID_FILL,22);
bar(0,46
8,639,479);
bar(0,9,
639,0);
settexts
tyle(4,0,1);
outtextx
y(120,25,":::Employee Casual Leave Record Entry:::");
cl.get_c
();
cleardev
ice();
settexts
tyle(0,0,1.9);
p=1;
q=478;
while(q>
5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>
1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<
625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<
632)
{
outtextxy(p,q,"*");
p=p+7;

}
line(0,4
79,0,0);
line(8,4
74,8,3);
line(631
,474,631,3);
line(639
,479,639,0);
line(8,1
0,631,10);
line(0,1
,639,1);
line(0,4
79,636,479);
line(8,4
70,631,470);
outtextx
y(40,150,"Entry has been made");
outtextx
y(80,180,"Do you want to enter another casual leave record(y/n)?");
cin>>ch;
}
break;
case 15:
while(ch=='y')
{
cleardev
ice();
setfills
tyle(SOLID_FILL,22);
bar(0,46
8,639,479);
bar(0,9,
639,0);
settexts
tyle(4,0,4);
outtextx
y(120,25,":::Employee Sick Leave Record Entry:::");
sl.get_s
();
cleardev
ice();
settexts
tyle(0,0,1.9);
p=1;
q=478;
while(q>
5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>
1)
{

outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<
625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<
632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,4
79,0,0);
line(8,4
74,8,3);
line(631
,474,631,3);
line(639
,479,639,0);
line(8,1
0,631,10);
line(0,1
,639,1);
line(0,4
79,636,479);
line(8,4
70,631,470);
setcolor
(8);
outtextx
y(40,150,"Entry has been made");
outtextx
y(80,180,"Do you want to enter another sick leave record(y/n)?");
cin>>ch;
}
break;
case 16:
while(ch=='y')
{
cleardev
ice();
setfills
tyle(SOLID_FILL,22);
bar(0,46
8,639,479);
bar(0,9,

639,0);
settexts
tyle(4,0,4);
outtextx
y(180,25,":::Employee Earn Leave Record Entry:::");
el.get_e
();
cleardev
ice();
settexts
tyle(0,0,1.9);
p=1;
q=478;
while(q>
5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>
1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<
625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<
632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,4
79,0,0);
line(8,4
74,8,3);
line(631
,474,631,3);
line(639
,479,639,0);
line(8,1

0,631,10);
line(0,1
,639,1);
line(0,4
79,636,479);
line(8,4
70,631,470);
setcolor
(9);
outtextx
y(40,150,"Entry has been made");
outtextx
y(80,180,"Do you want to enter another earn leave record(y/n)?");
cin>>ch;
}
break;
case 17:break;
default:
settextstyle(4,0,4);
setcolor(4);
outtextxy(90,70,"You have entered an invalid cho
ice.");
outtextxy(100,120,"Please enter your choice agai
n.");
getch();
}
break;
case 12:
cleardevice();
setcolor(9);
settextstyle(0,0,1.9);
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;

}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
setfillstyle(SOLID_FILL,25);
bar(60,140,590,110);
bar(60,400,590,370);
bar(30,400,60,110);
bar(560,400,590,110);
settextstyle(7,0,1);
outtextxy(100,170,"To see Casual
Leave Record

Press 18");
outtextxy(100,200,"To see Sick L

eave Record

Press 19");

eave Record

Press 20");

outtextxy(100,230,"To see Earn L


outtextxy(100,260,"To quit
Press 21");
while(!kbhit())
{
delay(1000);
setcolor(j);
settextstyle(4,0,4);
outtextxy(120,18,":::Emp
loyee Leave Record Display:::");
settextstyle(4,0,5);
outtextxy(10,415,"tp");
j++;
}
cin>>ch1;
switch(ch1)
{
case 18:
while(ch=='y')
{
cleardev
ice();
setfills
tyle(SOLID_FILL,22);
bar(0,46
8,639,479);
bar(0,9,
639,0);
settexts
tyle(4,0,4);
outtextx
y(200,25,":::Employee Casual Leave Record Display:::");
cl.show(
);
cleardev
ice();
setcolor
(6);
settexts
tyle(0,0,1.9);

int p,q;
p=1;
q=478;
while(q>
5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>
1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<
625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<
632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,4
79,0,0);
line(8,4
74,8,3);
line(631
,474,631,3);
line(639
,479,639,0);
line(8,1
0,631,10);
line(0,1
,639,1);
line(0,4
79,636,479);
line(8,4
70,631,470);
settexts
tyle(7,0,1);
setcolor

(5);
outtextx
y(15,150,"Do you want to see another casual leave record(y/n)?");
cin>>ch;
}
break;
case 19:
while(ch=='y')
{
cleardev
ice();
setfills
tyle(SOLID_FILL,22);
bar(0,46
8,639,479);
bar(0,9,
639,0);
settexts
tyle(4,0,4);
outtextx
y(120,25,":::Employee Sick Leave Record Display:::");
sl.show(
);
cleardev
ice();
setcolor
(6);
settexts
tyle(0,0,1.9);
int p,q;
p=1;
q=478;
while(q>
5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>
1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<
625)
{
outtextxy(p,q,"*");
p=p+7;
}

p=2;
q=3;
while(p<
632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,4
79,0,0);
line(8,4
74,8,3);
line(631
,474,631,3);
line(639
,479,639,0);
line(8,1
0,631,10);
line(0,1
,639,1);
line(0,4
79,636,479);
line(8,4
70,631,470);
settexts
tyle(7,0,1);
setcolor
(5);
outtextx
y(15,150,"Do you want to anothersee sick leave record(y/n)?");
cin>>ch;
}
break;
case 20:
while(ch=='y')
{
cleardevice();
setfillstyle(SOLID_FILL,22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,1);
outtextxy(200,25,":::Employee Earn Leave Record Display:::");
el.show();
cleardevice();
setcolor(6);
settextstyle(0,0,1.9);
int p,q;

p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);

line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
setcolor(2);
outtextxy(15,150,"Do you want to see another earn leave record (y/n)?");
cin>>ch;
}
break;
case 21:break;
default:
setcolor(4);
settextstyle(4,0
,4);
outtextx
y(90,70,"You have entered an invalid choice.");
outtextxy(100,120,"Please enter your choice agai
n.");
}
break;
case 13:break;
default:
setcolor(4);
settextstyle(4,0,4);
outtextxy(90,70,"You have entered an invalid cho
ice.");
outtextxy(100,120,"Please enter your choice agai
n.");
getch();
}
break;
case 3:
cleardevice();
setcolor(12);
settextstyle(0,0,1.9);
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");

q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
setfillstyle(SOLID_FILL,28);
bar(60,140,590,110);
bar(60,400,590,370);
bar(30,400,60,110);
bar(560,400,590,110);
settextstyle(7,0,1);
//
outtextxy(200,25,":::Employee Attendance
Record:::");
outtextxy(62,180,"To entre the attendance record
Press 22");
outtextxy(62,230,"To see the attendance record
Press 23");
outtextxy(62,280,"To quit
Press 24");
j=1;
while(!kbhit())
{
delay(1000);
setcolor(j);
settextstyle(4,0,4);
outtextxy(120,18,":::Employee Attendance
Record:::");
settextstyle(4,0,5);
outtextxy(10,415,"tp");
j++;
}
cin>>ch1;
switch(ch1)
{
case 22:
while(ch=='y')
{
cleardevice();
setfillstyle(SOLID_FILL,
22);

bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
outtextxy(120,25,":::Emp
loyee Attendance Record Entry:::");
attend.enter();
cleardevice();
setcolor(2);
settextstyle(0,0,1.9);
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*
");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*
");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*
");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*
");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
outtextxy(40,150,"Record
has been entered.");
outtextxy(40,180,"Do you
want to enter attendance of another employee(y/n)?");
cin>>ch;
}
break;
case 23:
while(ch=='y')
{

cleardevice();
setfillstyle(SOLID_FILL,
22);
bar(0,468,639,479);
bar(0,9,639,0);
settextstyle(4,0,4);
outtextxy(120,25,":::Emp
loyee Attendance Record Display:::");
attend.show();
cleardevice();
setcolor(6);
settextstyle(0,0,1.9);
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*
");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*
");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*
");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*
");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(7,0,1);
setcolor(5);
outtextxy(40,150,"Do you
want to see attendance of another employee(y/n)?");
cin>>ch;
}
break;
case 24:break;

default:
cleardevice();
setcolor(4);
settextstyle(4,0,4);
outtextxy(90,70,"You have entered an invalid cho
ice.");
outtextxy(100,120,"Please enter your choice agai
n.");
getch();
}
break;
case 4:break;
default:
cleardevice();
setcolor(4);
settextstyle(4,0,4);
outtextxy(90,70,"You have entered an invalid cho
ice.");
outtextxy(100,120,"Please enter your choice agai
n.");
getch();
}
cleardevice();
setcolor(6);
settextstyle(0,0,1.9);
setcolor(5);
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{
outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);

line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(4,0,4);
setcolor(1);
outtextxy(80,100,"Hit y to return to main menu.");
setcolor(9);
outtextxy(45,200,"Hit any key to quit program execution.");
cin>>ch;
for(long m=1;!kbhit();m++)
{
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
putpixel(random(700),random(480),0);
}
}
getch();
}
void function()
{
char code[40];
int n;
int k=50;
setcolor(6);
settextstyle(0,0,1.9);
int p,q;
p=1;
q=478;
while(q>5)
{
outtextxy(p,q,"*");
q=q-6;
}
p=631;
q=479;
while(q>1)
{

outtextxy(p,q,"*");
q=q-7;
}
p=7;
q=471;
while(p<625)
{
outtextxy(p,q,"*");
p=p+7;
}
p=2;
q=3;
while(p<632)
{
outtextxy(p,q,"*");
p=p+7;
}
line(0,479,0,0);
line(8,474,8,3);
line(631,474,631,3);
line(639,479,639,0);
line(8,10,631,10);
line(0,1,639,1);
line(0,479,636,479);
line(8,470,631,470);
settextstyle(4,0,04);
setbkcolor(15);
setcolor(5);
outtextxy(50,90,":::Please enter the password:::");
for(int i=0;code[i-1]!=13;i++)
{
code[i]=getch();
if(i!=0)
{
if(code[i]==8)
{
i=i-2;
}
else
{
setcolor(9);
outtextxy(k,130,"*");
}
}
else
{
setcolor(9);
outtextxy(50,130,"*");
}
k=k+19;
}
code[i-1]=NULL;
n=strcmp(code,password);
if(n!=0)
{
setcolor(4);
outtextxy(50,170,"You have entered a wrong password!!!");
getch();
exit(0);
}

else
{
setcolor(3);
outtextxy(50,170,"Password is correct");
outtextxy(50,205,"Now press any key to continue...");
getch();
}
int j=1;
for(int t=1;!kbhit();t++)
{
for(int k=2,l=474;k<=240;l--, k++)
{
bar(2,1,638,k);
delay(5);
bar(2,478,638,l);
delay(2);
}
settextstyle(0,0,1);
moveto(450,450);
setcolor(4);
outtext("Press any key to skip...");
for(k=240,l=240;k>3;k--,l++)
{
setcolor(6);
rectangle(5,l,635,k);
delay(5);
}
if(t<=2)
{
settextstyle(4,0,7);
setcolor(4);
outtextxy(165,205,"WELCOME");
}
if(t>2)
goto y;
}
getch();
y:
setfillstyle(SOLID_FILL,22);
floodfill(0,0,30);
/*delay(300);
settextstyle(4,0,7);
setcolor(4);
outtextxy(150,30,"Project Report");
delay(350);
moveto(250,100);
outtext(" On "); */
setcolor(1);
while(!kbhit())
{
delay(40);
setcolor(j);
moveto(10,430);
settextstyle(0,0,2);
outtext("tp");
moveto(20,50);
settextstyle(4,0,7);
outtext("Employee");

delay(80);
outtext(" Information");
/*setlinestyle();
line(20,50,);*/
delay(100);
moveto(30,230);
outtext("Management");
delay(120);
outtext(" System");
/*delay(1000);
settextstyle(11,0,01);
moveto(510,370);
setcolor(4);
outtext("SUBMITTED BY::");
moveto(525,390);
outtext("YOGITA");
delay(700);
outtext(" NEGI");
delay(500);
setcolor(4);
outtextxy(525,410,"B.TECH(CSE)");
outtextxy(495,430,"ROLL NO:10/CS117");
outtextxy(535,450,"BSAITM");
setcolor(15);*/
setcolor(1);
moveto(435,465);
settextstyle(11,0,.5);
outtext("Press any key to continue...");
j++;
}
getch();
}
void employee::entry()
{
char fl[100]="employee.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
fstream femp;
femp.open(path,ios::app);
if(femp==NULL)
{
cout<<"\n Employee file can not be created";
return;
}
cout<<"\nEnter id:";
cin>>emp_id;
/*int i=0;
while(femp.read((char*)&emp,sizeof(emp)))
{
i=emp.emp_id;
}
emp.emp_id=i+1;*/
time_t t=time(0);
struct tm *now=localtime(&t);
int c_yr=now->tm_year+1900;
int c_mon=now->tm_mon+1;
int c_day=now->tm_mday;
cout<<"Enter name";

cin>>name;
if(strlen(name)<3)
{
do
{
cout<<"Invalid name\nEnter the name again";
cin>>name;
}while(strlen(name)<3);
}
cout<<"Enter date of birth:";
cout<<"\nEnter day:";
cin>>emp_dob.day;
if(emp_dob.day>31)
{
do
{
cout<<"Invalid day\nEnter the day again";
cin>>emp_dob.day;
}while(emp_dob.day>31);
}
cout<<"Enter month:";
cin>>emp_dob.month;
if(emp_dob.month>12)
{
do
{
cout<<"Invalid month\nEnter the month again";
cin>>emp_dob.month;
}while(emp_dob.month>12);
}
cout<<"Enter year:";
cin>>emp_dob.yr;
if(emp_dob.yr>c_yr-18)
{
do
{
cout<<"Not eligible for job.\nIf you have entered wrong
yearthen enter the year again.";
cin>>emp_dob.yr;
}while(emp_dob.yr>c_yr-18);
}
cout<<"Enter address:";
cin>>address;
/*if(strlen(address)<10)
{
do
{
cout<<"There should be atleast 10 characters.\nEnter the
address again.";
cin>>address;
}while(strlen(address)<10);
} */
cout<<"Enter ph_no:";
cin>>ph_no;
/*if(strlen(ph_no)!=7||strlen(ph_no)!=10)
{
do
{
cout<<"There should be atleast 7 and atmost 10 digits.\n
Enter the phone no again.";

cin>>ph_no;
}while(strlen(ph_no)!=7||strlen(ph_no)!=10);
} */
cout<<"Enter the date of joining:";
cout<<"\nEnter day:";
cin>>emp_doj.day;
if(emp_doj.day>c_day)
{
do
{
cout<<"Invalid day.\nEnter the day again.";
cin>>emp_doj.day;
}while(emp_doj.day>c_day);
}
cout<<"Enter month:";
cin>>emp_doj.month;
if(emp_doj.month>c_mon)
{
do
{
cout<<"Invalid month.\nEnter the month again.";
cin>>emp_doj.month;
}while(emp_doj.month>c_mon);
}
cout<<"Enter year:";
cin>>emp_doj.yr;
if(emp_doj.yr<emp_dob.yr+18)
{
do
{
cout<<"Invalid year.\nEnter the year again.";
cin>>emp_doj.yr;
}while(emp_doj.yr<emp_dob.yr+18);
}
cout<<"Enter the name of department:";
cin>>dept;
if(strlen(dept)<7)
{
do
{
cout<<"There should be atleast 7 characters.\nEnter name
of department again.";
cin>>dept;
}while(strlen(dept)<7);
}
cout<<"Enter designation:";
cin>>post;
if(strlen(post)<7)
{
do
{
cout<<"There should be atleast 7 characters.\nEnter the d
esignation again.";
cin>>post;
}while(strlen(post)<7);
}
cout<<"Enter the name of reporting manager:";
cin>>r_manager;
if(strlen(r_manager)<3)
{

do
{
cout<<"There should be atleast 3 characters.\nEnter the n
ame of reporting manager again.";
cin>>r_manager;
}while(strlen(r_manager)<3);
}
cout<<"Enter the components of salary:";
cout<<"\nEnter basic salary:";
cin>>emp_salary.b_sal;
cout<<"Enter da:";
cin>>emp_salary.da;
cout<<"Enter hra:";
cin>>emp_salary.hra;
cout<<"Enter conveyance allowance:";
cin>>emp_salary.conv_allowance;
cout<<"Enter madical allowance:";
cin>>emp_salary.med_allowance;
cout<<"Enter acc_no:";
cin>>acc_no;
femp.write((char*)&emp,sizeof(emp));
femp.close();
char fl2[100]="c_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl2);
fstream fcl;
fcl.open(path,ios::app);
if(fcl==NULL)
{
cout<<"\nCasual leave file can't be opened.";
return;
}
cl.emp_id=emp.emp_id;
strcpy(cl.name,emp.name);
cl.leav_taken=0;
fcl.write((char*)&cl,sizeof(cl));
fcl.close();
char fl1[100]="s_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl1);
fstream fsl;
fsl.open(path,ios::app);
if(fsl==NULL)
{
cout<<"\nSick leave file can't be opened.";
return;
}
sl.emp_id=emp.emp_id;
strcpy(sl.name,emp.name);
sl.leav_taken=0;
fsl.write((char*)&sl,sizeof(sl));
fsl.close();
char fl3[100]="e_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl3);

fstream fel;
fel.open(path,ios::app);
if(fel==NULL)
{
cout<<"\nEarn leave file can't be opened.";
return;
}
el.emp_id=emp.emp_id;
strcpy(el.name,emp.name);
el.leav_taken=0;
fel.write((char*)&el,sizeof(el));
fel.close();
char fl4[100]="attend.txt";
sprintf(path,"%s\\%s",MYPATH,fl4);
fstream fattend;
fattend.open(path,ios::app);
if(fattend==NULL)
{
cout<<"\nAttendance file can't be opened.";
return;
}
attend.emp_id=emp.emp_id;
strcpy(attend.name,emp.name);
attend.att[11]=NULL;
fattend.write((char*)&attend,sizeof(attend));
fattend.close();
}
void employee::display()
{
char fl[100]="employee.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream femp;
femp.open(path);
if(femp==NULL)
{
cout<<"\nEmployee file can not be opened.";
return;
}
femp.seekg(0,ios::beg);
unsigned int x=femp.tellg();
femp.seekg(0,ios::end);
unsigned int y=femp.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nEmployee File is empty.";
getch();
femp.close();
return;
}
cout<<"\n"<<"ID"<<" "<<"NAME"<<" "<<"DOB"<<" "<<"ADDRESS"<<" "<<"PHONE N
O"<<" "<<"DOJ"<<" "<<"DEPT"<<" "<<"DESIGNATION"<<" "<<"REPORT_MANAGER"<<" "<<"SA
LARY"<<" "<<"ACC NO";
cout<<"\n-------------------------------------------------------------------------------";
femp.seekg(0);

femp.read((char*)&emp,sizeof(emp));
while(femp.gcount()!=0)
{
cout<<"\n"<<emp_id<<" "<<name<<" "<<emp_dob.month<<"/"<<emp_dob.
day<<"/"<<emp_dob.yr<<" "<<address<<"\t"<<ph_no<<" "<<emp_doj.month<<"/"<<emp_do
j.day<<"/"<<emp_doj.yr<<" "<<" "<<dept<<" "<<post<<" "<<r_manager<<" "<<(emp_sal
ary.b_sal+emp_salary.da+emp_salary.hra+emp_salary.conv_allowance+emp_salary.med_
allowance)<<" "<<acc_no;
cout<<"\n-------------------------------------------------------------------------------";
femp.read((char*)&emp,sizeof(emp));
}
femp.close();
getch();
}
void employee::modify()
{
char fl[100]="employee.txt";
sprintf(path1,"%s\\%s",MYPATH,fl);
ifstream femp;
femp.open(path1);
if(femp==NULL)
{
cout<<"\nFile employee can not be opened.";
return;
}
femp.seekg(0,ios::beg);
unsigned int x=femp.tellg();
femp.seekg(0,ios::end);
unsigned int y=femp.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nEmployee File is empty.";
getch();
femp.close();
return;
}
char fl1[100]="~mod_temp.txt";
sprintf(path,"%s\\%s",MYPATH,fl1);
fstream emp_mod;
emp_mod.open(path,ios::app);
if(emp_mod==NULL)
{
cout<<"\nTemporary modify file can not be opened";
return;
}
/*char fl2[100]="c_leav.txt";
sprintf(path1,"%s\\%s",MYPATH,fl2);
ifstream fcl;
fcl.open(path1);
if(fcl==NULL)
{
cout<<"\nFile employee can not be opened.";
return;
}
char fl3[100]="~mod_cas.txt";

sprintf(path,"%s\\%s",MYPATH,fl3);
fstream cas_mod;
cas_mod.open(path,ios::app);
if(cas_mod==NULL)
{
cout<<"\nTemporary modify file can not be opened";
return;
}
char fl4[100]="s_leav.txt";
sprintf(path1,"%s\\%s",MYPATH,fl4);
ifstream fsl;
fsl.open(path1);
if(fsl==NULL)
{
cout<<"\nFile employee can not be opened.";
return;
}
char fl5[100]="~mod_sick.txt";
sprintf(path,"%s\\%s",MYPATH,fl5);
fstream sick_mod;
sick_mod.open(path,ios::app);
if(sick_mod==NULL)
{
cout<<"\nTemporary modify file can not be opened";
return;
}
char fl6[100]="e_leav.txt";
sprintf(path2,"%s\\%s",MYPATH,fl6);
ifstream fel;
fel.open(path2);
if(fel==NULL)
{
cout<<"\nFile employee can not be opened.";
return;
}
char fl7[100]="~mod_earn.txt";
sprintf(path3,"%s\\%s",MYPATH,fl7);
fstream earn_mod;
earn_mod.open(path3,ios::app);
if(earn_mod==NULL)
{
cout<<"\nTemporary modify file can not be opened";
return;
}
earn_leav temp1;*/
int no,val,ch;
long int val1;
int i=0;
char field[20];
employee temp;
cout<<"\nEnter the id of the employee whose record u wanna modify:";
cin>>no;
femp.seekg(0);
femp.read((char*)&emp,sizeof(emp));
while(femp.gcount()!=0)
{
if(emp.emp_id!=no)
{

emp_mod.write((char*)&emp,sizeof(emp));
//earn_mod.write((char*)&el,sizeof(el));
}
else
{
temp.emp_id=emp.emp_id;
strcpy(temp.name,emp.name);
temp.emp_dob.day=emp.emp_dob.day;
temp.emp_dob.month=emp.emp_dob.month;
temp.emp_dob.yr=emp.emp_dob.yr;
temp.emp_doj.day=emp.emp_doj.day;
temp.emp_doj.month=emp.emp_doj.month;
temp.emp_doj.yr=emp.emp_doj.yr;
strcpy(temp.address,emp.address);
strcpy(temp.ph_no,emp.ph_no);
strcpy(temp.dept,emp.dept);
strcpy(temp.post,emp.post);
strcpy(temp.r_manager,emp.r_manager);
temp.emp_salary.b_sal=emp.emp_salary.b_sal;
temp.emp_salary.da=emp.emp_salary.da;
temp.emp_salary.hra=emp.emp_salary.hra;
temp.emp_salary.conv_allowance=emp.emp_salary.conv_allow
ance;
temp.emp_salary.med_allowance=emp.emp_salary.med_allowan
ce;
temp.acc_no=emp.acc_no;
/*strcpy(temp1.name,el.name);
temp1.leav_taken=el.leav_taken;
temp1.emp_id=el.emp_id;*/
time_t t=time(0);
struct tm *now=localtime(&t);
int c_yr=now->tm_year+1900;
int c_mon=now->tm_mon+1;
int c_day=now->tm_mday;
do
{
cout<<"Which field do u want to change\n1 name\n
2 address\n3 dept\n4 post\n5 DOB\n6 ph_no\n7 Reporting Manr\n8 Salary\n9 Bank Ac
count No\n10 DOJ\n11 Exit";
cin>>ch;
switch(ch)
{
case 1:
cout<<"Enter the modified name:"
;
cin>>field;
if(strlen(field)<3)
{
do
{
cout<<"Invalid n
ame\nEnter the name again";
cin>>field;
}while(strlen(field)<3);
}
strcpy(temp.name,field);
//strcpy(temp1.name,field);
break;
case 2:
cout<<"Enter the modified addres

s:";
cin>>field;
if(strlen(field)<10)
{
do
{
cout<<"There sho
uld be atleast 10 characters.\nEnter the address again.";
cin>>field;
}while(strlen(field)<10)
;
}
strcpy(temp.address,field);
break;
case 3:
cout<<"Enter the modified depart
ment:";
cin>>field;
if(strlen(field)<7)
{
do
{
cout<<"There sho
uld be atleast 7 characters.\nEnter the year again.";
cin>>field;
}while(strlen(field)<7);
}
strcpy(temp.dept,field);
break;
case 4:
cout<<"Enter the modified design
ation:";
cin>>field;
if(strlen(field)<7)
{
do
{
cout<<"There sho
uld be atleast 7 characters.\nEnter the designation again.";
cin>>field;
}while(strlen(field)<7);
}
strcpy(temp.post,field);
break;
case 5:
cout<<"Enter the modified date o
f birth:";
cout<<"\nEnter day:";
cin>>val;
if(val>31)
{
do
{
cout<<"Invalid day\nEnte
r the day again";
cin>>val;
}while(val>31);

}
temp.emp_dob.day=val;
cout<<"Enter month:";
cin>>val;
if(val>12)
{
do
{
cout<<"Invalid m
onth\nEnter the month again";
cin>>val;
}while(val>12);
}
temp.emp_dob.month=val;
cout<<"Enter year:";
cin>>val;
if(val>c_yr-18)
{
do
{
cout<<"Not eligible for
job.\nIf you have entered wrong yearthen enter the year again.";
cin>>val;
}while(val>c_yr-18);
}
temp.emp_dob.yr=val;
break;
case 6:
cout<<"Enter the modified phone
number";
cin>>field;
if(strlen(field)<7||strlen(field
)>10)
{
do
{
cout<<"There sho
uld be atleast 7 and atmost 10 digits.\nEnter the phone no again.";
cin>>field;
}while(strlen(field)<7||
strlen(field)>10);
}
strcpy(temp.ph_no,field);
break;
case 7:
cout<<"Enter the name of new rep
orting manager";
cin>>field;
if(strlen(field)<3)
{
do
{
cout<<"There sho
uld be atleast 3 characters.\nEnter the name of reporting manager again.";
cin>>field;
}while(strlen(field)<3);
}
strcpy(temp.r_manager,field);
break;

case 8:
cout<<"Enter the modified salary
";
cout<<"\nEnter basic salary:";
cin>>val1;
temp.emp_salary.b_sal=val1;
cout<<"Enter da:";
cin>>val1;
temp.emp_salary.da=val1;
cout<<"Enter hra:";
cin>>val1;
temp.emp_salary.hra=val1;
cout<<"Enter conv allowance:";
cin>>val1;
temp.emp_salary.conv_allowance=v
al1;
cout<<"Enter madical allowance:"
;
cin>>val1;
temp.emp_salary.med_allowance=va
l1;
break;
case 9:
cout<<"Enter the modified accoun
t number:";
cin>>val1;
temp.acc_no=val1;
break;
case 10:
cout<<"Enter the modified date o
f joining";
cout<<"\nEnter day:";
cin>>val;
if(val>c_day)
{
do
{
cout<<"Invalid d
ay.\nEnter the day again.";
cin>>val;
}while(val>c_day);
}
temp.emp_doj.day=val;
cout<<"Enter month:";
cin>>val;
if(val>c_mon)
{
do
{
cout<<"Invalid m
onth.\nEnter the month again.";
cin>>val;
}while(val>c_mon);
}
temp.emp_doj.month=val;
cout<<"Enter year:";
cin>>val;
if(val<emp_dob.yr+18)
{
do

{
cout<<"Invalid y
ear.\nEnter the year again.";
cin>>val;
}while(val<emp_dob.yr+18
);
}
temp.emp_doj.yr=val;
break;
default:
cleardevice();
setcolor(4);
settextstyle(4,0,4);
outtextxy(90,70,"You have entered an inv
alid choice.");
outtextxy(100,120,"Please enter your cho
ice again.");
getch();
case 11:break;
}
}while(ch!=11);
emp_mod.write((char*)&temp,sizeof(temp));
//earn_mod.write((char*)&temp1,sizeof(temp1));
i++;
}
femp.read((char*)&emp,sizeof(emp));
}
if(i==0)
{
cout<<"\nEmployee doesn't exist.";
getch();
femp.close();
remove(path);
//fel.close();
return;
}
femp.close();
emp_mod.close();
remove(path1);
rename(path,path1);
remove(path);
/*fel.close();
earn_mod.close();*/
remove(path2);
rename(path3,path2);
remove(path3);
}
void employee::del()
{
char fl[100]="employee.txt";
sprintf(path1,"%s\\%s",MYPATH,fl);
ifstream femp;
int i=0;
femp.open(path1);
if(femp==NULL)
{

cout<<"\nEmployee file can't be opened";


return;
}
femp.seekg(0,ios::beg);
unsigned int x=femp.tellg();
femp.seekg(0,ios::end);
unsigned int y=femp.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nEmployee File is empty.";
getch();
femp.close();
return;
}
char fl1[100]="~del_emp.txt";
sprintf(path,"%s\\%s",MYPATH,fl1);
ofstream emp_del;
emp_del.open(path);
if(emp_del==NULL)
{
cout<<"\nTemp delete file can't be created";
return;
}
int no;
cout<<"\nEnter the id of the employee whose record u waana delete:";
cin>>no;
femp.seekg(0);
femp.read((char*)&emp,sizeof(emp));
while(femp.gcount()!=0)
{
if(emp.emp_id!=no)
emp_del.write((char*)&emp,sizeof(emp));
else
{
i++;
}
femp.read((char*)&emp,sizeof(emp));
}
if(i==0)
{
cout<<"\nEmployee doesn't exist.";
getch();
femp.close();
remove(path);
return;
}
cout<<"\nRecord has been deleted.";
getch();
femp.close();
emp_del.close();
remove(path1);
rename(path,path1);
remove(path);
char fl2[100]="c_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl2);
ifstream fcl;

fcl.open(path);
if(fcl==NULL)
{
cout<<"\nCasual leave file can't be opened";
return;
}
char fl3[100]="~dtemp_c.txt";
sprintf(path1,"%s\\%s",MYPATH,fl3);
ofstream cl_del;
cl_del.open(path1);
if(cl_del==NULL)
{
cout<<"\nTemp del Casual leave file can't be opened";
return;
}
while(fcl.read((char*)&cl,sizeof(cl)))
{
if(cl.emp_id!=no)
cl_del.write((char*)&cl,sizeof(cl));
}
fcl.close();
cl_del.close();
remove(path);
rename(path1,path);
remove(path1);
char fl4[100]="s_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl4);
ifstream fsl;
fsl.open(path);
if(fsl==NULL)
{
cout<<"\nsick leave file can't be opened";
return;
}
char fl5[100]="~dtemp_s.txt";
sprintf(path1,"%s\\%s",MYPATH,fl5);
ofstream sl_del;
sl_del.open(path1);
if(sl_del==NULL)
{
cout<<"\nTemp del sick leave file can't be created";
fsl.close();
return;
}
while(fsl.read((char*)&sl,sizeof(sl)))
{
if(sl.emp_id!=no)
sl_del.write((char*)&sl,sizeof(sl));
}
fsl.close();
sl_del.close();
remove(path);
rename(path1,path);
remove(path1);
char fl6[100]="e_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl6);

ifstream fel;
fel.open(path);
if(fel==NULL)
{
cout<<"\nEarn leave file can't be opened";
return;
}
char fl7[100]="~dtemp_e.txt";
sprintf(path1,"%s\\%s",MYPATH,fl7);
ofstream el_del;
el_del.open(path1);
if(el_del==NULL)
{
cout<<"\nTemp del earn leave file can't be created";
fel.close();
return;
}
while(fel.read((char*)&el,sizeof(el)))
{
if(el.emp_id!=no)
el_del.write((char*)&el,sizeof(el));
}
fel.close();
el_del.close();
remove(path);
rename(path1,path);
remove(path1);
char fl8[100]="attend.txt";
sprintf(path,"%s\\%s",MYPATH,fl8);
ifstream fattend;
fattend.open(path);
if(fattend==NULL)
{
cout<<"\nAttendance file can't be opened";
return;
}
char fl9[100]="~dtemp_att.txt";
sprintf(path1,"%s\\%s",MYPATH,fl9);
ofstream del_fattend;
del_fattend.open(path1);
if(del_fattend==NULL)
{
cout<<"\nTemp attend file can't be created";
fattend.close();
return;
}
while(fattend.read((char*)&attend,sizeof(attend)))
{
if(attend.emp_id!=no)
del_fattend.write((char*)&attend,sizeof(attend));
}
fattend.close();
del_fattend.close();
remove(path);
rename(path1,path);
remove(path1);

}
void employee::search()
{
char fl[100]="employee.txt";
sprintf(path1,"%s\\%s",MYPATH,fl);
ifstream femp;
femp.open(path1);
if(femp==NULL)
{
cout<<"\nEmployee file can't be opened";
return;
}
femp.seekg(0,ios::beg);
unsigned int x=femp.tellg();
femp.seekg(0,ios::end);
unsigned int y=femp.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nEmployee File is empty.";
getch();
femp.close();
return;
}
int no;
cout<<"\nEnter the id of the employee whome do you want to search:";
cin>>no;
int i=0;
femp.seekg(0);
femp.read((char*)&emp,sizeof(emp));
while(femp.gcount()!=0)
{
if(emp.emp_id==no)
{
cout<<"\nName of the employee is:"<<name;
cout<<"\nDOB of the employee is:"<<emp_dob.month<<"/"<<e
mp_dob.day<<"/"<<emp_dob.yr;
cout<<"\nAddress of the employee is:"<<address;
cout<<"\nPhone no of the employee is:"<<ph_no;
cout<<"\nDOJ of the employee is:"<<emp_doj.month<<"/"<<e
mp_doj.day<<"/"<<emp_doj.yr;
cout<<"\nDepartment of the employee is:"<<dept;
cout<<"\nDesignation of the employee is:"<<post;
cout<<"\nReporting manager of the employee is:"<<r_manag
er;
cout<<"\nTotal salary of the employee is:"<<(emp_salary.
b_sal+emp_salary.da+emp_salary.hra+emp_salary.conv_allowance+emp_salary.med_allo
wance);;
cout<<"\nBank account number of the employee is:"<<acc_n
o;
getch();
i++;
}
femp.read((char*)&emp,sizeof(emp));
}
if(i==0)
{

cout<<"\nEmployee doesn't exist.";


getch();
femp.close();
return;
}
femp.close();
}
void cas_leav::get_c()
{
char fl[100]="c_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
fstream fcl;
fcl.open(path,ios::in);
if(fcl==NULL)
{
cout<<"\nCasual leave file can not be opened";
return;
}
char fl1[100]="~c_temp.txt";
sprintf(path1,"%s\\%s",MYPATH,fl1);
ofstream t_cl;
t_cl.open(path1);
if(t_cl==NULL)
{
cout<<"\nTemp Casual leave file can not be created";
fcl.close();
return;
}
cas_leav temp;
int no,lt;
cout<<"\n Enter the id of the employee casual whose leave record u want
to enter:";
cin>>no;
cout<<"\nEnter the number of leaves to be taken:";
cin>>lt;
int x=0;
while(fcl.read((char*)&cl,sizeof(cl)))
{
if(cl.emp_id==no)
{
if((lt+cl.leav_taken)>=cas_total)
{
cout<<"Leaves are exceeding the total limit.\nSo
leaves can't be granted.";
fcl.close();
remove(path1);
return;
}
else
{
temp.emp_id=cl.emp_id;
strcpy(temp.name,cl.name);
temp.leav_taken=lt+cl.leav_taken;
t_cl.write((char*)&temp,sizeof(temp)) ;
}
x++;
}

else
t_cl.write((char*)&cl,sizeof(cl));
}
if(x==0)
{
cout<<"\nEmployee doesn't exist.";
getch();
fcl.close();
remove(path1);
return;
}
fcl.close();
t_cl.close();
remove(path);
rename(path1,path);
remove(path1);
}
void sick_leav::get_s()
{
char fl1[100]="s_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl1);
ifstream fsl;
fsl.open(path);
if(fsl==NULL)
{
cout<<"\nSick leave file can not be opened";
return;
}
char fl[100]="~s_temp.txt";
sprintf(path1,"%s\\%s",MYPATH,fl);
ofstream t_sl;
t_sl.open(path1);
if(t_sl==NULL)
{
cout<<"\nTemp Sick leave file can not be created";
fsl.close();
return;
}
sick_leav temp;
int no,lt;
cout<<"\n Enter the id of the employee whose leave record u want to ente
r:";
cin>>no;
cout<<"\nEnter the number of leaves to be taken:";
cin>>lt;
int i=0;
while(fsl.read((char*)&sl,sizeof(sl)))
{
if(sl.emp_id==no)
{
if((lt+sl.leav_taken)>=sick_total)
{
cout<<"Leaves are exceeding the total limit.\nSo
leaves can't be granted.";

fsl.close();
remove(path1);
return;
}
else
{
temp.emp_id=sl.emp_id;
strcpy(temp.name,sl.name);
temp.leav_taken=lt+sl.leav_taken;
t_sl.write((char*)&temp,sizeof(temp)) ;
}
i++;
}
else
t_sl.write((char*)&sl,sizeof(sl)) ;
}
if(i==0)
{
cout<<"\nEmployee doesn't exist.";
getch();
fsl.close();
remove(path1);
return;
}
fsl.close();
t_sl.close();
remove(path);
rename(path1,path);
remove(path1);
}
void earn_leav::get_e()
{
char fl[100]="e_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream fel;
fel.open(path);
if(fel==NULL)
{
cout<<"\nEarn leave file can not be opened";
return;
}
char fl1[100]="~e_temp.txt";
sprintf(path1,"%s\\%s",MYPATH,fl1);
ofstream t_el;
t_el.open(path1);
if(t_el==NULL)
{
cout<<"\nTemp Earn leave file can not be created";
fel.close();
return;
}
earn_leav temp;
int no,lt;

cout<<"\n Enter the id of the employee whose leave record u want to ente
r:";
cin>>no;
cout<<"\nEnter the number of leaves to be taken:";
cin>>lt;
int x=0;
while(fel.read((char*)&el,sizeof(el)))
{
if(el.emp_id==no)
{
if((lt+el.leav_taken)>=earn_total)
{
cout<<"Leaves are exceeding the total limit.\nSo
leaves can't be granted.";
fel.close();
t_el.close();
return;
}
else
{
temp.emp_id=el.emp_id;
strcpy(temp.name,el.name);
temp.leav_taken=lt+el.leav_taken;
t_el.write((char*)&temp,sizeof(temp)) ;
}
x++;
}
else
t_el.write((char*)&el,sizeof(el)) ;
}
if(x==0)
{
cout<<"\nEmployee doesn't exist:";
getch();
fel.close();
remove(path1);
return;
}
fel.close();
t_el.close();
remove(path);
rename(path1,path);
remove(path1);
}
void cas_leav::show()
{
int i=0;
char ch;
int no;
char fl[100]="c_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream fcl;
fcl.open(path);
if(fcl==NULL)

{
cout<<"\nCasual leave file can't be opened";
return;
}
fcl.seekg(0,ios::beg);
unsigned int x=fcl.tellg();
fcl.seekg(0,ios::end);
unsigned int y=fcl.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nCasual Leave File is empty.";
getch();
fcl.close();
return;
}
cout<<"\nEnter the id of the employee whose leave record u want to see:"
;
cin>>no;
cout<<"\n"<<"EMP_ID"<<"\t"<<"NAME"<<"\t"<<"LEAVES TAKEN"<<"\t"<<"REMAINI
NG LEAVES";
fcl.seekg(0);
fcl.read((char*)&cl,sizeof(cl));
while(fcl.gcount()!=0)
{
if(cl.emp_id==no)
{
cout<<"\n"<<emp_id<<"\t"<<name<<"\t
"<<leav_taken<<"
\t
"<<(cas_total-leav_taken);
i++;
}
fcl.read((char*)&cl,sizeof(cl));
}
if(i==0)
{
cout<<"\nEmployee does not exist.";
getch();
fcl.close();
return;
}
fcl.close();
getch();
}
void sick_leav::show()
{
int i=0;
int no;
char fl[100]="s_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream fsl;
fsl.open(path);
if(fsl==NULL)
{
cout<<"\nSick leave file can't be opened";
return;
}
fsl.seekg(0,ios::beg);
unsigned int x=fsl.tellg();

fsl.seekg(0,ios::end);
unsigned int y=fsl.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nSick Leave File is empty.";
getch();
fsl.close();
return;
}
cout<<"\nEnter the id of the employee whose leave record u want to see:"
;
cin>>no;
cout<<"\n"<<"EMP_ID"<<"\t"<<"NAME"<<"\t"<<"LEAVES TAKEN"<<"\t"<<"REMAINI
NG LEAVES";
fsl.seekg(0);
fsl.read((char*)&sl,sizeof(sl));
while(fsl.gcount()!=0)
{
if(sl.emp_id==no)
{
\t

cout<<"\n"<<emp_id<<"\t"<<name<<"\t
"<<(sick_total-leav_taken);
i++;
}
fsl.read((char*)&sl,sizeof(sl));
}
if(i==0)
{
cout<<"\nEmployee does not exist.";
getch();
fsl.close();
return;
}
fsl.close();
getch();

}
void earn_leav::show()
{
int i=0;
int no;
char fl[100]="e_leav.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream fel;
fel.open(path);
if(fel==NULL)
{
cout<<"\nEarn leave file can't be opened";
return;
}
fel.seekg(0,ios::beg);
unsigned int x=fel.tellg();
fel.seekg(0,ios::end);
unsigned int y=fel.tellg();
unsigned int z=y-x;
if(z==0)
{

"<<leav_taken<<"

cout<<"\nEarn Leave File is empty.";


getch();
fel.close();
return;
}
cout<<"\nEnter the id of the employee whose leave record u want to see:"
;
cin>>no;
cout<<"\n"<<"EMP_ID"<<"\t"<<"NAME"<<"\t"<<"LEAVES TAKEN"<<"\t"<<"REMAINI
NG LEAVES";
fel.seekg(0);
fel.read((char*)&el,sizeof(el));
while(fel.gcount()!=0)
{
if(el.emp_id==no)
{
\t

cout<<"\n"<<emp_id<<"\t"<<name<<"\t
"<<(earn_total-leav_taken);
i++;
}
fel.read((char*)&el,sizeof(el));

"<<leav_taken<<"

}
if(i==0)
{
cout<<"\nEmployee does not exist.";
getch();
fel.close();
return;
}
fel.close();
getch();
}
void attendance::enter()
{
char fl[100]="attend.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream fattend1;
fattend1.open(path);
if(fattend1==NULL)
{
cout<<"\nAttendance file can not be opened";
return;
}
char fl1[100]="~attend_temp.txt";
sprintf(path1,"%s\\%s",MYPATH,fl1);
ofstream fattend2;
fattend2.open(path1);
if(fattend2==NULL)
{
cout<<"\nTemp Attendance file can not be created";
return;
}
int no,d_attend,d,m,y;
char atd[11];
cout<<"\nEnter the id of the employee whose leave record u want to enter
:";
cin>>no;

time_t t=time(0);
struct tm *now=localtime(&t);
int c_yr=now->tm_year+1900;
int c_mon=now->tm_mon+1;
int c_day=now->tm_mday;
cout<<"\nEnter the date:";
cout<<"Enter day:";
cin>>d;
if(d>c_day)
{
do
{
cout<<"Invalid day.\nEnter the day again.";
cin>>d;
}while(d>c_day);
}
cout<<"Enter month:";
cin>>m;
if(m>c_mon)
{
do
{
cout<<"Invalid month.\nEnter the month again.";
cin>>m;
}while(m>c_mon);
}
cout<<"Enter year:";
cin>>y;
if(y>c_yr)
{
do
{
cout<<"Invalid year.\nEnter the year again.";
cin>>y;
}while(y>c_yr);
}
cout<<"Enter the attendance of the employee:";
cin>>atd;
attendance temp;
int x=0;
while(fattend1.read((char*)&attend,sizeof(attend)))
{
if(attend.emp_id==no)
{
temp.emp_id=attend.emp_id;
strcpy(temp.name,attend.name);
strcpy(temp.att,atd);
temp.day=d;
temp.mon=m;
temp.yr=y;
fattend2.write((char*)&temp,sizeof(temp)) ;
x++;
}
else
{
fattend2.write((char*)&attend,sizeof(attend)) ;
}
}

if(x==0)
{
cout<<"\nEmployee doesn't exist.";
getch();
fattend1.close();
//remove(path1);
return;
}
fattend1.close();
fattend2.close();
remove(path);
rename(path1,path);
remove(path1);
}
void attendance::show()
{
int i=0;
int no;
char fl[100]="attend.txt";
sprintf(path,"%s\\%s",MYPATH,fl);
ifstream fattend;
fattend.open(path);
if(fattend==NULL)
{
cout<<"\nAttendance file can't be opened";
return;
}
fattend.seekg(0,ios::beg);
unsigned int x=fattend.tellg();
fattend.seekg(0,ios::end);
unsigned int y=fattend.tellg();
unsigned int z=y-x;
if(z==0)
{
cout<<"\nAttendance File is empty.";
getch();
fattend.close();
return;
}
cout<<"\nEnter the id of the employee whose attendance u want to see:";
cin>>no;
cout<<"\n"<<"EMP_ID"<<"\t"<<"NAME"<<"\t"<<"DATE"<<"\t"<<"ATTENDANCE";
fattend.seekg(0);
fattend.read((char*)&attend,sizeof(attend));
while(fattend.gcount()!=0)
{
if(attend.emp_id==no)
{
cout<<"\n"<<emp_id<<"\t"<<name<<"\t"<<mon<<"/"<<day<<"/"
<<yr<<" "<<att;
i++;
}
fattend.read((char*)&attend,sizeof(attend));
}
if(i==0)
{
cout<<"\nEmployee does not exixt.";

return;
}
fattend.close();
getch();
}

Anda mungkin juga menyukai