Pharmacy Management System/Project in C++ with MySQL

CWC
4 Min Read

This C++ program is a pharmacy management system can store the medicine information and create purchase and generate total amount of purchase.

Program Detail:

In the beginning of the program

Global variables used in Pharmacy Management System in C++ with MySQL

  • qstate represent the state of the query. If 0 is successful 1 is failed.
  • conn is the mysql connection variable.
  • row is for getting the current row of the database.
  • res is for getting all the values form the database.


Class db_response

  • This class contains connection of the database.
  • mysql_init is the initializer of mysql_real_connect
  • mysql_real_connect connects to the database. (MySql server should open while connecting)
  • the if statement shows the successful or failed connection.


Function main Pharmacy Management System in C++ with MySQL

  • Here firstly the clear screen command then the title command and the color command.
  • db_response::ConnectionFunction() is create the connection to the database.
  • The program features
    • Buy Medicine
    • Show Item List
    • Find Item From List
    • Add Item in Stock
    • Update Stock Item
    • Delete Stock Item

  • The switch case is used for switching between this functions
    • BuyMedicine()
    • ShowItemList()
    • FindItemFromList()
    • AddIteminStock()
    • UpdateStockItem()
    • DeleteStockItem()

Function BuyMedicine ()

  • This function is for the customer in Pharmacy Management System
  • If the customer wants to buy medicine the seller can easily make a list of medicine and create a total bill of the medicines.
  • Here all the medicine in the list will showing in the console
  • Seller can choose medicines more than ones
  • Simple “Select” query get all the medicine from the list
  • Then after validation of ids the total number of medicine will decrease after all purchase
  • And update the database
  • As well as show the total amount of purchased medicine

Function ShowItemList ()

  • Showing all the items in the database in Pharmacy Management System
  • “Select” query will get all the data from the database
  • And display in the console

Function FindItemFromList ()

  • User can find item from the list in Pharmacy Management System
  • Only with few characters of the name of the item the program can find all the similar product
  • And display all the information in the console

Function AddIteminStock ()

  • User can add new medicine with this function
  • “Insert” query is used for add item in the database
  • User can fill all the information of the medicine
  • Then the information’s are added in the database

Function UpdateStockItem ()

  • If the user wants to update any information of the item in the list then this is the function
  • “Update” query is used to update the database information.
  • User can keep the old data in the database by typing simple keyword “xN”
  • Then the database will update the information
  • It can validate the given number and show proper message in the console

Function DeleteStockItem ()

  • User can delete any item from the database
  • “Delete” query is used to delete information
  • User simply type the id of the item and delete the item from the database with a message
  • It can validate the given number and show proper message in the console

Database and Table Name used in Pharmacy Management System

Table: medicine_tb

Database: cpp_pharmacymanagementsystem

Usage

XAMPP Server, MySql Headers, MySql Libs
Download Project Source code Free Pharmacy Management System in C++ with MySQL

[sociallocker]Download Free Project Pharmacy Management System in C++ with MySQL
Password:codewithc.com
[/sociallocker]

Share This Article
13 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version