I'm trying to make a simple POS system with user accounts.
What I want to happen is for it to wait until the SubtotalOrder
class window is closed before the rest of the function is completed because the variable customerProfile
isn't assigned to the correct data until that class window is closed.
def subtotalOrder(self):
SubtotalOrder(self.win)
conn = sqlite3.connect("inventory.db")
cur = conn.cursor()
print(customerProfileID)
today = date.today()
cur.execute(
"INSERT INTO orders (cusID, date, subtotal) VALUES ('{0}', '{1}', '{2}')".format(
customerProfileID, today.strftime("%d/%m/%Y"), self.subtotal))
cur.execute("SELECT * FROM orders WHERE OrderID = (SELECT MAX(OrderID) FROM orders)")
orderID = cur.fetchone()
for items in self.orderList:
cur.execute(
"INSERT INTO transactions (OrderID, ItemID) VALUES ('{0}', '{1}')".format(
orderID[1], items[1]))
conn.commit()
conn.close()