Download - Gas Agency New
-
7/30/2019 Gas Agency New
1/39
TERM PAPER
Of
FOUNDATION OF COMPUTING
Topic: - gas agency Management system
ACKNOWLEDGEMENT
It is not until you undertake the project like this one that you realize how massive the effort
it really is, or how much you must rely upon the Selfless efforts and goodwill of others.
There aremany who helped us with this project, and we want to thank them all from the
core of our Hearts.
We owe special words of thanks to our Teachers MS.SUKHDILPREET KAUR for their
vision, thoughtful counseling and encouragement at every step of the project. We are also
thankful to the teachers of the Department for giving us the best of knowledge and guidance
throughout the project.
And last but not the least, we find no wordsto acknowledge the financial assistance &
moral support rendered by our parents in
making the effort a success. All this has
become reality because of their blessingsand above all by the grace of god.
-
7/30/2019 Gas Agency New
2/39
TABLE OF CONTENTS
S.No Content Page no.
1 INTRODUCTION 4
2 Proposed system 71. Description2. System Requirements
3 Requirement analysis 84 System Design 95 Source code 106 Testing 327 Future scope of project 37
OVERVIEW TO C
HISTORY OF C:
C is a popular general purpose programming
language. It is one of the most popular computer
languages today, because it is a structured, high
level, machine independent language.
-
7/30/2019 Gas Agency New
3/39
The root of all modern language is ALGOL, introduced in early 1960s. ALGOL wasthe 1 st computer language to use a block structure. Subsequently, several other languages
were announced after 1960s. In 1967, Martin Richard developed a language called BCPL i.e.
basic combined programming language mainly for writing system software. In 1970, Ken
Thompson created a language using many features of BCPL and called it simply B. B was
used to create early version of UNIX operating system.
C was evolved from ALGOL, BCPL, and B by Dennis Ritchie at the Bell Laboratoriesin 1972, strongly associated with UNIX. During 1970s, C had evolved into the
TRADITIONAL C. With the publication of the book The C Programming language
by Brian Kerningham and Dennis Ritchie in 1978, it becomes more powerful.
In 1983, American National Standards Institutes (ANSI) appointed a technicalcommittee to define a standard for C. The committee approved a version of C inDecember 1989, which is now known as ANSI C. It was then approved byInternational Standard Organization (ISO) in 1990.
IMPORTANCE OF C:
The increasing popularity of C is probably due to its many desirable qualities. The C
compiler combines the capabilities of an assembly language with the features of a high level
language and therefore it is well suited for writing both system software and business
packages. In fact many of the C compilers available in the market are written in C.
Programs written in C are efficient and fast. This is due to its variety of data types and
powerful operators. It is many times faster than BASIC.
There are only 32 key words in ANSI C and its strength lies in its built in functions. Cis highly portable; this means that C programs written for one computer can be runon another with little or no modifications. C language is well suited for structured
programming, thus requiring the user to think of a problem in terms of functionmodules or blocks. This modular structure makes program de-bugging, testing andmaintenance easier.Another important feature of C is its ability to extend itself. Wecan continuously add our own functions to C library, thus our programming taskbecomes so easier and simple.
INTRODUCT
ION:
-
7/30/2019 Gas Agency New
4/39
We have discussed so far various features of C language and are ready to write and execute
program of modest complexity. However, before attempting to develop complex programs, it
is worthwhile to consider some programming techniques that would help design efficient
and error free.
The program development process includes three important stages, namely,
program design, program coding and program testing. All the three stagescontribute to the production of high quality program.In GAS AGENCY MANAGEMENT SYSTEM we have done system design, sourcecoding, and program testing and added many more features to facilitate the userwith the best. We have given the user the facility to enter the customers record andsee whether the user is provided with the gas cylinder and the option for gascylinder booking and many more options.We can improve the efficiency of the system, thus overcome the drawbacks of the existing
system.
Less human error Strength and strain of manual labour can be reduced
High security
Data consistency
Easy to handle
Easy data updating
Easy record keeping
Backup data can be easily genera
Introduction of gas agencymanagement system
We can make this gas management system in C language by using three or more than
three header files or many data types such as:
1. #include : this header file will containScanf () , Printf () And, there are many
headerfiles which are used in this program.
2. #include: this header file will contain Clrscr(); , Getch(); , and many more..
a. #include: this header file will contain power function(pow()) ,
squareroots function , cuberoots function , etc are used in this program
b. #include : this header file will contain string function such as 1.Strrev();
1. Strlen();
2. Strupr();
3. Strlwr();
-
7/30/2019 Gas Agency New
5/39
4. And many mores
-
7/30/2019 Gas Agency New
6/39
SYSTEM REQUIREMENTS
Operating
System:
Windows
2000/NT/Xp/Vista
RAM: 256 MB or more
HARD DISK 40 GB or more
Processor P3 or High
Compiler
Standard C++
Compiler
SYSTEM DESCRIPTION
THE OPERATING SYSTEM USED IN THIS PROJECT IS WINDOWSXPIT HAS
MICROSOFT OFFICE INSTALLED IN IT. IT HAS RAM OF 2GB. HARD DISK CAPACITY
OF OPERATING SYSTEM IS 250GB. IT CONSISTS OF PENTIUM-4 PROCESSOR.THE
OPEREATING SYSTEM ALSO HAS C++ COMPILER. THE SYSTEM ALSO HAS TYPE
CONVERSIONS WHICH CONVERT LOWER TO UPPER TYPE. THE OPERATING
SYSTEM HAVE 1GB RAM FOR MICROSOFT WORLD.
-
7/30/2019 Gas Agency New
7/39
system design:
If no then go to main menu
If yes then stop and exit
SOURCE CODE
#include
#include #include #include #include #include #include #include#include void show_mouse();int t();void edit(); voidinfor(); voidentry(); voiddisplay(); voidsearch(); voidsearch_id();void search_name();void del();
-
7/30/2019 Gas Agency New
8/39
void deletion();void deletion_id();void print();
void help();void eat();void general();void exit();
void seteefect(int,int); void graph();void bar(int inscor);
void graph2();void bar2(int inscore2);void report();void report2();void report3();void pur();void graph1();void design();void bbox();
void ventry(char t[],int);
struct shop{
char desc[20];
int rack; charch;
int cabnit;intquantity;float sale;char id[6];float total;float unit;float cost;float
profit;float bye;int qty;
intost; intb; };
struct shop temp;struct shopx[20]; FILE *ptr;//int age;char a[10];/************************************displays information about the cars***************************/
void infor(){
int sher;
clrscr();textcolor(WHITE);gotoxy(13,3);
printf("\xDB\xDB\xDB\xDB\xB2 INFORMATION ABOUT PRODUCTS\xB2\xDB\xDB\xDB\xDB"); gotoxy(2,5);printf("THIS SECTION IS TO TELL WHAT KIND OF PRODUCTS ARE THERE INSTORE"); printf("\n\nENTER THE OPTION WHICH SUITS YOU.\n");printf("\n\n1.EDIBLES.\n\n");printf("\n2.GENERAL ITEMS.\n\n");printf("\n\n\n\n\nOPTION:");sher=toupper(getch());
//switch(she
-
7/30/2019 Gas Agency New
9/39
r)
-
7/30/2019 Gas Agency New
10/39
{case '1':eat();break;
case '2':general();break;
default:
gotoxy(8,21);cprintf("\awrong entry press any key to go main menu..");
}getche();
}
void eat(){
clrscr();printf("***************************************************************\n");
printf("ID :
123. JAMCOMPANY
:MITUCHELS RACK NO 24 \n");
printf("ID :124. HONEY
COMPANY:
PAKPURE RACK NO 25\n");
printf("ID :
125. MILKCOMPANY
: HALEEB RACK NO 26\n");
printf("ID :
126. BREADCOMPANY
: WONDER RACK NO 27\n");
printf("ID :
127. CHEESCOMPANY
: JUNAID RACK NO 28\n");
printf("ID :
128. JUICECOMPANY
: SONS RACK NO 29\n");
printf("ID :
129. PEPSICOMPANY
: MAJEED RACK NO 30 \n");
printf("ID :
130.
BUTTER
COMPANY
: JAFFAR RACK NO 31 \n");
printf("
ID :
131.
ICECREAM COMPANY
: POLKA FREEZER 32 \n");printf("**************************************************************\n\n");
printf("Press any key to continue......");getche();
clrscr();
printf("ID :
133. MILOCOMPANY
:
MITUCHELS RACK NO 24 \n");
printf("ID :
134.
KEY BRAN COMPANY
:
PAKPURE RACK NO 25\n");
printf("ID :
135. TANGCOMPANY
: HALEEB RACK NO 26\n");
printf("ID :
136.
ALWAYS
COMPANY
: WONDER RACK NO 27\n");printf(" ID : 327. PEPPARS COMPANY : JUNAID RACK NO 28\n");printf(" ID : 138. JHERBAL COMPANY : SONS RACK NO 29\n");
printf("ID :
139. PEPSICOMPANY
: MAJEED RACK NO 30 \n");
printf("ID :
130. ORAGDCOMPANY
: JAFFAR RACK NO 31 \n");
printf("ID :
131.
ICECREAM COMPANY
: POLKA FREEZER 32 \n");printf("**************************************************************\n");
printf("ID :
143.
SHAMPO
COMPANY
:
MITUCHELS RACK NO 24 \n");
printf("ID :
144. AGRICOMPANY
:
PAKPURE RACK NO 25\n");
printf("ID :
145. TIMOCOMPANY
: HALEEB RACK NO 26\n");
-
7/30/2019 Gas Agency New
11/39
printf("ID :
146.
WASHSN
COMPANY
: WONDER RACK NO 27\n");
printf("ID :
147. LACECOMPANY
: JUNAID RACK NO 28\n");
printf("ID :
428.
YARDLY
COMPANY
: SONS RACK NO 29\n");
printf("ID :
149. MUSKCOMPANY
: MAJEED RACK NO 30 \n");
printf("ID :
140.
BUTTER
COMPANY
: JAFFAR RACK NO 31 \n");
printf("ID :
141.
IMPERIAL COMPANY
: POLKA FREEZER 32 \n");printf("**************************************************************\n");
printf("\n\nPress enter to return to main menu");
}
void general(){
clrscr();printf("***************************************************************\n");
printf("ID :153. DETOL
COMPANY :MITUCHELS
RACK NO 24
\n");
printf("ID
:
154.
SHAMPO
COMPANY
:
PAKPURE
RACK NO
25\n");
printf("
ID
:
15
5.
FINER
RE
COMPANY
: HALEEB
RACK NO
26\n");printf(" ID : 156.
CURTIS
COMPANY :WONDER RACK NO 27\n");
printf(" ID : 157.
NIVKA
COMPANY :JUNAID RACK NO 28\n");
printf(" ID : 158.
NIVCA COMPANY : SONS RACK NO 29\n");printf(" ID : 159.
DETOL
COMPANY :MAJEED RACK NO 30 \n");
printf(" ID : 150.
BUTTER
COMPANY :JAFFAR RACK NO 31 \n");
printf(" ID : 151.
SHAVE COMPANY : POLKA FREEZER 32 \n");printf("***************************************************************\n\n"
);
printf("Press any key tocontinue......");getche();clrscr();
printf(" ID : 163.
ADDIS
COMPANY :
MITUCHELS RACK NO 24 \n");printf(" ID : 164.
SKIN
COMPANY : PAK
PURE RACK NO 25\n");printf(" ID : 165.
MAX
COMPANY :HALEEB RACK NO 26\n");
printf(" ID : 166.
BRESCO
COMPANY :WONDER RACK NO 27\n");
printf(" ID : 167.
ZABIT
COMPANY :JUNAID RACK NO 28\n");
printf(" ID : 168.
COPEX COMPANY : SONS RACK NO 29\n");printf(" ID : 169.
SOAP
COMPANY :MAJEED RACK NO 30 \n");
printf(" ID : 160.
PAMOLI
COMPANY :JAFFAR RACK NO 31 \n");
printf(" ID : 161.
AVA COMPANY : POLKA FREEZER 32 \n");printf("***************************************************************\n"
);printf(" ID : 163.
CAMY
COMPANY :
MITUCHELS RACK NO 24 \n");printf(" ID : 164.
SAFE
COMPANY : PAK
PURE RACK NO 25\n");printf(" ID : 165. COMPANY : RACK NO 26\n");
-
7/30/2019 Gas Agency New
12/39
GUARD HALEEBprintf(" ID : 166.
DOVE
COMPANY :WONDER RACK NO 27\n");
printf(" ID : 167.
REXONA
COMPANY :JUNAID RACK NO 28\n");
printf(" ID : 168.
TOUCNME COMPANY : SONS RACK NO 29\n");printf(" ID : 169.
FORHANS
COMPANY :MAJEED RACK NO 30 \n");
printf(" ID : 160.
SIGNAL2
COMPANY :JAFFAR RACK NO 31 \n");
printf(" ID : 161.
CLOSEUP COMPANY : POLKA FREEZER 32 \n");printf("***************************************************************\n"
);printf("\n\nPress enter to return to main
menu");
}///////////////////////////////
time
//////////////////////////
/
int t(void){
time_t t;
time(&t);//clrscr();gotoxy(15,21);printf("Date and time: %s\n",ctime(&t)); return 0;
}///////////////////////////////////// validation //////////////////////////void ventry(char t[],int code){int i=0;if(code==0)
{
while((t[i]=getch())!='\r' && i=97 && t[i]=65 && t[i]
-
7/30/2019 Gas Agency New
13/39
}t[i]='\0';
}
/******************************data entry***********************************/
void entry(){
char ch;clrscr();
ptr=fopen("shop.dat","a+b");ch='y';while(ch=='y'){clrscr();design();textcolor(14);t();gotoxy(14,3);cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 PURSHASE \xB2\xDB\xDB\xDB\xDB\xDB ");
{
gotoxy(7,5);cprintf("\xDB\xDB\xB2 ENTER PRODUCT ID : ");ventry(temp.id,1);
//flushall();gotoxy(7,7);cprintf("\xDB\xDB\xB2 ENTER DESCRIPTION : ");ventry(temp.desc,0);flushall();gotoxy(7,9);
cprintf("\xDB\xDB\xB2 ENTER RACK NO : ");
ventry(a,1);temp.rack= atoi(a);
flushall();gotoxy(7,11);cprintf("\xDB\xDB\xB2 ENTER CABNIT NO : ");ventry(a,1);temp.cabnit= atoi(a);
//flushall();gotoxy(7,13);///////////////////////cprintf("\xDB\xDB\xB2 ENTER UNIT COST :$ ");ventry(a,1);temp.unit= atof(a);
flushall();
gotoxy(7,15);cprintf("\xDB\xDB\xB2 ENTER SALE PRICE :$ ");ventry(a,1);temp.sale= atof(a);flushall();
gotoxy(7,17);cprintf("\xDB\xDB\xB2 ENTER QUANTITY : ");ventry(a,1);temp.quantity=atoi(a); flushall();
-
7/30/2019 Gas Agency New
14/39
gotoxy(7,18);cprintf("=====================================");temp.total=temp.quantity*temp.sale;
textcolor(10);gotoxy(10,20);cprintf("\xB2\xDB\xB2 TOTAL PRICE = $ %.2f",temp.total);
temp.cost=(temp.unit*temp.quantity);gotoxy(40,20);cprintf("\xDB\xB2 TOTAL COST = $ %.2f",temp.cost);
}fwrite(&temp,sizeof(temp),1,ptr);textcolor(10);gotoxy(10,23);cprintf("More entries[y/n]"); ch=getche();}fclose(ptr);
}
/*****************************data retreivel********************************/
void display(){
clrscr();ptr=fopen("shop.dat","rb");while ((fread(&temp,sizeof(temp),1,ptr))==1)
{gotoxy(22,3);
printf("\xDB\xDB\xDB\xB2\xB2
RETRIEVE
RECORD
\
xB2\xB2\xDB\xDB\xDB")
;gotoxy(18,5);
printf("\xDB\xDB\xB2DESCRIOTION
: %s",temp.desc);gotoxy(18,7);
printf("\xDB\xDB\xB2IDNUMBER : %s",temp.id);
gotoxy(18,9);
printf("\xDB\xDB\xB2RACK
NO : %d",temp.rack);gotoxy(18,11);
printf("\xDB\xDB\xB2CABNITNO : %d",temp.cabnit);
gotoxy(18,13);
printf("\xDb\xDB\xB2
UNITCOST :$ %.2f",temp.unit);
gotoxy(18,15);
printf("\xDB\xDB\xB2SALE
PRICE : $ %.2f",temp.sale);gotoxy(18,17);
printf("\xDB\xDB\xB2QUANT
ITY : %d",temp.quantity);gotoxy(16,18);printf("===================================");
gotoxy(16,20);printf("\xDB\xDB\xB2 TOTAL PRICE : $ %.2f",temp.total);gotoxy(47,20);printf("\xDB\xB2 TOTAL COST : $ %.2f",temp.cost);
-
7/30/2019 Gas Agency New
15/39
gotoxy(20,23);printf("Press Enter to see next if any or exit ...");
getche();clrscr();
}fclose(ptr);
-
7/30/2019 Gas Agency New
16/39
//}
/*******************************data search*******************************/
void search(){int sh;clrscr();
design();gotoxy(17,6);printf("\xDB\xDB\xB2 Two options available to search \xB2\xDB\xDB");
gotoxy(15,9);printf("[ 1 ] - Search by ID number .");gotoxy(15,11);printf("[ 2 ] - Search by Description .");gotoxy(17,15);printf("Enter your choice:: ");sh=toupper(getch());
switch(sh){
case '1':
search_id(); break;
case '2':search_name(); break;
default:gotoxy(18,18);
printf("\a\xDB\xDB wrong entry tryagain"); getch();}
getche();
}
/*****************************search by id*********************************/
void search_id(){int flag=0;char lkf[20];
clrscr();ptr=fopen("shop.dat","rb");design();
gotoxy(13,4);printf("\xDB\xDB\xB2 Enter id to be
searched:"); scanf("%s",&lkf);while((!flag)&&(fread(&temp,sizeof(temp),1,ptr))==1){
if(strcmp(temp.id,lkf)==0)flag=1;
}if(flag)
{
gotoxy(18,6);printf("Product ID : %s",temp.id);
gotoxy(18,8);
-
7/30/2019 Gas Agency New
17/39
printf("Description : %s",temp.desc);gotoxy(18,10);printf("Rack no : %d",temp.rack);gotoxy(18,12);
printf("Cabnit :%d",temp.cabnit);
gotoxy(18,14);
printf("Sale price:$
%.2f",temp.sale);
gotoxy(18,16);
printf("Quantity : %d",temp.quantity);gotoxy(16,17);printf("============================");gotoxy(18,19);
printf(" Total:$
%.2f",temp.total);
}else
printf("Record notfound!"); fclose(ptr);}
/*****************************search by name******************************/
void search_name(){int flag=0;char lkf[20];
clrscr();ptr=fopen("shop.dat","rb");design();
gotoxy(13,4);printf("\xDB\xDB\xB2 Enter description to besearched:"); scanf("%s",&lkf);
while((!flag)&&(fread(&temp,sizeof(temp),1,ptr))==1)
{ if(strcmp(temp.desc,lkf)==0)flag=1;
}if(flag)
{
gotoxy(18,6);printf("ProductID : %s",temp.id);gotoxy(18,8);printf("Description : %s",temp.desc);gotoxy(18,10);printf("Rack no : %d",temp.rack);gotoxy(18,12);
printf("Cabnit :%d",temp.cabnit);
gotoxy(18,14);printf("Saleprice
:$
%.2f",temp.sale);
gotoxy(18,16);
printf("Quantity :%d",temp.quantity
);
gotoxy(16,17);printf("============================");gotoxy(18,19);
-
7/30/2019 Gas Agency New
18/39
printf(" Total:$
%.2f",temp.total);
}else
printf("Record not found!"); fclose(ptr);
-
7/30/2019 Gas Agency New
19/39
}
/******************************datadeletion*****************************/ void deletion(){int j,n,i;char tar[30];int count=0;
ptr = fopen("shop.dat","rb");clrscr();design();gotoxy(17,10);
printf("\xDB\xDB Enter Description to bedeleted:"); scanf("%s",&tar);j=0;
while((fread(&temp,sizeof(temp),1,ptr))==1){
if((strcmp(temp.desc,tar)0)){
x[j] =temp; j++;
}else{
count++;}
}if (count==0){clrscr();design();gotoxy(30,10);
printf("\xDB\xDB Record NotFound"); gotoxy(17,23);printf("Press Enter to go to MAIN
MENU ....."); getch();return;}
fclose(ptr); n = j;clrscr();
ptr=fopen("shop.dat","wb");for(i=0; i
-
7/30/2019 Gas Agency New
20/39
clrscr();putc('\n',stdprn);fputs("\n\t\t\tREPRT OF SALES",stdprn);
putc('\n',stdprn);fputs("===========================",stdprn);
putc('\n',stdprn);
putc('\n',stdprn);fputs("PRODUCT ID. NAME. SALE PRICE. QUANTITY. TOTAL PRICE",stdprn);
fputs("===================================================================",stdprn);putc('\n',stdprn);
putc('\n',stdprn);
ptr=fopen("shop.dat","rb");while( (fread(&temp,sizeof(temp),1,stdprn))==1)
{fprintf(stdprn," %s",temp.id);fprintf(stdprn,"\t%s",temp.desc);fprintf(stdprn,"\t%.2f",temp.sale);fprintf(stdprn,"\t%ld\n",temp.quantity);fprintf(stdprn,"\t%.2f",temp.total);
}
fclose(ptr);}
/******************************help***************************************/
void help(){
clrscr();design();textcolor(WHITE);gotoxy(20,4);
cprintf("\xDB\xDB\xDB\xDB\xB2 HELP ABOUT THE PROGRAM\xB2\xDB\xDB\xDB\xDB"); gotoxy(4,6);cprintf(" [ 2 ] - ENTER RECORDS : THIS OPTION ALLOWS THE USER TO ENTER NEW
"); gotoxy(30,7);cprintf("RECORDS. USER ENTERS PRODUCT ID,DESCRIPTION,"); gotoxy(30,8);cprintf("QUANTITY AND UNIT PRICE. THE PROGRAMMCALCULATES"); gotoxy(30,9);cprintf("TOTAL PRICE AND DISPLAYS ON THESCREEN."); gotoxy(4,11);cprintf(" [ 3 ] - ENTER SALES : THIS OPTION ALLOWS THE USER TO SEE PREVIOUS ");gotoxy(30,12);cprintf("SALE RECORDS.");gotoxy(4,14);
cprintf(" [ 4 ] - SEARCH PURCHASE : THIS OPTION ALLOWS THE USER TO SEARCHSPECIFIC"); gotoxy(30,15);cprintf("RECORD BY ENTERING ID OR'DESCRIPTION'"); gotoxy(4,17);cprintf(" [ 5 ] - DELETE PURCHASE : THIS OPTION ALLOWS THE USER TO DELETE ASPECIFIC"); gotoxy(30,18);cprintf("RECORD BY ENTERING ITS 'DESCRIPTION' ORID"); gotoxy(6,23);cprintf("Press any key to continue .............");
getche();clrscr();design();textcolor(WHITE);gotoxy(4,5);
-
7/30/2019 Gas Agency New
21/39
cprintf(" [ 6 ] - VIEW REPORT : THIS OPTION ALLOWS THE USER TO PRINTPREVIOUS"); gotoxy(30,6);cprintf("SALE RECORDS ONPRINTER"); gotoxy(4,8);cprintf(" [ 7 ] - PRINT RECORDS : THIS OPTION ALLOWS THE USER TO PRINTRECORDS"); gotoxy(30,9);cprintf("OM PRINTER.");gotoxy(4,11);
cprintf(" [ 8 ] - VIEW GRAPH : THIS OPTION ALLOWS THE USER TO VIEW GRAPH ");gotoxy(30,12);
cprintf("OF QUANTITY.");gotoxy(10,23);printf("Press any key to go to the MAIN MENU ........");
getche();}
/***************************mainmenu*************************************/ menu(){int x;do{
{
clrscr();design();t();textcolor(WHITE);gotoxy(24,3);cprintf("\xDB\xDB\xDB\xDB\xB2 GAS AGENCY \xB2\xDB\xDB\xDB\xDB");gotoxy(3,4);cprintf("--------------------------------------------------------------------------");
gotoxy(35,5);
cprintf("MAIN MENU");
gotoxy(26,8);
cprintf(" 1 -INFORMATION ABOUT
PRODUCTS ");gotoxy(26,9);
cprintf(" 2 -
ENTE
R
PURCHASE RECORDS
");
gotoxy(26,10);
cprintf(" 3 -ENTER PRODUCTS TO BE
SALE
");
gotoxy(26,11);
cprintf(" 4 -SEARCH FOR
RECORD ");gotoxy(26,12);
cprintf(" 5 -DELETE RECORD FROM STORE
DATABASE ");gotoxy(26,13);
cprintf(" 6 -VIEW SALES , PURCHASE & PROFIT REPORT
");
gotoxy(26,14);
cprintf(" 7 - PRINT RECORDS ");gotoxy(26,15);
cprintf(" 8 -BAR
GRAPH OF QUANTITY /
PROFIT ");gotoxy(26,16);
cprintf(" 9 - RETRIEVE INFORMATION");
gotoxy(26,17);
cprintf(" H -HELP ");
gotoxy(26,18);
cprintf(" E - EX ");
-
7/30/2019 Gas Agency New
22/39
ITgotoxy(26,23);
//cprintf("ENTER YOUR CHOICE :: ");
gotoxy(47,23);
x=toupper(getch());switch(x)
{case '1':
-
7/30/2019 Gas Agency New
23/39
infor();break;
case '2':entry();break;
case '3':edit();
break;
case '4':search();break;
case '5':del();break;
case '6':report2();break;
case '7':print();break;
case 'h':case'H': help();break;
case'8':graph1();break;
case '9':display();break;
case 'e': case'E': exit(0);break;
default:clrscr();design();gotoxy(17,12);
printf("\a\xDB\xB2 WRONG ENTRY : PRESS ANY KEY AND TRYAGAIN"); getche();}}
}while((x!='e')||(x!='E'));return x;}
void main(){textbackground(14);show_mouse();menu();
}
-
7/30/2019 Gas Agency New
24/39
/************************************* graph ***********************************/
-
7/30/2019 Gas Agency New
25/39
void graph(){int inscor=1;char ch;clrscr();design();gotoxy(20,23);
printf("Press enter to go to MAINMENU ....."); textcolor(10);gotoxy(15,4);
cprintf("************* GRAPH OF PRODUCT QUANTITY *************");textcolor(14);gotoxy(3,5);cprintf(" PRODUCT NAME");
ptr=fopen("shop.dat","rb");while((fread(&temp,sizeof(temp),1,ptr))==1)
{
printf("\n \xBA %s \t:",temp.desc);bar(inscor);
}
fclose(ptr);
getche();}void bar(){int j;for(j=1;j
-
7/30/2019 Gas Agency New
26/39
}
getche();}void seteffect(int b, int f){
clrscr();textbackground(b);textcolor(f);
}
/********************************** purchase report **********************/
void pur(){char ch;clrscr();design();show_mouse();gotoxy(20,23);printf("Press Enter to go to MAIN MENU ...........");textcolor(GREEN);gotoxy(25,4);cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 VIEW OF PURCHASES \xB2\xDB\xDB\xDB\xDB\xDB");
textcolor(RED);gotoxy(4,7);
cprintf("PRODUCT ID. NAME. UNIT PRICE. QUANTITY. TOTAL COST");gotoxy(4,9);
printf("========================================================================");
ptr=fopen("shop.dat","rb");while((fread(&temp,sizeof(temp),1,ptr))==1)
{//printf("\n \xBA %s\t\t",temp.id);printf(" %s",temp.desc);
printf("\t\t$%.2f",temp.unit);printf("\t\t%d",temp.quantity);printf("\t\t $%.2f",temp.cost);
}getche();}
/*********************************** purchase graph ***********************/
void graph2(){int inscor2=1;char ch;clrscr();design();gotoxy(20,23);
printf("Pres Enter to go to MAINMENU ..........."); textcolor(10);gotoxy(15,4);cprintf("************* GRAPH OF PROFIT *************");textcolor(14); gotoxy(4,5);cprintf("PRODUCT NAME");
ptr=fopen("shop.dat","rb");
while((fread(&temp,sizeof(temp),1,ptr))==1){
-
7/30/2019 Gas Agency New
27/39
printf("\n \xBA %s\t:",temp.desc); bar2(inscor2);
}
fclose(ptr);getche();}void bar2(){
int j; temp.profit=(temp.total-temp.cost);//for(j=1;j
-
7/30/2019 Gas Agency New
28/39
printf("Press Enter to go to MAIN MENU .... ");
-
7/30/2019 Gas Agency New
29/39
textcolor(GREEN);gotoxy(25,4);cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 VIEW OF PROFIT \xB2\xDB\xDB\xDB\xDB\xDB");textcolor(RED);gotoxy(4,7);
cprintf("PRODUCT ID. DESCRIPTION. QUANTITY. PROFIT.");gotoxy(4,9);printf("============================================================");
ptr=fopen("shop.dat","rb");while((fread(&temp,sizeof(temp),1,ptr))==1)
{
printf("\n \xBA %s.",temp.id);printf("\t\t%s",temp.desc);printf("\t\t%d",temp.quantity);temp.profit=(temp.total-temp.cost);
printf("\t\t $%.2f",temp.profit);
}getche();}
/************************* SALE , PURCHASE AND PROFIT REPORT CALL***************/
void report2(){
int sher;clrscr();bbox();
textcolor(WHITE);gotoxy(21,3);
printf("\xDB\xDB\xDB\xDB\xB2 REPORT OF SALES / PURCHASE\xB2\xDB\xDB\xDB\xDB"); gotoxy(5,5);printf("\tTHIS SECTION IS VIEWING SALES, PURCHASE and PROFIT REPORTS"); gotoxy(10,7);
printf(" ********* ENTER THE OPTION WHICH SUITS YOU. **********\n");gotoxy(12,10);printf("\xDB\xDB\xB21.SALES."); gotoxy(12,12);printf("\xDB\xDB\xB22.PURCHASE."); gotoxy(12,14);printf("\xDB\xDB\xB23.PROFIT."); gotoxy(14,17);printf("\xDB\xDB\xB2 OPTION:");sher=toupper(getch());
switch(sher){
case '1':report();break;
case '2':pur();break;
case '3':report3();break;
default:
-
7/30/2019 Gas Agency New
30/39
gotoxy(9,20);textcolor(RED);
cprintf("\a\xDB\xB2 WRONG ENTRY : PRESS ENTER TO GO TO MAINMENU...."); getche();
}
}
/************************************ design module **********************/
void design(){int i;clrscr();
textcolor(14);/****************************** table design *********************/gotoxy(2,2);cprintf("\xC9");gotoxy(3,2);
for(i=1;i
-
7/30/2019 Gas Agency New
31/39
{int c,r;for(c=1;c
-
7/30/2019 Gas Agency New
32/39
fwrite(&x[i],sizeof(x[i]),1,ptr);fclose(ptr);
-
7/30/2019 Gas Agency New
33/39
clrscr();design();gotoxy(15,10);
printf("Record has beendeleted"); gotoxy(15,12);printf("Check it by going to the displayedrecord"); gotoxy(17,23);printf("Press Enter to go to MAINMENU ......"); getch();
}///////////////////////////////// both deletion call ///////////////////////
void del(){int sh;clrscr();
design();gotoxy(17,6);
printf("\xDB\xDB\xB2 Two options available to delete \xB2\xDB\xDB");
gotoxy(16,9);printf("[ 1 ] - Delete by ID number ");gotoxy(16,11);printf("[ 2 ] - Delete by Description ");gotoxy(18,15);
printf("Enter your choice :: ");sh=toupper(getch());
switch(sh){
case '1':deletion_id(); break;
case '2':deletion();break;
default:
gotoxy(18,18);
printf("\a\xDB\xDB Wrong entry"); gotoxy(17,23);printf("Press Enter to go to MAINMENU ....."); getch();}
getche();
}///////////////////////////////////// update record //////////////////////void edit(){int
j,n,i,a;float b;char tar[30],ch;int count=0;
ch='y';while(ch=='y')
{ptr = fopen("shop.dat","rb");clrscr();design();gotoxy(15,9);
printf("\xDB\xDB ENTER ID OF THE PRODUCT TO BE
-
7/30/2019 Gas Agency New
34/39
SOLD:"); scanf("%s",&tar);j=0;
-
7/30/2019 Gas Agency New
35/39
while((fread(&temp,sizeof(temp),1,ptr))==1){
if((strcmp(temp.id,tar)0)){
x[j] = temp;j++;
}else{
design();gotoxy(8,7);
printf("\xDB\xDB Description = %s",temp.desc);
gotoxy(8,9);printf("\xDB\xDB Quantity in stock = %d",temp.quantity);
gotoxy(8,11);
printf("\xDB\xDB Sales price = %.2f",temp.sale);
gotoxy(8,13);printf("\xDB\xDB Quantity want to sale : ");scanf("%d",&a);
x[j]=temp;x[j].quantity=(x[j].quantity-a);
x[j].total=(x[j].quantity*temp.sale);x[j].cost=(x[j].quantity*temp.unit);x[j].bye=(x[j].sale*a);
b=x[j].bye;x[j].qty=a;j++; count++;
}}if (count==0){clrscr();design();gotoxy(33,10);
printf("\a\xDB\xDB\xB2 Not instock"); getch();return;}
fclose(ptr); n = j;clrscr();
ptr=fopen("shop.dat","wb");for(i=0; i
-
7/30/2019 Gas Agency New
36/39
union REGS in, out;
-
7/30/2019 Gas Agency New
37/39
in.x.ax = 0x1;int86(0x33, &in, &out);
}
OUTPUT SNAPSHOTS
TESTING
THE SOURCECODE
DECLARED ABOVE FOR THE
PROGRAM OF ADDRESS BOOK
HAS
-
7/30/2019 Gas Agency New
38/39
BEEN TESTED AND IT HAS BEEN FOUND THAT THE ABOVE SOURCE CODE IS OKAY
AND CORRECT.THE PROGRAM INVOLVES MANY TYPE OF CONVERSIONS. THESE
CONVERSIONS HAS TO DONE CAREFULLY.
MAINLY THERE ARE TWO TYPES OFTESTING: 1-SYSTEM TESTING AND2-INTEGRATION TESTINGSYSTEM TESTING INVOLVES WHOLE TESTING OF PROGRAM AT ONCE ANDINTEGRATION TESTING INVOLVES THE BREAKING OF PROGRAM INTOMODULES & THEN TEST.
FUTURE SCOPE
In future one change can be done by adding the fingerprints of the persons of which the address is
entered.And one more major change which can be done in this project is that to add the snaps of the
person of which the address is entered.We can also add or subtract details of the individual.
-
7/30/2019 Gas Agency New
39/39
PDF to Wor
http://pdfonline.blogspot.com/http://pdfonline.blogspot.com/