Anda di halaman 1dari 37

OF

BLOOD BANK AUTOMATION SYSTEM

SUBMITTED BY: NAME: ajay kumar RUCHIKA DHALL REGD NO. : 11203127 ROLL NO. : a26 SECTION:1206a

SUBMITTED TO:

ACKNOWLEDGEMENT
I take this opportunity to present my votes of thanks to all those guidepost who really acted as lightening pillars to enlighten our way throughout this project that has led to successful and satisfactory completion of this study. . We are highly thankful to Mr . AWADESH SIR for his active support, valuable time and advice, whole-hearted guidance, sincere cooperation and pains-taking involvement during the study and in completing the assignment of preparing the said project within the time stipulated. Lastly, We are thankful to all those, particularly the various friends , who have been instrumental in creating proper, healthy and conductive environment and including new and fresh innovative ideas for us during the project, their help, it would have been extremely difficult for us to prepare the project in a time bound framework.

TABLE OF CONTENTS INTRODUCTION SOURCE CODE TESTING FUTURE SCOPE OF PROJECT

INTRODUCTION

In the existing system, most of the records are maintained on paper. It becomes very inconvenient to modify the data. In the existing system, here is a possibility that the same data in different registers may have different values which means the entries of the same data do not match. This inconsistent state does not supply the concrete information which poses a problem in the case information related to particular search record. Our project is very useful. User is no longer required to check his register in search of records, as now it can be searched over the software by choosing some options. The user need not to type in most of the information. He/she is just required to enter the desired options. On the whole it liberates the user from keeping lengthy manual records. In a nutshell, it abates the work load of an organization. In todays world, no one likes to perform calculations on calculator or manually when computer is there. Every one wants his/her work to be done by computer automatically and displaying the result for further manipulations.

This term paper project is just an application of the language C in developing softwares.This is the program for keeping records of Blood bank automation system, that is the entire details of the Donor ,Members ,how much blood he/she donate , etc.

DEFINITION OF BLOOD BANK BLOOD BANK:


A place where the blood is collected from donars,

typed,separated into components, stored and prepared for transfusion to recipients. A blood bank may be a separate free- standing facility or part of a larger laboratory in a hospital.

Seperation of blood: Typically, each donated unit of blood (whole blood) is


separated into multiple components, such as red blood cells, plasma and platelets. Each component is generally transfused to a different individual, each with different needs. As increasingly common blood bank procedure is apheresis, or the process of removing a specific component of the blood, such as platelets, and returning the remaining components, such as red blood cell and plasma, to the donor. This process allows more of one particular part of the blood to be collected than could be separated from a unit of whole blood. Apheresis is also performed to collect plasma (the liquid part of the blood) and granulocytes (white blood cells).

Who receives blood: Accident victims, people undergoing surgery and


patients receiving treatment for leukemia, cancer or other diseases, such as sickle cell diseases and thalassemia, all utilize blood. Over 20 million units of blood components are transfused every year in the US.

Giving blood to yourself: Patients scheduled for surgery may be eligible to


donate blood for themselves, a process known as autologous blood donation. In

the weeks before non-emergency surgery, an autologous donor may be able to donate blood that will be stored until the surgical procedure .

Typing and testing blood: After blood is drawn, it is tested for the ABO blood
group type and the Rh type (positive or negative), as well as for any unexpected red blood cell antibodies that may cause problems in the recipient. Screening tests are also performed for evidence of donor infection with hepatitis viruses B and C, human immunodeficiency viruses (HIV) 1 and 2, human T-lymphotropic viruses (HTLV) I and II and syphilis.

Storage of blood: Each unit of whole blood is normally separated into several
components. Red blood cells may be stored under refrigeration for a maximum of 42 days, or they may be frozen for up to 10 years. Red cells carry oxygen and are used to treat anemia. Platelets are important in the control of bleeding and are generally used in patients with leukemia and other forms of cancer. Platelets are stored at room temperature and may be kept for a maximum of five days. Fresh frozen plasma, used to control bleeding due to low levels of some clotting factors, is usually kept in the frozen state for up to one year. Cryoprecipitated AHF, which contains only a few specific clotting factors, is made from fresh frozen plasma and may be stored frozen for up to one year. Granulocytes are sometimes used to fight infections, although their efficacy is not well-established. They must be transfused within 24 hours of donation .

Other blood products: Other products derived from blood include albumin,
immune globulin, specific immune globulins and clotting factor concentrates. These blood products are commonly made by commercial manufacturers.

American Association of Blood Banks (AABB): The AABB is a key


international association of blood banks, including hospital and community blood centers, transfusion and transplantation services and individuals involved in transfusion and transplantation medicine. The AABB establishes the standards of

care for patients and donors in all aspects of blood banking; transfusion medicine; hematopoietic, cellular and gene therapies; and tissue transplantation. More than 2000 community and hospital blood banks, hospital transfusion services and laboratories and over 8000 individuals from the US and 80 countries outside the US make up the AABB.

SOURCE CODE
//Header Files #include <dos.h> #include <stdio.h> #include <ctype.h> #include <conio.h> #include <stdlib.h> #include <string.h> #include <graphics.h> #include"d:\project\box.cpp" //Defination of macros #define NUM 5 #define PH 8 #define MPH 12

#define MIN 30 #define MAX 61 #define BLOOD 4 #define StructLength sizeof(rec); //Decleration of functions void add(); void view(); void viewall(); void Statistics(); void searchname(); void searchblood(); void searchid(); void c_name(); void c_fname(); void c_add(); void c_blood(); void c_ph(); void c_mph(); void del(); int date(void); //Checks the validtity of functions void check_id(char *,int); void check_name(char *,int); void check_add(char *,int); void check_blood(char *,int); void check_phone(char *,int); void check_mphone(char *,int); int duplicate(char idno[]); //Miscleneous functions void empty(); void highlight(int); void showmenu (); void showsearch(); void showview(); void showmodify(); void mainmenu(); void searchmain(); void modifymenu(); void viewmenu(); void highlightsearch(int); void highlightview(int); void highlightmodify(int); void about(); void cls (); //Main menu void main() { //image(); //loader(); mainmenu(); }

void mainmenu() { int count=1; char ch; textcolor(15); textbackground(0); clrscr(); showmenu(); highlight(1); _setcursortype(_NOCURSOR); //To disable the cursor //Arrow key functions while(1) { ch=getch(); switch(ch) { case 80: count++; if(count==8)count=1; break; case 72: count--; if(count==0)count=7; break; } showmenu(); highlight(count); //Enter function if(ch=='\r') { cls(); if(count==7)abort(); if(count==1)add(); if(count==2)viewmenu(); if(count==3)searchmain(); if(count==4)del(); if(count==5)modifymenu(); if(count==6)about(); } } } //Main menu void showmenu(void) { char *ch[]={"Add New Record"," View Record ","Search Record ","Delete Record ","Modify Record ","About Program "," Exit "}; textcolor(7); box(29,4,49,6); gotoxy(30,5); printf("++++ MAIN MENU ++++");

textbackground(0); box(29,7,49,15); for(int i=0;i<7;i++) { gotoxy(30,8+i); cprintf(" %s ",ch[i]); } } //Highliting menu void highlight(int item) { textcolor(WHITE); textbackground(2); switch (item) { case 1: gotoxy(30,8); cprintf(" Add New Record "); break; case 2: gotoxy(30,9); cprintf(" View Record "); break; case 3: gotoxy(30,10); cprintf(" Search Record "); break; case 4: gotoxy(30,11); cprintf(" Delete Record "); break; case 5: gotoxy(30,12); cprintf(" Modify Record "); break; case 6: gotoxy(30,13); cprintf(" About Program "); break; case 7: gotoxy(30,14); cprintf(" Exit "); break; } } //Clear box function void cls(void) { textbackground(0); textcolor(15); for(int c=1;c<79;c++)

for(int r=1;r<24;r++) { gotoxy(c,r); cprintf(" "); } } //Show search menu function void showsearch(void) { char *ch[]={"Search By Mebmer ID"," Search By Name "," Search By B Group "," \x11 \x11 \x11 BACK "}; textcolor(7); box(29,4,49,6); gotoxy(30,5); printf(" +++SEARCH MENU+++ "); box(29,7,49,15); textbackground(0); for(int i=0;i<4;i++) { gotoxy(30,8+i); cprintf("%s",ch[i]); } } //Highlighting search menu function void highlightsearch(int item) { textcolor(WHITE); textbackground(GREEN); switch (item) { case 1: gotoxy(30,8); cprintf("Search By Mebmer ID"); break; case 2: gotoxy(30,9); cprintf(" Search By Name "); break; case 3: gotoxy(30,10); cprintf(" Search By B Group "); break; case 4: gotoxy(30,11); cprintf(" \x11 \x11 \x11 BACK "); break; } } void searchmain() { int count=1;

char ch; textcolor(WHITE); textbackground(0); clrscr(); showsearch(); highlightsearch(1); _setcursortype(_NOCURSOR); //Swting Up the Arrow Key Function while(1) { ch=getch(); switch(ch) { case 80: count++; if(count==5)count=1; break; case 72: count--; if(count==0)count=4; break; } showsearch(); highlightsearch(count); if(ch=='\r') { cls(); if(count==1){searchid();} if(count==2){searchname();} if(count==3){searchblood();} if(count==4)mainmenu();break;} } } void modifymenu() { int count=1; char ch; textcolor(WHITE); textbackground(0); clrscr(); showmodify(); highlightmodify(1); _setcursortype(_NOCURSOR); while(1) { ch=getch(); switch(ch) { case 80:

count++; if(count==8)count=1; break; case 72: count--; if(count==0)count=7; break; } showmodify(); highlightmodify(count); //Setting Up Enter Function if(ch=='\r') { cls(); if(count==7){mainmenu();} if(count==1){c_name();} if(count==2){c_fname();} if(count==3){c_add();} if(count==4){c_ph();} if(count==5){c_mph();} if(count==6){c_blood();} } } } //Making Menu void showmodify(void) { char *ch[]={"Change Name ","Change Father Name ","Change Address ","Change Phone No. ","Change Mobile No. ","Change Blood Group "," \x11 \x11 \x11 BACK "}; textcolor(7); box(29,4,49,6); gotoxy(30,5); printf("+++ MODIFY MENU +++"); box(29,7,49,15); textbackground(0); for(int i=0;i<7;i++) { gotoxy(30,8+i); cprintf("%s",ch[i]); } } //Highliting Menu void highlightmodify(int item) { textcolor(WHITE); textbackground(GREEN); switch (item) { case 1:

gotoxy(30,8); cprintf("Change Name break; case 2:

");

gotoxy(30,9); cprintf("Change Father Name "); break; case 3: gotoxy(30,10); cprintf("Change Address break; case 4: gotoxy(30,11); cprintf("Change Phone No. "); break; case 5: gotoxy(30,12); cprintf("Change Mobile No. "); break; case 6: gotoxy(30,13); cprintf("Change Blood Group "); break; case 7: gotoxy(30,14); cprintf(" \x11 \x11 \x11 BACK break; } } //Show Search menu void showview(void) { char *ch[]={"Record One-By-One ","View all Records ","Statistics \x11 BACK "}; textcolor(7); box(29,4,49,6); gotoxy(30,5); printf(" +++ VIEW MENU +++ "); box(29,7,49,15); textbackground(0); for(int i=0;i<4;i++) { gotoxy(30,8+i); cprintf("%s",ch[i]); } } //Highliting Search Menu void highlightview(int item) { textcolor(WHITE); textbackground(GREEN); "); ");

"," \x11 \x11

switch (item) { case 1: gotoxy(30,8); cprintf("Record One-By-One "); break; case 2: gotoxy(30,9); cprintf("View all Records "); break; case 3: gotoxy(30,10); cprintf("Statistics break; case 4: gotoxy(30,11); cprintf(" \x11 \x11 \x11 BACK break; } } void viewmenu() { int count=1; char ch; textcolor(WHITE); textbackground(0); clrscr(); showview(); highlightview(1); _setcursortype(_NOCURSOR); //Swting Up the Arrow Key Function while(1) { ch=getch(); switch(ch) { case 80: count++; if(count==5)count=1; break; case 72: count--; if(count==0)count=4; break; } showview(); highlightview(count); //Setting up enter function if(ch=='\r') { "); ");

cls(); if(count==1){view();} if(count==2){viewall();} if(count==3){Statistics();} if(count==4)mainmenu();break;} } } //Structure decleration struct student { char id[NUM]; char name[MIN]; char fname[MIN]; char address[MAX]; char phone[PH]; char mphone[MPH]; char blood[BLOOD]; int day; int month; int year; int status; }rec; //Adding new records void add() { FILE *fp; char ch; char temp[NUM];

if(fp!=NULL) { do{ fp=fopen("cblood.rec","ab"); clrscr(); box(5,2,75,15); gotoxy(25,2); printf(" ++ Adding records to database ++ "); do{ gotoxy(8,5); printf("Enter Member ID: "); check_id(temp, NUM); } while(duplicate(temp)); strcpy(rec.id, temp);

gotoxy(8,6); printf("Enter Name : "); check_name(rec.name,MIN); gotoxy(8,7); printf("Enter Father's Name : "); check_name(rec.fname,MIN); gotoxy(8,8); printf("Enter Address : "); check_add(rec.address,MAX); gotoxy(8,9); printf("Enter Phone Number : "); check_phone(rec.phone,PH); gotoxy(8,10); printf("Enter Mobile Number : "); check_mphone(rec.mphone,MPH); gotoxy(8,11); printf("Enter Blood Group : "); check_blood(rec.blood, BLOOD); rec.status=0; { struct date d; getdate(&d); gotoxy(8,12); printf("Date of Membership : %d-%d-%d ",d.da_day,d.da_mon,d.da_year); rec.day = d.da_day; rec.month = d.da_mon; rec.year = d.da_year; } window(1,1,80,25); gotoxy(1,12); fwrite(&rec, sizeof(rec), 1, fp); fclose(fp); gotoxy(18,24); printf("Do you want to enter another record [Y]/[N]: "); ch=toupper(getche()); }while(ch =='Y'); } else { gotoxy(18,24); printf("+++ Error opening file +++"); }

mainmenu(); } //Viewing Records void view() { FILE *fp; fp=fopen("cblood.rec","rb"); if(fp!=NULL) { clrscr(); while( fread(&rec, sizeof(rec), 1, fp)) if(rec.status==0) { /*Calling all the records saved in the database*/ clrscr(); box(5,2,75,15); gotoxy(20,2); printf(" ++ Viewing records form the database ++ "); gotoxy(8,5); printf(" Member ID : %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Father's Name : %s",rec.fname); gotoxy(8,8); printf(" Address: %s",rec.address); gotoxy(8,9); printf(" Phone Number: %s",rec.phone); gotoxy(8,10); printf(" Mobile Number: %s",rec.mphone); gotoxy(8,11); printf(" Blood Group : %s",rec.blood); gotoxy(8,12); printf(" Date of membership : %d-%d%d",rec.day,rec.month,rec.year); getch(); } if(rec.status==1) { clrscr(); gotoxy(17,13); sound(500);delay(200);nosound(); printf("+++ Record not found in the database +++"); getch(); }

fclose(fp); } else { gotoxy(20,24); printf("+++ Error opening file +++"); } mainmenu(); } //Searching by name void searchname() { char ch; FILE *fp; char name[MIN]; clrscr(); fp=fopen("cblood.rec","rb"); gotoxy(20,13); printf("Please enter the members name : "); check_name(name,MIN); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(name,rec.name) ); ch=strcmp(name,rec.name); if(ch!=0) { clrscr(); sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID: %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Fathers Name : %s",rec.fname);

gotoxy(8,8); printf(" Address : %s",rec.address); gotoxy(8,9); printf(" Phone Number : %s",rec.phone); gotoxy(8,10); printf(" Mobile Number : %s",rec.mphone); gotoxy(8,11); printf(" Blood Group : %s",rec.blood); gotoxy(8,12); printf(" Date of Membership : %d-%d%d",rec.day,rec.month,rec.year); getch(); } fclose(fp); mainmenu(); } //Search by ID void searchid() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb"); gotoxy(20,13); printf("Please enter the member ID : "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) { clrscr(); sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2);

printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID : %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Father's Name : %s",rec.fname); gotoxy(8,8); printf(" Address : %s",rec.address); gotoxy(8,9); printf(" Phone Number : %s",rec.phone); gotoxy(8,10); printf(" Mobile Number : %s",rec.mphone); gotoxy(8,11); printf(" Blood Group : %s",rec.blood); gotoxy(8,12); printf(" Date of membership : %d-%d%d",rec.day,rec.month,rec.year); getch(); } fclose(fp); mainmenu(); } //Changing name void c_name() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+"); gotoxy(20,13); printf("Please enter the Member ID : "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) { clrscr(); sound(500);delay(200);nosound();

gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID : %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,10); printf(" New Name : "); check_name(rec.name,MIN); fseek(fp, ftell(fp) - sizeof(rec),0); fwrite(&rec, sizeof(rec), 1, fp); gotoxy(28,24); printf(" +++ Database Updated +++ "); getch(); } fclose(fp); mainmenu(); } //Changing name void c_fname() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+"); gotoxy(20,13); printf("Please enter the member ID: "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) { clrscr(); sound(500);delay(200);nosound();

gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID : %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Father's Name : %s",rec.fname); gotoxy(8,10); printf(" New Father's Name : "); check_name(rec.fname,MIN); fseek(fp, ftell(fp) - sizeof(rec),0); fwrite(&rec, sizeof(rec), 1, fp); gotoxy(28,24); printf(" +++ Database Updated +++ "); getch(); } fclose(fp); mainmenu(); } //Changing address void c_add() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+"); gotoxy(20,13); printf("Please enter member ID : "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) { clrscr();

sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID: %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Address : %s",rec.address); gotoxy(8,10); printf(" Enter New Address : "); check_add(rec.address,MAX); fseek(fp, ftell(fp) - sizeof(rec),0); fwrite(&rec, sizeof(rec), 1, fp); gotoxy(28,24); printf(" +++ Database Updated +++ "); getch(); } fclose(fp); mainmenu(); } //Changing Blood Group void c_blood() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+"); gotoxy(20,13); printf("Please enter member ID : "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) {

clrscr(); sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID : %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Blood Group : %s",rec.blood); gotoxy(8,10); printf(" Enter New Blood Group : "); check_blood(rec.blood, BLOOD); fseek(fp, ftell(fp) - sizeof(rec),0); fwrite(&rec, sizeof(rec), 1, fp); window(1,1,80,25); gotoxy(1,12); gotoxy(28,24); printf(" +++ Database Updated +++ "); getch(); } fclose(fp); mainmenu(); } //Changing phone number void c_ph() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+"); gotoxy(20,13); printf("Please enter member ID : "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );

ch=strcmp(sno,rec.id); if(ch!=0) { clrscr(); sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID : %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Phone Number : %s",rec.phone); //Old phone number is displayed. gotoxy(8,10); printf("Enter New Phone Number : "); //New phone number is asked by the user. check_phone(rec.phone,PH); fseek(fp, ftell(fp) - sizeof(rec),0); fwrite(&rec, sizeof(rec), 1, fp); gotoxy(28,24); printf(" +++ Database Updated +++ "); getch(); } fclose(fp); mainmenu(); } //Changing mobile phone number void c_mph() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+"); gotoxy(20,13); printf("Please enter member ID : "); check_id(sno,NUM);

while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) { clrscr(); sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID: %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Mobile Number : %s",rec.mphone); //Old Mobile Number is displayed. gotoxy(8,10); printf(" Enter New Mobile Number : "); //New Mobile Number is asked by the user. check_phone(rec.mphone,MPH); fseek(fp, ftell(fp) - sizeof(rec),0); fwrite(&rec, sizeof(rec), 1, fp); gotoxy(28,24); printf(" +++ Database Updated +++ "); getch(); } fclose(fp); mainmenu(); } //Deleting Records void del() { int ch; FILE *fp; char sno[NUM]; clrscr(); fp=fopen("cblood.rec","rb+");

gotoxy(20,13); printf("Please enter member ID : "); check_id(sno,NUM); while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) ); ch=strcmp(sno,rec.id); if(ch!=0) { clrscr(); sound(500);delay(200);nosound(); gotoxy(28,13); printf(" +++ Record Not Found +++ "); getch(); } else { clrscr(); box(5,2,75,15); gotoxy(28,2); printf(" ++ Search Results ++ "); gotoxy(8,5); printf(" Member ID: %s",rec.id); gotoxy(8,6); printf(" Name : %s",rec.name); gotoxy(8,7); printf(" Father's Name : %s",rec.fname); gotoxy(8,8); printf(" Address : %s",rec.address); gotoxy(8,9); printf(" Phone Number: %s",rec.phone); gotoxy(8,10); printf(" Mobile Number: %s",rec.mphone); gotoxy(8,11); printf(" Blood Group : %s",rec.blood); gotoxy(8,12); printf(" Date of Membership : %d-%d%d",rec.day,rec.month,rec.year); gotoxy(23,24); printf("Do You Want To Delete this Record [Y/N] "); ch=toupper(getche()); if (ch=='Y') { empty();

fseek(fp, ftell(fp) - sizeof(rec), 0); fwrite(&rec, sizeof(rec), 1, fp); clrscr(); sound(500);delay(200);nosound(); gotoxy(28,24); printf(" +++ Record Deleted +++ "); getch(); } } fclose(fp); mainmenu(); } //Checking the length of member ID void check_id(char *p, int size) { int i=0; char ch; do { ch=getch(); if( (ch>='0' && ch<='9') && (i<size-1) ) { *p=ch; p++; i++; printf("%c",ch); } else if(ch==8 && i>0) { printf("%c%c%c",8,32,8); i--; p--; } }while(ch!=13 || i<size-1); *p='\0'; } //Checking the validity of phone number void check_phone(char *ph, int size) { int p=0; char s[20],ch;

do { ch=getch(); if( ((ch>='0' && ch<='9')||(ch=='-')) && (p<size-1) ) { *ph=ch; ph++; p++; printf("%c",ch); } else if( (ch==8)&&(p>0) ) { printf("%c%c%c",8,32,8); p--; ph--; } }while(ch!=13 || p<size-1); s[p]='\0'; *ph='\0'; } //Checking the validity of mobile phone void check_mphone(char *ph, int size) { int p=0; char s[20],ch; do { ch=getch(); if( ((ch>='0' && ch<='9')||(ch=='-')) && (p<size-1) ) { *ph=ch; ph++; p++; printf("%c",ch); } else if( (ch==8)&&(p>0) ) { printf("%c%c%c",8,32,8);

p--; ph--; } }while(ch!=13 || p<size-1); s[p]='\0'; *ph='\0'; } //Checking the validity of members name void check_name(char *p, int size) { int j=0; char x[40],cj; do { cj=toupper(getch()); if(((cj>='a' && cj<='z')||(cj>='A' && cj<='Z')||(cj==' ')) && (j<size-1)) { *p++=cj; j++; printf("%c",cj); } else if(cj==8 && j>0) { printf("%c%c%c",8,32,8); j--; p--; } }while(cj!=13); x[j]='\0'; *p='\0'; } //Checkign the validity of address void check_add(char *p, int size) { int l=0; char a[50],ad; do { ad=toupper(getch());

if(((ad>='a' && ad<='z')||(ad>='A' && ad<='Z')||(ad==' ')||(ad=='-')|| (ad==',')||(ad=='/')||(ad=='.')||(ad>='0' && ad<='9')) && (l<size-1)) { *p++=ad; l++; printf("%c",ad); } else if( (ad==8)&&(l>0) ) { printf("%c%c%c",8,32,8); l--; p--; } }while(ad!=13); a[l]='\0'; *p='\0'; } //Checking the validity of father's name void check_blood(char *p, int size) { int j=0; char x[40],cj; do { cj=toupper(getch()); if(((cj=='a')||(cj=='b')||(cj=='o')||(cj=='A')||(cj=='B')||(cj=='O')||(cj=='+')|| (cj=='-')) && (j<size-1)) { *p++=cj; j++; printf("%c",cj); } else if(cj==8 && j>0) { printf("%c%c%c",8,32,8); j--; p--; } }while(cj!=13); x[j]='\0';

*p='\0'; } //Empty Function void empty() { rec.status=1; } //Duplicate Member ID check int duplicate(char idno[]) { FILE *fp; fp=fopen("cblood.rec","rb"); while(fread(&rec, sizeof(rec), 1, fp) && strcmp(rec.id, idno)); fclose(fp); if(strcmp(rec.id, idno)==0) return 1; else return 0; } //About program void about () { box(18,4,65,6); gotoxy(32,5); printf(" About Program "); textbackground(0); box(18,7,65,25); gotoxy (38,9); textcolor (WHITE); cprintf ("Made By"); gotoxy (22,10); textcolor(7); cprintf ("Muhammad Ahmed Khalid BCS/L-F02-73 "); gotoxy (22,11); textcolor(7); cprintf ("Usman Riaz Ahmed Khawaja BCS/L-F02-141"); gotoxy (35,13); textcolor (WHITE); cprintf ("Presented To"); gotoxy (33,14); textcolor (7); cprintf ("Mr Hassan Chohan"); gotoxy (37,16); textcolor (WHITE); cprintf ("Project"); gotoxy (31,17); textcolor (7); cprintf ("Blood Donator System");

gotoxy (32,19); textcolor(WHITE); cprintf ("Conact Information"); gotoxy (32,20); textcolor (7); cprintf("ehmedk@hotmail.com"); gotoxy (29,21); textcolor (7); cprintf ("zohairkhawaja@hotmail.com"); gotoxy (20,24); textcolor (WHITE); cprintf ("COMSATS INSTITUTE OF INFORMATION TECHNOLOGY"); getch(); clrscr(); } //View all records in the database void viewall() { FILE *pt; int x=6; pt = fopen("cblood.rec", "rb"); clrscr(); box(3,2,79,25); gotoxy(25,2); printf(" ++ All records of database ++ "); gotoxy(6,4); printf("ID Name Phone No. Mobile No. B Group "); while ((fread(&rec,sizeof(rec),1,pt)==1)) { if(rec.status==0) { if(x==21) { gotoxy(6,23); printf("Press any key to continue..."); getch(); clrscr(); box(3,2,79,25); gotoxy(25,2); printf(" ++ All records of database ++ "); gotoxy(6,4); printf("ID Name Phone No. Mobile No. B Group "); x=6; } else { gotoxy(6,x); printf("%s",rec.id); gotoxy(14,x);

printf("%s",rec.name); gotoxy(46,x); printf("%s",rec.phone); gotoxy(56,x); printf("%s",rec.mphone); gotoxy(71,x); printf("%s",rec.blood); x++; } } } fclose(pt); gotoxy(6,23); printf("End of records"); getch(); mainmenu(); } //showing statistics int Length() { int size=0; FILE *fin; fin = fopen("cblood.rec", "rb"); while ((fscanf(fin, "%c")) != EOF) { size++; } fclose(fin); return size; } void Statistics() { int NPerson; NPerson = 0; NPerson = Length() / StructLength; clrscr(); box(5,2,75,15); gotoxy(25,2); printf(" ++ Statistics of database ++ "); gotoxy(22,8); printf("Number of persons in data base is %d.", NPerson); gotoxy(25,10); printf("Size of data base is %d bytes.", Length()); getch(); mainmenu(); } //Searching by blood group

void searchblood() { FILE *pt; int x=6; char blood[BLOOD],a; pt = fopen("cblood.rec", "rb"); clrscr(); gotoxy(20,13); printf("PLEASE ENTER Blood Group ==->>>> "); check_blood(blood,BLOOD); clrscr(); box(3,2,79,25); gotoxy(25,2); printf(" ++ Blood Group Search ++ "); gotoxy(8,4); printf("ID Name Phone No. Mobile No. B Group "); while ((fread(&rec,sizeof(rec),1,pt))) { if(x==21) { gotoxy(6,23); printf("Press any key to continue..."); getch(); clrscr(); box(3,2,79,25); gotoxy(25,2); printf(" ++ Blood Group Search ++ "); gotoxy(6,4); printf("ID Name Phone No. Mobile No. B Group "); x=6; } a=strcmp(blood,rec.blood); if(a==0) { gotoxy(8,x); printf("%s",rec.id); gotoxy(16,x); printf("%s",rec.name); gotoxy(48,x); printf("%s",rec.phone); gotoxy(58,x); printf("%s",rec.mphone); gotoxy(73,x); printf("%s",rec.blood); x++; }

} Fclose(pt); getch (); main menu(); }

FUTURE SCOPE OF PROJECT


Our project will be able to implement in future after making some changes and modifications as we make our project at a very low level. So the modifications that can be done in our project are:This project can be implement only at small bloodbank branches. It cannot be used for large scale bank purposes.

Anda mungkin juga menyukai