sales management project

34
SALES MANAGEMENT SYSTEM #include <stdio.h> #include <conio.h> #include <ctype.h> #include <string.h> #include <dos.h> #include <math.h> #include <time.h> #include<stdlib.h> #include <bios.h> int t(); void edit(); void infor(); void entry(); void display(); void search(); void search_id(); void search_name(); void del(); void deletion(); void deletion_id(); void help(); void exit(); void graph(); void bar(int inscor); void graph2(); void bar2(int inscore2); 1

Upload: rashmi-bhardwaj

Post on 13-Jul-2016

217 views

Category:

Documents


2 download

DESCRIPTION

Coding C Language

TRANSCRIPT

Page 1: Sales Management Project

SALES MANAGEMENT SYSTEM#include <stdio.h>#include <conio.h>#include <ctype.h>#include <string.h>#include <dos.h>#include <math.h>#include <time.h>#include<stdlib.h>#include <bios.h>

int t();void edit();void infor();void entry();void display();void search();void search_id();void search_name();void del();void deletion();void deletion_id();

void help();

void exit();

void graph();void bar(int inscor);void graph2();void bar2(int inscore2);void report();void report2();void report3();void pur();void graph1();

void bbox();

1

Page 2: Sales Management Project

SALES MANAGEMENT SYSTEMvoid ventry(char t[],int);

struct shop{

char desc[20];int rack;char ch;int cabnit;int quantity;float sale;char id[6];float total;float unit;float cost;float profit;float bye;int qty;int ost;int b;

};

struct shop temp;struct shop x[20];FILE *ptr;//int age;char a[10];

/////////////////////////////// time ///////////////////////////int t(void){ time_t t;

time(&t); // clrscr(); gotoxy(15,21); printf("Date and time: %s\n", ctime(&t)); return 0;}

2

Page 3: Sales Management Project

SALES MANAGEMENT SYSTEM

///////////////////////////////////// validation //////////////////////////void ventry(char t[],int code){ int i=0; if(code==0) {

while((t[i]=getch())!='\r' && i<30) if((t[i]>=97 && t[i]<=122) || (t[i]>=65 && t[i]<=90) || t[i]==32 || t[i]==8) { printf("%c",t[i]);

i++;}

} else if(code==1) { while((t[i]=getch())!='\r' && i<10) if((t[i]>=48 && t[i]<=57) || t[i]==46 || t[i]==8 ) { printf("%c",t[i]);

i++;}

} t[i]='\0';}

/******************************data entry***********************************/

void entry(){ char ch; clrscr();

ptr=fopen("shop.dat","a+b"); ch='y'; while(ch=='y') { clrscr(); t(); gotoxy(14,3);

3

Page 4: Sales Management Project

SALES MANAGEMENT SYSTEM 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);

4

Page 5: Sales Management Project

SALES MANAGEMENT SYSTEM cprintf("\xDB\xDB\xB2 ENTER QUANTITY : "); ventry(a,1); temp.quantity= atoi(a); flushall();

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");

5

Page 6: Sales Management Project

SALES MANAGEMENT SYSTEM gotoxy(18,5); printf("\xDB\xDB\xB2 DESCRIOTION : %s",temp.desc); gotoxy(18,7); printf("\xDB\xDB\xB2 ID NUMBER : %s",temp.id); gotoxy(18,9); printf("\xDB\xDB\xB2 RACK NO : %d",temp.rack); gotoxy(18,11); printf("\xDB\xDB\xB2 CABNIT NO : %d",temp.cabnit); gotoxy(18,13); printf("\xDb\xDB\xB2 UNIT COST :$ %.2f",temp.unit); gotoxy(18,15); printf("\xDB\xDB\xB2 SALE PRICE : $ %.2f",temp.sale); gotoxy(18,17); printf("\xDB\xDB\xB2 QUANTITY : %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); gotoxy(20,23); printf("Press Enter to see next if any or exit ...");

getche(); clrscr();

}

fclose(ptr);//}

/*******************************data search*******************************/

void search(){ int sh; clrscr();

gotoxy(17,6);

6

Page 7: Sales Management Project

SALES MANAGEMENT SYSTEM 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 try again"); getch(); } getche();

}

/*****************************search by id*********************************/

void search_id(){ int flag=0; char lkf[20];

clrscr(); ptr=fopen("shop.dat","rb");

gotoxy(13,4); printf("\xDB\xDB\xB2 Enter id to be searched:");

7

Page 8: Sales Management Project

SALES MANAGEMENT SYSTEM 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); 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 not found!"); fclose(ptr);}

/*****************************search by name******************************/

void search_name(){ int flag=0; char lkf[20];

clrscr();

8

Page 9: Sales Management Project

SALES MANAGEMENT SYSTEM ptr=fopen("shop.dat","rb");

gotoxy(13,4); printf("\xDB\xDB\xB2 Enter description to be searched:"); 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("Product ID : %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("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 not found!"); fclose(ptr);}

/******************************data deletion*****************************/void deletion()

9

Page 10: Sales Management Project

SALES MANAGEMENT SYSTEM{ int j,n,i; char tar[30]; int count=0;

ptr = fopen("shop.dat","rb");clrscr();

gotoxy(17,10);printf("\xDB\xDB Enter Description to be deleted:");scanf("%s",&tar);j=0;

while((fread(&temp,sizeof(temp),1,ptr))==1){ if((strcmp(temp.desc,tar)<0) || (strcmp(temp.desc,tar)>0)) { x[j] = temp; j++; } else { count++; }}if (count==0){ clrscr();

gotoxy(30,10); printf("\xDB\xDB Record Not Found"); gotoxy(17,23); printf("Press Enter to go to MAIN MENU ....."); getch(); return;}

fclose(ptr);n = j;clrscr();ptr=fopen("shop.dat","wb");

10

Page 11: Sales Management Project

SALES MANAGEMENT SYSTEMfor(i=0; i<n; i++)fwrite(&x[i],sizeof(x[i]),1,ptr);fclose(ptr);clrscr();

gotoxy(20,10);printf("Record has been deleted");gotoxy(20,12);printf("Check it by going to the displayed record");gotoxy(17,23);printf("Press Enter to go to MAIN MENU ......");getch();

}

/******************************help***************************************/

void help(){ clrscr(); gotoxy(20,4); cprintf("\xDB\xDB\xDB\xDB\xB2 HELP ABOUT THE PROGRAM \xB2\xDB\xDB\xDB\xDB"); gotoxy(4,6); cprintf(" [ 1 ] - 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 PROGRAMM CALCULATES"); gotoxy(30,9); cprintf("TOTAL PRICE AND DISPLAYS ON THE SCREEN."); gotoxy(4,11); cprintf(" [ 2 ] - ENTER SALES : THIS OPTION ALLOWS THE USER TO SEE PREVIOUS "); gotoxy(30,12); cprintf("SALE RECORDS."); gotoxy(4,14);

11

Page 12: Sales Management Project

SALES MANAGEMENT SYSTEM cprintf(" [ 3 ] - SEARCH PURCHASE : THIS OPTION ALLOWS THE USER TO SEARCH SPECIFIC"); gotoxy(30,15); cprintf("RECORD BY ENTERING ID OR 'DESCRIPTION'"); gotoxy(4,17); cprintf(" [ 4 ] - DELETE PURCHASE : THIS OPTION ALLOWS THE USER TO DELETE A SPECIFIC"); gotoxy(30,18); cprintf("RECORD BY ENTERING ITS 'DESCRIPTION' OR ID"); gotoxy(6,23); cprintf("Press any key to continue .............");

getche(); clrscr(); gotoxy(4,5); cprintf(" [ 5 ] - VIEW REPORT : THIS OPTION ALLOWS THE USER TO PRINT PREVIOUS"); gotoxy(30,6); cprintf("SALE RECORDS ON PRINTER"); gotoxy(4,8); cprintf(" [ 6 ] - RETRIEVE RECORD : THIS OPTION ALLOWS THE USER TO RETRIEVE Deleted & Non-Deleted RECORD"); gotoxy(10,23); printf("Press any key to go to the MAIN MENU ........");

getche();}

/***************************main menu*************************************/ menu(){ int x; do{ {

clrscr();

12

Page 13: Sales Management Project

SALES MANAGEMENT SYSTEMt();

// textcolor(WHITE);gotoxy(24,3);cprintf("\xDB\xDB\xDB\xDB\xB2 SAM'S DEPARTMANTAL STORE \

xB2\xDB\xDB\xDB\xDB");gotoxy(3,4);cprintf("--------------------------------------------------------------------------");gotoxy(35,5);cprintf("MAIN MENU");

gotoxy(26,9);cprintf(" 1 - ENTER PURCHASE RECORDS ");gotoxy(26,10);cprintf(" 2 - ENTER PRODUCTS TO BE SALE ");gotoxy(26,11);cprintf(" 3 - SEARCH FOR RECORD ");gotoxy(26,12);cprintf(" 4 - DELETE RECORD FROM STORE DATABASE ");gotoxy(26,13);cprintf(" 5 - VIEW SALES , PURCHASE & PROFIT REPORT ");gotoxy(26,14);cprintf(" 6 - RETRIEVE INFORMATION ");gotoxy(26,15);cprintf(" H - HELP ");

gotoxy(26,16);cprintf(" E - EXIT ");

gotoxy(26,17);gotoxy(26,23);

cprintf("ENTER YOUR CHOICE :: "); x=toupper(getch());

switch(x){

13

Page 14: Sales Management Project

SALES MANAGEMENT SYSTEMcase '1':entry();break;

case '2':edit();break;

case '3':search();break;

case '4':del();break;

case '5':report2();break;

case 'h': case'H':help();break;

case '6':display();break;

case 'e': case 'E':exit(0);break;

default:clrscr();

gotoxy(17,12);printf("\a\xDB\xB2 WRONG ENTRY : PRESS ANY KEY AND TRY

AGAIN");getche();

14

Page 15: Sales Management Project

SALES MANAGEMENT SYSTEM}

} }while((x!='e')||(x!='E'));return x;}

void main(){

menu();}

/************************************* graph ***********************************/

void graph(){ int inscor=1; char ch; clrscr(); gotoxy(20,23); printf("Press enter to go to MAIN MENU ....."); // 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();

15

Page 16: Sales Management Project

SALES MANAGEMENT SYSTEM}void bar(int j){for(j=1;j<=temp.quantity;j++)printf("\xDB");printf(" %d",temp.quantity);printf("\n");}

/*********************************** view report ****************************/void report(){ char ch; clrscr();

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 SALES \xB2\xDB\xDB\xDB\xDB\xDB"); // textcolor(RED); gotoxy(4,7); cprintf("PRODUCT ID. NAME. SALE PRICE. QUANTITY. TOTAL PRICE"); gotoxy(4,9); printf("========================================================================");

ptr=fopen("shop.dat","rb"); while((fread(&temp,sizeof(temp),1,ptr))==1)

{ // printf("\n \xBA %s\t",temp.id); printf("\t%s",temp.desc); printf("\t\t$%.2f",temp.sale); // printf("\t\t%d",temp.qty); printf("\t\t%d",temp.quantity); // printf("\t\t%d",temp.bye); printf("\t\t $%.2f",temp.total);

16

Page 17: Sales Management Project

SALES MANAGEMENT SYSTEM

}

getche();}void seteffect(int b, int f){ clrscr(); // textbackground(b); //textcolor(f);}

/********************************** purchase report **********************/

void pur(){ char ch; clrscr();

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);

17

Page 18: Sales Management Project

SALES MANAGEMENT SYSTEM 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(); gotoxy(20,23); printf("Pres Enter to go to MAIN MENU ...........");// 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) {

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<=temp.profit;j++)printf("\xDB");

18

Page 19: Sales Management Project

SALES MANAGEMENT SYSTEMprintf(" %.1f$",temp.profit);printf("\n");}

/********************************* both graphs call ****************************/

void graph1(){ int sher; clrscr(); // textcolor(WHITE); gotoxy(24,3); printf("\xDB\xDB\xDB\xDB\xB2 BAR GRAPH \xB2\xDB\xDB\xDB\xDB"); gotoxy(10,5); printf("THIS SECTION IS TO show the graph of quantity and profit "); printf("\n\n\t ********* ENTER THE OPTION WHICH SUITS YOU. *******\n"); printf("\n\n\t\xDB\xDB\xB2 1.QUANTITY.\n\n"); printf("\n\t\xDB\xDB\xB2 2.PROFIT.\n"); printf("\n\n\n\t\t\xDB\xDB\xB2 OPTION:"); sher=toupper(getch());

switch(sher) { case '1': graph(); break;

case '2': graph2(); break;

default: gotoxy(9,20); // textcolor(RED); cprintf("\a\xDB\xB2 WRONG ENTRY : PRESS ENTER TO GO TO MAIN MENU... "); getche(); }

19

Page 20: Sales Management Project

SALES MANAGEMENT SYSTEM

}/************************** report of profit **********************/

void report3(){ char ch; clrscr(); 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 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()

20

Page 21: Sales Management Project

SALES MANAGEMENT SYSTEM{

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\xB2 1.SALES."); gotoxy(12,12); printf("\xDB\xDB\xB2 2.PURCHASE."); gotoxy(12,14); printf("\xDB\xDB\xB2 3.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:

21

Page 22: Sales Management Project

SALES MANAGEMENT SYSTEMgotoxy(9,20);//textcolor(RED);cprintf("\a\xDB\xB2 WRONG ENTRY : PRESS ENTER TO GO TO

MAIN MENU....");getche();

}

}

void bbox(){

int c,r;for(c=1;c<=79;c++){

gotoxy(c,1);printf("ß");gotoxy(c,25);printf("ß");

}for(r=1;r<=24;r++){

gotoxy(1,r);printf("Û");gotoxy(79,r);printf("Û");

}}

////////////////////////////////// by id deletion ////////////////////////////

void deletion_id(){ int j,n,i; char tar[30]; int count=0;

ptr = fopen("shop.dat","rb");

22

Page 23: Sales Management Project

SALES MANAGEMENT SYSTEMclrscr();

gotoxy(15,8);printf("\xDB\xDB Enter ID be deleted:");scanf("%s",&tar);j=0;

while((fread(&temp,sizeof(temp),1,ptr))==1){ if((strcmp(temp.id,tar)<0) || (strcmp(temp.id,tar)>0)) { x[j] = temp; j++; } else { count++; }}if (count==0){ clrscr();

gotoxy(30,10); printf("\xDB\xDB Record Not Found"); 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<n; i++)fwrite(&x[i],sizeof(x[i]),1,ptr);fclose(ptr);clrscr();

gotoxy(15,10);

23

Page 24: Sales Management Project

SALES MANAGEMENT SYSTEMprintf("Record has been deleted");gotoxy(15,12);printf("Check it by going to the displayed record");gotoxy(17,23);printf("Press Enter to go to MAIN MENU ......");getch();

}

///////////////////////////////// both deletion call ///////////////////////

void del(){int sh; clrscr();

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);

24

Page 25: Sales Management Project

SALES MANAGEMENT SYSTEM printf("Press Enter to go to MAIN MENU ....."); 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();

gotoxy(15,9);printf("\xDB\xDB ENTER ID OF THE PRODUCT TO BE

SOLD:");scanf("%s",&tar);j=0;

while((fread(&temp,sizeof(temp),1,ptr))==1){ if((strcmp(temp.id,tar)<0) || (strcmp(temp.id,tar)>0)) { x[j] = temp; j++; } else { gotoxy(8,7); printf("\xDB\xDB Description = %s",temp.desc); gotoxy(8,9); printf("\xDB\xDB Quantity in stock = %d",temp.quantity);

25

Page 26: Sales Management Project

SALES MANAGEMENT SYSTEM 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();

gotoxy(33,10); printf("\a\xDB\xDB\xB2 Not in stock"); getch(); return;}

fclose(ptr);n = j;clrscr();ptr=fopen("shop.dat","wb");for(i=0; i<n; i++)fwrite(&x[i],sizeof(x[i]),1,ptr);fclose(ptr);clrscr();

gotoxy(8,9);printf("\xDB\xDB Price paid by customer = %.2f",b);gotoxy(8,11);printf("\xDB\xDB Quantity sold = %d",a);getch();

26

Page 27: Sales Management Project

SALES MANAGEMENT SYSTEMprintf("more enteries=(y/n)");ch=getche();}

}

/////////////////////////////////// end ///////////////////////////

27