📄 main.cpp
字号:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<fstream.h>
#include<graphics.h>
#include<stdlib.h>
#include"header.h"
#include"textbox.h"
#include"user.cpp"
#include"user1.cpp"
/**************************************** */
void main()
{
graph();
loginmain();
}
/******************************************* */
int found=TRUE;
void loginmain()
{
mouse.hidemouseptr();
setbk();
setcolor(WHITE);
setfillstyle(SOLID_FILL,RED);
bar(400,getmaxy()-57,getmaxx()-35,getmaxy()-20);
/////////////////////////////////////////
button exittt(593,33,14,14);
exittt.tbutton(2);
exittt.show();
button abouttt(475,440,14,14);
abouttt.tbutton(2);
abouttt.show();
button helpttt(549,440,14,14);
helpttt.tbutton(2);
helpttt.show();
o.open("helpb.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){ cleardevice();outtextxy(200,200,"ERROR IN LOGON.DAT");getch();exit(1);}
o.read(picture,10000);
putimage(535,424,picture,0);
o.close();
o.open("about.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
o.read(picture,5000);
putimage(460,424,picture,0);
o.close();
rectangle(400,getmaxy()-57,getmaxx()-35,getmaxy()-20);
setcolor(BLACK);
rectangle(402,getmaxy()-55,getmaxx()-37,getmaxy()-22);
setcolor(WHITE);
line(getmaxx()-37,getmaxy()-55,getmaxx()-37,getmaxy()-22);
setcolor(BLACK);
line(getmaxx()-35,getmaxy()-57,getmaxx()-35,getmaxy()-20);
setcolor(WHITE);
line(402,getmaxy()-22,getmaxx()-37,getmaxy()-22);
setcolor(BLACK);
line(400,getmaxy()-20,getmaxx()-35,getmaxy()-20);
o.open("exit.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
o.read(picture,5000);
putimage(getmaxx()-60,18,picture,0);
o.close();
textbox id,pass;
button submit(245,300,245+87,322);
pass.settype(1);
setcolor(YELLOW);
id.setpoints(230,200); outtextxy(130,207,"EMP-ID :");
pass.setpoints(230,250); outtextxy(130,257,"PASSWORD :");
submit.tbutton(1);
id.show();
pass.show();
submit.show();
o.open("logon.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){ cleardevice();outtextxy(200,200,"ERROR IN LOGON.DAT");getch();exit(1);}
o.read(picture,5000);
o.close();
putimage(236,300,picture,0);
if(found==FALSE){settextstyle(0,0,0);setcolor(YELLOW);outtextxy(230,170,"INVALID : EMP-ID \\ PASSWORD");}
mouse.initmouse();
int rrr=NULL;
mouse.showmouseptr();
while(1)
{
mouse.getmousepos();
//printf("%d %d \r",globalx,globaly);
id.check();
pass.check();
if(submit.check()==TRUE)
{
delay(50);
rrr=current.search(id.readstring());
if(rrr==-1)
{//found=FALSE;cleardevice();
settextstyle(0,0,0);setcolor(YELLOW);outtextxy(230,170,"INVALID : EMP-ID \\ PASSWORD");
continue;
}
else
{
current.readfromdisk(rrr);
if(strcmp(current.password,pass.readstring())==0)
{
/************************************CALL THE FUNCTION HERE YOU WANT TO*/
if(strcmp(current.ID,"ADMINISTER")==0)
{
administer=WHITE;
administratormain();
return;
}
else
{
employee();
//personalmain();
return;
}
}
else
{
//found=FALSE;cleardevice();
//loginmain();return;
settextstyle(0,0,0);setcolor(YELLOW);outtextxy(230,170,"INVALID : EMP-ID \\ PASSWORD");
continue;
}
}
}
if(exittt.check()==TRUE)
{exit(1);
}
if(abouttt.check()==TRUE)
{
about();
return;
}
if(helpttt.check()==TRUE)
{
}
}
}
void employee()
{
mouse.hidemouseptr();
setbk();
settextstyle(0,0,2);
setcolor(YELLOW);
outtextxy(50,100,"WELCOME");
outtextxy(190,100,current.ID);
setcolor(BLACK);
button emppersonal(130,190,270,230);
button empworkflow(130,310,270,350);
button messageboard(380,190,520,230);
button logout(380,310,520,350);
button centre(325,180,330,360);
button left(120,270,280,275);
button right(370,265,530,270);
button rightu1(100,150,104,180);
button rightu2(100,150,130,155);
button leftu1(550,150,520,155);
button leftu2(550,150,555,180);
button leftd1(523,380,555,385);
button leftd2(550,350,555,380);
button rightd1(100,380,130,385);
button rightd2(100,380,105,350);
leftd2.show(4);
leftd1.show(4);
rightd2.show(4);
rightd1.show(4);
leftu1.show(4);
leftu2.show(4);
rightu2.show(4);
rightu1.show(4);
centre.show(4);
right.show(4);
left.show(4);
settextstyle(0,0,0);
setlinestyle(0,0,0);
//putimage(20,20,logo,0);
logout.show(4); setcolor(15); outtextxy(440,325,"Logout");
fstream o;
o.open("logout.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN LOGOUT.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(385,315,picture,0);
emppersonal.show(4); setcolor(15); outtextxy(185,205,"Personal");
o.open("per.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN PERS.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(136,195,picture,0);
empworkflow.show(4); setcolor(15); outtextxy(185,325,"Workflow");
o.open("work.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN WORK.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(133,313,picture,0);
messageboard.show(4); setcolor(15); outtextxy(435,205,"Messages");
o.open("mess.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN MESS.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(385,195,picture,0);
//putimage(0,getmaxy()-20,jr2,0);
while(1)
{
mouse.showmouseptr();
mouse.getmousepos();
/*centre.check();
right.check();
left.check();*/
if(emppersonal.check()==TRUE){
personalmain();
return;}
if(empworkflow.check()==TRUE){workflow();return;}
if(messageboard.check()==TRUE){/*mess.messages();return;*/}
if(logout.check()==TRUE)
{//administer=LIGHTGRAY;
current.writetodisk(current.RRN);
if(administer==WHITE){administratormain();}
else{loginmain();}
return;
}
}
}
void personalmain()
{
mouse.hidemouseptr();
setbk();
settextstyle(0,0,2);
setcolor(YELLOW);
outtextxy(60,80,current.ID);
//putimage(20,20,logo,0);
button top(95,100,545,105);
button left(80,120,85,405);
button down(95,425,545,430);
button right(560,120,565,405);
right.show(0);
down.show(0);
left.show(0);
top.show(0);
setcolor(BLACK);
setlinestyle(0,0,0);
button personal(130,150,240,185);
button family(130,220,240,255);
button payslip(130,290,240,325);
button medical(130,350,240,385);
button leave(400,150,510,185);
button loan(400,220,510,255);
button pf(400,290,510,325);
button pass(400,350,510,385);
settextstyle(0,0,0);
setcolor(15);
medical.show(4); setcolor(15); outtextxy(167,363,"MEDICAL");
pass.show(4); setcolor(15); outtextxy(445,363,"PASS.");
//putimage(404,355,backlog,0);
//button back(578,432,614,464);
//back.show(4);
button back(594,443,15,15);
back.tbutton(2);
back.show();
fstream o;
o.open("back.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
o.read(picture,10000);
o.close();
putimage(580,427,picture,0);
//putimage(580,427,picture,0);
//putimage(580,435,backlog,0);
pf.show(4); setcolor(15); outtextxy(445,303,"P.F.");
personal.show(4); setcolor(15); outtextxy(190,163,"SELF");
o.open("per.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN PERSON.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(132,152,picture,0);
family.show(4); setcolor(15); outtextxy(184,233,"FAMILY");
o.open("family.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN family.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(132,222,picture,0);
loan.show(4); setcolor(15); outtextxy(445,233,"LOAN");
leave.show(4); setcolor(15); outtextxy(445,163,"LEAVE");
payslip.show(4); setcolor(15); outtextxy(175,303,"PAYSLIP");
o.open("pay.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN pay.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(133,293,picture,0);
o.open("medical.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN medical.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(133,353,picture,0);
o.open("pf.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN pf.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(403,293,picture,0);
o.open("pass.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN pass.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(403,353,picture,0);
o.open("leav.dat",ios::in|ios::out|ios::binary|ios::nocreate|ios::noreplace);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN leav.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(402,152,picture,0);
//putimage(0,getmaxy()-20,jr2,0);
while(1)
{
mouse.showmouseptr();
mouse.getmousepos();
if(personal.check()==TRUE){current.spprofile();/*personalmain();*/return;}
if(family.check()==TRUE){current.sfprofile();/*personalmain();*/return;}
if(loan.check()==TRUE){current.sloandetails();/*personalmain();*/return;}
if(leave.check()==TRUE){current.sleavedetails();/*personalmain();*/return;}
if(payslip.check()==TRUE){current.spayslip();/*personalmain();*/return;}
if(medical.check()==TRUE){current.smedicaldetails();/*personalmain();*/return;}
if(back.check()==TRUE){employee();return;}
if(pf.check()==TRUE){current.sPF();/*personalmain();*/return;}
if(pass.check()==TRUE){changepassword();return;}
}
}
void modifyfamily()
{
mouse.hidemouseptr();
setbk();
int k=15;
button down(50,350,600,355);
down.show(0);
//putimage(20,20,logo,0);
textbox father,mother,nod,nof,nom,native;
settextstyle(0,0,0);
setcolor(RED);
char t[13],t0[13],t01[13],t1[13],t2[13],t3[13];
strcpy(t,current.father);
strcpy(t0,current.mother);
strcpy(t01,current.native);
itoa(current.NOD,t1,10);
itoa(current.NOF,t2,10);
itoa(current.NOM,t3,10);
father.setstring(t);
mother.setstring(t0);
native.setstring(t01);
nod.setstring(t1);
nof.setstring(t2);
nom.setstring(t3);
father.setpoints(170,150); setcolor(11); outtextxy(90,158,"FATHER");
mother.setpoints(170,210); outtextxy(90,218,"MOTHER");
nod.setpoints(170,270); outtextxy(80,278,"DEPENDANTS");
nof.setpoints(430,150); outtextxy(360,158,"MEMBERS");
nom.setpoints(430,210); outtextxy(360,218,"MINORS ");
native.setpoints(430,270); outtextxy(360,278,"NATIVE");
father.show(k);
mother.show(k);
native.show(k);
nod.show(k);
nof.show(k);
nom.show(k);
//button back(578,432,614,464);
//back.show(4);
button back(594,443,15,15);
back.tbutton(2);
back.show();
o.open("back.dat",ios::in|ios::out|ios::nocreate|ios::noreplace|ios::binary);
if(!o.good()){cleardevice();outtextxy(200,200,"ERROR IN BACK.DAT");getch();}
o.read(picture,10000);
o.close();
putimage(580,427,picture,0);
//putimage(580,427,picture,0);
//putimage(0,getmaxy()-20,jr2,0);
//button submit(285,400,385,430);
//button submit(260,350,370,383);
button submit(260,410,370,443);
submit.show(4);
setcolor(15);
outtextxy(320,422,"SUBMIT");
o.open("submit.dat",ios::in|ios::out|ios::binary|ios::noreplace|ios::nocreate);
o.read(picture,10000);
o.close();
putimage(263,412,picture,0);
//submit.show(4); // setcolor(15);outtextxy(328,413,"SUBMIT");
while(1)
{
mouse.showmouseptr();
father.check(4,15);
mother.check(4,15);
nod.check(4,15);
nof.check(4,15);
nom.check(4,15);
native.check(4,15);
if(submit.check()==TRUE)
{current.gfprofile(father.readstring(),mother.readstring(),nod.readnumber(),nof.readnumber(),nom.readnumber(),native.readstring());
current.sfprofile();
return;
}
if(back.check()==TRUE)
{current.sfprofile();}
}
}
void newusermain()
{
mouse.hidemouseptr();
setbk();
button submit(260,350,370,383);
submit.show(4);
setcolor(15);
outtextxy(320,362,"SUBMIT");
o.open("submit.dat",ios::in|ios::out|ios::binary|ios::noreplace|ios::nocreate);
o.read(picture,10000);
o.close();
putimage(263,352,picture,0);
textbox id,pass,repass;
pass.settype(1);
repass.settype(1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -