Name Of School or University
Project Report
On
COMPUTER SHOP SYSTEM
…………………………………………….
(SESSION-……….)
………………………….
…...............
LOGO
ACKNOWLEDGEMENT
I would like to convey my heartful thanks to
……………………………. (Computer Science) who always
gave valuable suggestions & guidance for completion of my
project.
He helped me to understand & remember important details of
the project. My project has been a success only because of his
guidance.
I am especially indented & I am also beholden to my friends. And
finally I thank to the members of my family for their support &
encouragement.
CERTIFICATE
This is to certify that …………………… of class
………… of ………………………………….. has
completed his project under my supervision. He has taken
proper care & shown sincerity in completion of this project.
I certify that this project is up to my expectation &
as per the guideline issued by CBSE.
…………………………….
(Computer Science faculty)
Content
1. Introduction
2. Flowchart Design
3. Database Structure
4. Source Code
5. Output
6. Requirement
7. Advantages and disadvantages
8. Conclusion
9. Bibliography
INTRODUCTION
The Computer Shop System is designed & developed for a computer shop to manage their records
of selling and purchasing of the computer parts from the dealers and sell them to the customers.
This system makes the work of the computer shopkeepers easy as it keeps all the records of the
computer product and also keep the records of the product that is sold to the customers. This
system first checks the availability of the computer parts and their quantity then enter the record
to the record table after deducting number of the computer parts from the quantity and then print
the invoice after adding all the discounts and VAT% and save the record for future use if needed.
It also prints the reports in a tabular form as well as according to the search of a particular
computer product available at that time, if product is less than it provides the facility to modify
the product by adding more. It automates the Systems records, their Selling and Maintenance,
Balance evaluation, due to calculation other functions. In other words, you can say it a complete
computer-shop management System. In this project we can easily maintain systems sales details.
We can see the Systems details before selling the particular items.
FLOWCHART DESIGN
DATABASE STRUCTURE
Table Name: compinfo
Column Name Data Type Constraints
compID int(11) Primary Key
prodname varchar(25)
price int(11)
qty int(11)
type varchar(45)
companynm varchar(35)
description varchar(80)
Table Name: compinvoice
Column Name Data Type Constraints
compinno int(11) Primary Key
compID int(11)
qty int(11)
status varchar(35)
invoiceno int(11)
amount int(11)
dateSP date
SOURCE CODE
File Name: comp_menu.py
"""*************************************************************
THE MAIN FUNCTION OF PROGRAM
****************************************************************"""
import platform
import os
def myclear():
if platform.system()=="Windows":
print(os.system("cls"))
def intromain():
myclear()
print("**********COMPUTER******SHOP****SYSTEM******PROJECT*******************")
print("***************************************************************************")
def intro():
print("****************************COMPUTER SHOP*************************")
print("===========================================================")
print("****************************S=Y=S=T=E=M********************************")
print("PROJECT:")
print("MADE BY : ……………………")
print("---------------SCHOOL : Name of School--------------------")
def main():
ch=0
myclear()
intromain()
print("=================MAIN MENU====================")
print("01. REPORTS GENERATOR")
print("02. ADMINISTRATOR")
print("03. EXIT")
print("==============================================")
ch=int(input("Please Select Your Option (1-3)"))
return ch
def comp_menu1():
ch=0
intromain()
print("===========COMPUTERS PRODUCT INFO MENU===========")
print("01. ADD COMPUTERS PRODUCT INFORMATION")
print("02. MODIFY INFORMATION")
print("03. DELETE INFORMATION")
print("04. BACK TO MAIN")
print("==============================================")
ch=int(input("Please Select Your Option (1-4) "))
return ch
"""***************************************************************
ADMINSTRATOR COMPUTERS PRODUCT FUNCTION
****************************************************************"""
def comp_menu_medicine():
ch=0
myclear()
intromain()
print("=================COMPUTERS PRODUCT ADD MENU====================")
print("1.CREATE COMPUTERS PRODUCT DETAILS")
print("2.DISPLAY ALL COMPUTERS PRODUCT DETAILS")
print("3.SEARCH RECORD BY COMPID")
print("4.SEARCH RECORD BY COMPUTER PRODCUCT NAME")
print("5-SEARCH RECORD BY PRICE")
print("6.SEARCH RECORD BY TYPE")
print("7.SEARCH RECORD BY COMPANY")
print("8.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-8) "))
return ch
"""***************************************************************
ADMINSTRATOR COMPUTERS PRODUCT MAIN MENU FUNCTION
****************************************************************"""
def COMP_menu():
ch=0
myclear()
intromain()
print("=================ADMIN MENU====================")
print("1.COMPUTERS PRODUCT MENU")
print("2.COMPUTERS PRODUCT SALE/PURCHASE")
print("3.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-3) "))
return ch
"""**********************************************************
MODIFY MENU
********************************************************"""
def modifycomp_menu():
ch=0
myclear()
intromain()
print("===============MODIFY MENU==================")
print("1.MODIFY COMPUTER PRODUCT NAME")
print("2.MODIFY PRICE")
print("3.MODIFY QUANTITY")
print("4.MODIFY COMPANY NAME")
print("5.MODIFY DESCRIPTION")
print("6.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-6) "))
return ch
"""**********************************************************
REPORTS MENU
********************************************************"""
def SALE_PURCHASEmenu():
ch=0
myclear()
intromain()
print("===============SALE AND PURCHASE MENU==================")
print("1.COMPUTER PRODUCT SOLD OUT")
print("2.COMPUTER PRODUCT PURCHASED")
print("3.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-3) "))
return ch
def compinvoicereports():
ch=0
myclear()
intromain()
print("=================COMPUTER PRODUCT INVOICE MENU====================")
print("1.SEARCH AND PRINT SALE INVOICE")
print("2.SEARCH AND PRINT PURCHASE INVOICE")
print("3.DISPLAY ALL INVOICE(SALE/PURCHASE)")
print("4.SEARCH INVOICE BY DATEOFINVOICE")
print("5.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-5) "))
return ch
File Name: computer.py
import os
import pymysql
#-- to generate the autonumbers
def giveno():
count=0
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
print(mydb)
mycursor=mydb.cursor()
query=("SELECT COUNT(*) FROM compinfo")
q=("SELECT MAX(compID) FROM compinfo")
mycursor.execute(query)
rc=mycursor.fetchone()
tmp=rc[0]
print(tmp)
if tmp==0:
count=int(input("Enter the New No:"))
else:
q=("SELECT MAX(compID) FROM compinfo")
mycursor.execute(q)
rc=mycursor.fetchone()
count=rc[0]
count=count+1
mycursor.close()
mydb.close()
return count
#-- to generate the autonumbers
#-To add new record of computer shop
def write_comprecord():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
print(mydb)
C=mydb.cursor()
Query=("INSERT INTO compinfo VALUES(%s,%s,%s,%s,%s,%s,%s)")
cno=giveno()
compid=cno
pname=input("Enter Product Name:")
pr=int(input("Enter Price of product"))
typenm=input("Enter type(Ex-HDD,motherboard,keyboard,mouse....) name")
cmpnm=input("Enter Company Name")
desc=input("Enter Other details abour product")
data=(compid,pname,pr,0,typenm,cmpnm,desc)
C.execute(Query,data)
mydb.commit()
C.close()
mydb.close()
except:
mydb.close()
#--show all computer products
def showallcomp():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
Query=("SELECT * FROM compinfo")
#data=(scid,)
C.execute(Query)
rc=C.fetchall()
if rc:
print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYttDESCRIPTION")
for x in rc:
print(x[0],"t",x[1],"tt",x[2],"t",x[3],"t",x[4],"t",x[5],"t",x[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----search and display computer by ID
def showcompID():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
compid=int(input("Enter the Computer ID:"))
Query=("SELECT * FROM compinfo WHERE compid=%s")
data=(compid,)
C.execute(Query,data)
rc=C.fetchone()
if rc:
print("COMPIDtPRODUCTttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION")
print(rc[0],"t",rc[1],"tt",rc[2],"t",rc[3],"t",rc[4],"t",rc[5],"t",rc[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----search and display computer information by product name
def showproduct():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
cmppdnm=input("Enter the product name:")
Query=("SELECT * FROM compinfo WHERE prodname=%s")
data=(cmppdnm,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION")
for rc1 in rc:
print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----search and display computer prodcts by price
def showbyprice():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
low=int(input("Enter the Price lowest value:"))
high=int(input("Enter the Price Highest value:"))
Query=("SELECT * FROM compinfo WHERE price BETWEEN %s AND %s ")
data=(low,high)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION")
for rc1 in rc:
print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----search and display COMPUTER Products by type
def showtype():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
scid=input("Enter the computer product type(HDD/CPU/KEYBOARD/MOUSE/MONITOR/UPS):")
Query=("SELECT * FROM compinfo WHERE type=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION")
for rc1 in rc:
print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----search and display products by company
def showcompany():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
scid=input("Enter the company name:")
Query=("SELECT * FROM compinfo WHERE companynm=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION")
for rc1 in rc:
print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----Modify Computer Product Name
def search_mod_product():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
cno=int(input("ENTER Computer ID"))
rc1=compsearchdata(cno)
if rc1:
pnm=input("Enter the Product name to update:")
Query=("UPDATE compinfo SET prodname=%s WHERE compid=%s")
data=(pnm,cno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify price of computer product
def search_mod_price():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
bno=int(input("ENTER Computer ID"))
rc1=compsearchdata(bno)
if rc1: #--- and f==1:
tnm=int(input("Enter the price to update:"))
Query=("UPDATE compinfo SET price=%s WHERE compid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify Quantity of computer product
def search_mod_qty():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
bno=int(input("ENTER Computer ID"))
rc1=compsearchdata(bno)
if rc1:
tnm=int(input("Enter the new Quantity to update:"))
Query=("UPDATE compinfo SET qty=qty+%s WHERE compid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify comapany name
def search_mod_company():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
bno=int(input("ENTER Computer ID"))
rc1=compsearchdata(bno)
if rc1:
tnm=input("Enter the Company name to update:")
Query=("UPDATE compinfo SET companynm=%s WHERE compid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify Decription
def search_mod_desc():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
bno=int(input("ENTER Computer ID"))
rc1=compsearchdata(bno)
if rc1:
tnm=input("Enter the Computer Description to update:")
Query=("UPDATE compinfo SET description=%s WHERE compid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#---delete the computer product record from the table
def deletecompprod():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
bno=int(input("ENTER Computer ID"))
rc1=compsearchdata(bno)
if rc1:
Query=("DELETE FROM compinfo WHERE compid=%s")
data=(bno,)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#---Search Computer ID
def compsearchdata(scid):
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
Query=("SELECT * FROM compinfo WHERE compid=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchone()
if rc:
print("COMPIDtPRODUCT-NAMEtPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION")
print(rc[0],"t",rc[1],"t",rc[2],"t",rc[3],"t",rc[4],"t",rc[5],"t",rc[6])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#-------invoice to sell the computers products
def comp_Sale():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
print(mydb)
C=mydb.cursor()
netamt=0
Query=("INSERT INTO compinvoice VALUES(%s,%s,%s,%s,%s,%s,%s)")
invono=int(input("Enter the invoice no:"))
dosp=input("Enter the date of sale(yyyy-mm-dd)")
while True:
no=givemeno()
invoiceid=no
bno=int(input("Enter the Computer ID"))
rc1=compsearchdata(bno)
if rc1:
qt=int(input("Enter the quantity:"))
pr=int(input("Enter the price"))
netamt=pr*qt
data=(invoiceid,bno,qt,'SALE',invono,netamt,dosp)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
changeqty(bno,qt,'S')
else:
print("No such record please try again")
ch=input("Do you want to add more to sell(y/n)")
if(ch=='n' or ch=='N'):
break
C.close()
mydb.close()
except:
mydb.close()
#-------invoice to sell the computer products
#-- to generate the autonumbers
def givemeno():
count=0
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
print(mydb)
mycursor=mydb.cursor()
query=("SELECT COUNT(*) FROM compinvoice")
q=("SELECT MAX(compinno) FROM compinvoice")
mycursor.execute(query)
rc=mycursor.fetchone()
tmp=rc[0]
print(tmp)
if tmp==0:
count=1
else:
q=("SELECT MAX(compinno) FROM compinvoice")
mycursor.execute(q)
rc=mycursor.fetchone()
count=rc[0]
count=count+1
mycursor.close()
mydb.close()
return count
#------Update the qty----
def changeqty(bno,qt,ch):
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=mydb.cursor()
if(ch=='S'):
Query=("UPDATE compinfo SET qty=qty-%s WHERE compid=%s")
elif(ch=='P'):
Query=("UPDATE compnfo SET qty=qty+%s WHERE compid=%s")
data=(qt,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#-------invoice to Purchase the computers products
def comp_Purchase():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
print(mydb)
#mycursor=mydb.cursor()
C=mydb.cursor()
netamt=0
Query=("INSERT INTO compinvoice VALUES(%s,%s,%s,%s,%s,%s,%s)")
invono=int(input("Enter the invoice no:"))
dosp=input("Enter the date of Purchase(yyyy-mm-dd)")
while True:
no=givemeno()
invoiceid=no
bno=int(input("Enter the Computer ID"))
rc1=compsearchdata(bno)
if rc1:
qt=int(input("Enter the quantity:"))
pr=int(input("Enter the price"))
netamt=pr*qt
data=(invoiceid,bno,qt,'PURCHASE',invono,netamt,dosp)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
changeqty(bno,qt,'P')
else:
print("No such record please try again")
ch=input("Do you want to add more to sell(y/n)")
if(ch=='n' or ch=='N'):
break
C.close()
mydb.close()
except:
mydb.close()
#--------SEARCH AND PRINT SALE INVOICE
def searchinvoice():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
tot=0
gst=0
count=1
nettot=0
invo=int(input("Enter the Invoice No:"))
Query=("SELECT compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP FROM
compinfo,compinvoice WHERE compinfo.compid=compinvoice.compid AND compinvoice.status='SALE'
AND compinvoice.invoiceno=%s")
data=(invo,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("----------------INVOICE: ",invo,"---------DATE: ",rc[0][3])
print("--------------------------SALE------------------------------")
print("S.NO.----|----------COMPUTER PRODUCT NAME---------TOTAL-----")
for rc1 in rc:
tot=tot+rc1[1]
print(count," |---",rc1[0],"ttttt |t",rc1[1])
count=count+1
gst=tot*12/100
nettot=tot+gst
print("============================================================")
print(" Total: ",tot)
print(" GST : ",gst)
print(" NETTOTAL: ",nettot)
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()
#--------SEARCH AND PRINT PURCHASE INVOICE
def searchinvoicePUR():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
tot=0
gst=0
count=1
nettot=0
invo=int(input("Enter the Invoice No:"))
Query=("SELECT compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP FROM
compinfo,compinvoice WHERE compinfo.compID=compinvoice.compID AND
compinvoice.status='PURCHASE' AND compinvoice.invoiceno=%s")
data=(invo,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("----------------INVOICE: ",invo,"---------DATE: ",rc[0][3])
print("--------------------------PURCHASE--------------------------")
print("S.NO.----|----------COMPUTER PRODUCT NAME---------TOTAL-----")
for rc1 in rc:
tot=tot+rc1[1]
print(count," |---",rc1[0],"ttttt |t",rc1[1])
count=count+1
gst=tot*12/100
nettot=tot+gst
print("============================================================")
print(" Total: ",tot)
print(" GST : ",gst)
print(" NETTOTAL: ",nettot)
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()
#----------display all invoice SALE or PURCHASE wise
def displayinvoiceSP():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
count=1
ch=int(input("Enter the Choice 1- SALE Wise 2- PURCHASE Wise:"))
Query=("SELECT
compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP,compinvoice.invoiceno FROM
compinfo,compinvoice WHERE compinfo.compID=compinvoice.compID AND compinvoice.status=%s")
if(ch==1):
data=('SALE')
else:
data=('PURCHASE')
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("---------------------INVOICE LIST---------------------------")
print("------------------------------------------------------------")
print("S.NO.ttPRODUCT-NAMEttQUANTITYttAMOUNTttDATEtINVOICENO")
for rc1 in rc:
print(count,"tt",rc1[0],"tt",rc1[2],"tt",rc1[1],"tt",rc1[3],"t",rc1[4])
count=count+1
print("============================================================")
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()
#----------display all invoice SALE or PURCHASE by date
def displayinvoiceSPdate():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop")
C=conn.cursor()
count=1
ch=int(input("Enter the Choice 1- SALE Wise 2- PURCHASE Wise:"))
dt=input("Enter the date(yyyy-mm-dd)")
Query=("SELECT
compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP,compinvoice.invoiceno FROM
compinfo,compinvoice WHERE compinfo.compid=compinvoice.compid AND compinvoice.status=%s and
compinvoice.dateSP=%s")
if(ch==1):
data=('SALE',dt)
info='SALE'
else:
data=('PURCHASE',dt)
info='PURCHASE'
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("---------------------INVOICE LIST---------------------------")
print("---------------------",info,"---------------------------")
print("S.NO.ttTitlettQUANTITYttAMOUNTttDATEttINVOICENO")
for rc1 in rc:
print(count,"tt",rc1[0],"tt",rc1[2],"tt",rc1[1],"tt",rc1[3],"tt",rc1[4])
count=count+1
print("============================================================")
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()
File Name: computermainpage.py
import comp_menu as CM
import sys
import computer as compsh
def invoice_show():
choice1=CM.compinvoicereports()
while True:
if choice1==1:
compsh.searchinvoice()
break
elif choice1==2:
compsh.searchinvoicePUR()
break
elif choice1==3:
compsh.displayinvoiceSP()
break
elif choice1==4:
compsh.displayinvoiceSPdate()
break
elif choice1==5:
main()
else:
input("Enter any key to continue")
choice1=0
invoice_show()
def modifyCOMPshow():
choice1=" "
choice1=CM.modifycomp_menu()
while True:
if choice1==1:
compsh.search_mod_product()
break
elif choice1==2:
compsh.search_mod_price()
break
elif choice1==3:
compsh.search_mod_qty()
break
elif choice1==4:
compsh.search_mod_company()
break
elif choice1==5:
compsh.search_mod_desc()
break
elif choice1==6:
main()
else:
input("Enter any key to continue")
modifyCOMPshow()
#-----------------COMPUTERS MENU
def compmenu_show():
choice1=" "
choice1=CM.COMP_menu()
while True:
if choice1==1:
compmainshow()
break
elif choice1==2:
salepurchase_show()
break
elif choice1==3:
main()
else:
input("Enter any key to continue")
compmenu_show()
#--------COMPUERS PRODUCT MAIN MENU
AREA
def compmainshow():
choice1=CM.comp_menu1()
while True:
if choice1==1:
compmidmenu()
break
elif choice1==2:
modifyCOMPshow()
break
elif choice1==3:
compsh.deletecompprod()
break
elif choice1==4:
print("a")
break
else:
input("-----Press any key to continue-----")
choice1=0
compmainshow()
#-------------------------
#--------administrator menu
def compmidmenu():
choice1=CM.comp_menu_medicine()
while True:
if choice1==1:
compsh.write_comprecord()
break
elif choice1==2:
compsh.showallcomp()
break
elif choice1==3:
compsh.showcompID()
break
elif choice1==4:
compsh.showproduct()
break
elif choice1==5:
compsh.showbyprice()
break
elif choice1==6:
compsh.showtype()
break
elif choice1==7:
compsh.showcompany()
break
elif choice1==8:
main()
break
else:
input("Enter any key to continue")
choice1=0
compmidmenu()
def salepurchase_show():
choice1=CM.SALE_PURCHASEmenu()
while True:
if choice1==1:
compsh.comp_Sale()
break
elif choice1==2:
compsh.comp_Purchase()
break
elif choice1==3:
main()
else:
input("Enter any key to continue")
choice1=0
salepurchase_show()
#-------------Main MENU------------------------------
def main():
CM.intro()
choice=0
while(True):
choice=CM.main()
if choice==1:
CM.myclear()
invoice_show()
elif choice==2:
CM.myclear()
compmenu_show()
elif choice==3:
exit(1)
else:
input("Enter any key to continue")
main()
OUTPUTS
=================MAIN MENU====================
01. REPORTS GENERATOR
02. ADMINISTRATOR
03. EXIT
==============================================
Please Select Your Option (1-3)
If choice : 1
=================COMPUTER PRODUCT INVOICE MENU====================
1.SEARCH AND PRINT SALE INVOICE
2.SEARCH AND PRINT PURCHASE INVOICE
3.DISPLAY ALL INVOICE(SALE/PURCHASE)
4.SEARCH INVOICE BY DATEOFINVOICE
5.BACK TO MAIN MENU
Please Enter Your Choice (1-5)
If choice : 1
Enter the Invoice No:7008
----------------INVOICE: 7008 ---------DATE: 2021-01-05
--------------------------SALE------------------------------
S.NO.----|----------COMPUTER PRODUCT NAME---------TOTAL-----
1 |--- Hard-disk | 25500
2 |--- Key-200 | 0
3 |--- HARDDISK2DX | 0
============================================================
Total: 25500
GST : 3060.0
NETTOTAL: 28560.0
If choice : 2
=================ADMIN MENU====================
1.COMPUTERS PRODUCT MENU
2.COMPUTERS PRODUCT SALE/PURCHASE
3.BACK TO MAIN MENU
Please Enter Your Choice (1-3)
If choice : 1
===========COMPUTERS PRODUCT INFO MENU===========
01. ADD COMPUTERS PRODUCT INFORMATION
02. MODIFY INFORMATION
03. DELETE INFORMATION
04. BACK TO MAIN
==============================================
If choice: 1
=================COMPUTERS PRODUCT ADD MENU====================
1.CREATE COMPUTERS PRODUCT DETAILS
2.DISPLAY ALL COMPUTERS PRODUCT DETAILS
3.SEARCH RECORD BY COMPID
4.SEARCH RECORD BY COMPUTER PRODCUCT NAME
5-SEARCH RECORD BY PRICE
6.SEARCH RECORD BY TYPE
7.SEARCH RECORD BY COMPANY
8.BACK TO MAIN MENU
If choice: 1
Please Enter Your Choice (1-8)
Enter Product Name:M-200
Enter Price of product55
Enter Quantity: 10
Enter type(Ex-HDD,motherboard,keyboard,mouse....) nameMouse
Enter Company NameMTOD
Enter Other details abour productMouse with LED
If choice : 2
COMPID PRODUCT-NAME PRICE QUANTITY TYPE COMPANY DESCRIPTION
1201 Hard-disk 8750 55 HDD HTC 2 TB hard disk with
1203 Key-200 1200 30 keyboard prodot prodot EX keyboard
1204 HARDDISK2DX 5500 32 HDD Samsung 1TB hard disk
1205 RX-K400 480 12 Keyboard TRAX Gaming Keyboard
1206 M-200 55 10 Mouse MTOD Mouse with LED
===============MODIFY MENU==================
1.MODIFY COMPUTER PRODUCT NAME
2.MODIFY PRICE
3.MODIFY QUANTITY
4.MODIFY COMPANY NAME
5.MODIFY DESCRIPTION
6.BACK TO MAIN MENU
REQUIREMENTS
HARDWARE REQUIRED
 Printer, to print the required documents of the project
 Processor : intel or any other
 Ram : 512 MB or above
 Harddisk : 80 GB or more
 SOFTWARE REQUIRED
 Operating system : Windows 7 or above
 Python 2 or above
 IDE Atom, PyCharm, Thonny, or any other.
 Database: MySQL
 WebServer: XAMPP
ADVANTAGES AND DISADVANTAGES
Advantage:
1. Provides the searching facilities based on various factors. Such as ProductID, Product name, Price etc.
2. It tracks all the information of Seller, Customer etc.
3. Shows the information and description of the Computer and products
4. It generates the report on computer products, sellers and Customers.
Disadvantage:
1. Require much man power i.e. much efforts, much cost and hard to operate and maintain.
2. Since, all the work is done in papers so it is very hard to locate a particular student record when it is
required.
CONCLUSION
Nothing is perfect in this world. So, we are also no exception. Although, we have tried our best
to present the information effectively, yet, there can be further enhancement in the Application.
We have taken care of all the critical aspects, which need to take care of during the development
of the Project. Like the things this project also has some limitations and can further be enhances
by someone, because there are certain drawbacks that do not permit the system to be 100%
accurate.
BIBLIOGRAPHY
 www.mysql.org
 www.google.co.in
 www.w3schools.com
 www.tutorialspoint.com
 www.javapoint.com
 www.programiz.com
 www.guru99.com

Python Project on Computer Shop

  • 1.
    Name Of Schoolor University Project Report On COMPUTER SHOP SYSTEM ……………………………………………. (SESSION-……….) …………………………. …............... LOGO
  • 2.
    ACKNOWLEDGEMENT I would liketo convey my heartful thanks to ……………………………. (Computer Science) who always gave valuable suggestions & guidance for completion of my project. He helped me to understand & remember important details of the project. My project has been a success only because of his guidance. I am especially indented & I am also beholden to my friends. And finally I thank to the members of my family for their support & encouragement.
  • 3.
    CERTIFICATE This is tocertify that …………………… of class ………… of ………………………………….. has completed his project under my supervision. He has taken proper care & shown sincerity in completion of this project. I certify that this project is up to my expectation & as per the guideline issued by CBSE. ……………………………. (Computer Science faculty)
  • 4.
    Content 1. Introduction 2. FlowchartDesign 3. Database Structure 4. Source Code 5. Output 6. Requirement 7. Advantages and disadvantages 8. Conclusion 9. Bibliography
  • 5.
    INTRODUCTION The Computer ShopSystem is designed & developed for a computer shop to manage their records of selling and purchasing of the computer parts from the dealers and sell them to the customers. This system makes the work of the computer shopkeepers easy as it keeps all the records of the computer product and also keep the records of the product that is sold to the customers. This system first checks the availability of the computer parts and their quantity then enter the record to the record table after deducting number of the computer parts from the quantity and then print the invoice after adding all the discounts and VAT% and save the record for future use if needed. It also prints the reports in a tabular form as well as according to the search of a particular computer product available at that time, if product is less than it provides the facility to modify the product by adding more. It automates the Systems records, their Selling and Maintenance, Balance evaluation, due to calculation other functions. In other words, you can say it a complete computer-shop management System. In this project we can easily maintain systems sales details. We can see the Systems details before selling the particular items.
  • 6.
  • 7.
    DATABASE STRUCTURE Table Name:compinfo Column Name Data Type Constraints compID int(11) Primary Key prodname varchar(25) price int(11) qty int(11) type varchar(45) companynm varchar(35) description varchar(80) Table Name: compinvoice Column Name Data Type Constraints compinno int(11) Primary Key compID int(11) qty int(11) status varchar(35) invoiceno int(11) amount int(11) dateSP date
  • 8.
    SOURCE CODE File Name:comp_menu.py """************************************************************* THE MAIN FUNCTION OF PROGRAM ****************************************************************""" import platform import os def myclear(): if platform.system()=="Windows": print(os.system("cls")) def intromain(): myclear() print("**********COMPUTER******SHOP****SYSTEM******PROJECT*******************") print("***************************************************************************") def intro(): print("****************************COMPUTER SHOP*************************") print("===========================================================") print("****************************S=Y=S=T=E=M********************************") print("PROJECT:") print("MADE BY : ……………………") print("---------------SCHOOL : Name of School--------------------") def main(): ch=0 myclear() intromain() print("=================MAIN MENU====================") print("01. REPORTS GENERATOR") print("02. ADMINISTRATOR") print("03. EXIT") print("==============================================") ch=int(input("Please Select Your Option (1-3)")) return ch def comp_menu1(): ch=0 intromain() print("===========COMPUTERS PRODUCT INFO MENU===========") print("01. ADD COMPUTERS PRODUCT INFORMATION") print("02. MODIFY INFORMATION") print("03. DELETE INFORMATION") print("04. BACK TO MAIN")
  • 9.
    print("==============================================") ch=int(input("Please Select YourOption (1-4) ")) return ch """*************************************************************** ADMINSTRATOR COMPUTERS PRODUCT FUNCTION ****************************************************************""" def comp_menu_medicine(): ch=0 myclear() intromain() print("=================COMPUTERS PRODUCT ADD MENU====================") print("1.CREATE COMPUTERS PRODUCT DETAILS") print("2.DISPLAY ALL COMPUTERS PRODUCT DETAILS") print("3.SEARCH RECORD BY COMPID") print("4.SEARCH RECORD BY COMPUTER PRODCUCT NAME") print("5-SEARCH RECORD BY PRICE") print("6.SEARCH RECORD BY TYPE") print("7.SEARCH RECORD BY COMPANY") print("8.BACK TO MAIN MENU") ch=int(input("Please Enter Your Choice (1-8) ")) return ch """*************************************************************** ADMINSTRATOR COMPUTERS PRODUCT MAIN MENU FUNCTION ****************************************************************""" def COMP_menu(): ch=0 myclear() intromain() print("=================ADMIN MENU====================") print("1.COMPUTERS PRODUCT MENU") print("2.COMPUTERS PRODUCT SALE/PURCHASE") print("3.BACK TO MAIN MENU") ch=int(input("Please Enter Your Choice (1-3) ")) return ch """********************************************************** MODIFY MENU ********************************************************""" def modifycomp_menu(): ch=0 myclear() intromain() print("===============MODIFY MENU==================") print("1.MODIFY COMPUTER PRODUCT NAME") print("2.MODIFY PRICE")
  • 10.
    print("3.MODIFY QUANTITY") print("4.MODIFY COMPANYNAME") print("5.MODIFY DESCRIPTION") print("6.BACK TO MAIN MENU") ch=int(input("Please Enter Your Choice (1-6) ")) return ch """********************************************************** REPORTS MENU ********************************************************""" def SALE_PURCHASEmenu(): ch=0 myclear() intromain() print("===============SALE AND PURCHASE MENU==================") print("1.COMPUTER PRODUCT SOLD OUT") print("2.COMPUTER PRODUCT PURCHASED") print("3.BACK TO MAIN MENU") ch=int(input("Please Enter Your Choice (1-3) ")) return ch def compinvoicereports(): ch=0 myclear() intromain() print("=================COMPUTER PRODUCT INVOICE MENU====================") print("1.SEARCH AND PRINT SALE INVOICE") print("2.SEARCH AND PRINT PURCHASE INVOICE") print("3.DISPLAY ALL INVOICE(SALE/PURCHASE)") print("4.SEARCH INVOICE BY DATEOFINVOICE") print("5.BACK TO MAIN MENU") ch=int(input("Please Enter Your Choice (1-5) ")) return ch File Name: computer.py import os import pymysql #-- to generate the autonumbers def giveno(): count=0 mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") print(mydb) mycursor=mydb.cursor() query=("SELECT COUNT(*) FROM compinfo") q=("SELECT MAX(compID) FROM compinfo") mycursor.execute(query)
  • 11.
    rc=mycursor.fetchone() tmp=rc[0] print(tmp) if tmp==0: count=int(input("Enter theNew No:")) else: q=("SELECT MAX(compID) FROM compinfo") mycursor.execute(q) rc=mycursor.fetchone() count=rc[0] count=count+1 mycursor.close() mydb.close() return count #-- to generate the autonumbers #-To add new record of computer shop def write_comprecord(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") print(mydb) C=mydb.cursor() Query=("INSERT INTO compinfo VALUES(%s,%s,%s,%s,%s,%s,%s)") cno=giveno() compid=cno pname=input("Enter Product Name:") pr=int(input("Enter Price of product")) typenm=input("Enter type(Ex-HDD,motherboard,keyboard,mouse....) name") cmpnm=input("Enter Company Name") desc=input("Enter Other details abour product") data=(compid,pname,pr,0,typenm,cmpnm,desc) C.execute(Query,data) mydb.commit() C.close() mydb.close() except: mydb.close() #--show all computer products def showallcomp(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() Query=("SELECT * FROM compinfo") #data=(scid,) C.execute(Query) rc=C.fetchall() if rc:
  • 12.
    print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYttDESCRIPTION") for x inrc: print(x[0],"t",x[1],"tt",x[2],"t",x[3],"t",x[4],"t",x[5],"t",x[6]) input("--------------------press the key---------------------------------") os.system('cls') C.close() conn.close() return rc except: conn.close() #----search and display computer by ID def showcompID(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() compid=int(input("Enter the Computer ID:")) Query=("SELECT * FROM compinfo WHERE compid=%s") data=(compid,) C.execute(Query,data) rc=C.fetchone() if rc: print("COMPIDtPRODUCTttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION") print(rc[0],"t",rc[1],"tt",rc[2],"t",rc[3],"t",rc[4],"t",rc[5],"t",rc[6]) input("--------------------press the key---------------------------------") os.system('cls') C.close() conn.close() return rc except: conn.close() #----search and display computer information by product name def showproduct(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() cmppdnm=input("Enter the product name:") Query=("SELECT * FROM compinfo WHERE prodname=%s") data=(cmppdnm,) C.execute(Query,data) rc=C.fetchall() if rc: print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION") for rc1 in rc: print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6]) input("--------------------press the key---------------------------------") os.system('cls')
  • 13.
    C.close() conn.close() return rc except: conn.close() #----search anddisplay computer prodcts by price def showbyprice(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() low=int(input("Enter the Price lowest value:")) high=int(input("Enter the Price Highest value:")) Query=("SELECT * FROM compinfo WHERE price BETWEEN %s AND %s ") data=(low,high) C.execute(Query,data) rc=C.fetchall() if rc: print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION") for rc1 in rc: print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6]) input("--------------------press the key---------------------------------") os.system('cls') C.close() conn.close() return rc except: conn.close() #----search and display COMPUTER Products by type def showtype(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() scid=input("Enter the computer product type(HDD/CPU/KEYBOARD/MOUSE/MONITOR/UPS):") Query=("SELECT * FROM compinfo WHERE type=%s") data=(scid,) C.execute(Query,data) rc=C.fetchall() if rc: print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION") for rc1 in rc: print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6]) input("--------------------press the key---------------------------------") os.system('cls') C.close() conn.close() return rc
  • 14.
    except: conn.close() #----search and displayproducts by company def showcompany(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() scid=input("Enter the company name:") Query=("SELECT * FROM compinfo WHERE companynm=%s") data=(scid,) C.execute(Query,data) rc=C.fetchall() if rc: print("COMPIDtPRODUCT-NAMEttPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION") for rc1 in rc: print(rc1[0],"t",rc1[1],"tt",rc1[2],"t",rc1[3],"t",rc1[4],"t",rc1[5],"t",rc1[6]) input("--------------------press the key---------------------------------") os.system('cls') C.close() conn.close() return rc except: conn.close() #----Modify Computer Product Name def search_mod_product(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=mydb.cursor() cno=int(input("ENTER Computer ID")) rc1=compsearchdata(cno) if rc1: pnm=input("Enter the Product name to update:") Query=("UPDATE compinfo SET prodname=%s WHERE compid=%s") data=(pnm,cno) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close() mydb.close() except: mydb.close() #----Modify price of computer product def search_mod_price(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=mydb.cursor()
  • 15.
    bno=int(input("ENTER Computer ID")) rc1=compsearchdata(bno) ifrc1: #--- and f==1: tnm=int(input("Enter the price to update:")) Query=("UPDATE compinfo SET price=%s WHERE compid=%s") data=(tnm,bno) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close() mydb.close() except: mydb.close() #----Modify Quantity of computer product def search_mod_qty(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=mydb.cursor() bno=int(input("ENTER Computer ID")) rc1=compsearchdata(bno) if rc1: tnm=int(input("Enter the new Quantity to update:")) Query=("UPDATE compinfo SET qty=qty+%s WHERE compid=%s") data=(tnm,bno) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close() mydb.close() except: mydb.close() #----Modify comapany name def search_mod_company(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=mydb.cursor() bno=int(input("ENTER Computer ID")) rc1=compsearchdata(bno) if rc1: tnm=input("Enter the Company name to update:") Query=("UPDATE compinfo SET companynm=%s WHERE compid=%s") data=(tnm,bno) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close()
  • 16.
    mydb.close() except: mydb.close() #----Modify Decription def search_mod_desc(): try: mydb=pymysql.connect(host="localhost",user="root", passwd="", database="computershop") C=mydb.cursor() bno=int(input("ENTER Computer ID")) rc1=compsearchdata(bno) if rc1: tnm=input("Enter the Computer Description to update:") Query=("UPDATE compinfo SET description=%s WHERE compid=%s") data=(tnm,bno) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close() mydb.close() except: mydb.close() #---delete the computer product record from the table def deletecompprod(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=mydb.cursor() bno=int(input("ENTER Computer ID")) rc1=compsearchdata(bno) if rc1: Query=("DELETE FROM compinfo WHERE compid=%s") data=(bno,) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close() mydb.close() except: mydb.close() #---Search Computer ID def compsearchdata(scid): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() Query=("SELECT * FROM compinfo WHERE compid=%s") data=(scid,) C.execute(Query,data)
  • 17.
    rc=C.fetchone() if rc: print("COMPIDtPRODUCT-NAMEtPRICEtQUANTITYtTYPEtCOMPANYtDESCRIPTION") print(rc[0],"t",rc[1],"t",rc[2],"t",rc[3],"t",rc[4],"t",rc[5],"t",rc[6]) input("--------------------press thekey---------------------------------") os.system('cls') C.close() conn.close() return rc except: conn.close() #-------invoice to sell the computers products def comp_Sale(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") print(mydb) C=mydb.cursor() netamt=0 Query=("INSERT INTO compinvoice VALUES(%s,%s,%s,%s,%s,%s,%s)") invono=int(input("Enter the invoice no:")) dosp=input("Enter the date of sale(yyyy-mm-dd)") while True: no=givemeno() invoiceid=no bno=int(input("Enter the Computer ID")) rc1=compsearchdata(bno) if rc1: qt=int(input("Enter the quantity:")) pr=int(input("Enter the price")) netamt=pr*qt data=(invoiceid,bno,qt,'SALE',invono,netamt,dosp) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") changeqty(bno,qt,'S') else: print("No such record please try again") ch=input("Do you want to add more to sell(y/n)") if(ch=='n' or ch=='N'): break C.close() mydb.close() except: mydb.close() #-------invoice to sell the computer products #-- to generate the autonumbers
  • 18.
    def givemeno(): count=0 mydb=pymysql.connect(host="localhost", user="root",passwd="", database="computershop") print(mydb) mycursor=mydb.cursor() query=("SELECT COUNT(*) FROM compinvoice") q=("SELECT MAX(compinno) FROM compinvoice") mycursor.execute(query) rc=mycursor.fetchone() tmp=rc[0] print(tmp) if tmp==0: count=1 else: q=("SELECT MAX(compinno) FROM compinvoice") mycursor.execute(q) rc=mycursor.fetchone() count=rc[0] count=count+1 mycursor.close() mydb.close() return count #------Update the qty---- def changeqty(bno,qt,ch): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=mydb.cursor() if(ch=='S'): Query=("UPDATE compinfo SET qty=qty-%s WHERE compid=%s") elif(ch=='P'): Query=("UPDATE compnfo SET qty=qty+%s WHERE compid=%s") data=(qt,bno) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") C.close() mydb.close() except: mydb.close() #-------invoice to Purchase the computers products def comp_Purchase(): try: mydb=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") print(mydb) #mycursor=mydb.cursor()
  • 19.
    C=mydb.cursor() netamt=0 Query=("INSERT INTO compinvoiceVALUES(%s,%s,%s,%s,%s,%s,%s)") invono=int(input("Enter the invoice no:")) dosp=input("Enter the date of Purchase(yyyy-mm-dd)") while True: no=givemeno() invoiceid=no bno=int(input("Enter the Computer ID")) rc1=compsearchdata(bno) if rc1: qt=int(input("Enter the quantity:")) pr=int(input("Enter the price")) netamt=pr*qt data=(invoiceid,bno,qt,'PURCHASE',invono,netamt,dosp) C.execute(Query,data) mydb.commit() print(C.rowcount, "record(s) affected") changeqty(bno,qt,'P') else: print("No such record please try again") ch=input("Do you want to add more to sell(y/n)") if(ch=='n' or ch=='N'): break C.close() mydb.close() except: mydb.close() #--------SEARCH AND PRINT SALE INVOICE def searchinvoice(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() tot=0 gst=0 count=1 nettot=0 invo=int(input("Enter the Invoice No:")) Query=("SELECT compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP FROM compinfo,compinvoice WHERE compinfo.compid=compinvoice.compid AND compinvoice.status='SALE' AND compinvoice.invoiceno=%s") data=(invo,) C.execute(Query,data) rc=C.fetchall() if rc: print("----------------INVOICE: ",invo,"---------DATE: ",rc[0][3])
  • 20.
    print("--------------------------SALE------------------------------") print("S.NO.----|----------COMPUTER PRODUCT NAME---------TOTAL-----") forrc1 in rc: tot=tot+rc1[1] print(count," |---",rc1[0],"ttttt |t",rc1[1]) count=count+1 gst=tot*12/100 nettot=tot+gst print("============================================================") print(" Total: ",tot) print(" GST : ",gst) print(" NETTOTAL: ",nettot) input("----------------------Press any key-------------------------") C.close() conn.close() return rc except: conn.close() #--------SEARCH AND PRINT PURCHASE INVOICE def searchinvoicePUR(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() tot=0 gst=0 count=1 nettot=0 invo=int(input("Enter the Invoice No:")) Query=("SELECT compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP FROM compinfo,compinvoice WHERE compinfo.compID=compinvoice.compID AND compinvoice.status='PURCHASE' AND compinvoice.invoiceno=%s") data=(invo,) C.execute(Query,data) rc=C.fetchall() if rc: print("----------------INVOICE: ",invo,"---------DATE: ",rc[0][3]) print("--------------------------PURCHASE--------------------------") print("S.NO.----|----------COMPUTER PRODUCT NAME---------TOTAL-----") for rc1 in rc: tot=tot+rc1[1] print(count," |---",rc1[0],"ttttt |t",rc1[1]) count=count+1 gst=tot*12/100 nettot=tot+gst print("============================================================") print(" Total: ",tot)
  • 21.
    print(" GST :",gst) print(" NETTOTAL: ",nettot) input("----------------------Press any key-------------------------") C.close() conn.close() return rc except: conn.close() #----------display all invoice SALE or PURCHASE wise def displayinvoiceSP(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() count=1 ch=int(input("Enter the Choice 1- SALE Wise 2- PURCHASE Wise:")) Query=("SELECT compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP,compinvoice.invoiceno FROM compinfo,compinvoice WHERE compinfo.compID=compinvoice.compID AND compinvoice.status=%s") if(ch==1): data=('SALE') else: data=('PURCHASE') C.execute(Query,data) rc=C.fetchall() if rc: print("---------------------INVOICE LIST---------------------------") print("------------------------------------------------------------") print("S.NO.ttPRODUCT-NAMEttQUANTITYttAMOUNTttDATEtINVOICENO") for rc1 in rc: print(count,"tt",rc1[0],"tt",rc1[2],"tt",rc1[1],"tt",rc1[3],"t",rc1[4]) count=count+1 print("============================================================") input("----------------------Press any key-------------------------") C.close() conn.close() return rc except: conn.close() #----------display all invoice SALE or PURCHASE by date def displayinvoiceSPdate(): try: conn=pymysql.connect(host="localhost", user="root", passwd="", database="computershop") C=conn.cursor() count=1 ch=int(input("Enter the Choice 1- SALE Wise 2- PURCHASE Wise:")) dt=input("Enter the date(yyyy-mm-dd)")
  • 22.
    Query=("SELECT compinfo.prodname,compinvoice.amount,compinvoice.qty,compinvoice.dateSP,compinvoice.invoiceno FROM compinfo,compinvoice WHEREcompinfo.compid=compinvoice.compid AND compinvoice.status=%s and compinvoice.dateSP=%s") if(ch==1): data=('SALE',dt) info='SALE' else: data=('PURCHASE',dt) info='PURCHASE' C.execute(Query,data) rc=C.fetchall() if rc: print("---------------------INVOICE LIST---------------------------") print("---------------------",info,"---------------------------") print("S.NO.ttTitlettQUANTITYttAMOUNTttDATEttINVOICENO") for rc1 in rc: print(count,"tt",rc1[0],"tt",rc1[2],"tt",rc1[1],"tt",rc1[3],"tt",rc1[4]) count=count+1 print("============================================================") input("----------------------Press any key-------------------------") C.close() conn.close() return rc except: conn.close() File Name: computermainpage.py import comp_menu as CM import sys import computer as compsh def invoice_show(): choice1=CM.compinvoicereports() while True: if choice1==1: compsh.searchinvoice() break elif choice1==2: compsh.searchinvoicePUR() break elif choice1==3: compsh.displayinvoiceSP() break elif choice1==4: compsh.displayinvoiceSPdate() break elif choice1==5: main() else: input("Enter any key to continue") choice1=0 invoice_show() def modifyCOMPshow(): choice1=" " choice1=CM.modifycomp_menu() while True: if choice1==1: compsh.search_mod_product() break elif choice1==2: compsh.search_mod_price() break elif choice1==3: compsh.search_mod_qty() break elif choice1==4:
  • 23.
    compsh.search_mod_company() break elif choice1==5: compsh.search_mod_desc() break elif choice1==6: main() else: input("Enterany key to continue") modifyCOMPshow() #-----------------COMPUTERS MENU def compmenu_show(): choice1=" " choice1=CM.COMP_menu() while True: if choice1==1: compmainshow() break elif choice1==2: salepurchase_show() break elif choice1==3: main() else: input("Enter any key to continue") compmenu_show() #--------COMPUERS PRODUCT MAIN MENU AREA def compmainshow(): choice1=CM.comp_menu1() while True: if choice1==1: compmidmenu() break elif choice1==2: modifyCOMPshow() break elif choice1==3: compsh.deletecompprod() break elif choice1==4: print("a") break else: input("-----Press any key to continue-----") choice1=0 compmainshow() #------------------------- #--------administrator menu def compmidmenu(): choice1=CM.comp_menu_medicine() while True: if choice1==1: compsh.write_comprecord() break elif choice1==2: compsh.showallcomp() break elif choice1==3: compsh.showcompID() break elif choice1==4: compsh.showproduct() break elif choice1==5: compsh.showbyprice() break elif choice1==6: compsh.showtype() break elif choice1==7: compsh.showcompany() break elif choice1==8: main() break else: input("Enter any key to continue") choice1=0 compmidmenu() def salepurchase_show(): choice1=CM.SALE_PURCHASEmenu() while True: if choice1==1: compsh.comp_Sale() break elif choice1==2: compsh.comp_Purchase()
  • 24.
    break elif choice1==3: main() else: input("Enter anykey to continue") choice1=0 salepurchase_show() #-------------Main MENU------------------------------ def main(): CM.intro() choice=0 while(True): choice=CM.main() if choice==1: CM.myclear() invoice_show() elif choice==2: CM.myclear() compmenu_show() elif choice==3: exit(1) else: input("Enter any key to continue") main() OUTPUTS =================MAIN MENU==================== 01. REPORTS GENERATOR 02. ADMINISTRATOR 03. EXIT ============================================== Please Select Your Option (1-3) If choice : 1 =================COMPUTER PRODUCT INVOICE MENU==================== 1.SEARCH AND PRINT SALE INVOICE 2.SEARCH AND PRINT PURCHASE INVOICE 3.DISPLAY ALL INVOICE(SALE/PURCHASE) 4.SEARCH INVOICE BY DATEOFINVOICE 5.BACK TO MAIN MENU Please Enter Your Choice (1-5) If choice : 1 Enter the Invoice No:7008 ----------------INVOICE: 7008 ---------DATE: 2021-01-05 --------------------------SALE------------------------------ S.NO.----|----------COMPUTER PRODUCT NAME---------TOTAL----- 1 |--- Hard-disk | 25500 2 |--- Key-200 | 0 3 |--- HARDDISK2DX | 0 ============================================================ Total: 25500 GST : 3060.0 NETTOTAL: 28560.0
  • 25.
    If choice :2 =================ADMIN MENU==================== 1.COMPUTERS PRODUCT MENU 2.COMPUTERS PRODUCT SALE/PURCHASE 3.BACK TO MAIN MENU Please Enter Your Choice (1-3) If choice : 1 ===========COMPUTERS PRODUCT INFO MENU=========== 01. ADD COMPUTERS PRODUCT INFORMATION 02. MODIFY INFORMATION 03. DELETE INFORMATION 04. BACK TO MAIN ============================================== If choice: 1 =================COMPUTERS PRODUCT ADD MENU==================== 1.CREATE COMPUTERS PRODUCT DETAILS 2.DISPLAY ALL COMPUTERS PRODUCT DETAILS 3.SEARCH RECORD BY COMPID 4.SEARCH RECORD BY COMPUTER PRODCUCT NAME 5-SEARCH RECORD BY PRICE 6.SEARCH RECORD BY TYPE 7.SEARCH RECORD BY COMPANY 8.BACK TO MAIN MENU If choice: 1 Please Enter Your Choice (1-8) Enter Product Name:M-200 Enter Price of product55 Enter Quantity: 10 Enter type(Ex-HDD,motherboard,keyboard,mouse....) nameMouse Enter Company NameMTOD Enter Other details abour productMouse with LED If choice : 2 COMPID PRODUCT-NAME PRICE QUANTITY TYPE COMPANY DESCRIPTION 1201 Hard-disk 8750 55 HDD HTC 2 TB hard disk with 1203 Key-200 1200 30 keyboard prodot prodot EX keyboard 1204 HARDDISK2DX 5500 32 HDD Samsung 1TB hard disk 1205 RX-K400 480 12 Keyboard TRAX Gaming Keyboard 1206 M-200 55 10 Mouse MTOD Mouse with LED ===============MODIFY MENU================== 1.MODIFY COMPUTER PRODUCT NAME 2.MODIFY PRICE 3.MODIFY QUANTITY 4.MODIFY COMPANY NAME 5.MODIFY DESCRIPTION 6.BACK TO MAIN MENU
  • 26.
    REQUIREMENTS HARDWARE REQUIRED  Printer,to print the required documents of the project  Processor : intel or any other  Ram : 512 MB or above  Harddisk : 80 GB or more  SOFTWARE REQUIRED  Operating system : Windows 7 or above  Python 2 or above  IDE Atom, PyCharm, Thonny, or any other.  Database: MySQL  WebServer: XAMPP ADVANTAGES AND DISADVANTAGES Advantage: 1. Provides the searching facilities based on various factors. Such as ProductID, Product name, Price etc. 2. It tracks all the information of Seller, Customer etc. 3. Shows the information and description of the Computer and products 4. It generates the report on computer products, sellers and Customers. Disadvantage: 1. Require much man power i.e. much efforts, much cost and hard to operate and maintain. 2. Since, all the work is done in papers so it is very hard to locate a particular student record when it is required.
  • 27.
    CONCLUSION Nothing is perfectin this world. So, we are also no exception. Although, we have tried our best to present the information effectively, yet, there can be further enhancement in the Application. We have taken care of all the critical aspects, which need to take care of during the development of the Project. Like the things this project also has some limitations and can further be enhances by someone, because there are certain drawbacks that do not permit the system to be 100% accurate. BIBLIOGRAPHY  www.mysql.org  www.google.co.in  www.w3schools.com  www.tutorialspoint.com  www.javapoint.com  www.programiz.com  www.guru99.com