Ejemplo n.º 1
0
def create_dohod():
    dovidniks = get_dovidnik()
    tovaroobigs = get_tovaroobig()

    def get_dovidnik_name(dovidnik_code):
        for dovidnik in dovidniks:
            if dovidnik[0] == dovidnik_code:
                return dovidnik[1]
        return "*** назва не знайдена"

    def get_dovidnik_discount(dovidnik_code):
        for dovidnik in dovidniks:
            if dovidnik[0] == dovidnik_code:
                return dovidnik[2]
        return "*** назва не знайдена"

    dohod_list = []

    for tovaroobig in tovaroobigs:
        dohod_copy = dohod.copy()

        dohod_copy['name'] = get_dovidnik_name(tovaroobig[0])
        dohod_copy['year'] = tovaroobig[3].rstrip()
        dohod_copy['plan_tovaroobig'] = tovaroobig[1]
        dohod_copy['ochikuvane_tovaroobig'] = tovaroobig[2]
        dohod_copy['discount'] = float(get_dovidnik_discount(tovaroobig[0]))
        dohod_copy['plan_dohod'] = int(dohod_copy['plan_tovaroobig']) * int(
            dohod_copy['discount'] * 10) / 10
        dohod_copy['ochikuvane_dohod'] = int(
            dohod_copy['ochikuvane_tovaroobig']) * int(
                dohod_copy['discount'] * 10) / 10
        dohod_list.append(dohod_copy)
    return dohod_list
Ejemplo n.º 2
0
Archivo: main.py Proyecto: stashyk/Ivan
            


while True: 
    os.system('clear')
    print(MAIN_MENU)
    command_number = input('Введіть номер команди: ')
    
    if command_number == '0':
        print("\nПрограма завершила роботу")
        exit(0)

    elif command_number == '1':
        dohod_list = create_dohod()
        show_dohod(dohod_list)  
        input(STOP_MESSAGE)  

    elif command_number == '2':
        dohod_list = create_dohod()
        write_file(dohod_list)
        input(STOP_MESSAGE)

    elif command_number == '3':
        tovaroobigs = get_tovaroobig()
        show_tovaroobig(tovaroobigs)
        input(STOP_MESSAGE)

    elif command_number == '4':
        dovidniks = get_dovidnik()
        show_dovidnik(dovidniks)
        input(STOP_MESSAGE)