示例#1
0
    def printing_receipt():
        # Dummy Data
        store = Store(1111, "Nozima's & Darhon's Store", "Ziyollilar,9",
                      998908889900)
        staff = Staff(1234, 2222, entry_Name.get(), "Ziyollilar,9", "Manager",
                      1234)
        customer = Customer(entry_CustomerID.get(), "ban", "ddd", 122,
                            23232323, ["VIP"])
        order = Order(store, customer, staff)

        if not are_product_cells_empty():
            if are_product_cells_valid():
                for entries in products:
                    product = get_product(entries)
                    quantity = int(entries[quantity_index].get())
                    order.add_product(product, quantity)

                # RECEIPT WINDOW
                t = Toplevel()
                t.wm_title("Receipt")
                labeltest = Label(t,
                                  text=str(order.generate_receipt()),
                                  font=("Courier", 12))
                labeltest.pack()

                def array_clear():
                    del products[:]
                    t.destroy()

                close_receipt_Button = Button(t,
                                              text="Close",
                                              bg="#386fe5",
                                              width=8,
                                              font=("Courier", 12, "bold"),
                                              command=array_clear)
                close_receipt_Button.pack(pady=10)
                t.protocol("WM_DELETE_WINDOW", array_clear)

            else:
                tkinter.messagebox.showinfo(
                    "Warning!",
                    "Price must be FLOAT or INTEGER\nPoints, Quantity - MUST be INTEGER"
                )
        else:
            tkinter.messagebox.showinfo(
                "Warning!", "Firstly fill all the gaps, then you can Print!")
示例#2
0
    print(store)
    print()
    print(c1)
    print()
    print(c2)
    print()
    print(staff1)
    print()
    print(staff2)
    print()
    ans = 0
    while ans != "yes":
        print("Are you ready to make an order? (type yes or no):")
        ans = input()
        if ans == "no":
            print("Okay, type yes when you'll be ready!")

    while ans != 'done':
        print(
            "Currently there are only 2 products:\n"
            "1. Cucumber\n"
            "2. Tomatoes\n"
            "Which one do you want to by?: (type 1 or 2 or 'done' to proceed)")
        ans = input()
        if ans == '1':
            order.add_product(p1)
        if ans == '2':
            order.add_product(p2)
    print("\tHere is your receipt:\n")
    order.print_receipt()