cs project work on canteen managment

32
Made by akash Gaurav kv1 hindan 16-17 Made by akash Gaurav kv1 hindan 16-17 PROJECT REPORT ON CANTEEN MANAGEMENT The project report is submitted in the partial fulfilment of central board of secondary education KENDRIYA VIDYALAYA NO.1, AFS HINDAN, GZB GUIDE- Ms.Renu Singh Submitted by- Akash Gaurav rollno-58*****

Upload: akashgauravr

Post on 13-Apr-2017

33 views

Category:

Education


0 download

TRANSCRIPT

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

PROJECT REPORT ON CANTEEN

MANAGEMENT

The project report is submitted in the partial

fulfilment of central board of secondary

education KENDRIYA VIDYALAYA NO.1,

AFS HINDAN, GZB

GUIDE- Ms.Renu Singh

Submitted by-

Akash Gaurav rollno-58*****

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

INDEX

1. about the project…

2. Preface…

3. Certificate…

4. Acknowledgement…

5. Coding…

6. Outputs…

7. Bibliography…

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

MADE BY

AKASH

GAURAV

KV1 HINDAN

16-17

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

ABOUT THE PROJECT This project is used in canteens to keep the records of the

customer visited, stocks record,to perform operations like

delete, modify, search. Thereby becming the need of the

hour. It finds its immense use in CSD canteens where the

records of the customer keeping is must.

Also, this project successfully prints bill while making

transactions. The bill thereby can be printed for later use.

This project keeps a list of all the current records of the

items in the canteen with their code no.

So this is a very useful project.

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

PREFACE Completely automated canteen process. It eliminates

human errors.it increases efficiency by reducing time &

cost of planning.Significantly increases user’s

satisfaction due to authenticated data.

Allows customization & updating menu. Data is correct &

accurate. This project on canteen management is

complete,flexible & easy to use & is designed to deliver

benefits in order to keep the records of ongoing bill ..

display them,modify them, delete them or search them or add

items as per the requirement.

This project at its basic level provised a way to maintain

data & items of customers & stock.

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

CERTIFICATE This is hereby to certify that, the original &

genuine project report has been made out to

work on the subject matter & related data

collection & investigation has been completed

by the students i) jatin jain ii) akash gaurav

iii) pradipta mukherjee

Teachers sign

ACKNOWLEDGEMENT

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

It’d be my utmost pleasure to express my thanks to my

computer teacher Ms Renu Singh in providing a

helping hand in this project.

Her valuable guidance,support,supervision &

inspiration all through the project is responsible for

attaining its present form.

We thank her for providing her guidance at every step

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

……. ……. CODING #include<fstream.h>

#include<conio.h>

#include<string.h>

#include<stdio.h>

#include<iomanip.h> class

stock

{

char items[20];

int itemid;

int itemprice;//each items price

public:

void additem();//to enter d items

void showstock();//to show the contents of d stock

int returnids(int x); friend void

purchaseitem(stock);//to purchase items friend void

searchitem(stock);//to searchitems

};

float totprice=0; int

billno=1000; int id;

int a[100]; int h=0;

int d1,d2,d3;//for date

class customer

{ int cardno;

char cosname[20];

char rank[20];

char date[23];

public: void showc();//to show the customer details

void enter();//to enter d customer details

int returnidc(int x); friend void

search(customer); void instructions();

};

void customer::showc()

{

cout<<cardno<<"\t"<<cosname<<"\t\t"<<rank<<"\n";

}

void customer::enter()

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

{

cout<<"\nnter card no\n";

cin>>cardno;

cout<<"\nenter customers name\n";

fflush(stdin); gets(cosname);

cout<<"\nenter customers rank\n";

fflush(stdin); gets(rank);

} void

entry()

{ char u;

customer c;

ofstream f("customer.dat",ios::binary|ios::app);

if(!f) cout<<"file error"; else do{

c.enter();

do{

cout<<"\nenter todays date(dd-mm-yy)\n";

cin>>d1>>d2>>d3; if((d2>31)||(d2>12))

cout<<"invalid date:- days in a month are 30 or 31..invalid

date:- there are 12 months...try again\n";

}while(d1>31 || d2>12);

f.write((char*)&c,sizeof(c));

cout<<"\ndo ya wanna add more rec? y/n\n";

fflush(stdin); u=getchar();

}while(u!='n'||u!='N');

f.close();

}

void show() //to show all list of customer

{ customer

c;

ifstream f("customer.dat",ios::binary) ;

if(!f) cout<<"file error"; else {

cout<<"\n cardno\tname\t\trank\n ";

while(f.read((char*)&c,sizeof(c)))

c.showc();

}

f.close();

}

void search(customer c)

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

{ int

x,p,g=0;

char q[20];

ifstream f("customer.dat",ios::binary);

if(!f) cout<<"file error"; else {

cout<<"by which way u wanna search?\n1.by cardno\n2.name\n";

cin>>x; if(x==1) {

cout<<"enter d cardno\n";

cin>>p; } else {

cout<<"entr d name of d customr\n";

gets(q); }

while(f.read((char*)&c,sizeof(c)))

{ if(x==1)

if(c.cardno==p)

{

g=1;

cout<<"\n cardno name rank\n ";

c.showc();

break; }

if(x!=1)

if(strcmp(c.cosname,q)==0)

{

g=1;

cout<<"\n cardno name rank\n ";

c.showc();

break;

}

}

f.close(); if(g==1)

cout<<"record found\n";

else

cout<<"not found";

} } void modify() {

customer c; int g=0,p,x;

ifstream f("customer.dat",ios::binary);

ofstream f1("temp.dat",ios::binary|ios::app);

if(!f||!f1) cout<<"file error"; else {

cout<<"\nenter d cardid\n";

cin>>p;

while(f.read((char*)&c,sizeof(c)))

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

{

if(c.returnidc(p)==1)

{

g=1;

c.enter();

}

f1.write((char*)&c,sizeof(c));

}

f.close();

f1.close();

if(g==0) {

cout<<"no modification took place";

remove("temp.dat");

}

else {

cout<<"record modified";

remove("customer.dat");

rename("temp.dat","customer.dat");

}

}

} void del(int

x) {

ifstream f("customer.dat",ios::binary);

ofstream f1("temp.dat",ios::binary);

int g=0; customer c; if(!f||!f1)

cout<<"file error"; else

while(f.read((char*)&c,sizeof(c)))

if(c.returnidc(x)==1) g=1; else

f1.write((char*)&c,sizeof(c));

f.close(); f1.close();

if(g==0) {

cout<<"no deletion took place\n";

remove("temp.dat");

}

else {

cout<<"deletion took place\n";

remove("customer.dat");

rename("temp.dat","customer.dat");

}

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

} void

display() {

stock s; h=0;

ifstream f("item.dat",ios::binary);

if(!f) cout<<"error"; else {

cout<<"\n stock \n";

cout<<"itemcode\tprice\tqty\titemname\n";

while(f.read((char*)&s,sizeof(s)))

{

s.showstock();

h++;

}}

f.close();

} void fill() { int

i=0; ofstream

f("arr.txt"); if(!f)

cout<<"error"; else

while(i!=10)

f<<a[i++]<<" ";

f.close();

}

void purchaseitem(stock s)

{ char e; int

k=0,g=0,p,y,qty;

totprice=0;

customer c;

ofstream f("bill.txt"); //to print the bill

ifstream f2("customer.dat",ios::binary);

ifstream f1("item.dat",ios::binary);

if(!f2||!f||!f1) cout<<"file error";

else {

f<<"name\tqty\tprice";

cout<<"enter the customers id";

cin>>id;

while(f2.read((char*)&c,sizeof(c)))

if(c.returnidc(id))

{ k=1;

cout<<"\n"<<setw(35)<<"list\n";

display(); billno++;

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

cout<<"enter d no. at d lhs of items to buy that\n";

cin>>p;

while(f1.read((char*)&s,sizeof(s)))

if(s.returnids(p))

{ g=1;

cout<<"qty??";

cin>>qty;

if(qty<=5) {

a[p-1]-=qty;

y=qty*s.itemprice;

totprice+=y;

f<<"\n"<<s.items<<"\t"<<qty<<"\t"<<y<<"\n";

cout<<"do ya want more?y/n\n";

fflush(stdin); e=getchar();

if(e=='n') break; else {

display();

cout<<"enter d no. at d lhs of items to buy that\n";

cin>>p; } } else

cout<<"max 5 items sir!!\n";

}

break;

} }

f2.close();

f.close();

f1.close();

if(g!=1)

cout<<"enter d correct itemid\n";

if(k!=1)

cout<<"no such id found";

}

void showbill()

{ char x[80];

customer c; ifstream

f("bill.txt");

ifstream f1("customer.dat",ios::binary);

if(!f||!f1) cout<<"file error"; else

{

cout<<"billno"<<billno<<"\n";

cout<<"date="<<d1<<"-"<<d2<<"-"<<d3<<"\n";

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

while(f1.read((char*)&c,sizeof(c)))

if(c.returnidc(id))

c.showc();

cout<<"\n";

while(!f.eof())

{ f>>x;

cout<<x<<"\n";

} f1.close();

}

f.close();

cout<<"\ntotal amount="<<totprice<<"\n";

}

void stock::additem()

{

cout<<"\nenter item id,item name,qty,price\n";

cin>>itemid; fflush(stdin); gets(items);

cin>>a[h];// because qty only varies

cin>>itemprice;

}

void itemadd()

{ stock

s; char

c;

ofstream f("item.dat",ios::binary|ios::app);

if(!f) cout<<"file error"; else do{

s.additem();

f.write((char*)&s,sizeof(s));

cout<<"do ya wanna add more?y/n\n";

fflush(stdin); c=getchar();

h++; //to increment the index value of a

}while(c!='n');

f.close();

}

void stock::showstock()

{

cout<<itemid<<"\t\t"<<itemprice<<"\t"<<a[h]<<"\t"<<items<<"\n"

;

}

void searchitem( stock s)

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

{ int

x,p,g=0;

char q[20];

ifstream f("item.dat",ios::binary);

if(!f) cout<<"file error"; else {

cout<<"by which way u wanna search?\n1.by

itemno\n2.itemname\n"; cin>>x;

if(x==1)

{

cout<<"enter d itemno\n";

cin>>p; } else {

cout<<"entr d name of d item\n";

fflush(stdin); gets(q); }

while(f.read((char*)&s,sizeof(s)))

{ if(x==1) if(s.itemid==p)

{ g=1; cout<<"record

found\n"; h=p-1; // fr

printin the qty

s.showstock(); break;

} if(x!=1)

if(strcmp(s.items,q)==0)

{ g=1;

cout<<"record found\n";

h=s.itemid-1;

s.showstock();

break;

}

}

f.close();

if(g!=1) cout<<"not

found";

} } void

modifyitem() {

stock s; int

g=0,p,x;

ifstream f("item.dat",ios::binary);

ofstream f1("temp.dat",ios::binary);

if(!f||!f1) cout<<"file error"; else

{

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

cout<<"\nenter d itemid\n";

cin>>p;

while(f.read((char*)&s,sizeof(s)))

{ if(s.returnids(p)==1)

{

g=1;

h=p-1;

s.additem();

}

f1.write((char*)&s,sizeof(s));

}

f.close();

f1.close();

if(g==0) {

cout<<"no modification took place";

remove("temp.dat");

} else { cout<<"record

modified"; remove("item.dat");

rename("temp.dat","item.dat");

}

}

}

void delitem(int x)

{

ifstream f("item.dat",ios::binary);

ofstream f1("temp.dat",ios::binary);

int g=0; stock s; if(!f||!f1)

cout<<"file error"; else

while(f.read((char*)&s,sizeof(s)))

if(s.returnids(x)==1) g=1; else

f1.write((char*)&s,sizeof(s));

f.close();

f1.close();

if(g==0) {

cout<<"no deletion took place\n";

remove("temp.dat");

}

else {

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

cout<<"deletion took place\n";

remove("item.dat");

rename("temp.dat","item.dat");

}

}

int stock::returnids(int x)

{

if(x==itemid)

return(1);

else

return(0); }

int customer::returnidc(int x)

{

if(x==cardno)

return(1);

else

return(0); }

void customer::instructions()

{

clrscr();

cout<<"* canteen is closed on evry tuesday..\n";

cout<<"*no entry to civilian\n"; cout<<"*no item

will be given without card"; cout<<"*opening&

closing times are 9:00am to 4:00pm respectively\n";

cout<<"*goods once sold wont be taen back";

cout<<"*thts it..hav a nice day";

}

void array()//will keep rec of prev deduced qnties

{ int x; h=0; stock

s; ifstream f("arr.txt");

if(!f) cout<<"error";

else

while(!f.eof())

{ f>>x;

a[h++]=x;

}

f.close();

}

//************************************************************

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

***********

void main() {

int opt,x,opt1,opt2;

clrscr(); h=0;

stock s; customer

c; clrscr();

array(); do{

cout<<setw(40)<<"# #

# # # # # # # #\n";

cout<<setw(41)<<"#1.c

ustomer #\n";

cout<<setw(41)<<"#2.s

tock n items #\n";

cout<<setw(41)<<"#3.p

urchase #\n";

cout<<setw(41)<<"#4.i

nstructions #\n";

cout<<setw(41)<<"#5.s

how bill #\n";

cout<<setw(41)<<"#6.e

xit #\n";

cout<<setw(41)<<"# #

# # # # # # # #\n";

cout<<"enter ur choice";

cin>>opt;

switch(opt) {

case 1: do{

clrscr();

cout<<setw(40)<<"# # # # # # # # # #\n";

cout<<setw(41)<<"#1.add customers #\n";

cout<<setw(41)<<"#2.show customers #\n";

cout<<setw(41)<<"#3.delete #\n";

cout<<setw(41)<<"#4.modify #\n";

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

cout<<setw(41)<<"#5.search #\n";

cout<<setw(41)<<"#6.exit #\n";

cout<<setw(41)<<"# # # # # # # # # #\n";

cout<<"enter ur choice";

cin>>opt1;

switch(opt1)

{

case 1: entry();

break;

case 2: show();

break;

case 3: cout<<"ener d customer id to be deleted\n";

cin>>x;

del(x);

break;

case 4: modify();

break;

case 5: search(c);

}

getch();

}while(opt1!=6);

break; case 2:

do{

clrscr();

cout<<setw(40)<<"# # # # # # # # # #\n";

cout<<setw(41)<<"#1.add item #\n";

cout<<setw(41)<<"#2.search item #\n";

cout<<setw(41)<<"#3.show stock #\n";

cout<<setw(41)<<"#4.modify item #\n";

cout<<setw(41)<<"#5.del item #\n";

cout<<setw(41)<<"#6.exit #\n";

cout<<setw(41)<<"# # # # # # # # # #\n";

cout<<"enter ur choice";

cin>>opt2;

switch(opt2)

{

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

case 1: itemadd();

break;

case 2: searchitem(s);

break;

case 3: display();

break;

case 4:modifyitem();

break;

case 5: cout<<"ener item id to be deleted\n";

cin>>x;

delitem(x);

break;

} getch();

}while(opt2!=6);

break;

case 3: purchaseitem(s);

break;

case 4: c.instructions();

break;

case 5: showbill();

break;

}

fill();//to save the modified item [qty]

}while(opt!=6);

getch();

}

…………#.OUTPUT

# overall view

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

# customer menu

Add customer

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

//after addin 10 more entries…it looks like

• Show customers

Delete operation

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

• Modify operation

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

• Search operation

Show operation

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

////////////////////////////////////////////////

# stock menu

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

• Show stock

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

• Modify stock items

Search operation

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

• Delete operation

• Show operation

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

# purchase

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17

BIBLOGRAPHY

#GOOGLE.COM

#BOOKS

Show bill operation

Made by akash Gaurav

kv1 hindan 16-17

Made by akash Gaurav

kv1 hindan 16-17