Skip to content

Commit

Permalink
Finilize 2
Browse files Browse the repository at this point in the history
  • Loading branch information
miladbarooni committed Jan 23, 2020
1 parent 9a7c305 commit e35ccdc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,17 +413,18 @@ def make_address_str(address_id):
def orderPage(self):
def showHistoryOfOrders():
print ("show history")
def finilizeCart():
def finilizeCart(discount_code):
print (self.address_id)
mydb.finalizeCart(self.user_id, self.address_id, discount_code.get())
self.order_screen = Tk()
self.order_screen.title("Orders Page")
Label(self.menu_screen, text="Finilize your Cart", bg="red", width="300", height="2", font=("Calibri", 13)).pack()
Label(self.order_screen, text="Finilize your Cart", bg="red", width="300", height="2", font=("Calibri", 13)).pack()
Label(text="").pack()
Label(self.order_screen, text="enter your discount code if you have one").pack()
discount_code = Entry(self.order_screen).pack()
Button(self.order_screen,text="Buy your Cart", height="2", width="30", command=finilizeCart).pack()
Label(self.menu_screen, text="Your Orders History", bg="red", width="300", height="2", font=("Calibri", 13)).pack()
discount_code = Entry(self.order_screen)
discount_code.pack()
Button(self.order_screen,text="Buy your Cart", height="2", width="30", command=partial(finilizeCart, discount_code)).pack()
Label(self.order_screen, text="Your Orders History", bg="red", width="300", height="2", font=("Calibri", 13)).pack()
Label(text="").pack()
Button(self.order_screen,text="history of orders", height="2", width="30", command=showHistoryOfOrders).pack()

Expand Down
Binary file modified __pycache__/snapFood.cpython-37.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion snapFood.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def finalizeCart(self, user_id, address_id, discount_code = None): #NOT CHECKED
for food in foods:
self._mycursor.execute("INSERT INTO FOOD_INVOIC(FOODfoodid, INVOICinvoiceid) VALUES (\'{}\', \'{}\');"
.format(food[0], invoic_id))
self._mycursor.execute("SELECT minimum-bill-value, price FROM SHOP JOIN FOOD ON shopid = SHOPshopid AND foodid = \'{}\'"
self._mycursor.execute("SELECT `minimum-bill-value`, price FROM SHOP JOIN FOOD ON shopid = SHOPshopid AND foodid = \'{}\'"
.format(food[0]))
data = self._mycursor.fetchall()
price = int(data[0][1])
Expand Down

0 comments on commit e35ccdc

Please sign in to comment.