2. ACKNOWLEDGEMENT
I would like to convey my heartful thanks to
……………………… (Computer Science) who
always gave valuable suggestions & guidance for
completion of my project.
He helped me to understand & remember important
details of the project. My project has been a success
only because of his guidance.
I am especially indented & I am also beholden to my
friends. And finally I thank to the members of my
family for their support & encouragement.
3. CERTIFICATE
This is to certify that ……………………….. of
……… of
…………………………………………………
……. has completed his project under my
supervision. He has taken proper care & shown
sincerity in completion of this project.
I certify that this project is up to my
expectation & as per the guideline issued by
CBSE.
……………………………..
(Computer Science faculty )
5. This project BLOOD DONATION SYSTEM includes some facilities for
the patients to search and get the required blood from the blood
bank and if there is no blood available for the patients the
blood bank provide the other group blood that is compatible
for the patients and the patient can also search the donors
according to their blood group and can directly contact to the
donors also on the basis of city or blood group.
This software keep the records of all the donors and their
information about how many time they donated the blood to
the blood bank with the dates of donation of blood.
The blood bank keeps the records of the patient to whom the
blood is given for the future records if needed by the
management.
6. //***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include<ctype.h>
struct otherinfo
{
char mobno[15];
char email[70];
char bloodgroup[5];
char status;
};
//name structure
struct nameinfo
{
char fname[20];
char lname[20];
int age;
};
// address structure
struct address
{
int hno;
char city[35];
char state[15];
};
//date structure
struct dateinfo
{
int dd;
int mm;
int yy;
};
struct donardate
{
char donarreg[25];
dateinfo dt;
};
//******************FUNCTION PROTOTYPE****************
void intromain();
int getdonarno();
int checkpass();
8. intromain();
gotoxy(5,7);
cout<<"----------------The Blood Group System-------------------------";
gotoxy(2,8);
cout<<"There are four major blood groups determined by the presence or";
gotoxy(2,9);
cout<<"absence of two antigens – A and B – on the surface of red blood cells:";
gotoxy(2,11);
cout<<"Group A – has only the A antigen on red cells (and B antibody in the plasma)";
gotoxy(2,13);
cout<<"Group B – has only the B antigen on red cells (and A antibody in the plasma)";
gotoxy(2,15);
cout<<"Group AB – has both A and B antigens on red cells (but neither A nor B antibody in the plasma)";
gotoxy(2,18);
cout<<"Group O – has neither A nor B antigens on red cells (but both A and B antibody are in the plasma)";
gotoxy(5,20);
cout<<"================================================================";
objiff.close();
}
//***************donar's class**********************************
class donar
{
int dono;
char donar_regist[15];
nameinfo nm;
address add;
dateinfo date1;
otherinfo other;
public:
donar()
{
dono=0;
};
//*********set all the variables
void setfullname(nameinfo n)
{
strcpy(nm.fname,n.fname);
strcpy(nm.lname,n.lname);
}
void setage(int ag)
{
nm.age=ag;
}
void setaddress(address ad1)
{
add.hno=ad1.hno;
strcpy(add.city,ad1.city);
strcpy(add.state,ad1.state);
}
void setmobileno(char mb[15])
{
strcpy(other.mobno,mb);
}
void setemail(char eid[75])
{
strcpy(other.email,eid);
}
void setblodgrp(char bg[5])
{
strcpy(other.bloodgroup,bg);
}
//*********set all the variables
char *getdonarreg()
10. gotoxy(15,19);
cin>>other.mobno;
gotoxy(1,20);
cout<<"E-MAIL(IF NO ENTER "NO"):";
gotoxy(30,20);
cin>>other.email;
if(strcmp(other.email,"NO")==0||strcmp(other.email,"no")==0)
strcpy(other.email,"NO EMAIL ID");
gotoxy(1,21);
cout<<"BLOOD GROUP(A+ , A- , B+ , B- , O+ , O- , AB+ , AB- ):";
gotoxy(5,22);
cin>>other.bloodgroup;
other.status='Y';
}
//input fuction for donar information
//****************display donars information in a box
void display_donar_rectangle()
{
gotoxy(5,7);
cout<<"======================================================================";
gotoxy(1,8);
cout<<"DONAR REG:";
gotoxy(12,8);
cout<<donar_regist;
gotoxy(25,8);
cout<<"NAME:";
gotoxy(30,8);
cout<<" "<<nm.fname;
gotoxy(40,8);
cout<<"- "<<nm.lname;
gotoxy(60,8);
cout<<"AGE:";
gotoxy(65,8);
cout<<nm.age;
gotoxy(1,9);
cout<<"ADDRESS::";
gotoxy(10,9);
cout<<add.hno<<"-";
gotoxy(15,9);
cout<<add.city;
cout<<","<<add.state;
gotoxy(1,10);
cout<<"MOBILE NO:";
gotoxy(12,10);
cout<<other.mobno;
gotoxy(1,11);
cout<<"E-MAIL:";
gotoxy(10,11);
cout<<other.email;
gotoxy(40,10);
cout<<"BLOOD GROUP:";
gotoxy(60,10);
cout<<other.bloodgroup;
gotoxy(5,12);
cout<<"======================================================================";
}
//****************show all donars with blood groups row wise
void showalldonarsrowwise(int c)
{
gotoxy(1,c);
cout<<donar_regist<<setw(8)<<nm.fname<<"-"<<nm.lname<<setw(10)<<nm.age<<setw(5)<<add.hno<<"-"<<add.city<<","<<a
dd.state<<setw(15)<<other.mobno<<setw(5)<<other.bloodgroup;
gotoxy(1,c+1);
cout<<"------------------------------------------------------------------------";
}
//****************show all donars with blood groups row wise
11. int getdono()
{
return dono;
}
char *getfname()
{
return nm.fname;
}
char *getgroup()
{
return other.bloodgroup;
}
char *getcity()
{
return add.city;
}
char getstatus()
{
return other.status;
}
};
//***************donar's class**********************************
//**************
//***************patient's class**********************************
class patient
{
char pno[15];
nameinfo pnm;
address padd;
otherinfo pother;
int no_of_bottle;
dateinfo pdate1;
public:
//****************show all donars with blood groups row wise
void showallpatientsrowwise(int c)
{
gotoxy(1,c);
cout<<pno<<setw(8)<<pnm.fname<<"-"<<pnm.lname<<setw(10)<<pnm.age<<setw(5)<<padd.hno<<"-"<<padd.city<<","<<pad
d.state<<setw(15)<<pother.mobno<<setw(5)<<pother.bloodgroup;
gotoxy(1,c+1);
cout<<"------------------------------------------------------------------------";
}
//****************show all donars with blood groups row wise
//input fuction for patients information
void create_patient(char bloodgr[5])
{
gotoxy(5,7);
cout<<"====================PATIENT'S INFORMATION==============================";
gotoxy(1,8);
cout<<"PAT.NO:";
gotoxy(10,8);
cin>>pno;
gotoxy(20,8);
cout<<"FIRST NAME:";
gotoxy(32,8);
cin>>pnm.fname;
gotoxy(48,8);
cout<<"LAST NAME:";
gotoxy(60,8);
cin>>pnm.lname;
gotoxy(10,9);
cout<<"AGE:";
gotoxy(20,9);
cin>>pnm.age;
gotoxy(10,10);
cout<<"-----------------PATIENT'S ADDRESS DETAIL'S---------------------";
12. gotoxy(1,12);
cout<<"HOUSE NO:";
gotoxy(12,12);
cin>>padd.hno;
gotoxy(18,12);
cout<<"ADDRESS:";
gotoxy(30,12);
cin>>padd.city;
gotoxy(55,12);
cout<<"STATE:";
gotoxy(65,12);
cin>>padd.state;
gotoxy(10,14);
cout<<"-----------------DATE OF BLOOD GIVEN TO PATIENT--------------------";
gotoxy(10,15);
cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,15);
cin>>pdate1.dd;
gotoxy(35,15);
cout<<"/";
gotoxy(40,15);
cin>>pdate1.mm;
gotoxy(45,15);
cout<<"/";
gotoxy(50,15);
cin>>pdate1.yy;
gotoxy(10,17);
cout<<"-----------------OTHER INFORMATION----------------------";
gotoxy(1,18);
cout<<"MOBILE NO:";
gotoxy(15,18);
cin>>pother.mobno;
gotoxy(1,19);
cout<<"E-MAIL(IF NO ENTER "NO"):";
gotoxy(30,19);
cin.getline(pother.email,70);
if(strcmp(pother.email,"NO")==0||strcmp(pother.email,"no")==0)
strcpy(pother.email,"NO EMAIL ID");
gotoxy(1,20);
no_of_bottle=1;
strcpy(pother.bloodgroup,bloodgr);;
pother.status='Y';
}
//input fuction for patients information
char *getpno()
{
return pno;
}
dateinfo getdate()
{
return pdate1;
}
int pdd()
{
return pdate1.dd;
}
int pmm()
{
return pdate1.mm;
}
int pyy()
{
return pdate1.yy;
}
char getstatus()
{
return pother.status;
13. }
};
//***************patient's class**********************************
//***************blood storage class**********************************
class bloodstore
{
int blstno;
char bloodgroup[5];
int qty;
char status;
public:
void add_bloodstore(int blno,char blgr[5],int qtty)
{
blstno=blno;
strcpy(bloodgroup,blgr);
qty=qtty;
status='Y';
}
void setbloodqty()
{
qty=qty+1;
}
int getblstno()
{
return blstno;
}
int getqty()
{
return qty;
}
char getstatus()
{
return status;
}
char *getbloodgroup()
{
return bloodgroup;
}
};
//***************blood storage class**********************************
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
void main()
{
char ch;
intro();
if(checkpass()==0)
{
do
{
//****************TEMPORARY***********************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================MAIN MENU====================";
gotoxy(28,7);
cout<<"01. BLOOD DONATION INFO./creating blood qty file";
gotoxy(28,8);
cout<<"02. ADMINISTRATOR";
gotoxy(28,9);
cout<<"03. EXIT";
gotoxy(20,10);
cout<<"==============================================";
gotoxy(25,12);
cout<<"Please Select Your Option (1-3) ";
gotoxy(30,14);
14. ch=getche();
switch(ch)
{
case '1': clrscr();
stockbloodonetime();
getch();
break;
case '2': admin_menu();
break;
case '3':exit(0);
default :cout<<"a";
}
}while(ch!='3');
}else
{
exit(0);
}
}
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
//***************main intro
void intromain()
{ clrscr();
gotoxy(1,2);
cout<<"*************************BLOOD******DONATION********SYSTEM********************";
gotoxy(1,3);
cout<<"******************************************************************************";
}
//***************main intro
//******************************login name and password****************
int checkpass()
{
char nm[20];
char pass[10];
clrscr();
intromain();
gotoxy(20,20);
cout<<"PLEASE ENTER THE USER NAME:";
gotoxy(20,21);
cin>>nm;
clrscr();
gotoxy(20,20);
cout<<"PLEASE ENTER THE PASSWORD:";
gotoxy(20,21);
cin>>pass;
if(strcmp(nm,"admin")==0 && strcmp(pass,"vicky")==0)
{
return 0;
}else
{
return 1;
}
}
//********************************************************************
//***************************************************************
// INTRODUCTION FUNCTION
//****************************************************************
void intro()
{ clrscr();
gotoxy(4,2);
cout<<"****************************BLOOD DONATION******************************";
gotoxy(12,4);
cout<<"===========================================================";
gotoxy(5,5);
cout<<"****************************S=Y=S=T=E=M********************************";
15. gotoxy(50,10);
cout<<"PROJECT:";
gotoxy(50,12);
cout<<"MADE BY : --------------------";
gotoxy(10,14);
cout<<"---------------CLASS : XII A--------------------";
getch();
}
//***************************************************************
// ADMINSTRATOR MENU FUNCTION
//****************************************************************
void admin_menu()
{
clrscr();
char ch2;
//int num;
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================ADMIN MENU====================";
gotoxy(22,7);
cout<<"1.DONAR INFORMATION";
gotoxy(22,8);
cout<<"2.BLOOD TO PATIENTS INFORMATION";
gotoxy(22,9);
cout<<"3.REPORTS";
gotoxy(22,10);
cout<<"4.BACK TO MAIN MENU";
gotoxy(22,11);
cout<<"Please Enter Your Choice (1-4) ";
gotoxy(22,12);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1':
donar_menu();
break;
case '2':
//*****************search for blood
char bldgroup[15];
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE BLOOD GROUP(QTY) TO BE SEARCHED(WITH COMPATIBILITY):";
gotoxy(55,9);
cin>>bldgroup;
//display_bloodavailable(bldgroup);
if(display_bloodavailable2(bldgroup)==0)
{
patients_menu(bldgroup);
}else
{
gotoxy(5,18);
cout<<"SORRY BLOOD NOT IN STOCK";
}
break;
case '3':
donar_report_menu();
break;
default:
cout<<"a";//admin_menu();
}
}
//***************************************************************
// DONARS INFORMATION ADD / MODIFY / DELETE
16. //****************************************************************
void donar_menu()
{
clrscr();
char ch2;
char regno[5];
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================DONAR'S MENU====================";
gotoxy(22,7);
cout<<"1.ADD DONAR INFORMATION";
gotoxy(22,8);
cout<<"2.MODIFY DONAR INFORMATION";
gotoxy(22,9);
cout<<"3.DELETE DONAR INFORMATION";
gotoxy(22,10);
cout<<"4.BACK TO MAIN MENU";
gotoxy(22,11);
cout<<"Please Enter Your Choice (1-4) ";
gotoxy(22,12);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1': clrscr();
donar_new_old();
break;
case '2':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED:";
gotoxy(55,9);
cin>>regno;
modify_donarinfo(regno);
break;
case '3':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED AND DELETE:";
gotoxy(55,9);
cin>>regno;
delete_donarinfo(regno);
break;
default:
cout<<"a";//admin_menu();
}
}
//***************************************************************
//*************donars registration or already registered
void donar_new_old()
{
clrscr();
char ch2;
//int num;
char regno[15];
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================DONAR'S MENU====================";
gotoxy(22,7);
cout<<"1.NEW DONAR REGISTRATION";
gotoxy(22,8);
17. cout<<"2.ALREADY REGISTERED";
gotoxy(22,9);
cout<<"3.BACK TO MAIN MENU";
gotoxy(22,10);
cout<<"Please Enter Your Choice (1-4) ";
gotoxy(22,11);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1': clrscr();
write_donars();
break;
case '2':
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================ALREADY REGISTERED====================";
gotoxy(5,7);
cout<<"ENTER THE DONARS REGISTERED NO:";
gotoxy(40,7);
cin>>regno;
write_donar_ALREDYREG(regno);
break;
default:
cout<<"a";//admin_menu();
}
}
//*************donars registration or already registered
//***************************************************************
// donar's reports
//****************************************************************
void donar_report_menu()
{
clrscr();
char ch2;
char regno[15];
char bldgroup[5],cty[35];
dateinfo dtvalue2;
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================REPORTS====================";
gotoxy(22,7);
cout<<"1.ALL DONAR INFORMATION BLOOD GROUP WISE";
gotoxy(22,8);
cout<<"2.ALL DONAR INFORMATION CITY WISE";
gotoxy(22,9);
cout<<"3.ALL BLOOD GROUP WITH AVAILABILITY";
gotoxy(22,10);
cout<<"4.DISPLAY DONAR INFORMATION WITH DATE OF DONATIONS";
gotoxy(22,11);
cout<<"5.DISPLAY PATIENTS INFORMATION WITH BLOOD INFO. DATE WISE";
gotoxy(22,12);
cout<<"6.DISPLAY BLOOD GROUP WITH QUANTITY";
gotoxy(22,13);
cout<<"7.BACK TO MAIN MENU";
gotoxy(22,14);
cout<<"Please Enter Your Choice (1-7) ";
gotoxy(22,15);
//**********************************************************
ch2=getche();
switch(ch2)
{
18. case '1':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE BLOOD GROUP TO BE SEARCHED(WITH COMPATIBILITY):";
gotoxy(55,9);
cin>>bldgroup;
displaybloodgroupwise(bldgroup);
break;
case '2':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE CITY WISE SEARCH OF DONARS:";
gotoxy(55,9);
cin>>cty;
searchdonarcitywise(cty);
break;
case '6':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE BLOOD GROUP(QTY) TO BE SEARCHED(WITH COMPATIBILITY):";
gotoxy(55,9);
cin>>bldgroup;
display_bloodavailable(bldgroup);
break;
case '4':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED:";
gotoxy(55,9);
cin>>regno;
displaydonarwithlist(regno);
break;
case '5':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE DATE OF BLOOD GIVEN TO PATIENTS:";
gotoxy(10,10);
cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,10);
cin>>dtvalue2.dd;
gotoxy(35,10);
cout<<"/";
gotoxy(40,10);
cin>>dtvalue2.mm;
gotoxy(45,10);
cout<<"/";
gotoxy(50,10);
cin>>dtvalue2.yy;
displaypatientdetails(dtvalue2);
break;
case '3':
display_bloodstock();
default:
cout<<"a";//admin_menu();
}
}
//*****************add new registered donars information
void write_donars()
{
ofstream objoff;
donar donarobj;
donardate donalist;
19. objoff.open("donars.dat",ios::binary|ios::app);
ofstream objofflist("donarlist.dat",ios::binary|ios::app);
clrscr();
intromain();
int rnn=getdonarno();
char getprv_regno[15];
strcpy(getprv_regno,getreg());
if(strcmp(getprv_regno,"NULL")!=0)
{
gotoxy(5,4);
cout<<"Previous REGNO: "<<getprv_regno;
}
if(rnn>10000)
{
rnn=1;
}
donarobj.create_donar(rnn);
objoff.write((char*)&donarobj,sizeof(donarobj));
//************write to donar list also
strcpy(donalist.donarreg,donarobj.getdonarreg());
donalist.dt=donarobj.getdate();
objofflist.write((char*)&donalist,sizeof(donalist));
objoff.close();
objofflist.close();
gotoxy(10,24);
cout<<"***************DONARS RECORD SAVED******************* ";
//********send the blood group to the bloodstock file
write_bloodstock(donarobj.getbloodname());
//************************************************
cin.ignore();
getch();
}
//*****************add new registered donars information
//************get thje donars last number****************
char *getreg()
{
ifstream objiff;
donar st;
int count=0;
char tmpregno[15];
objiff.open("donars.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
}
//**************temporary hiding these lines
while(objiff.read((char *) &st, sizeof(donar)))
{
count++;
}
//***********jump to the last line
objiff.seekg(count-sizeof(st),ios::beg);
objiff.read((char *) &st, sizeof(donar));
strcpy(tmpregno,st.getdonarreg());
objiff.close();
if(count!=0)
return tmpregno;
else
return "NULL";
}
//************get thje donars last number****************
//******************all the donars fuction details****************************
//******************generate the number
20. int getdonarno()
{
ifstream objiff;
donar st;
int count=0;
objiff.open("donars.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
}
//**************temporary hiding these lines
while(objiff.read((char *) &st, sizeof(donar)))
{
count++;
}
//***********jump to the last line
objiff.seekg(count-sizeof(st),ios::beg);
objiff.read((char *) &st, sizeof(donar));
count=st.getdono();
count++;
objiff.close();
return count;
}
//****************generate the donars number
//**************write the donars dates who is already registered
void write_donar_ALREDYREG(char rgno[15])
{
/*
struct donardate
{
char donarreg[25];
dateinfo dt;
};
*/
dateinfo date1;
donar dr;
int flag=0;
donardate donalist;
ifstream fp;
fp.open("donars.dat",ios::binary);
ofstream objoff("donarlist.dat",ios::binary|ios::app);
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),rgno)==0)
{
clrscr();
intromain();
dr.display_donar_rectangle();
flag=1;
strcpy(donalist.donarreg,dr.getdonarreg());
}
}
fp.close();
if(flag==0)
{cout<<"nnrecord not exist";
getch();
}else
{
gotoxy(5,14);
cout<<"ENTER THE DATE OF BLOOD DOATION:";
gotoxy(10,16);
21. cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,16);
cin>>date1.dd;
gotoxy(35,16);
cout<<"/";
gotoxy(40,16);
cin>>date1.mm;
gotoxy(45,16);
cout<<"/";
gotoxy(50,16);
cin>>date1.yy;
donalist.dt.dd=date1.dd;
donalist.dt.mm=date1.mm;
donalist.dt.yy=date1.yy;
objoff.write((char*)&donalist,sizeof(donalist));
objoff.close();
//********send the blood group to the bloodstock file
write_bloodstock(dr.getbloodname());
//************************************************
}
}
//**************write the donars dates who is already registered
//**********donar name and list of blood donation
void displaydonarwithlist(char rgno[15])
{
ifstream fp;
fp.open("donars.dat",ios::binary);
ifstream objiff("donarlist.dat",ios::binary);
donardate donalist;
donar dr;
int flag=-1;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),rgno)==0)
{
clrscr();
intromain();
dr.display_donar_rectangle();
flag=1;
strcpy(donalist.donarreg,dr.getdonarreg());
}
}
fp.close();
if(flag==1)
{
gotoxy(5,13);
cout<<"-------------------LIST OF BLOOD DONATED BY DONAR---------------------";
int c1=14;
int no1=1;
int y1=0;
while(objiff.read((char*)&donalist,sizeof(donardate)))
{
if(strcmp(rgno,donalist.donarreg)==0)
{
if(y1<=2)
{
donarlist(c1,donalist,y1,no1);
y1++;
no1++;
}else
22. {
y1=0;
c1++;
no1++;
}
}
}
}
objiff.close();
getch();
}
//**********donar name and list of blood donation
//************blood stock list
void display_bloodstock()
{
ifstream objiff("bloodstock.dat",ios::binary);
storeblood blstk;
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
int c1=5;
gotoxy(5,c1);
c1++;
cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY";
while(objiff.read((char*)&blstk,sizeof(blstk)))
{
gotoxy(5,c1);
cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty;
c1++;
}
objiff.close();
getch();
}
//************blood stock list
//*******************display blood group wise with compatibility
void displaybloodgroupwise(char bgp[5])
{
ifstream fp;
fp.open("donars.dat",ios::binary);
donar dr;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
int c1=7;
gotoxy(1,5);
cout<<"REG No."<<setw(15)<<"NAME OF DONAR"<<setw(5)<<"AGE"<<setw(12)<<"------
ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP";
gotoxy(1,6);
cout<<"========================================================================";
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),bgp)==0)
28. // fp.seekp(fpos-sizeof(donar),ios::beg);
dr.display_donar_rectangle();
fp.close();
//*******deletion of the records starts from here
gotoxy(1,15);
cout<<"*****************************************************************************";
gotoxy(5,16);
cout<<"======DO YOU WANT TO DELETE THE RECORDS GIVEN ABOVE[YES(Y) OR NO (N)========";
gotoxy(2,17);
cin>>ch;
if (toupper(ch)=='Y')
{
ofstream outFile;
outFile.open("Temp1.dat",ios::binary);
ifstream objiff("donars.dat",ios::binary);
objiff.seekg(0,ios::beg);
while(objiff.read((char *) &dr, sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),regno)!=0)
{
outFile.write((char *) &dr, sizeof(donar));
}
}
outFile.close();
objiff.close();
remove("donars.dat");
rename("Temp1.dat","donars.dat");
//againopenandclose();
gotoxy(30,20);
cout<<"----------------------------Record Deleted----------------------------------";
getch();
}
}
//***********************delete record ends************************************
}
//***************delete donars information
//****************modification of donar information
void modify_donarinfo(char regno[5])
{
char ch2;
clrscr();
intromain();
fstream fp;
fp.open("donars.dat",ios::binary|ios::in|ios::out);
//donardate donalist;
donar dr;
nameinfo nminfo;
address ad1;
char mb[15],eid[75],bg[5];
int fpos=-1,ag=0;
int flag=-1,flagblood=-1;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),regno)==0)
29. {
//clrscr();
//intromain();
//dr.display_donar_rectangle();
flag=1;
//strcpy(donalist.donarreg,dr.getdonarreg());
fpos=(int)fp.tellg();
break;
}
}
// fp.close();
if(flag==1)
{
fp.seekp(fpos-sizeof(donar),ios::beg);
dr.display_donar_rectangle();
//fp.write((char *) &dr, sizeof(donar));
//--------------------------------------------
gotoxy(20,13);
cout<<"==========DONAR'S MODIFICATION MENU====================";
gotoxy(22,14);
cout<<"1.MODIFY NAME";
gotoxy(22,15);
cout<<"2.MODIFY AGE";
gotoxy(22,16);
cout<<"3.MODIFY ADDRESS";
gotoxy(22,17);
cout<<"4.MODIFY MOBILE NO.";
gotoxy(22,18);
cout<<"5.MODIFY EMAIL";
gotoxy(22,19);
cout<<"6.MODIFY BLOOD GROUP";
//gotoxy(22,20);
//cout<<"7.BACK TO MAIN MENU";
gotoxy(22,21);
cout<<"Please Enter Your Choice (1-6) ";
gotoxy(22,22);
//**********************************************************
ch2=getche();
clrscr();
intromain();
dr.display_donar_rectangle();
switch(ch2)
{
case '1':
gotoxy(20,13);
cout<<"===ENTER THE FIRST NAME TO MODIFY: ";cin>>nminfo.fname;
gotoxy(20,14);
cout<<"===ENTER THE LAST NAME TO MODIFY: ";cin>>nminfo.lname;
dr.setfullname(nminfo);
break;
case '2':
gotoxy(20,13);
cout<<"===ENTER THE AGE TO MODIFY: ";cin>>ag;
dr.setage(ag);
break;
case '3':
gotoxy(20,13);
cout<<"===ENTER THE HNO TO MODIFY: ";cin>>ad1.hno;
gotoxy(20,14);
cout<<"===ENTER THE CITY TO MODIFY: ";cin>>ad1.city;
gotoxy(20,15);
cout<<"===ENTER THE STATE TO MODIFY: ";cin>>ad1.state;
dr.setaddress(ad1);
break;
case '4':
gotoxy(20,13);
30. cout<<"===ENTER THE MOBILE TO MODIFY: ";cin>>mb;
dr.setmobileno(mb);
break;
case '5':
gotoxy(20,13);
cout<<"===ENTER THE EMAIL TO MODIFY: ";cin>>eid;
dr.setemail(eid);
break;
case '6':
gotoxy(20,13);
cout<<"===ENTER THE BLOOD GROUP TO MODIFY: ";cin>>bg;
dr.setblodgrp(bg);
flagblood=1;
break;
default:
cout<<"a";//admin_menu();
}
fp.write((char *) &dr, sizeof(donar));
}
fp.close();
gotoxy(10,24);
if(flagblood==1)
{
gotoxy(20,15);
cout<<"old blood:"<<dr.getbloodname()<<" new blood::"<<bg;
write_bloodstock(bg);
decrease_bloodstock(dr.getbloodname());
flagblood=-1;
}
cout<<"*****************modified the record******************";
getch();
}
//****************increase the blood qty by 1
void write_bloodstock(char bldgr[5])
{
int fpos=-1;
fstream File;
storeblood st,tmp;
File.open("bloodstock.dat",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(File)
{
File.read((char *) &st, sizeof(storeblood));
if(strcmp(st.bloodgroup,bldgr)==0)
{ fpos=(int)File.tellg();
break;
}
}
File.seekp(fpos-sizeof(storeblood));
tmp=st;
tmp.qty=tmp.qty+1;
File.write((char *) &tmp, sizeof(storeblood));
File.close();
}
//****************************************************************************
//****************decrease the blood stock by 1******************************
31. //****************increase the blood qty by 1
void decrease_bloodstock(char bldgr[5])
{
int fpos=-1;
fstream File;
storeblood st,tmp;
File.open("bloodstock.dat",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(File.read((char *) &st, sizeof(storeblood)))
{
if(strcmp(st.bloodgroup,bldgr)==0)
{ fpos=(int)File.tellg();
break;
}
}
File.seekp(fpos-sizeof(storeblood),ios::beg);
tmp=st;
tmp.qty=tmp.qty-1;
File.write((char *) &tmp, sizeof(storeblood));
File.close();
}
//************************************************************************
//*************function to search for blood and compatibility and return true
int display_bloodavailable2(char blgrp[5])
{
int returnvalue=-1;
ifstream objiff("bloodstock.dat",ios::binary);
storeblood blstk;
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
//return;
}
clrscr();
intromain();
int c1=5;
gotoxy(5,c1);
c1++;
cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY";
while(objiff.read((char*)&blstk,sizeof(blstk)))
{
if( strcmp(blstk.bloodgroup,blgrp)==0 && blstk.qty>0)
{
gotoxy(5,c1);
cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty;
c1++;
returnvalue=0;
}
}
objiff.close();
//*******************main ends here
ifstream fp;
fp.open("bloodstock.dat",ios::binary);
storeblood dr;
gotoxy(1,c1);
cout<<"========================================================================";
33. {
if((strcmp(dr.bloodgroup,"A+")==0 || strcmp(dr.bloodgroup,"A-")==0 || strcmp(dr.bloodgroup,"B+")==0 ||
strcmp(dr.bloodgroup,"B-")==0 || strcmp(dr.bloodgroup,"O+")==0 || strcmp(dr.bloodgroup,"O-")==0 ||
strcmp(dr.bloodgroup,"AB-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for AB-
else if(strcmp(blgrp,"AB-")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"O-")==0 ||strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"B-")==0 ||
strcmp(dr.bloodgroup,"AB-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for O+
else if(strcmp(blgrp,"O+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for O-
else if((strcmp(blgrp,"O-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<"*****************ONLY O - *************************";
returnvalue=0;
}
//**************************ends here************************
fp.close();
return returnvalue;
//******************compatibility ends here
}
//*************function to search for blood and compatibility and return true
//************function to display all patients details date wise
void displaypatientdetails(dateinfo bgp)
{
ifstream fp;
fp.open("patientsinfo.dat",ios::binary);
patient dr;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
34. }
clrscr();
intromain();
//***********display date
gotoxy(10,5);
cout<<"DATE(dd/mm/yyyy): "<<bgp.dd<<"/"<<bgp.mm<<"/"<<bgp.yy;
//**********************
int c1=9;
gotoxy(1,6);
cout<<"REG No."<<setw(15)<<"NAME OF PATIENT"<<setw(5)<<"AGE"<<setw(12)<<"------
ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP";
gotoxy(1,7);
cout<<"========================================================================";
while(fp.read((char*)&dr,sizeof(patient)))
{
if(dr.pdd()==bgp.dd && dr.pmm()==bgp.mm && dr.pyy()==bgp.yy)
{
dr.showallpatientsrowwise(c1);
c1++;
}
}
fp.close();
getch();
}
//************function to display all patients details date wise
//***************************************************************
// patient's information
//***************************************************************
void patients_menu(char brg[5])
{
patient patobj;
ofstream objoff;
char getprv_patno[15];
objoff.open("patientsinfo.dat",ios::binary|ios::app);
//************************************************************
clrscr();
intromain();
strcpy(getprv_patno,getpatno());
if(strcmp(getprv_patno,"NULL")!=0)
{
gotoxy(5,4);
cout<<"Previous REGNO: "<<getprv_patno;
}
//**************************************
patobj.create_patient(brg);
objoff.write((char*)&patobj,sizeof(patient));
objoff.close();
//*********now decrease one from the stock of blood
clrscr();
intromain();
//***********check the available with compatibility and decrease one from it
display_bloodavailable(brg);
char blgroup[5];
//************************************************************************
gotoxy(10,15);
cout<<"Enter the blood group ::";
gotoxy(60,15);
cin>>blgroup;
decrease_bloodstock(blgroup);
//*********now decrease one from the stock of blood
getch();
}
//**************patient previous no
//************get thje donars last number****************
char *getpatno()
{
ifstream objiff;
35. patient st;
int count=0;
char tmpregno[15];
objiff.open("patientsinfo.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
}
//**************temporary hiding these lines
while(objiff.read((char *) &st, sizeof(patient)))
{
count++;
}
//***********jump to the last line
objiff.seekg(count-sizeof(st),ios::beg);
objiff.read((char *) &st, sizeof(patient));
strcpy(tmpregno,st.getpno());
objiff.close();
if(count!=0)
return tmpregno;
else
return "NULL";
}
//************get thje donars last number****************
//**************patient previous no
//******************all the donars fuction details****************************
40. REQUIREMENTS
HARDWARE REQUIRED
• Printer, to print the required documents of the project
• Compact Drive
• Processor : intel
• Ram : 512 MB or more than 512MB
• Harddisk : 80 GB or more than 80GB.
SOFTWARE REQUIRED
• Operating system : Windows XP
• Turbo C++, for execution of program and Ms word, for
presentation of output.
41. ADVANTAGES
• A patient does not need to wait in long queues.
• This software reduces paper work.
• It is easy to handle patient’s record.
• This software saves the time.
• Information of the donors stores permanently.
DISADVANTAGES
• This system suitable for only small blood banks.
• Online facility is not available.
42. CONCLUSION
This software is efficient in maintaining donor’s details and
can easily perform operations on blood donation’s records.
This software also reduces the work load of the blood bank
management to know how much blood is available and also
keep the records of how many patients get the blood from the
blood bank.
In future, this system can launch web site for easy online blood
banking system.
43. SYSTEM DESIGN
Then we began with the design phase of the system. System design is a solution, a
“HOW TO” approach to the creation of a new system. It translates system
requirements into ways by which they can be made operational. It is a
translational from a user oriented document to a document oriented
programmers. For that, it provides the understanding and procedural details
necessary for the implementation. Here we use Flowchart to supplement the
working of the new system. The system thus made should be reliable, durable and
above all should have least possible maintenance costs. It should overcome all the
drawbacks of the Old existing system and most important of all meet the user
requirements.