0% found this document useful (0 votes)
75 views6 pages

Medical Shop Management System

computer science project

Uploaded by

kishorejai988
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views6 pages

Medical Shop Management System

computer science project

Uploaded by

kishorejai988
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

SOURCE CODE :

#Project on Medical Shop Management System

import mysql.connector as m

mydb=m.connect(host='localhost',user='root',passwd='admin')

mycursor=mydb.cursor()

choice='y'

cont='y'

mycursor.execute("CREATE DATABASE MEDICAL2")

mycursor.execute("USE MEDICAL2")

mycursor.execute("CREATE TABLE MEDSHOP (SNO INT PRIMARY KEY,NAME VARCHAR(15),PRICE


FLOAT,QUANTITY INT)")

print("*****************WELCOME TO MEDICAL SHOP MANAGEMENT******************")

while choice=='y':

user=int(input("Hit 1 for ADMIN , 2 for CUSTOMER"))

if user==1:

while cont=='y':

a=int(input("Enter the medicine code"))

b=input("Enter the medicine")

c=float(input("Enter the price per unit"))

d=float(input("Enter the quantity"))

mycursor.execute("INSERT INTO MEDSHOP VALUES({},'{}',{},{})".format(a,b,c,d))

mydb.commit()

cont=input("Do you want to continue(y)")

elif user==2:

while choice=='y':
print("MENU\n1.DISPLAY THE AVAILABLE STOCK \n2.SEARCH FOR A MEDICINE\
n3.PURCHASE& BILLING ")

ch=int(input("Enter your choice"))

if ch==1:

print("---------------------------------------------------------")

print("MEDICINE CODE MEDICINE NAME PRICE QUANTITY")

print("---------------------------------------------------------")

mycursor.execute("SELECT* FROM MEDSHOP")

for i in mycursor:

print(i[0],'\t\t ',i[1],'\t\t ',i[2],'\t\t ',i[3])

print("----------------------------------------------------------")

elif ch==2:

a=int(input("Enter the medicine code to be searched"))

mycursor.execute("SELECT * FROM MEDSHOP WHERE SNO=%s" %a)

print("---------------------------------------------------------")

print("MEDICINE CODE MEDICINE NAME PRICE QUANTITY ")

print("---------------------------------------------------------")

for i in mycursor:

print(i[0],'\t\t ',i[1],'\t\t ',i[2],'\t\t ',i[3])

print("----------------------------------------------------------")

mydb.commit()

elif ch==3:

cont='y'

bill=0

while cont=='y':

a=int(input("Enter the medicine code to be purchased"))

b=float(input("Enter the quantity to be purchased"))

print("---------------------------------------------------------")
print("MEDICINE CODE MEDICINE NAME PRICE ")

print("---------------------------------------------------------")

mycursor.execute("SELECT * FROM MEDSHOP WHERE SNO=%s" %a)

for i in mycursor:

c=i[3]-b

if c>=0:

mycursor.execute("UPDATE MEDSHOP SET QUANTITY=%s where SNO=%s" %(c,a))

mycursor.execute("SELECT * FROM MEDSHOP WHERE SNO=%s" %a)

for i in mycursor:

print(i[0],'\t\t ',i[1],'\t\t ',i[2],'\t\t',i[3])

print("----------------------------------------------------------")

bill=bill+i[2]*b

print("Successfully added to cart")

else:

print("Quantity is not sufficient")

cont=input("Do you want to add more medicines")

print("\n\n\n\n********************Net Payable amount is


***********************************RS.",bill,'\n\n\n\n')

choice=input("Do you want to continue with customer option")

elif user==3:

print("INVALID CHOICE")
OUTPUT :
BIBLIOGRAPHY

• Computer science With Python - Class XII By : Sumita Arora


• Computer science With Python - Class XII By : Preethi Arora
• Website: https://www.w3resource.com
• https://en.wikipedia.org/

You might also like