Professional Documents
Culture Documents
Mobile Shop
Mobile Shop
Iuhyiugiugigi
CREATE DATABASE
a=sqltor.connect(host="localhost",user="root",passwd="root",database="mobile
_smag")
b=a.cursor()
b.execute("create table item(item_no integer(10),item_name
varchar(50),price int(10),quantity integer(10))")
b.execute("create table customer(cust_id integer(10),cust_name
varchar(50),address varchar(50),contact varchar(11))")
1
41
Iuhyiugiugigi
2
41
Iuhyiugiugigi
MAIN MENU
def main_menu():
while True:
print("\t\t\t\t___________________________________________")
print("\t\t\t\t *******************************************")
print("\t\t\t\t ***WELCOME TO MOBILE SHOP MANAGEMENT***")
print("\t\t\t\t *******************************************")
print("\t\t\t\t___________________________________________")
print("\t\t\t")
print("1. DETAILS OF CUSTOMERS")
print("2. DETAILS OF MOBILE")
print("3. DETAILS OF BILL")
choice=int(input("\t\t\t\t\tENTER YOUR CHOICE : "))
if choice==1:
cust_menu()
elif choice==2:
3
41
Iuhyiugiugigi
mob_purch()
elif choice==3:
bill_data()
else:
print("ERROR: INVALID CHOICE TRY AGAIN.....")
conti=input("PRESS ENTER KEY TO CONTINUE")
4
41
Iuhyiugiugigi
CUSTOMER
def cust_menu():
while True:
print("\t\t\t\t\t ___________________________________")
print("\t\t\t\t\t ********** CUSTOMER MENU **********")
print("\t\t\t\t\t ___________________________________")
print("1. ADD CUSTOMER DETAILS")
print("2. SHOW CUSTOMER DETAILS")
print("3.SEARCH")
print("4.DELETION OF RECORD")
print("5.UPDATE CUSTOMER DETAILS")
print("6.RETURN")
choice=int(input("\t\t\t\t\tENTER YOUR CHOICE : "))
if choice==1:
cust_details()
elif choice==2:
show_cust_details()
elif choice==3:
search_cust_details()
elif choice==4:
delete_cust_details()
elif choice==5:
5
41
Iuhyiugiugigi
edit_cust_details()
elif choice==6:
return
else:
print("ERROR: INVALID CHOICE TRY AGAIN.....")
conti=input("PRESS ENTER KEY TO CONTINUE")
def cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
sql="select * from customer";
cursor.execute(sql)
cust_id=100
for x in cursor:
cust_id=int(x[0])
cust_id=cust_id+1
print("new customer id : ",cust_id)
cust_name=input("Enter customer name:")
address=input("Enter customer address:")
contact=int(input("Enter customer contact no.:"))
6
41
Iuhyiugiugigi
def show_cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",datab
ase="mobile_smag")
cursor=mycon.cursor()
cursor.execute("select * from customer")
print("\t\t\t\t\t","*"*55)
print("\t\t\t\t\tCUST_ID \tCUST_NAME \tADDRESS \
tCONTACT")
data=cursor.fetchall()
for row in data:
print("\t\t\t\t\t",row[0],' \t\t',row[1],' \t\t',row[2],' \t\t',row[3])
print("\t\t\t\t\t","*"*55)
7
41
Iuhyiugiugigi
SEARCH:-
def search_cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("\nEnter customer ID: ")
st="select * from customer where cust_id='%s' "%(ac)
cursor.execute(st)
data=cursor.fetchall()
print("-"*25)
for row in data:
print("CUST_ID: ",row[0])
print("CUST_NAME: ",row[1])
print("ADDRESS: ",row[2])
print("CONTACT: ",row[3])
print("-"*25)
DELETION OF RECORD:-
8
41
Iuhyiugiugigi
def delete_cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("\nEnter customer ID:")
st="delete from customer where cust_id='%s' "%(ac)
cursor.execute(st)
com=mycon.commit()
print("Data deleted successfully")
def edit_name():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database
="mobile_smag")
cursor=mycon.cursor()
ac=input("Enter customer ID:")
name=input("Enter correct name:")
st="update customer set cust_name='%s'wherecust_id='%s'"%(name,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
9
41
Iuhyiugiugigi
2. EDIT ADDRESS:-
def edit_address():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database
="mobile_smag")
cursor=mycon.cursor()
ac=input("Enter customer ID:")
address2=input("Enter correct address:")
st="update customer set address='%s'wherecust_id='%s'"%(address2,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
3. EDIT CONTACT:-
def edit_contact():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter customer ID:")
contact3=int(input("Enter correct contact no.:"))
st="update customer set contact='%s'wherecust_id='%s'"%(contact3,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
10
41
Iuhyiugiugigi
MOBILE
def mob_purch():
while True:
print("\t\t\t\t\t ___________________________________")
print("\t\t\t\t\t ******* MOBILE PURCHASE MENU ******")
print("\t\t\t\t\t ___________________________________")
11
41
Iuhyiugiugigi
12
41
Iuhyiugiugigi
def mob_details():
try:
mycon=sqltor.connect(host="localhost",user="root",passwd="root",datab
ase="mobile_smag")
cursor=mycon.cursor()
pro_code=int(input("enter product code : "))
cust_id=input("Customer id:")
pro_name=input("Product name:")
model=input("Model name:")
qty=int(input("Quantity:"))
d_o_pur=input("Date of purchase(YYYY-MM-DD): ")
pur_unitprice=int(input("Purchase unit price:"))
total_pamount=int(qty*pur_unitprice)
print("Total purchase amount:%s"%(total_pamount))
query="insert into mobile_purchase
(pro_code,cust_id,pro_name,model,qty,d_o_pur,pur_unitprice,total_pam
ount)values({},'{}','{}','{}',{},'{}',{},
{})".format(pro_code,cust_id,pro_name,model,qty,d_o_pur,pur_unitprice
,total_pamount)
cursor.execute(query)
mycon.commit()
mycon.close()
cursor.close()
print("RECORD HAS BEEN SAVED IN MOBILE PURCHASE
TABLE")
except:
print("ERROR")
13
41
Iuhyiugiugigi
def show_mob_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",datab
ase="mobile_smag")
cursor=mycon.cursor()
cursor.execute("select * from mobile_purchase")
print("\t","*"*130)
print("\tPRO_CODE\tCUST_ID\tPRO_NAME\tMODEL\t\
tQUANTITY\tD_O_PURCH\tUNITPRICE\tTOTAL_AMOUNT")
data=cursor.fetchall()
for row in data:
print("\t",row[0],'\t\t',row[1],'\t\t',row[2],'\t',row[3],'\t\t',row[4],'\t\
t',row[5],'\t',row[6],'\t\t',row[7])
print("\t","*"*130)
SEARCH:-
def search_mob_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",datab
ase="mobile_smag")
14
41
Iuhyiugiugigi
cursor=mycon.cursor()
ac=input("Enter Product Code: ")
st="select * from mobile_purchase where pro_code=%s"%(ac)
cursor.execute(st)
data=cursor.fetchall()
print("-"*25)
for row in data:
print("PRO_CODE : ",row[0])
print("CUST_ID : ",row[1])
print("MODEL : ",row[2])
print("QUANTITY : ",row[3])
print("D_O_PURC : ",row[4])
print("UNITPRICE : ",row[5])
print("TOTAL AMOUNT: ",row[6])
print("-"*25)
DELETION OF RECORD:-
def delete_mob_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",datab
ase="mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product Code:")
st="delete from mobile_purchase where pro_code=%s"%(ac)
cursor.execute(st)
mycon.commit()
15
41
Iuhyiugiugigi
UPDATE RECORDS:-
1. EDIT MOBILE NAME:-
def edit_mobilename():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database=
"mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product code:")
name=input("Enter correct product name:")
st="update mobile_purchase set pro_name='%s' where pro_code='%s'"%
(name,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
2. EDIT QUANTITY:-
def edit_qty():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="m
obile_smag")
cursor=mycon.cursor()
ac=input("Enter Product code:")
address2=input("Enter correct quantity:")
st="update mobile_purchase set qty='%s'wherepro_code='%s'"%(address2,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
16
41
Iuhyiugiugigi
def edit_pur_unitprice():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product code:")
contact3=int(input("Enter correct unit price:"))
st="update mobile_purchase set pur_unitprice='%s'wherepro_code='%s'"%
(contact3,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
BILL
def bill_data():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
o="y"
while(o=="y" or o=="Y"):
print("\t\t\t\t\t\t*******MOBILE SHOP BILL*******")
print("\t\t\t\t\t\t*********TAX # INVOICE********")
print("\t\t\t\t\t\t***SHOP NO.4 RATANLAL NAGAR***")
print("\t\t\t\t\t\t************KANPUR************")
17
41
Iuhyiugiugigi
print("\t\t\t\t\t\t****MOBILE NO.:-8421468850****")
print("PRESS *1* TO MAKE BILL")
print("PRESS *2* TO SHOW BILL")
print("PRESS *3* TO EXIT")
c=int(input("\t\t\t\t\tENTER YOUR CHOICE:"))
MAKE BILL:-
18
41
Iuhyiugiugigi
if c==1:
print("\t\t\t\t\tMOBILE SHOP BILL")
date=input("Date(YYYY-MM-DD): ")
19
41
Iuhyiugiugigi
address=str(input("CUSTOMER'S ADDRESS:"))
mobileno=int(input("CUSTOMER'S NO.:"))
total=0
maxitem=41 # maximum number of items can be purchased at a time
if(impt<=maxitem):
for a in range(1,impt+1):
print("SERIAL NO.:",a)
i=str(input("ENTER ITEM NAME:"))
rate=int(input("ENTER PRICE:"))
qty=int(input("ENTER QUANTITY:"))
value=qty*rate # total price of product with no. of quantity
print("Total price:",value) # total amount of particular product
total=total+value # total amount of all products
sql="insert into item (item_no,item_name,price,quantity) values({},'{}',{},
{})".format(a,i,rate,qty)
cursor.execute(sql)
mycon.commit()
print("\
t_______________________________________________________________
_____________________________________")
print("\t\t\t\t\tMOBILE SHOP BILL")
print("CUSTOMER NAME:%s\t\t\t\t\t\t\t\t DATE=:%s"%
(customer,date))
print("CUSTOMER ADDRESS:%s"%(address))
print("CUSTOMER CONTACT NO.:%s"%(mobileno))
print("\t\t\t\t\t\t\t\t")
print("\t\t\t\t\t\t\t\t")
#print("\tItems Purchased Till Now:")
print("\t\t\t\t\t\t\t\t")
20
41
Iuhyiugiugigi
## print(row)
gst=18/100
gtax=total*gst #gst taxed amount
price=total+gtax # total amount of all products after adding gst
if(total<1200):
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price)
print("\t\t","*"*55)
elif(total>=1200 and total<=4000):
discount=5/100
dprice=total*discount # discount amount
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price-dprice)
print("\t\t","*"*55)
elif(total>4000 and total<=7000):
discount=15/100
21
41
Iuhyiugiugigi
dprice=total*discount
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price-dprice)
print("\t\t","*"*55)
elif(total>7000 and total<=12000):
discount=20/100
dprice=total*discount
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price-dprice)
print("\t\t","*"*55)
elif(total>12000):
discount=25/100
dprice=total*discount
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price-dprice)
print("\t\t","*"*55)
else:
print(" Sorry You Can Only Buy 41 Items At A Time")
SHOW BILL:
22
41
Iuhyiugiugigi
elif c==2:
print("\tItems Purchased Till Now:")
print("\t\t\t\t\t\t\t\t")
cursor.execute('select * from item')
print("\t\t","*"*55)
print("\t\tITEM_NO \tITEM_NAME \tPRICE \t QUANTITY")
data=cursor.fetchall()
for row in data:
print("\t\t",row[0],'\t\t',row[1],'\t\t',row[2],'\t ',row[3])
print("\t\t","*"*55)
SOURCE CODE
23
41
Iuhyiugiugigi
a=sqltor.connect(host="localhost",user="root",passwd="root",database="mobile
_smag")
b=a.cursor()
b.execute("create table item(item_no integer(10),item_name
varchar(50),price int(10),quantity integer(10))")
b.execute("create table customer(cust_id integer(10),cust_name
varchar(50),address varchar(50),contact varchar(11))")
b.execute("create table mobile_purchase(pro_code integer(10),cust_id
varchar(10),pro_name varchar(20),model varchar(20),qty integer(10),d_o_pur
Date,pur_unitprice integer(10),total_pamount integer(10))")
print("ITEM TABLE CREATED")
print("CUSTOMER TABLE CREATED")
print("MOBILE_PURCHASE TABLE CREATED")
print("\t\t\t\t====>>>READY TO EXECUTE MOBILE SHOP
MANAGEMENT MODULE")
except:
if(conn.is_connected()):
print("DATABASE ALREADY CREATED...")
print(">>>READY TO CONTINUE WITH MOBILE SHOP
MANAGEMENT MODULE")
24
41
Iuhyiugiugigi
cur.close()
conn.close()
def main_menu():
while True:
print("\t\t\t\t___________________________________________")
print("\t\t\t\t *******************************************")
print("\t\t\t\t ***WELCOME TO MOBILE SHOP MANAGEMENT***")
print("\t\t\t\t *******************************************")
print("\t\t\t\t___________________________________________")
print("\t\t\t")
print("1. DETAILS OF CUSTOMERS")
print("2. DETAILS OF MOBILE")
print("3. DETAILS OF BILL")
choice=int(input("\t\t\t\t\tENTER YOUR CHOICE : "))
if choice==1:
cust_menu()
elif choice==2:
mob_purch()
elif choice==3:
bill_data()
else:
print("ERROR: INVALID CHOICE TRY AGAIN.....")
conti=input("PRESS ENTER KEY TO CONTINUE")
def cust_menu():
while True:
25
41
Iuhyiugiugigi
print("\t\t\t\t\t ___________________________________")
print("\t\t\t\t\t ********** CUSTOMER MENU **********")
print("\t\t\t\t\t ___________________________________")
print("1. ADD CUSTOMER DETAILS")
print("2. SHOW CUSTOMER DETAILS")
print("3.SEARCH")
print("4.DELETION OF RECORD")
print("5.UPDATE CUSTOMER DETAILS")
print("6.RETURN")
choice=int(input("\t\t\t\t\tENTER YOUR CHOICE : "))
if choice==1:
cust_details()
elif choice==2:
show_cust_details()
elif choice==3:
search_cust_details()
elif choice==4:
delete_cust_details()
elif choice==5:
edit_cust_details()
elif choice==6:
return
else:
print("ERROR: INVALID CHOICE TRY AGAIN.....")
conti=input("PRESS ENTER KEY TO CONTINUE")
def cust_details():
26
41
Iuhyiugiugigi
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
sql="select * from customer";
cursor.execute(sql)
cust_id=100
for x in cursor:
cust_id=int(x[0])
cust_id=cust_id+1
print("new customer id : ",cust_id)
cust_name=input("Enter customer name:")
address=input("Enter customer address:")
contact=int(input("Enter customer contact no.:"))
query="insert into customer
(cust_id,cust_name,address,contact)values('{}','{}','{}',
{})".format(cust_id,cust_name,address,contact)
cursor.execute(query)
mycon.commit()
mycon.close()
cursor.close()
print("RECORD HAS BEEN SAVED IN CUSTOMER TABLE")
## break
## else:
## print("ERROR")
def show_cust_details():
27
41
Iuhyiugiugigi
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
cursor.execute("select * from customer")
print("\t\t\t\t\t","*"*55)
print("\t\t\t\t\tCUST_ID \tCUST_NAME \tADDRESS \tCONTACT")
data=cursor.fetchall()
for row in data:
print("\t\t\t\t\t",row[0],' \t\t',row[1],' \t\t',row[2],' \t\t',row[3])
print("\t\t\t\t\t","*"*55)
def search_cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("\nEnter customer ID: ")
st="select * from customer where cust_id='%s' "%(ac)
cursor.execute(st)
data=cursor.fetchall()
print("-"*25)
for row in data:
print("CUST_ID: ",row[0])
print("CUST_NAME: ",row[1])
print("ADDRESS: ",row[2])
print("CONTACT: ",row[3])
print("-"*25)
28
41
Iuhyiugiugigi
def delete_cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("\nEnter customer ID:")
st="delete from customer where cust_id='%s' "%(ac)
cursor.execute(st)
com=mycon.commit()
print("Data deleted successfully")
def edit_cust_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
print("1.Edit customer name")
print("2.Edit address")
print("3.Edit contact")
print("4.Return")
print("\t")
choice=int(input("\t\t\t\t\tEnter Your Choice:"))
if choice == 1:
edit_name()
elif choice == 2:
edit_address()
elif choice == 3:
edit_contact()
29
41
Iuhyiugiugigi
elif choice == 4:
return
else:
print("Error:Invalid choice---")
conti="Press any key to continue"
def edit_name():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter customer ID:")
name=input("Enter correct name:")
st="update customer set cust_name='%s'where cust_id='%s'"%(name,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
def edit_address():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter customer ID:")
address2=input("Enter correct address:")
st="update customer set address='%s'where cust_id='%s'"%(address2,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
def edit_contact():
30
41
Iuhyiugiugigi
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter customer ID:")
contact3=int(input("Enter correct contact no.:"))
st="update customer set contact='%s'where cust_id='%s'"%(contact3,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
def mob_purch():
while True:
print("\t\t\t\t\t ___________________________________")
print("\t\t\t\t\t ******* MOBILE PURCHASE MENU ******")
print("\t\t\t\t\t ___________________________________")
print("1. ADD MOBILE DETAILS")
print("2. SHOW MOBILE DETAILS")
print("3. SEARCH")
print("4. DELETION OF RECORD")
print("5. UPDATE RECORD")
print("6. RETURN")
choice=int(input("\t\t\t\t\tENTER YOUR CHOICE : "))
if choice==1:
mob_details()
elif choice==2:
show_mob_details()
elif choice==3:
31
41
Iuhyiugiugigi
search_mob_details()
elif choice==4:
delete_mob_details()
elif choice==5:
update_mob_details()
elif choice==6:
return
else:
print("ERROR: INVALID CHOICE TRY AGAIN.....")
conti=input("PRESS ENTER KEY TO CONTINUE")
def mob_details():
try:
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
pro_code=int(input("enter product code : "))
cust_id=input("Customer id:")
pro_name=input("Product name:")
model=input("Model name:")
qty=int(input("Quantity:"))
d_o_pur=input("Date of purchase(YYYY-MM-DD): ")
pur_unitprice=int(input("Purchase unit price:"))
total_pamount=int(qty*pur_unitprice)
print("Total purchase amount:%s"%(total_pamount))
query="insert into mobile_purchase
(pro_code,cust_id,pro_name,model,qty,d_o_pur,pur_unitprice,total_pamount)v
alues({},'{}','{}','{}',{},'{}',{},
32
41
Iuhyiugiugigi
{})".format(pro_code,cust_id,pro_name,model,qty,d_o_pur,pur_unitprice,total_
pamount)
cursor.execute(query)
mycon.commit()
mycon.close()
cursor.close()
print("RECORD HAS BEEN SAVED IN MOBILE PURCHASE
TABLE")
except:
print("ERROR")
def show_mob_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
cursor.execute("select * from mobile_purchase")
print("\t","*"*130)
print("\tPRO_CODE\tCUST_ID\tPRO_NAME\tMODEL\t\tQUANTITY\
tD_O_PURCH\tUNITPRICE\tTOTAL_AMOUNT")
data=cursor.fetchall()
for row in data:
print("\t",row[0],'\t\t',row[1],'\t\t',row[2],'\t',row[3],'\t\t',row[4],'\t\t',row[5],'\
t',row[6],'\t\t',row[7])
print("\t","*"*130)
def search_mob_details():
33
41
Iuhyiugiugigi
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product Code: ")
st="select * from mobile_purchase where pro_code=%s"%(ac)
cursor.execute(st)
data=cursor.fetchall()
print("-"*25)
for row in data:
print("PRO_CODE : ",row[0])
print("CUST_ID : ",row[1])
print("MODEL : ",row[2])
print("QUANTITY : ",row[3])
print("D_O_PURC : ",row[4])
print("UNITPRICE : ",row[5])
print("TOTAL AMOUNT: ",row[6])
print("-"*25)
def delete_mob_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product Code:")
st="delete from mobile_purchase where pro_code=%s"%(ac)
cursor.execute(st)
mycon.commit()
print("Data deleted successfully")
34
41
Iuhyiugiugigi
def update_mob_details():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
print("1.Edit Mobile name")
print("2.Edit Quantity")
print("3.Edit Purchase unit price")
print("4.Return")
print("\t")
choice=int(input("\t\t\t\t\tEnter Your Choice:"))
if choice == 1:
edit_mobilename()
elif choice == 2:
edit_qty()
elif choice == 3:
edit_pur_unitprice()
elif choice == 4:
return
else:
print("Error:Invalid choice---")
conti="Press any key to continue"
def edit_mobilename():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
35
41
Iuhyiugiugigi
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product code:")
address2=input("Enter correct quantity:")
st="update mobile_purchase set qty='%s'where pro_code='%s'"%
(address2,ac)
cursor.execute(st)
mycon.commit()
print("Data updated successfully")
def edit_pur_unitprice():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
ac=input("Enter Product code:")
contact3=int(input("Enter correct unit price:"))
st="update mobile_purchase set pur_unitprice='%s'where pro_code='%s'"%
(contact3,ac)
cursor.execute(st)
mycon.commit()
36
41
Iuhyiugiugigi
def bill_data():
mycon=sqltor.connect(host="localhost",user="root",passwd="root",database="
mobile_smag")
cursor=mycon.cursor()
o="y"
while(o=="y" or o=="Y"):
print("\t\t\t\t\t\t*******MOBILE SHOP BILL*******")
print("\t\t\t\t\t\t*********TAX # INVOICE********")
print("\t\t\t\t\t\t***SHOP NO.4 RATANLAL NAGAR***")
print("\t\t\t\t\t\t************KANPUR************")
print("\t\t\t\t\t\t****MOBILE NO.:-8421468850****")
print("PRESS *1* TO MAKE BILL")
print("PRESS *2* TO SHOW BILL")
print("PRESS *3* TO EXIT")
c=int(input("\t\t\t\t\tENTER YOUR CHOICE:"))
if c==1:
print("\t\t\t\t\tMOBILE SHOP BILL")
date=input("Date(YYYY-MM-DD): ")
37
41
Iuhyiugiugigi
38
41
Iuhyiugiugigi
## print(row)
gst=18/100
gtax=total*gst #gst taxed amount
price=total+gtax # total amount of all products after adding gst
if(total<1200):
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price)
print("\t\t","*"*55)
elif(total>=1200 and total<=4000):
discount=5/100
dprice=total*discount # discount amount
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price-dprice)
print("\t\t","*"*55)
elif(total>4000 and total<=7000):
discount=15/100
dprice=total*discount
print("\t\t\t\t\t\tPAYABLE AMOUNT(inc.GST):",price-dprice)
print("\t\t","*"*55)
39
41
Iuhyiugiugigi
40
41
Iuhyiugiugigi
print("\t\t\t\t\t******VISIT US AGAIN*****")
print("\t\t\t\t\t***SHOP NO.4 RATANLAL NAGAR***")
print("\t\t\t\t\t************KANPUR************")
print("\t\t\t\t\t****MOBILE NO.:-8421468850****")
print("\t\t\t\t\t*****APUS@YAHOOO.in*****")
o=input("want to run again y/n or Y/N:")
main_menu()
41