Note - Double Click to Copy Code Contact Us!
Posts

Pharmacy Manager System using C++

Tech Doubility
Pharmacy Manager System using C++



  1. // main.cpp
  2. // CSE - 202 Project By Tech Doubility
  3. //
  4. #include <iostream>
  5. #include <stdlib.h>
  6. #include <string>
  7. #include <cctype>
  8. #include <cmath>
  9. #include <cstdio>
  10. #include <fstream>
  11. #include <iomanip>
  12. #define max 10
  13.  
  14. using namespace std;
  15.  
  16.  
  17. class medicineType //base class
  18. {
  19. public:
  20.  
  21. void take_order();
  22. void delete_order();
  23. void modify();
  24. void order_list();
  25. void daily_summary();
  26. void exit();
  27. medicineType();//constuctor
  28.  
  29. };
  30.  
  31. medicineType::medicineType ()
  32. {
  33.  
  34. } //constructor for class CarType
  35.  
  36.  
  37. struct node //constract node
  38. {
  39. int reciept_number;
  40. string customerName;
  41. string date;
  42. int quantity[10];
  43. string type = {"OTC"};
  44. int x, menu2[10];
  45. double amount[10];
  46. string medicineName[10]={"Probiotics","Vitamin C(500mg)","Acid Free C(500mg)","Women'S Multivate","Marino Tablet","Maxi Cal Tablet",
  47. "Amino Zinc Tablet","Burnex","Fabuloss 5","Royal Propollen"};
  48. double Medicine[10] = {2.00,3.00,1.00,4.00,1.00,5.00,7.00,4.00,3.00,5.00};
  49. double total;
  50.  
  51. node *prev;
  52. node *next;
  53. node *link;
  54.  
  55. }*q, *temp; //pointer declaration
  56.  
  57.  
  58. node *start_ptr = NULL;
  59. node *head = NULL;
  60. node *last = NULL;
  61.  
  62. int main()
  63. {
  64.  
  65.  
  66.  
  67. system("COLOR 61");
  68. medicineType medicine;
  69. int menu;
  70. do
  71. {
  72. system("cls");
  73. cout<<"\t\t==================================================\n";
  74. cout<<"\t\t\t UNI Pharmacy Management System - MUJIB\n";
  75. cout<<"\t\t==================================================\n\n";
  76. cout<<"\t\t--------------------------------------------------\n";
  77. cout<<"\t\t||\t1. Take new Medicine order \t\t ||\n";
  78. cout<<"\t\t||\t2. delete latest Medicine order\t\t ||\n";
  79. cout<<"\t\t||\t3. Modify Order List \t\t\t ||\n";
  80. cout<<"\t\t||\t4. Print the Reciept and Make Payment \t ||\n";
  81. cout<<"\t\t||\t5. Daily Summary of total Sale \t\t ||\n";
  82. cout<<"\t\t||\t6. Exit\t\t\t\t\t ||\n";
  83. cout<<"\t\t--------------------------------------------------\n";
  84. cout<<"Enter choice: ";
  85.  
  86. cin>>menu;
  87.  
  88. switch (menu)
  89. {
  90. case 1:
  91. {
  92. medicine.take_order();
  93. break;
  94. }
  95.  
  96.  
  97. case 2:
  98. {
  99. medicine.delete_order();
  100. system("PAUSE");
  101. break;
  102. }
  103.  
  104. case 3:
  105. {
  106. medicine.modify();
  107. system("PAUSE");
  108. break;
  109. }
  110.  
  111. case 4:
  112. {
  113. medicine.order_list();
  114. system("PAUSE");
  115. break;
  116. }
  117. case 5:
  118. {
  119. medicine.daily_summary();
  120. system("PAUSE");
  121. break;
  122. }
  123. case 6:
  124. {
  125. medicine.exit();
  126. goto a;
  127. break;
  128. }
  129.  
  130.  
  131. default:
  132. {
  133. cout<<"You enter invalid input\nre-enter the input\n"<<endl;
  134. break;
  135. }
  136. }
  137. }while(menu!=6);
  138. a://goto
  139. cout<<"thank you"<<endl;
  140. system ("PAUSE");
  141. return 0;
  142. }
  143.  
  144.  
  145. void medicineType::take_order()
  146. {
  147. system("cls");
  148. int i;
  149. int choice, quantity, price,None;
  150.  
  151. cout <<"\nAdd Order Details\n";
  152. cout <<"_____________________________________ \n\n";
  153.  
  154. node *temp;
  155. temp=new node;
  156.  
  157. cout <<"**************************************************************************\n";
  158. cout<<"DRUGS ID"<<"\tDRUGS TYPE"<<" \t\tDRUGS NAME"<<" DRUGS PRICE(Rupe)"<<endl;
  159. cout <<"**************************************************************************\n";
  160. cout<<"0001"<<"\t"<<"\tOTC"<<"\t\t"<<" Probiotics"<<" Rupe 2.00"<<endl;
  161. cout<<"0002"<<"\t"<<"\tOTC"<<"\t\t"<<" Vitamin C(500mg)"<<" Rupe 3.00"<<endl;
  162. cout<<"0003"<<"\t"<<"\tOTC"<<"\t\t"<<" Acid Free C(500mg)"<<" Rupe 1.00"<<endl;
  163. cout<<"0004"<<"\t"<<"\tOTC"<<"\t\t"<<" Women'S Multivate"<<" Rupe 4.00"<<endl;
  164. cout<<"0005"<<"\t"<<"\tOTC"<<"\t\t"<<" Marino Tablet"<<" Rupe 1.00"<<endl;
  165. cout<<"0006"<<"\t"<<"\tOTC"<<"\t\t"<<" Maxi Cal Tablet"<<" Rupe 5.00"<<endl;
  166. cout<<"0007"<<"\t"<<"\tOTC"<<"\t\t"<<" Amino Zinc Tablet"<<" Rupe 7.00"<<endl;
  167. cout<<"0008"<<"\t"<<"\tOTC"<<"\t\t"<<" Burnex"<<" Rupe 4.00"<<endl;
  168. cout<<"0009"<<"\t"<<"\tOTC"<<"\t\t"<<" Fabuloss 5"<<" Rupe 3.00"<<endl;
  169. cout<<"0010"<<"\t"<<"\tOTC"<<"\t\t"<<" Royal Propollen"<<" Rupe 5.00"<<endl;
  170. cout<<" "<<endl;
  171.  
  172. temp = new node;
  173. cout << "Type Order no: ";
  174. cin >> temp->reciept_number;
  175. cout<< "Enter Customer Name: ";
  176. cin>> temp->customerName;
  177. cout<<"Enter Date : ";
  178. cin>>temp->date;
  179. cout << "How many Medicine would you like to order:"<< endl;
  180. cout<<"( Maximum is 10 order for each transaction ) \n";
  181. cout << " " ;
  182. cin >> temp->x;
  183. if (temp->x >10)
  184. {
  185. cout << "The Medicine you order is exceed the maximum amount of order !";
  186. system("pause");
  187. }
  188. else{
  189. for (i=0; i<temp->x; i++)
  190. {
  191.  
  192. cout << "Please enter your selection : "<<endl;
  193. cin>> temp->menu2[i];
  194. cout<< "Medicine Name: " <<temp->medicineName[temp->menu2[i]-1]<<endl;
  195. cout << "How many medicine do you want: ";
  196. cin >> temp->quantity[i];
  197. temp->amount[i] = temp->quantity[i] * temp->Medicine[temp->menu2[i]-1];
  198. cout << "The amount You need to pay is: " << temp->amount[i]<<" Rupe"<<endl;
  199. system("PAUSE");
  200.  
  201. }
  202. cout<<"==========================================================================="<<endl;
  203. cout << "Order Taken Successfully"<<endl;
  204. cout<<"==========================================================================="<<endl;
  205. cout << "Go to Reciept Menu to Pay The Bill"<<endl;
  206. cout<<"==========================================================================="<<endl;
  207. system ("PAUSE");
  208.  
  209. temp->next=NULL;
  210. if(start_ptr!=NULL)
  211. {
  212. temp->next=start_ptr;
  213. }
  214. start_ptr=temp;
  215. system("cls");
  216. }
  217. }
  218.  
  219.  
  220. void medicineType::order_list()
  221.  
  222. {
  223.  
  224. int i, num, num2;
  225. bool found;
  226. system("cls");
  227. node *temp;
  228.  
  229. temp=start_ptr;
  230. found = false;
  231.  
  232. cout<<" Enter the Reciept Number To Print The Reciept\n";
  233. cin>>num2;
  234. cout<<"\n";
  235. cout<<"==========================================================================="<<endl;
  236. cout <<"\t\tHere is the Order list\n";
  237. cout<<"==========================================================================="<<endl;
  238.  
  239.  
  240. if(temp == NULL)
  241. {
  242. cout << "\tThere is no Order to show\n\t\t\tSo The List is Empty\n\n\n";
  243. }
  244. while(temp !=NULL && !found)
  245. {
  246. if (temp->reciept_number==num2)
  247. {
  248. found = true;
  249. }
  250. else
  251. {
  252. temp = temp -> next;
  253. }
  254. if (found)
  255. {
  256. cout <<"Reciept Number : "<<temp->reciept_number;
  257. cout <<"\n";
  258. cout<<"Customer Name: "<<temp->customerName<<endl;
  259.  
  260. cout<<"Order Date : "<<temp->date<<endl;
  261.  
  262. cout<<"_____________________________________________________________________________"<<endl;
  263.  
  264. cout << "===============================================================================" << endl;
  265. cout << "| Medicine Type | Medicine Name | Quantity | Total Price |" << endl;
  266. cout << "=======++==================++================++===============++===============" << endl;
  267. for (i=0;i<temp->x;i++)
  268. {
  269. cout << temp->type <<" \t\t";
  270. cout<<temp->medicineName[temp->menu2[i]-1]<<"\t\t\t ";
  271. cout<<temp->quantity[i] <<"\t\t";
  272. cout<< temp->amount[i]<<" Rupe"<<endl;
  273. cout<<"_________________________________________________________________________________"<<endl;
  274. }
  275.  
  276. 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]
  277. +temp->amount[8]+temp->amount[9];
  278. cout<<"Total Bill is : "<<temp->total;
  279. cout<<"\n";
  280. cout << "Type the exact amount You need to pay: ";
  281. cin >> num;
  282.  
  283. cout <<"\n";
  284. cout <<"\n";
  285. cout<<"Payment Done\nThank You\n";
  286. cout <<"\n_______________________________________________________________________________\n";
  287. }
  288.  
  289.  
  290. }
  291. }
  292.  
  293.  
  294. void medicineType::delete_order()
  295. {
  296. system("cls");
  297. int i, num, count;
  298. cout<<"Enter the data you want to delete \n";
  299. cin>>num;
  300. node *q;
  301. node *temp;
  302. bool found;
  303.  
  304. if(start_ptr == NULL)
  305. cerr<<"Can not delete from an empty list.\n";
  306. else
  307. {
  308. if(start_ptr->reciept_number == num)
  309. {
  310. q = start_ptr;
  311. start_ptr = start_ptr->next;
  312. count--;
  313. if(start_ptr == NULL)
  314. last = NULL;
  315. delete q;
  316. cout<<"The Reciept is Deleted Successfully"<<endl;
  317. }
  318. else
  319. {
  320. found = false;
  321. temp = start_ptr;
  322. q = start_ptr->next;
  323.  
  324. while((!found) && (q != NULL))
  325. {
  326. if(q->reciept_number != num)
  327. {
  328. temp = q;
  329. q = q-> next;
  330. }
  331. else
  332. found = true;
  333. }
  334.  
  335. if(found)
  336. {
  337. temp->next = q->next;
  338. count--;
  339.  
  340. if(last == q)
  341. last = temp;
  342. delete q;
  343. cout<<"The Reciept is Deleted Successfully"<<endl;
  344. }
  345. else
  346. cout<<"Item to be deleted is not in the list."<<endl;
  347. }
  348. }
  349. }
  350.  
  351.  
  352.  
  353. void medicineType::modify()
  354. {
  355. system("cls");
  356. int i, ch, sid;
  357. bool found;
  358. found = false;
  359. temp = start_ptr;
  360. cout<<"Enter Receipt Number To Modify: ";
  361. cin>>sid;
  362. if (temp==NULL && sid==0)
  363. {
  364. cout<<"NO RECORD TO MODIFY..!"<<endl;
  365. }
  366.  
  367. else
  368. {
  369. while(temp !=NULL && !found)
  370. {
  371. if (temp->reciept_number==sid)
  372. {
  373. found = true;
  374. }
  375. else
  376. {
  377. temp = temp -> next;
  378. }
  379. if (found)
  380. {
  381. cout << "Change Order Number: ";
  382. cin >> temp->reciept_number;
  383. cout<< "Change Customer Name: ";
  384. cin>> temp->customerName;
  385. cout<<"Change Date : ";
  386. cin>>temp->date;
  387. cout << "How many New Medicine would you like to Change:"<< endl;
  388. cout<<"( Maximum is 10 order for each transaction ) \n";
  389. cout << " " ;
  390. cin >> temp->x;
  391. if (temp->x >10)
  392. {
  393. cout << "The Medicine you order is exceed the maximum amount of order !";
  394. system("pause");
  395. }
  396. else{
  397. for (i=0; i<temp->x; i++)
  398. {
  399.  
  400. cout << "Please enter your selection to Change: "<<endl;
  401. cin>> temp->menu2[i];
  402. cout<< "Change Medicine Name: " <<temp->medicineName[temp->menu2[i]-1]<<endl;
  403. cout << "How many New medicine do you want: ";
  404. cin >> temp->quantity[i];
  405. temp->amount[i] = temp->quantity[i] * temp->Medicine[temp->menu2[i]-1];
  406. cout << "The amount You need to pay After Modify is: " << temp->amount[i]<<" Rupe"<<endl;
  407. system("PAUSE");
  408. }
  409. temp = temp->next;
  410. system("cls");
  411.  
  412. }
  413.  
  414. cout<<"RECORD MODIFIED....!"<<endl;
  415. }
  416. else
  417. {
  418. if(temp != NULL && temp->reciept_number != sid)
  419. {
  420. cout<<"Invalid Reciept Number...!"<<endl;
  421. }
  422. }
  423. }
  424. }
  425. }
  426.  
  427.  
  428.  
  429. void medicineType::daily_summary()
  430. {
  431. int i,num;
  432. system("cls");
  433. node *temp ;
  434.  
  435. temp=start_ptr;
  436.  
  437.  
  438. if(temp == NULL)
  439. {
  440. cout << "\t\t\tThere is no Order to show\n\t\t\tSo The List is Empty\n\n\n";
  441. }
  442. else
  443. {
  444. cout<<"\n";
  445. cout<<"==========================================================================="<<endl;
  446. cout <<" \t\tHere is the Daily Summary of All Orders \n"; //print all receipt
  447. cout<<"==========================================================================="<<endl;
  448.  
  449. while(temp!=NULL)
  450.  
  451. {
  452.  
  453.  
  454. ofstream fout;
  455. char fname[20];
  456. char rec[80];
  457.  
  458. cout<<"Enter a unique file name: ";
  459. cin>>fname;
  460.  
  461. fout.open(fname, ios::app);
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468. cout <<"Reciept Number : "<<temp->reciept_number;
  469. cout <<"\n";
  470. cout<<"Customer Name: "<<temp->customerName<<endl;
  471.  
  472. cout<<"Order Date : "<<temp->date<<endl;
  473.  
  474. cout<<"____________________________________________________________________________"<<endl;
  475.  
  476. cout << "==========================================================================" << endl;
  477. cout << "| Medicine Type | Medicine Name | Quantity | Total Price |" << endl;
  478. cout << "=======++==================++================++===============++==========" << endl;
  479. for (i=0;i<temp->x;i++)
  480. {
  481. cout << temp->type <<" \t\t";
  482. cout<<temp->medicineName[temp->menu2[i]-1]<<"\t\t";
  483. cout<<temp->quantity[i] <<"\t\t";
  484. cout<< temp->amount[i]<<" Rupe"<<endl;
  485. cout<<"_____________________________________________________________________________"<<endl;
  486. }
  487.  
  488. 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]
  489. +temp->amount[8]+temp->amount[9];
  490. cout<<"Total Bill is : "<<temp->total;
  491.  
  492. cout <<"\n";
  493. cout <<"\n";
  494. cout <<"\n_______________________________________________________________________________\n";
  495.  
  496.  
  497. fout <<"Reciept Number : "<<temp->reciept_number;
  498. fout <<"\n";
  499. fout<<"Customer Name: "<<temp->customerName<<endl;
  500.  
  501. fout<<"Order Date : "<<temp->date<<endl;
  502. fout <<"\n";
  503. fout<<"Total Bill is : "<<temp->total;
  504. temp=temp->next;
  505. cout<<"Data inserted successfully..!!";
  506. fout.close();
  507. }
  508.  
  509. }
  510. }
  511. void medicineType::exit()
  512. {
  513. cout<<"\nYou choose to exit.\n"<<endl;
  514. }
  515.  
  516.  
  517. ////////////////////////////Thank You @ Kishan Prajapati//////////////////////////////////////////

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.