Exemplo n.º 1
0
def show_cash():
    user_name = control.get_user_name()
    cash = module.get_cash(user_name)
    print("___________________________________________")
    print("The cash of {} is {}$".format(user_name, cash))
    print("___________________________________________")
    client()
Exemplo n.º 2
0
def employee():
    print("""What do you want to do?
       1. Add new product
       2. Change the prices
       3. Show pricelist
       4. Exit""")
    answer = input("Choose: ")
    if answer == "1":
        control.add_product()
    if answer == "2":
        control.change_prices()
    if answer == "3":
        show_pricelist1()
    if answer == "4":
        # control.del_product()
        user_name = control.get_user_name()
        control.logger(": Staff's session end")
        print("Goodbye")
        welcome()
Exemplo n.º 3
0
def client():
    user_name = control.get_user_name()

    print(""""What do you want to do?
        1. Buy something from shop
        2. Show the putchase history
        3. Show the wallet
        4. Exit""")

    a = input()
    if a == "1":
        shop()
    elif a == "2":
        history()
    elif a == '3':
        show_cash()
    else:
        control.logger(": Clients session end".format(user_name))
        print("Bye")
        welcome()
Exemplo n.º 4
0
def history():
    user_name = control.get_user_name()
    check = module.get_check()
    print("The purchase history of {}".format(user_name))
    for i in range(0, len(check)):
        print("Date: " + str(check[i][0]) + ", product: " + check[i][1] +
              ", money left: " + str(check[i][2]) + "$")
    print(" ")

    # st_history = module.string_from_history().replace("\n"," ")
    # ls_history = st_history.split(" ")
    # user_name = control.get_user_name()
    # # print(st_history)
    # # print(user_name)
    # print("The purchase history of {}".format(user_name))
    # print("-------------------------------------------------")
    # for i in range(0, len(ls_history)):
    #     if user_name == ls_history[i]:
    #         print("Date: "+ls_history[i-3]+", product: "+ls_history[i-2]+", money left: "+ls_history[i-1]+"$")
    # print("-------------------------------------------------")
    client()
def get_check():
    name = control.get_user_name()
    sql.execute(f"SELECT date,product,money_left FROM history WHERE user_name='{name}'")
    check = sql.fetchall()
    return check
def add_history(check):
    name = control.get_user_name()
    check = check.split(" ")
    print(check)
    sql.execute(f"INSERT INTO history VALUES('{check[0]}','{check[1]}',{check[2]},'{name}')")
    db.commit()