forked from ashvish183/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bookshop-Management-System.cpp
1053 lines (987 loc) · 24.1 KB
/
Bookshop-Management-System.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include <windows.h>
#include <mysql.h>
#include <sstream>
#include <conio.h>
#define HOST "127.0.0.1"
#define USER "root"
#define PASS /*put the password of MySQL in here between ""*/
#define DATABASE "Management"
#define PORT 3306
#define PASSWORD /*Set a Numeric Password for Your Application*/
using namespace std;
MYSQL * conn;
MYSQL_RES *res_set;
MYSQL_ROW row;
stringstream stmt;
const char * q;
string query;
// my_bool result;
typedef struct
{
int date;
int month;
int year;
}date;
class books
{
int id; // Primary Key
string name;
string auth;
int price;
int qty;
public:
void add();
void update_price();
void search();
void update();
void display();
};
class suppliers
{
int id; //Primary Key
string name;
long int phn;
string addr_line1;
string addr_line2;
string addr_city;
string addr_state;
public:
void add_sup();
void remove_supplier();
void search_id();
};
class purchases
{
int ord_id; //Primary Key
int book_id; //FK ref (books)
int sup_id; //FK ref (suppliers)
int qty;
date dt_ordered;
int eta;
char received; // Check(T or C or F) def (F)
int inv;
public:
void new_ord();
void view();
void mar_cancel();
void mark_reciv();
};
class employees
{
int id; //Primary Key
string name;
string addr_line1;
string addr_line2;
string addr_city;
string addr_state;
long int phn;
date date_of_joining;
long int salary;
string mgr_status; //check(T or F) def f
public:
void add_emp();
void search_emp();
void assign_mgr_stat();
void display();
void update_sal();
};
class members
{
int id; //Primary Key
string name;
string addr_line1;
string addr_line2;
string addr_city;
string addr_state;
long int phn;
date beg_date;
date end_date;
string valid;
public:
void add_mem();
void refresh();
void search_mem();
};
class sales
{
int invoice_id; //Primary key
int member_id; //FK ref member(id)
int book_id; //FK ref books(id)
int qty;
int amount;
date date_s;
public:
void add();
void find_total_sales();
};
cout << "Enter the name of the book : " ;
cin >> name;
cout << "Enter the name of the author : ";
cin >> auth;
cout << "Enter the Price : ";
cin >> price;
cout << "Enter the Qty Recived : ";
cin >> qty;
stmt.str("");
stmt << "Insert into books(name,auth,price,qty) values('" << name << "','" << auth << "'," << price << "," << qty << ");";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if (!(res_set))
cout << endl << endl << "Book Record Inserted Successfully" << endl << endl << endl;
else
cout << endl << endl << "Entry ERROR !" << endl << "Contact Technical Team " << endl << endl << endl;
}
void books::update_price()
{
char choice;
cout << "Enter the id of the book for update in price : ";
cin >> id;
stmt.str("");
stmt << "Select name,price from books where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "The Name of the book is : " << row[0] << endl ;
cout << "The current price of the book is : " << row[1] << endl ;
cout << "Do you Want to Update the Price [y/n] : " ;
cin >> choice;
if (choice == 121 || choice == 89)
{
cout << "Enter the new price : ";
cin >> price;
stmt.str("");
stmt << "Update books set price = " << price << " where id = " << id << ";";
res_set = mysql_store_result(conn);
if (!(res_set))
cout << endl << endl << "Book Price Updated Successfully" << endl << endl << endl;
else
cout << endl << endl << "Entry ERROR !" << endl << "Contact Technical Team " << endl << endl << endl;
}
else
{
cout << "No changes Made!!";
}
}
else
{
cout << "No Book found!!!";
}
}
void books::search()
{
cout << "Enter book id for details : ";
cin >> id;
stmt.str("");
stmt << "Select * from books where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "The Details of Book Id " << row[0] << endl;
cout << "The Name of the book is : " << row[1] << endl ;
cout << "THE Author of " << row[1] << " is " << row[2] << endl;
cout << "The Price of the book is : " << row[3] << endl ;
cout << "The inventory count is " << row[4] << endl;
}
else
{
cout << "No record Found" << endl;
}
}
void books::update()
{
int b_id[100],qty[100],i = 0,max;
stmt.str("");
stmt << "Select book_id,qty from purchases where recieves = 'T' and inv IS NULL;";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
stmt.str("");
stmt << "Update purchases set inv = 1 where recieves = 'T' and inv IS NULL;";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
while((row = mysql_fetch_row(res_set)) != NULL)
{
b_id[i] = (int) row[0];
qty[i] = (int) row[1];
i++;
}
max = i;
for(i = 0; i <= max; i++)
{
stmt.str("");
stmt << "update books set qty = " << qty[i] << " where id = " << b_id[i] << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
}
cout << "The orders recieved have been updated.";
}
void books::display()
{
int i = 0;
query = "Select * from books;";
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
while((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "Name for book " << ++i << " : " << row[1] << endl;
cout << "Name of Author : " << row[2] << endl;
cout << "Price : " << row[3] << endl;
cout << "Quantity : " << row[4] << endl;
cout << endl << endl << endl << endl ;
}
}
// ---------------
// class suppliers
// ---------------
void suppliers::add_sup()
{
cout << "Enter the Supplier Name : ";
cin >> name;
cout << "Enter Phone no. : ";
cin >> phn;
cout << "Enter the address (in 3 lines) : ";
cin >> addr_line1;
cin >> addr_line2;
cin >> addr_city;
cout << "Enter State : ";
cin >> addr_state;
stmt.str("");
stmt << "Insert into suppliers(name,phone_no,addr1,addr2,addr_city,addr_stat) values('" << name << "'," << phn << ",'" << addr_line1 << "','" << addr_line2 << "','" << addr_city << "','" << addr_state << "');";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if (!(res_set))
cout << endl << endl << "Supplier Record Inserted Successfully" << endl << endl << endl;
else
cout << endl << endl << "Entry ERROR !" << endl << "Contact Technical Team " << endl << endl << endl;
}
void suppliers::remove_supplier()
{
cout << "Enter the supplier id to remove the Supplier : ";
cin >> id;
stmt.str("");
stmt << "Delete from suppliers where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << "Supplier Removed.";
}
void suppliers::search_id()
{
cout << "Enter the supplier id to find the Supplier details : ";
cin >> id;
stmt.str("");
stmt << "Select * from suppliers where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "Details of Supplier Id : " << row[0] << endl;
cout << "Name : " << row[1] << endl;
cout << "Phone no. : " << row[2] << endl;
cout << "Address Line 1 : " << row[3] << endl;
cout << "Address Line 2 : " << row[4] << endl;
cout << "City : " << row[5] << endl;
cout << "State : " << row[6] << endl;
}
else
{
cout << "No Supplier Found!!";
}
}
// ------------------
// class Purchases
// ------------------
void purchases::new_ord()
{
cout << "Enter the book Id : ";
cin >> book_id;
cout << "Enter Supplier Id : ";
cin >> sup_id;
cout << "Enter the Quantity : ";
cin >> qty;
cout << "Estimated expected Delivery (in days) : ";
cin >> eta;
stmt.str("");
stmt << "Insert into purchases (book_id,sup_id,qty,dt_ord,eta) values ( " << book_id << "," << sup_id << "," << qty << ",curdate(),Date_add(curdate(), INTERVAL " << eta << " DAY)" << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << "New order Added!!";
}
void purchases::mark_reciv()
{
cout << "Enter the order id for order recieved : ";
cin >> ord_id;
stmt.str("");
stmt << "Update puchases set recieved = 'T' where ord_id = " << ord_id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << "Recieved Marked successfully";
}
void purchases::mar_cancel()
{
cout << "Enter the order id for order cancelled : ";
cin >> ord_id;
stmt.str("");
stmt << "Update puchases set recieved = 'C' where ord_id = " << ord_id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << "Cancelled Marked successfully";
}
void purchases::view()
{
int c;
cout << "Select an Option" << endl;
cout << "1. View orders not Recieved" << endl;
cout << "2. View orders Cancelled" << endl;
cout << "3. View orders Recieved" << endl;
cout << "Enter Your choice : ";
cin >> c;
if (c == 1)
received = 'F';
else if (c == 2)
received = 'C';
else if (c == 3)
received = 'T';
else
return;
stmt.str("");
stmt << "Select * from purchases where recieved = '" << received << "';";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if (c == 1)
cout << endl << "Orders not recieved are" << endl;
else if (c == 2)
cout << endl << "Orders Cancelled are" << endl;
else if (c == 3)
cout << endl << "Orders recieved are" << endl;
while((row = mysql_fetch_row(res_set)) != NULL)
{
cout << endl;
cout << "Order Id : " << row[0] << endl;
cout << "Book Id : " << row[1] << endl;
cout << "Supplier Id :" << row[2] << endl ;
cout << "Quantity : " << row[3] << endl;
cout << "Date Ordered : " << row[4] << endl;
cout << "Estimated Delivery date : " << row[5] << endl;
cout << endl << endl << endl;
}
cout <<endl << endl << endl <<endl << endl;
}
// ----------------
// class employees
// ----------------
void employees::add_emp()
{
cout << "Enter Your Id for verification : ";
cin >> id ;
stmt.str("");
stmt << "Select mgr_stat from employees where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if ((row = mysql_fetch_row(res_set)) == NULL)
{
cout << "Employee Not Found!!" << endl << endl << endl;
return;
}
else
{
mgr_status = (char*) row[0];
if (mgr_status == "T")
{
cout << "You Do Not have Manager Rights!!!" << endl << endl ;
return;
}
}
cout << "Enter The details of new employees!!";
cout << "Enter The name of the employee : ";
cin >> name;
cout << "Enter the Address (in 3 lines) : " << endl;
cin >> addr_line1;
cin >> addr_line2;
cin >> addr_city;
cout << "Enter State : ";
cin >> addr_state;
cout << "Enter phone no.";
cin >> phn;
cout << "Enter the salary : ";
cin >> salary;
stmt.str("");
stmt << "Insert into employees (name,addr1,addr2,addr_city,addr_stat,phone_no,doj,salary) values ('" << name << "','" << addr_line1 << "','" << addr_line2 << "','" << addr_city << "','" << addr_state << "'," << phn << ",curdate()," << salary << ");";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << endl << endl << "Employee Added Succesfully!" << endl << endl << endl;
}
void employees::assign_mgr_stat()
{
cout << "Enter Your Id for verification : ";
cin >> id ;
stmt.str("");
stmt << "Select mgr_stat from employees where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if ((row = mysql_fetch_row(res_set)) == NULL)
{
cout << "Employee Not Found!!" << endl << endl << endl;
return;
}
else
{
mgr_status = (char*) row[0];
if (mgr_status == "T")
{
cout << "You Do Not have Manager Rights!!!" << endl << endl ;
return;
}
}
cout << "Enter the employee id to grant Manager status : ";
cin >> id;
stmt.str("");
stmt << "update employees set mgr_stat = 'T' where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << endl << endl << endl;
cout << "Manager Status granted";
cout << endl << endl << endl;
}
void employees::search_emp()
{
cout << "Enter the id for searching an employee : ";
cin >> id ;
stmt.str("");
stmt << "Select * from employees where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if ((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "Employees Details" << endl ;
cout << "Name : " << row[1] <<endl;
cout << "Address : " << endl << row[2] << endl << row[3] << endl << row[4] << endl;
cout << "State : " << row[5] << endl;
cout << "Contact no. : " << row[6] << endl;
cout << "Date of Joining" << row[7] << endl;
cout << "Salary : " << row[8] << endl << endl << endl;
}
else
{
cout << "No Employee Found!!" << endl << endl << endl;
}
}
void employees::display()
{
int i = 0;
query = "Select * from employees;";
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if((row = mysql_fetch_row(res_set)) != NULL)
{
do
{
cout << "Employees Details of Emp no." << ++i << endl ;
cout << "Name : " << row[1] <<endl;
cout << "Address : " << endl << row[2] << endl << row[3] << endl << row[4] << endl;
cout << "State : " << row[5] << endl;
cout << "Contact no. : " << row[6] << endl;
cout << "Date of Joining" << row[7] << endl;
cout << "Salary : " << row[8] << endl;
cout << endl << endl << endl << endl;
}while((row = mysql_fetch_row(res_set)) != NULL);
}
else
{
cout << "Employees Not found!" << endl;
}
}
void employees::update_sal()
{
cout << "Enter the id to update the salary of an employee : ";
cin >> id ;
cout << "Enter the updated salary : ";
cin >> salary;
stmt.str("");
stmt << "Update employees set salary = " << salary << " where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
cout << endl << endl << endl << endl;
cout << "Salary update Successfully";
cout << endl << endl << endl << endl;
}
// ---------------------
// class members
// ---------------------
void members::add_mem()
{
cout << "Enter the name of the member : ";
cin >> name;
cout << "Enter phone no. : ";
cin >> phn;
cout << "Enter address (in 3 lines)" << endl;
cin >> addr_line1;
cin >> addr_line2;
cin >> addr_city;
cout << "Enter the name of the state : " ;
cin >> addr_state;
stmt.str("");
stmt << "insert into members(name,addr1,addr2,addr_city,addr_stat,phone_no,beg_date,end_date) values ('" << name << "','" << addr_line1 << "','" << addr_line2 << "','" << addr_city << "','" << addr_state << "'," << phn << ",curdate(),Date_add(curdate(), INTERVAL 1 YEAR));";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
// fetching member id...
stmt.str("");
stmt << "Select id from members where phone_no = " << phn << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
row = mysql_fetch_row(res_set);
cout << endl << endl << endl << endl;
cout << "Member Added successfully" << endl << endl <<"Member Id : " << row[0];
cout << endl << endl << endl << endl;
}
void members::refresh()
{
query = "Update members set valid = 'invalid' where end_date <= curdate();";
q = query.c_str();
mysql_query(conn,q);
}
void members::search_mem()
{
cout << "Enter member id : ";
cin >> id;
stmt.str("");
stmt << "Select * from members where id = " << id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if ((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "Member Details" << endl ;
cout << "Name : " << row[1] << endl;
cout << "Address : " << endl << row[2] << endl << row[3] << endl << row[4] << endl;
cout << "State : " << row[5] << endl;
cout << "Contact no. : " << row[6] << endl;
cout << "Membership begin date : " << row[7] << endl;
cout << "Membership end date : " << row[8] << endl;
cout << "Membership Status : " << row[9] << endl << endl << endl;
}
else
{
cout << "No Member Found!!" << endl << endl << endl;
}
}
// ------------------
// Class Sales
// ------------------
void sales::add()
{
cout << "Enter Menber id :";
cin >> member_id;
cout << "Enter the book id : ";
cin >> book_id;
cout << "Enter the quantity : ";
cin >> qty;
stmt.str("");
stmt << "select price*" << qty << " from books where id = " << book_id << ";";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if ((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "The bill amount : " << row[0] << endl << endl;
amount = (int) row[0];
}
else
{
cout << "Book Id invalid!!" << endl;
getch();
return;
}
stmt.str("");
stmt << "insert into sales(mem_id,book_id,qty,amt,sales_date) values (" << member_id << "," << book_id << "," << qty << "," << amount << ",curdate());";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
// fetching invoice id...
stmt.str("");
stmt << "select inv_id from sales where mem_id = " << member_id << " AND book_id = " << book_id << " AND qty = " << qty << " AND sales_date = curdate();";
query = stmt.str();
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "The Invoice id for the bill is " << row[0] << endl << endl << endl;
}
else
{
cout << "The entered details maybe wrong." << endl << "Please Recheck and Enter again" << endl << endl << endl;
}
}
void sales::find_total_sales()
{
query = "select sum(amt) from sales where year(sales_date) = year(curdate());";
q = query.c_str();
mysql_query(conn,q);
res_set = mysql_store_result(conn);
if((row = mysql_fetch_row(res_set)) != NULL)
{
cout << "Total sales this year : " << row[0] << endl << endl << endl << endl;
}
}
// ----------------
// Functions
// ----------------
void book_menu();
void sup_menu();
void pur_menu();
void emp_menu();
void mem_menu();
void sal_menu();
// main menu
void main_menu()
{
int c;
cout << "*************************************************" << endl;
cout << " BOOKSHOP MANGEMENT SYSTEM" << endl;
cout << "*************************************************" << endl;
cout << " 1. BOOKS" << endl;
cout << " 2. SUPPLIERS" << endl;
cout << " 3. PURCHASES" << endl;
cout << " 4. EMPLOYEES" << endl;
cout << " 5. MEMBERS" << endl;
cout << " 6. SALES" << endl;
cout << " 7. EXIT" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
system("cls");
book_menu();
getch();
break;
case 2:
system("cls");
sup_menu();
getch();
break;
case 3:
system("cls");
pur_menu();
getch();
break;
case 4:
system("cls");
emp_menu();
getch();
break;
case 5:
system("cls");
mem_menu();
getch();
break;
case 6:
system("cls");
sal_menu();
getch();
break;
case 7:
exit(1);
default:
system("cls");
cout << "Wrong Input" << endl << endl << "Invalid input";
getch();
break;
}
return;
}
// book menu
void book_menu()
{
int c;
books b;
cout << "*************************************************" << endl;
cout << " BOOK MENU" << endl;
cout << "*************************************************" << endl;
cout << " 1. ADD" << endl;
cout << " 2. UPDATE PRICE" << endl;
cout << " 3. SEARCH" << endl;
cout << " 4. UPDATE STATUS" << endl;
cout << " 5. DISPLAY ALL" << endl;
cout << " 6. RETURN TO MAIN MENU" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
b.add();
break;
case 2:
b.update_price();
break;
case 3:
b.search();
break;
case 4:
b.update();
break;
case 5:
b.display();
break;
case 6:
return;
break;
default:
cout << "Wrong Input" << endl << "Invalid input";
break;
}
return;
}
// supp menu
void sup_menu()
{
int c;
suppliers s;
cout << "*************************************************" << endl;
cout << " SUPPLIER MENU" << endl;
cout << "*************************************************" << endl;
cout << " 1. ADD" << endl;
cout << " 2. REMOVE" << endl;
cout << " 3. SEARCH" << endl;
cout << " 4. RETURN TO MAIN MENU" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
s.add_sup();
break;
case 2:
s.remove_supplier();
break;
case 3:
s.search_id();
break;
case 4:
return;
default:
cout << "Wrong Input" << endl << "Invalid input";
break;
}
}
// purchase menu
void pur_menu()
{
int c;
purchases p;
cout << "*************************************************" << endl;
cout << " PURCHASES MENU" << endl;
cout << "*************************************************" << endl;
cout << " 1. New Order" << endl;
cout << " 2. View All" << endl;
cout << " 3. Cancel Order" << endl;
cout << " 4. Recieved Order" << endl;
cout << " 5. RETURN TO MAIN MENU" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
p.new_ord();
break;
case 2:
p.view();
break;
case 3:
p.mar_cancel();
break;
case 4:
p.mark_reciv();
break;
case 5:
return;
default:
cout << "Wrong Input" << endl << "Invalid input";
break;
}
}
// emp_menu
void emp_menu()
{
int c;
employees e;
cout << "*************************************************" << endl;
cout << " EMPLOYEE MENU" << endl;
cout << "*************************************************" << endl;
cout << " 1. New Employee" << endl;
cout << " 2. Search Employee" << endl;
cout << " 3. Assign Manager" << endl;
cout << " 4. View All" << endl;
cout << " 5. Update Salary" << endl;
cout << " 6. RETURN TO MAIN MENU" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
e.add_emp();
break;
case 2:
e.search_emp();
break;
case 3:
e.assign_mgr_stat();
break;
case 4:
e.display();
break;
case 5:
e.update_sal();
break;
case 6:
return;
default:
cout << "Wrong Input" << endl << "Invalid input";
break;
}
}
// mem menu
void mem_menu()
{
int c;
members m;
m.refresh();
cout << "*************************************************" << endl;
cout << " MEMBERS MENU" << endl;
cout << "*************************************************" << endl;
cout << " 1. New Member" << endl;
cout << " 2. Search Member" << endl;
cout << " 3. RETURN TO MAIN MENU" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
m.add_mem();
break;
case 2:
m.search_mem();
break;
case 3:
return;
default:
cout << "Wrong Input" << endl << "Invalid input";
break;
}
}
// sal_menu
void sal_menu()
{
int c;
sales s;
cout << "*************************************************" << endl;
cout << " SALES MENU" << endl;
cout << "*************************************************" << endl;
cout << " 1. Add New Bill" << endl;
cout << " 2. Total Sales Of The Year" << endl;
cout << " 3. RETURN TO MAIN MENU" << endl << endl << endl;
cout << "Enter Your Choice : ";
cin >> c;
switch (c)
{
case 1:
s.add();
break;
case 2:
s.find_total_sales();
break;
case 3:
return;
default:
cout << "Wrong Input" << endl << "Invalid input";
break;
}
}