├── Accounts ├── delivery.txt ├── provider.txt └── saleman.txt ├── data ├── buy.txt ├── delivered.txt ├── need_material.txt └── sale.txt ├── main.py ├── order.txt ├── report.txt ├── solt.txt └── utils ├── __pycache__ ├── delivery.cpython-310.pyc ├── provider.cpython-310.pyc └── saleman.cpython-310.pyc ├── delivery.py ├── provider.py └── saleman.py /Accounts/delivery.txt: -------------------------------------------------------------------------------- 1 | delivery delivery123 2 | delery password 3 | -------------------------------------------------------------------------------- /Accounts/provider.txt: -------------------------------------------------------------------------------- 1 | provider provider123 2 | provider password 3 | -------------------------------------------------------------------------------- /Accounts/saleman.txt: -------------------------------------------------------------------------------- 1 | saleman pa$$word123 2 | saleman1 password 3 | diyor diyor01 4 | -------------------------------------------------------------------------------- /data/buy.txt: -------------------------------------------------------------------------------- 1 | Aralash 30blocks 2 | Shoro 10blocks 3 | Gun 30blocks -------------------------------------------------------------------------------- /data/delivered.txt: -------------------------------------------------------------------------------- 1 | aktan 3 2 | shoro 5 3 | ka 5 -------------------------------------------------------------------------------- /data/need_material.txt: -------------------------------------------------------------------------------- 1 | Aralash 33 2 | Shoro 1 3 | Kurut 1 4 | Chalap 320 5 | Tan 320 6 | -------------------------------------------------------------------------------- /data/sale.txt: -------------------------------------------------------------------------------- 1 | Tan 30January 2 | Shoro 20october 3 | Aralash 20october 4 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from utils.delivery import * 2 | from utils.provider import * 3 | from utils.saleman import * 4 | 5 | account = str( 6 | input('Для запуска программы, пожалуйста введите тип аккаунта: >>> ')) 7 | 8 | def typeOfAccount(arg): 9 | 10 | if arg.lower() == 'saleman': 11 | saleman_enter(arg) 12 | elif arg.lower() == 'delivery': 13 | delivery_enter(arg) 14 | elif arg.lower() == 'provider': 15 | provider_enter(arg) 16 | else: 17 | return print('Извините, но мы не нашли такой тип аккаунта, пожалуйста повторите.') 18 | 19 | 20 | typeOfAccount(account) 21 | -------------------------------------------------------------------------------- /order.txt: -------------------------------------------------------------------------------- 1 | Aralash 2 | Tan 3 | Kurut 4 | tan 20shtuk 5 | Semechki 20 6 | 5 5 7 | 4 4 8 | -------------------------------------------------------------------------------- /report.txt: -------------------------------------------------------------------------------- 1 | aaaaaa 2 | ddddddddddddddd 3 | asdas 4 | dddddddddddddd 5 | -------------------------------------------------------------------------------- /solt.txt: -------------------------------------------------------------------------------- 1 | Aralash 20 2 | Tan 30 3 | -------------------------------------------------------------------------------- /utils/__pycache__/delivery.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratovv/Python_Univeristy/11468bf26b691cdb8e00194f69839a463ca028a8/utils/__pycache__/delivery.cpython-310.pyc -------------------------------------------------------------------------------- /utils/__pycache__/provider.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratovv/Python_Univeristy/11468bf26b691cdb8e00194f69839a463ca028a8/utils/__pycache__/provider.cpython-310.pyc -------------------------------------------------------------------------------- /utils/__pycache__/saleman.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratovv/Python_Univeristy/11468bf26b691cdb8e00194f69839a463ca028a8/utils/__pycache__/saleman.cpython-310.pyc -------------------------------------------------------------------------------- /utils/delivery.py: -------------------------------------------------------------------------------- 1 | from os import read 2 | 3 | 4 | def read_file(file): 5 | f = open(file) 6 | for line in f: 7 | print(line[:-1]) 8 | 9 | def delivery_enter(arg): 10 | login = str(input('Введите логин ')) 11 | password = str(input('Введите пароль ')) 12 | validate = False 13 | f = open('./accounts/delivery.txt') 14 | for line in f: 15 | val1, val2 = line.split(' ') 16 | if val1 == login and val2[:-1] == password: 17 | validate = True 18 | while True: 19 | menu = str(input( 20 | 'Приветствую дорогой, Доставщик!Пожалуйста наберите номер меню для работы с программой, если закончили, то наберите 7: ')) 21 | if menu == '1': 22 | read_file('solt.txt') 23 | elif menu == '2': 24 | read_file('./data/delivered.txt') 25 | elif menu == '3': 26 | array = [] 27 | f = open('./data/delivered.txt') 28 | for line in f: 29 | array.append(line) 30 | for i in range(len(array)): 31 | print(str(i+1)+'.'+array[i]) 32 | deleteOne = int(input( 33 | 'Какой заказ вы бы хотели удалить (Выберите цифру)?>>> ')) 34 | for i in range(len(array)): 35 | if i == deleteOne-1: 36 | deleted=array.pop(i) 37 | with open ("report.txt","a+")as f: 38 | f.write(str(deleted)) 39 | with open('./data/delivered.txt', "w") as file: 40 | for line in array: 41 | file.write(line) 42 | print('У вас осталось:') 43 | read_file('./data/delivered.txt') 44 | elif menu == '4': 45 | f = open('./data/delivered.txt') 46 | count = 0 47 | for line in f: 48 | count += 1 49 | print('Количество доставленных товаров', count) 50 | elif menu == '5': 51 | f = open('solt.txt') 52 | count = 0 53 | for line in f: 54 | count += 1 55 | print('Количество заказанных товаров', count) 56 | elif menu == '6': 57 | f = open('./data/delivered.txt') 58 | count = 0 59 | for line in f: 60 | val1, val2 = line.split(' ') 61 | count += int(val2) 62 | print(count) 63 | elif menu == '7': 64 | return print('Программа завершена, мы будем рады вашему возвращению!') 65 | else: 66 | print('Введите пункт из меню') 67 | continue 68 | if validate == False: 69 | print('Я не понимаю вас') 70 | -------------------------------------------------------------------------------- /utils/provider.py: -------------------------------------------------------------------------------- 1 | def read_file(file): 2 | f = open(file) 3 | for line in f: 4 | print(line[:-1]) 5 | 6 | def provider_enter(arg): 7 | login = str(input('Введите логин ')) 8 | password = str(input('Введите пароль ')) 9 | validate = False 10 | f = open('./accounts/provider.txt') 11 | for line in f: 12 | val1, val2 = line.split(' ') 13 | if val1 == login and val2[:-1] == password: 14 | validate = True 15 | while True: 16 | menu = str(input( 17 | 'Приветствую дорогой, Продавец!Пожалуйста наберите номер меню для работы с программой, если закончили, то наберите 5: ')) 18 | if menu == '1': 19 | read_file('./data/need_material.txt') 20 | elif menu == '2': 21 | f = open('./data/need_material.txt') 22 | count = 0 23 | for line in f: 24 | count += 1 25 | print(count) 26 | 27 | elif menu == '3': 28 | array = [] 29 | f = open('./data/need_material.txt') 30 | for line in f: 31 | val1, val2 = line.split(' ') 32 | array.append(val1+' '+val2[:-1]) 33 | array.sort(key=lambda x: int(x.split()[1])) 34 | max = int(array[-1].split()[1]) 35 | for line in reversed(array): 36 | price = int(line.split()[1]) 37 | if(price == max): 38 | print(line) 39 | elif menu == '4': 40 | array = [] 41 | f = open('./data/need_material.txt') 42 | for line in f: 43 | val1, val2 = line.split(' ') 44 | array.append(val1+' '+val2[:-1]) 45 | array.sort(key=lambda x: -int(x.split()[1])) 46 | max = int(array[-1].split()[1]) 47 | for line in reversed(array): 48 | price = int(line.split()[1]) 49 | if(price == max): 50 | print(line) 51 | elif menu == '5': 52 | return print('Программа завершена, мы будем рады вашему возвращению!') 53 | else: 54 | print('Введите пункт из меню') 55 | continue 56 | if validate == False: 57 | print('Я не понимаю вас') -------------------------------------------------------------------------------- /utils/saleman.py: -------------------------------------------------------------------------------- 1 | def read_file(file): 2 | f = open(file) 3 | for line in f: 4 | print(line[:-1]) 5 | 6 | def saleman_enter(arg): 7 | login = str(input('Введите логин ')) 8 | password = str(input('Введите пароль ')) 9 | validate = False 10 | f = open('./accounts/saleman.txt') 11 | for line in f: 12 | val1, val2 = line.split(' ') 13 | if val1 == login and val2[:-1] == password: 14 | validate = True 15 | while True: 16 | menu = str(input( 17 | 'Приветствую дорогой, Продавец!Пожалуйста наберите номер меню для работы с программой, если закончили, то наберите 6: ')) 18 | if menu == '1': 19 | read_file('./data/sale.txt') 20 | elif menu == '2': 21 | print('1-Поиск по названию') 22 | print('2-Поиск по дате') 23 | print('3-выход') 24 | while True: 25 | Number = input('') 26 | if Number == '1': 27 | Name = str(input('Поиск товара по названию:>>')) 28 | f = open('./data/sale.txt') 29 | result = False 30 | for line in f: 31 | val1, val2 = line.split(' ') 32 | if Name.lower() == val1.lower(): 33 | result = True 34 | print(line) 35 | if result == False: 36 | print('Такого товара нет') 37 | elif Number == '2': 38 | Date = str(input('Поиск товара по дате:>>')) 39 | f = open('./data/sale.txt') 40 | result = False 41 | for line in f: 42 | val1, val2 = line.split(' ') 43 | if Date.lower() == val2[:-1].lower(): 44 | result = True 45 | print(line) 46 | if result == False: 47 | print('Товара по данной дате нет') 48 | elif Number == '3': 49 | break 50 | else: 51 | print('Нет команды') 52 | 53 | elif menu == '3': 54 | read_file('solt.txt') 55 | 56 | elif menu == '4': 57 | read_file('order.txt') 58 | Name = str(input('Название товара для заказа-> ')) 59 | Quantity = str(input('Количество-> ')) 60 | with open('order.txt', "a+") as file: 61 | file.write(Name+" "+Quantity+"\n") 62 | elif menu == '5': 63 | array = [] 64 | f = open('solt.txt') 65 | for line in f: 66 | array.append(line) 67 | for i in range(len(array)): 68 | print(str(i+1)+'.'+array[i]) 69 | deleteOne = int( 70 | input('Какой заказ вы бы хотели удалить (Выберите цифру)?>>> ')) 71 | for i in range(len(array)): 72 | if i == deleteOne-1: 73 | array.remove(array[i]) 74 | with open('solt.txt', "w") as file: 75 | for line in array: 76 | file.write(line) 77 | print('У вас осталось:') 78 | read_file('solt.txt') 79 | 80 | elif menu == '6': 81 | return print('Программа завершена, мы будем рады вашему возвращению! ') 82 | 83 | if validate == False: 84 | print('Я не понимаю вас') 85 | 86 | --------------------------------------------------------------------------------