-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPharmacy_Management_System.cpp
More file actions
483 lines (415 loc) · 13 KB
/
Pharmacy_Management_System.cpp
File metadata and controls
483 lines (415 loc) · 13 KB
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
//TMF 1434(Data structure and Algorithm
//Library
#include <iostream>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iomanip>
#define max 10
using namespace std;
//the header file
class medicineType//base class
{
public:
void take_order();//to take_order
void delete_order(); //to delete the order
void modify(); //to modify the order
void order_list(); //to display the order_list
void daily_summary(); //to display daily_summary
void exit(); //function to exit system
medicineType();//constuctor
};
medicineType::medicineType ()
{
} //constructor for class CarType
struct node //constract node
{
int reciept_number;
string customerName;
string date;
int quantity[10];
string type = {"OTC"};
int x, menu2[10];
double amount[10];
string medicineName[10]={"Probiotics","Vitamin C(500mg)","Acid Free C(500mg)","Women'S Multivate","Marino Tablet","Maxi Cal Tablet",
"Amino Zinc Tablet","Burnex","Fabuloss 5","Royal Propollen"};
double Medicine[10] = {2.00,3.00,1.00,4.00,1.00,5.00,7.00,4.00,3.00,5.00};
double total;
node *prev;
node *next;
node *link;
}*q, *temp; //pointer declaration
node *start_ptr = NULL;
node *head = NULL;
node *last = NULL;
int main()// Main function
{
system("COLOR 79"); //Color to change background
medicineType medicine;
int menu;
do
{
system("cls");
cout<<"\t\t\tPharmacy Management System - UNIMAS\n";
cout<<"\t\t==================================================\n\n";
cout<<"\t\t--------------------------------------------------\n";
cout<<"\t\t||\t1. Take new Medicine order \t\t ||\n";
cout<<"\t\t||\t2. delete latest Medicine order\t\t ||\n";
cout<<"\t\t||\t3. Modify Order List \t\t\t ||\n";
cout<<"\t\t||\t4. Print the Reciept and Make Payment \t ||\n";
cout<<"\t\t||\t5. Daily Summary of total Sale \t\t ||\n";
cout<<"\t\t||\t6. Exit\t\t\t\t\t ||\n";
cout<<"\t\t--------------------------------------------------\n";
cout<<"Enter choice: ";
cin>>menu;
switch (menu)
{
case 1:
{
medicine.take_order();//function add
break;
}//end case 1
case 2:
{
medicine.delete_order();//function delete
system("PAUSE");
break;
}
case 3:
{
medicine.modify();//function modify
system("PAUSE");
main();
break;
}
case 4:
{
medicine.order_list();//function order
system("PAUSE");
break;
}
case 5:
{
medicine.daily_summary();//function daily_summary
system("PAUSE");
break;
}
case 6:
{
medicine.exit();//function exit
goto a;
break;
}
default:
{
cout<<"You enter invalid input\nre-enter the input\n"<<endl;
break;
}//end defeault
}//end if
}while(menu!=6);//end do
a://goto
cout<<"thank you"<<endl;
system ("PAUSE");
return 0;
}//end int main
void medicineType::take_order()//function to take_order
{
system("cls");
int i;
int choice, quantity, price,None;
cout <<"\nAdd Order Details\n";
cout <<"_____________________________________ \n\n";
node *temp;
temp=new node;
cout <<"**************************************************************************\n";
cout<<"DRUGS ID"<<"\tDRUGS TYPE"<<" \t\tDRUGS NAME"<<" DRUGS PRICE(RM)"<<endl;
cout <<"**************************************************************************\n";
cout<<"0001"<<"\t"<<"\tOTC"<<"\t\t"<<" Probiotics"<<" RM 2.00"<<endl;
cout<<"0002"<<"\t"<<"\tOTC"<<"\t\t"<<" Vitamin C(500mg)"<<" RM 3.00"<<endl;
cout<<"0003"<<"\t"<<"\tOTC"<<"\t\t"<<" Acid Free C(500mg)"<<" RM 1.00"<<endl;
cout<<"0004"<<"\t"<<"\tOTC"<<"\t\t"<<" Women'S Multivate"<<" RM 4.00"<<endl;
cout<<"0005"<<"\t"<<"\tOTC"<<"\t\t"<<" Marino Tablet"<<" RM 1.00"<<endl;
cout<<"0006"<<"\t"<<"\tOTC"<<"\t\t"<<" Maxi Cal Tablet"<<" RM 5.00"<<endl;
cout<<"0007"<<"\t"<<"\tOTC"<<"\t\t"<<" Amino Zinc Tablet"<<" RM 7.00"<<endl;
cout<<"0008"<<"\t"<<"\tOTC"<<"\t\t"<<" Burnex"<<" RM 4.00"<<endl;
cout<<"0009"<<"\t"<<"\tOTC"<<"\t\t"<<" Fabuloss 5"<<" RM 3.00"<<endl;
cout<<"0010"<<"\t"<<"\tOTC"<<"\t\t"<<" Royal Propollen"<<" RM 5.00"<<endl;
cout<<" "<<endl;
temp = new node;
cout << "Type Order no: ";
cin >> temp->reciept_number;
cout<< "Enter Customer Name: ";
cin>> temp->customerName;
cout<<"Enter Date : ";
cin>>temp->date;
cout << "How many Medicine would you like to order:"<< endl;
cout<<"( Maximum is 10 order for each transaction ) \n";
cout << " " ;
cin >> temp->x;
if (temp->x >10)
{
cout << "The Medicine you order is exceed the maximum amount of order !";
system("pause");
}
else{
for (i=0; i<temp->x; i++)
{
cout << "Please enter your selection : "<<endl;
cin>> temp->menu2[i];
cout<< "Medicine Name: " <<temp->medicineName[temp->menu2[i]-1]<<endl;
cout << "How many medicine do you want: ";
cin >> temp->quantity[i];
temp->amount[i] = temp->quantity[i] * temp->Medicine[temp->menu2[i]-1];
cout << "The amount You need to pay is: " << temp->amount[i]<<" RM"<<endl;
}
cout<<"==========================================================================="<<endl;
cout << "Order Taken Successfully"<<endl;
cout<<"==========================================================================="<<endl;
cout << "Go to Reciept Menu to Pay The Bill"<<endl;
cout<<"==========================================================================="<<endl;
system ("PAUSE");
temp->next=NULL;
if(start_ptr!=NULL)
{
temp->next=start_ptr;
}
start_ptr=temp;
system("cls");
}
}//End function void take_order
void medicineType::order_list()//Function to display receipt
{
int i, num, num2;
bool found; //variable to search
system("cls");
node *temp;
temp=start_ptr;
found = false;
cout<<" Enter the Reciept Number To Print The Reciept\n";
cin>>num2;
cout<<"\n";
cout<<"==========================================================================="<<endl;
cout <<"\t\tHere is the Order list\n";
cout<<"==========================================================================="<<endl;
if(temp == NULL) //Invalid receipt code
{
cout << "\tThere is no Order to show\n\t\t\tSo The List is Empty\n\n\n";
}
while(temp !=NULL && !found)
{
if (temp->reciept_number==num2)
{
found = true;
}
else
{
temp = temp -> next;
}
if (found)
{
cout <<"Reciept Number : "<<temp->reciept_number;
cout <<"\n";
cout<<"Customer Name: "<<temp->customerName<<endl;
cout<<"Order Date : "<<temp->date<<endl;
cout<<"_____________________________________________________________________________"<<endl;
cout << "===============================================================================" << endl;
cout << "| Medicine Type | Medicine Name | Quantity | Total Price |" << endl;
cout << "=======++==================++================++===============++===============" << endl;
for (i=0;i<temp->x;i++)
{
cout << temp->type <<" \t\t";
cout<<temp->medicineName[temp->menu2[i]-1]<<"\t\t\t ";
cout<<temp->quantity[i] <<"\t\t";
cout<< temp->amount[i]<<" RM"<<endl;
cout<<"_________________________________________________________________________________"<<endl;
}
temp->total = temp->amount[0]+temp->amount[1]+temp->amount[2]+temp->amount[3]+temp->amount[4]+temp->amount[5]+temp->amount[6]+temp->amount[7]
+temp->amount[8]+temp->amount[9];
cout<<"Total Bill is : "<<temp->total;
cout<<"\n";
cout << "Type the exact amount You need to pay: ";
cin >> num;
cout <<"\n";
cout <<"\n";
cout<<"Payment Done\nThank You\n";
cout <<"\n_______________________________________________________________________________\n";
}
else
{
cout << "\tThere is no Order to show\n\t\t\tSo The List is Empty\n\n\n";
}
}
}//End function display
void medicineType::delete_order()//function to delete_order
{
system("cls");
int i, num, count;
cout<<"Enter the data you want to delete \n";
cin>>num;
node *q;
node *temp;
bool found;
if(start_ptr == NULL)
cerr<<"Can not delete from an empty list.\n";
else
{
if(start_ptr->reciept_number == num)
{
q = start_ptr;
start_ptr = start_ptr->next;
count--;
if(start_ptr == NULL)
last = NULL;
delete q;
cout<<"The Reciept is Deleted Successfully"<<endl;
}
else
{
found = false;
temp = start_ptr;
q = start_ptr->next;
while((!found) && (q != NULL))
{
if(q->reciept_number != num)
{
temp = q;
q = q-> next;
}
else
found = true;
}
if(found)
{
temp->next = q->next;
count--;
if(last == q)
last = temp;
delete q;
cout<<"The Reciept is Deleted Successfully"<<endl;
}
else
cout<<"Item to be deleted is not in the list."<<endl;
}
}
}//End function delete_order
void medicineType::modify() //function to modify order
{
system("cls");
int i, ch, sid;
bool found;
found = false;
temp = start_ptr;
cout<<"Enter Receipt Number To Modify: ";
cin>>sid;
if (temp==NULL && sid==0)
{
cout<<"NO RECORD TO MODIFY..!"<<endl;
}
else
{
while(temp !=NULL && !found)
{
if (temp->reciept_number==sid)
{
found = true;
}
else
{
temp = temp -> next;
}
if (found)
{
cout << "Change Order Number: ";
cin >> temp->reciept_number;
cout<< "Change Customer Name: ";
cin>> temp->customerName;
cout<<"Change Date : ";
cin>>temp->date;
cout << "How many New Medicine would you like to Change:"<< endl;
cout<<"( Maximum is 10 order for each transaction ) \n";
cout << " " ;
cin >> temp->x;
if (temp->x >10)
{
cout << "The Medicine you order is exceed the maximum amount of order !";
system("pause");
}
else{
for (i=0; i<temp->x; i++)
{
cout << "Please enter your selection to Change: "<<endl;
cin>> temp->menu2[i];
cout<< "Change Medicine Name: " <<temp->medicineName[temp->menu2[i]-1]<<endl;
cout << "How many New medicine do you want: ";
cin >> temp->quantity[i];
temp->amount[i] = temp->quantity[i] * temp->Medicine[temp->menu2[i]-1];
cout << "The amount You need to pay After Modify is: " << temp->amount[i]<<" RM"<<endl;
system("PAUSE");
}
temp = temp->next;
system("cls");
}
cout<<"RECORD MODIFIED....!"<<endl;
}
else
{
if(temp != NULL && temp->reciept_number != sid)
{
cout<<"Invalid Reciept Number...!"<<endl;
}
}
}
}
} //End modify function
void medicineType::daily_summary()//Function to display Daily Summary
{
int i,num;
system("cls");
node *temp ;
temp=start_ptr;
if(temp == NULL) //Invalid receipt code
{
cout << "\t\t\tThere is no Order to show\n\t\t\tSo The List is Empty\n\n\n";
}
else
{
cout<<"\n";
cout<<"==========================================================================="<<endl;
cout <<" \t\tHere is the Daily Summary of All Orders \n"; //print all receipt
cout<<"==========================================================================="<<endl;
while(temp!=NULL)
{
cout <<"Reciept Number : "<<temp->reciept_number;
cout <<"\n";
cout<<"Customer Name: "<<temp->customerName<<endl;
cout<<"Order Date : "<<temp->date<<endl;
cout<<"____________________________________________________________________________"<<endl;
cout << "==========================================================================" << endl;
cout << "| Medicine Type | Medicine Name | Quantity | Total Price |" << endl;
cout << "=======++==================++================++===============++==========" << endl;
for (i=0;i<temp->x;i++)
{
cout << temp->type <<" \t\t";
cout<<temp->medicineName[temp->menu2[i]-1]<<"\t\t";
cout<<temp->quantity[i] <<"\t\t";
cout<< temp->amount[i]<<" RM"<<endl;
cout<<"_____________________________________________________________________________"<<endl;
}
temp->total = temp->amount[0]+temp->amount[1]+temp->amount[2]+temp->amount[3]+temp->amount[4]+temp->amount[5]+temp->amount[6]+temp->amount[7]
+temp->amount[8]+temp->amount[9];
cout<<"Total Bill is : "<<temp->total;
cout <<"\n";
cout <<"\n";
cout <<"\n_______________________________________________________________________________\n";
temp=temp->next;
}
}
} //End daily summary
void medicineType::exit() //Function to exit
{
cout<<"\nYou choose to exit.\n"<<endl;
}//end function exit
////////////////////////////THE END OF PROGRAM//////////////////////////////////////////