def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    options = ['Add item', 'Edit item', 'Remove item']
    terminal_view.get_choice(options)

    table = inventory.create_table()

    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(options)
        if choice == "1":
            add_item(table)
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
def run():
    os.system('clear')
    options = [
        "Store manager", "Human resources manager", "Inventory manager",
        "Accounting manager", "Sales manager",
        "Customer Relationship Management (CRM)", "Data Analyser"
    ]
    choice = None
    while choice != "0":
        os.system('clear')
        choice = terminal_view.get_choice(options)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "7":
            data_analyser_controller.run()
        elif choice == "0":
            os.system('clear')
        else:
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 3
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    title = "Human resources manager"
    options = [
        "Add item", "Remove item", "Update item", "Show the oldest person",
        "Show person closest to average age"
    ]
    exit_message = "Back to main menu"

    title_list = [['Name'], ['Date of birth']]

    data_file = "model/hr/persons.csv"
    table = data_manager.get_table_from_file(data_file)
    terminal_view.print_table(table, title_list)

    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(title, options, exit_message)
        if choice == "1":
            record = []
            index = 0
            inputs = terminal_view.get_inputs(title_list, title)
            for i in inputs:
                record.insert(index, i)
                index += 1
            hr.add(table, record)
            data_manager.write_table_to_file(data_file, table)
            terminal_view.print_table(table, title_list)

        elif choice == "2":
            user_input = terminal_view.get_inputs(["Enter ID: "], "")
            hr.remove(table, user_input[0])
            terminal_view.print_table(table, title_list)
        elif choice == "3":
            record = []
            index = 0
            user_input = terminal_view.get_inputs(["Enter ID: "], "")
            inputs = terminal_view.get_inputs(title_list, title)
            for i in inputs:
                record.insert(index, i)
                index += 1
            hr.update(table, user_input[0], record)
            terminal_view.print_table(table, title_list)
        elif choice == "4":
            terminal_view.print_result(hr.get_oldest_person(table),
                                       "Oldest person")
        elif choice == "5":
            terminal_view.print_result(
                hr.get_persons_closest_to_average(table),
                "Person closest to average")
        else:
            terminal_view.print_error_message("You have chosen back to menu.")
Ejemplo n.º 4
0
def run():
    options = ["Store manager",
               "Human resources manager",
               "Inventory manager",
               "Accounting manager",
               "Sales manager",
               "Customer Relationship Management (CRM)"]
    
    common.print_art(0)
    choice = None
    while choice != "0":
        common.clear_terminal()
        common.print_art(0)
        choice = terminal_view.get_choice(options)
        if choice == "1":
            common.clear_terminal()
            store_controller.run()
        elif choice == "2":
            common.clear_terminal()
            hr_controller.run()
        elif choice == "3":
            common.clear_terminal()
            inventory_controller.run()
        elif choice == "4":
            common.clear_terminal()
            accounting_controller.run()
        elif choice == "5":
            common.clear_terminal()
            sales_controller.run()
        elif choice == "6":
            common.clear_terminal()
            crm_controller.run()
def handle_menu():
    options = [
        "Store manager", "Human resources manager", "Inventory manager",
        "Accounting manager", "Sales manager",
        "Customer Relationship Management (CRM)", "Data analyser"
    ]
    return terminal_view.get_choice(options)
Ejemplo n.º 6
0
def run():
    """
	Starts this module and displays its menu.
	* User can access default special features from here.
	* User can go back to main menu from here.

	Returns:
		None
	"""
    list_options = [
        'Human resources', 'Show all people', 'Add', 'Remove', 'Update',
        'Get oldest person', 'Get persons closest to average',
        'Exit to main menu'
    ]
    list_labels = [['Name', 'name'], ['Birth year', 'year']]
    data_file = "model/hr/persons.csv"
    crud_module = hr
    while True:
        table = data_manager.get_table_from_file(data_file)
        max_id = len(table)
        user_choice = terminal_view.get_choice(list_options)
        if user_choice in ['1', '2', '3', '4']:
            make_crud(crud_module, list_labels, list_options, max_id, table,
                      user_choice)
        elif user_choice == '5':
            terminal_view.print_result(hr.get_oldest_person(table),
                                       'Get oldest person:')
        elif user_choice == '6':
            terminal_view.print_result(
                hr.get_persons_closest_to_average(table),
                'Get persons closest to average:')
        elif user_choice == '0':
            break
        else:
            terminal_view.print_error_message("There is no such choice.")
def run():
    title = "Main Menu"
    options = [
        "Store manager", "Human resources manager", "Inventory manager",
        "Accounting manager", "Sales manager",
        "Customer Relationship Management (CRM)"
    ]
    exit_message = "Turn off program"

    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(title, options, exit_message)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        else:
            terminal_view.print_error_message(
                "You have chosen to turn off the program.")
Ejemplo n.º 8
0
def run():

    title = 'Main menu'
    options = [
        "Store manager", "Human resources manager", "Inventory manager",
        "Accounting manager", "Sales manager",
        "Customer Relationship Management (CRM)"
    ]
    exit_message = "Exit program"

    choice = None
    while choice != "0":
        common.clear()
        choice = terminal_view.get_choice(title, options, exit_message)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice != 0:
            terminal_view.print_error_message("There is no such choice.")
def run():
    options = [
        "Store manager", "Human resources manager", "Inventory manager",
        "Accounting manager", "Sales manager",
        "Customer Relationship Management (CRM)", "Data Analyzer"
    ]

    os.system("clear")
    choice = None
    while choice != "0":
        os.system("clear")
        terminal_view.print_predator()
        terminal_view.print_menu("What controller would you like to open:",
                                 options, "Exit")
        choice = terminal_view.get_choice(options)
        os.system("clear")
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "7":
            data_analysis_controller.run()
        else:
            if choice != "0":
                terminal_view.print_error_message("There is no such choice.\n")
Ejemplo n.º 10
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    title_list = ["* id", "* name", "* email", "* subscribed"]

    options = [
        "Add new record to table",
        "Remove a record with a given id from the table",
        "Update specified record in the table",
        "ID of the customer with the longest name",
        "Customers that have subscribed to the newsletter", "Print table"
    ]
    os.system('clear')
    file = "model/crm/customers.csv"
    choice = None
    while choice != "0":
        terminal_view.print_menu("What do you want to do:", options,
                                 "Back to main menu")
        choice = terminal_view.get_choice(options)
        if choice == "1":
            common.all_add(title_list, file)
        elif choice == "2":
            common.all_remove(title_list, file)
        elif choice == "3":
            common.all_updates(title_list, file)
        elif choice == "4":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            id_with_longest_name = crm.get_longest_name_id(table)
            os.system("clear")
            print("ID of the customer with the longest name: ",
                  id_with_longest_name)
            common.waiting()
            os.system("clear")
        elif choice == "5":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            subscribed_mails = crm.get_subscribed_emails(table)
            os.system("clear")
            print("Customers that have subscribed to the newsletter: ",
                  subscribed_mails)
            common.waiting()
            os.system("clear")
        elif choice == "6":
            common.all_print_table(title_list, file)

        else:
            if choice != "0":
                terminal_view.print_error_message("There is no such choice.")
def run():
    options = ["Store manager",
               "Human resources manager",
               "Inventory manager",
               "Accounting manager",
               "Sales manager",
               "Customer Relationship Management (CRM)"]

    choice = None
    while choice != "0":
        terminal_view.print_menu("Main menu:",options, "Exit program")
        choice = terminal_view.get_choice(options)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")
def run():
    
    options = ["1. Store manager",
               "2. Human resources manager",
               "3. Inventory manager",
               "4. Accounting manager",
               "5. Sales manager",
               "6. Customer Relationship Management (CRM)"]

    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(options)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            return
        else:
            terminal_view.print_error_message("There is no such choice. Choose from 1 to 6")
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    common.clear()
    title = 'Human Resources menu'
    options = ["Add new record to table",
               "Remove a record with a given id from the table.",
               "Updates specified record in the table.",
               "Who is the oldest person?",
               "Who is the closest to the average age?"]
    exit_message = "Back to main menu"

    title_list = ["ID", "NAME", "BIRTH YEAR"]
    table = hr.data_manager.get_table_from_file('model/hr/persons.csv')
    # terminal_view.print_table(table, title_list)

    choice = None
    while choice != "0":
        terminal_view.print_table(table, title_list)
        choice = terminal_view.get_choice(title, options, exit_message)
        if choice == "1":
            record = terminal_view.get_inputs(title_list, 'Please add following informations :', table)
            updated_table = hr.add(table, record)
            hr.data_manager.write_table_to_file('model/hr/persons.csv', updated_table)
            common.exit_prompt()
            common.clear()
        elif choice == "2":
            id_ = terminal_view.get_inputs(['Id'], 'Please give ID to remove :', table)
            updated_table = hr.remove(table, id_)
            hr.data_manager.write_table_to_file('model/hr/persons.csv', updated_table)
            common.exit_prompt()
            common.clear()
        elif choice == "3":
            id_ = terminal_view.get_inputs(['Id'], 'Please give ID of changed line :', table)
            record = terminal_view.get_inputs(title_list, 'Please add following informations :', table)
            updated_table = hr.update(table, id_, record)
            hr.data_manager.write_table_to_file('model/hr/persons.csv', updated_table)
            common.exit_prompt()
            common.clear()
        elif choice == "4":
            result = hr.get_oldest_person(table)
            label = "The oldest person is: "
            terminal_view.print_result(result, label)
            common.exit_prompt()
            common.clear()
        elif choice == "5":
            result = hr.get_persons_closest_to_average(table)
            label = "The closest to the average age is person: ?"
            terminal_view.print_result(result, label)
            common.exit_prompt()
            common.clear()
        elif choice != 0:
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 14
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    list_of_customers = crm.get_data_to_list()

    # your code
    options = [
        "Add new record", "Remove a record", "Update record",
        "Id of the customer with the longest name",
        "Customers has subscribed to the newsletter", "Print table"
    ]

    title_list = ["ID", "Name", "e-mail", "subscribed"]

    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(options, "Back to main menu")
        if choice == "1":
            new_record = terminal_view.get_inputs(
                ["Name: ", "e-mail: ", "subscribed: "], "Please enter value: ")
            new_record.insert(0, crm.get_random_id(list_of_customers))
            list_of_customers = crm.add(list_of_customers, new_record)
        elif choice == "2":
            #  id_of_record_to_remove = id_to_number_of_line(list_of_customers)
            id_of_record_to_remove = ask_untill_correct(list_of_customers)
            list_of_customers = crm.remove(
                list_of_customers,
                common.check_id_by_number(list_of_customers,
                                          int(id_of_record_to_remove)))
        elif choice == "3":
            id_of_record_to_update = ask_untill_correct(list_of_customers)
            updated_record = terminal_view.get_inputs(
                ["Name: ", "e-mail: ", "subscribed: "], "Please enter value: ")
            list_of_customers = crm.update(
                list_of_customers,
                common.check_id_by_number(list_of_customers,
                                          int(id_of_record_to_update)),
                updated_record)
        elif choice == "4":
            terminal_view.print_result(
                crm.get_longest_name_id(list_of_customers),
                "Longest person's ID")
        elif choice == "5":
            terminal_view.print_result(
                crm.get_subscribed_emails(list_of_customers),
                "List of subsrcibe user")
        elif choice == "6":
            terminal_view.print_table(list_of_customers, title_list)
        elif choice == "0":
            crm.export_list_to_file(list_of_customers)

        else:
            terminal_view.print_error_message(
                "There is no such choice.")  # your code
def run():

    os.system('cls||clear')

    title = "Main menu\n"

    options = [
        "(1) Store manager", "(2) Human resources manager",
        "(3) Inventory manager", "(4) Accounting manager", "(5) Sales manager",
        "(6) Customer Relationship Management (CRM)"
    ]

    exit_message = "(0) Exit program\n"

    argument = None
    choice = None
    while argument != "0":
        choice = terminal_view.get_choice(title, options, exit_message)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "0":
            argument = terminal_view.kutas_kurwa()
        else:
            terminal_view.print_error_message("There is no such choice.")
def run():
    options = [
        "Store manager", "Human resources manager", "Inventory manager",
        "Accounting manager", "Sales manager",
        "Customer Relationship Management (CRM)", "Data analyser"
    ]

    choice = None
    while choice != "0":
        common.clear_function()
        terminal_view.print_primitive_logo()
        terminal_view.print_menu("Main menu: ", options, "Exit program")
        choice = terminal_view.get_choice()
        common.clear_function()
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            inventory_controller.run()
        elif choice == "4":
            accounting_controller.run()
        elif choice == "5":
            sales_controller.run()
        elif choice == "6":
            crm_controller.run()
        elif choice == "7":
            data_analyser_controller.run()
        else:
            pass
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    title_list = [
        "* ID", "* Month of the transaction", "* Day of the transaction",
        "* Year of the transaction", "* Type", "* Amount in USD"
    ]

    options = [
        "Add new record to table",
        "Remove a record with a given id from the table",
        "Update specified record in the table", "Year of the highest profit",
        "Average profit in a given year", "Print table"
    ]
    os.system('clear')
    file = "model/accounting/items.csv"
    choice = None
    while choice != "0":
        terminal_view.print_menu("What do you want to do:", options,
                                 "Back to main menu")
        choice = terminal_view.get_choice(options)
        if choice == "1":
            common.all_add(title_list, file)
        elif choice == "2":
            common.all_remove(title_list, file)
        elif choice == "3":
            common.all_updates(title_list, file)
        elif choice == "4":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            year_of_highest_profit = accounting.which_year_max(table)
            os.system("clear")
            print("Year of the highest profit:", year_of_highest_profit)
            common.waiting()
            os.system("clear")
        elif choice == "5":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            terminal_view.print_table(table, title_list)
            year = int(common.get_input("Enter year: "))
            print(accounting.avg_amount(table, year))
            common.waiting()
            os.system("clear")
        elif choice == "6":
            common.all_print_table(title_list, file)
        else:
            if choice != "0":
                terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 18
0
def run():
	"""
	Starts this module and displays its menu.
	* User can access default special features from here.
	* User can go back to main menu from here.

	Returns:
		None
	"""
	
	list_options = [
		'Sales',
		'Show all data',
		'Add',
		'Remove',
		'Update',
		'Get lowest price item id',
		'Get items sold between',
		'Exit to main menu'
	]
	data_file = "model/sales/sales.csv"
	crud_module = sales
	while True:
		table = data_manager.get_table_from_file(data_file)
		max_id = len(table)
		list_labels = [
			['Title', str],
			['Price', int],
			['Month', 'month'],
			['Day', 'day'],
			['Year', 'year'],
			['Customer', str]
		]
		user_choice = terminal_view.get_choice(list_options)
		if user_choice in ['1', '2', '3', '4']:
			make_crud(crud_module, list_labels, list_options, max_id, table, user_choice)
		elif user_choice == '5':
			result = sales.get_lowest_price_item_id(table)
			terminal_view.print_result(result, "Lowest price item ID")
		elif user_choice == '6':
			inputs_labels_between = [
				['Date from', 'date'],
				['Date to', 'date'],
			]
			inputs = terminal_view.get_inputs(['must'] + inputs_labels_between, 'Date from to')
			inputs = [int(item) for item in inputs]
			result = sales.get_items_sold_between(table, *inputs)
			print(common.bcolors.WARNING + common.bcolors.BOLD)
			terminal_view.os.system('clear')
			if common.check_if_empty(result):
				terminal_view.print_table(result, list_labels)
			print(common.bcolors.ENDC)
		
		elif user_choice == '0':
			break
		
		else:
			terminal_view.print_error_message("There is no such choice.")
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    list_options = [
        "1. Add new record to table",
        "2. Remove a record with a given id from the table",
        "3. Update specified record in the table",
        "4. Which items have not exceeded their durability yet?",
        "5. What are the average durability times for each manufacturer?"
    ]

    program_works = True

    while program_works:
        table = inventory.get_table()
        title_list = [
            "ID", "NAME", "MANUFACTURER", "PURCHASE YEAR", "DURABILITY"
        ]
        terminal_view.print_table(table, title_list)

        answer = terminal_view.get_choice(list_options)

        if answer == "1":
            record = terminal_view.get_inputs([
                "ID: ", "Name: ", "Manufacturer: ", "Purchase year: ",
                "Durability: "
            ], "Please provide information: \n")
            common.add(table, record)
            inventory.save_table(table)
        elif answer == "2":
            id_ = terminal_view.get_input("Please enter id number: ")
            common.remove(table, id_)
            inventory.save_table(table)
        elif answer == "3":
            id_ = terminal_view.get_input("Please enter id number: ")
            record = terminal_view.get_inputs([
                "Enter ID: ", "Name of item: ", "Manufacturer: ",
                "Year of purchase", "Durability year"
            ], "Please provide new information")
            common.update(table, id_, record)
            inventory.save_table(table)
        elif answer == "4":
            inventory.get_oldest_person(table)
        elif answer == "5":
            inventory.get_average_durability_by_manufacturers(table)
        elif answer == "0":
            program_works = False
        else:
            terminal_view.print_error_message(
                "There is no such choice. Choose from 1 to 5")
    return
Ejemplo n.º 20
0
def run():
    """
Uruchamia ten moduł i wyświetla jego menu.
     * Użytkownik ma tutaj dostęp do domyślnych funkcji specjalnych.
     * Użytkownik może wrócić do głównego menu.

    Zwroty:
        Żaden
    """

    options = [
        "Add new record to table", "Remove a record", "Update a record",
        "Get oldest person in file",
        "Get closest person to average year in file", "Print table"
    ]

    title_list = ["*id", "person", "year"]
    os.system('clear')
    file = "model/hr/persons.csv"
    choice = None
    while choice != "0":
        terminal_view.print_menu("What do you want to do: ", options,
                                 "Back to main menu")
        choice = terminal_view.get_choice(options)
        if choice == "1":
            common.all_add(title_list, file)
        elif choice == "2":
            common.all_remove(title_list, file)
        elif choice == "3":
            common.all_updates(title_list, file)
        elif choice == "4":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            oldest_person = hr.get_oldest_person(table)
            os.system("clear")
            print("The oldest persons in the file: ", oldest_person)
            common.waiting()
            os.system("clear")
        elif choice == "5":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            closest_to_average = hr.get_persons_closest_to_average(table)
            os.system("clear")
            print("Closest person to average year is:", closest_to_average)
            common.waiting()
            os.system("clear")
        elif choice == "6":
            common.all_print_table(title_list, file)

        else:
            if choice != "0":
                terminal_view.print_error_message("There is no such choice.")
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    list_options = [
        "1. Add new record to table",
        "2. Remove a record with a given id from the table",
        "3. Update specified record in the table",
        "4. Which year has the highest profit?",
        "5. What is the average (per item) profit in a given year?"
    ]

    program_works = True
    while program_works:

        table = accounting.get_table()
        title_list = ["ID", "MONTH", "DAY", "YEAR", "TYPE", "AMOUNT"]
        terminal_view.print_table(table, title_list)

        answer = terminal_view.get_choice(list_options)

        if answer == "1":
            record = terminal_view.get_inputs([
                "ID: ", "Month of the transaction: ",
                "Day of the transaction: ", "Year of the transaction: ",
                "Type - income/outflow (in.out): ",
                "Amount of transaction in USD: "
            ], "Please provide information: \n")
            common.add(table, record)
            accounting.save_table(table)
        elif answer == "2":
            id_ = terminal_view.get_input("Please enter id number: ")
            common.remove(table, id_)
            accounting.save_table(table)
        elif answer == "3":
            id_ = terminal_view.get_input("Please enter id number: ")
            record = terminal_view.get_inputs(
                ["ID: ", "Month: ", "Day: ", "Year: ", "Type: ", "Ammount: "],
                "Please provide new information")
            common.update(table, id_, record)
            accounting.save_table(table)
        elif answer == "4":
            accounting.which_year_max(table)
        elif answer == "5":
            accounting.avg_amount(table, year)
        elif answer == "0":
            program_works = False
        else:
            terminal_view.print_error_message(
                "There is no such choice. Choose from 1 to 5")
    return
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code
    menu_accounting = [
        "Print accounting list", "Add to accounting list",
        "Remove form accounting list", "Update record in accounting list",
        "Show year with highest profit",
        "Show average profit per item in a given year"
    ]
    title = ["Id", "Month", "Day", "Year", "Type", "Amount"]
    title_del = ["Input ID: "]
    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(menu_accounting)

        if choice == "1":
            terminal_view.print_table(accounting.get_data(), title)

        if choice == "2":
            accounting.new_record(
                common.get_user_inp_record(
                    terminal_view.get_inputs(title[1:], "")),
                "model/accounting/items.csv")

        if choice == "3":
            accounting.delete_record(
                accounting.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                "model/accounting/items.csv")

        if choice == "4":
            accounting.update_record(
                accounting.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                terminal_view.get_inputs(title[1:], ""),
                "model/accounting/items.csv")

        if choice == "5":
            terminal_view.print_result(
                accounting.which_year_max(accounting.get_data()),
                "Year with max profit")
        if choice == "6":
            year = terminal_view.get_inputs(["Year:"], "")
            terminal_view.print_result(
                accounting.avg_amount(accounting.get_data(), year[0]),
                "Averange profit per item")
Ejemplo n.º 23
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code

    menu_store = [
        "Print store list", "Add to store list", "Remove form store list",
        "Update record in store list", "Number of games in the manufacture",
        "Average amount of games in stock of a given manufacturer "
    ]
    title = ["ID", "Title", "Manufacturer", "Price", "In_stock"]
    title_del = ["Input ID: "]
    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(menu_store)

        if choice == "1":
            terminal_view.print_table(store.get_data(), title)

        if choice == "2":
            store.new_record(
                common.get_user_inp_record(
                    terminal_view.get_inputs(title[1:], "")),
                "model/store/games.csv")
        if choice == "3":
            store.delete_record(
                store.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                "model/store/games.csv")
        if choice == "4":
            store.update_record(
                store.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                terminal_view.get_inputs(title[1:], ""),
                "model/store/games.csv")
        if choice == "5":
            terminal_view.print_result(
                store.get_counts_by_manufacturers(store.get_data()),
                "Different kinds of game are available of each manufacturer: ")
        if choice == "6":
            terminal_view.print_result(
                store.get_average_by_manufacturer(
                    store.get_data(),
                    common.get_user_inp_record(
                        terminal_view.get_inputs(["Input manufactures: "],
                                                 ""))),
                "Average games in manufacturer: ")
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    list_options = [
        "1. Add new record to table",
        "2. Remove a record with a given id from the table",
        "3. Update specified record in the table", "4. Which person is oldest",
        "5. Which person is closest to average"
    ]

    program_works = True

    while program_works:
        table = hr.get_table()
        title_list = ["ID", "NAME", "DATE OF BIRTH"]
        terminal_view.print_table(table, title_list)
        answer = terminal_view.get_choice(list_options)

        if answer == "1":
            record = terminal_view.get_inputs(
                ["ID: ", "Name and surname: ", "Date of birth: "],
                "Please provide your personal information")
            common.add(table, record)
            hr.save_table(table)
        elif answer == "2":
            id_ = terminal_view.get_input("Please enter id number: ")
            common.remove(table, id_)
            hr.save_table(table)
        elif answer == "3":
            id_ = terminal_view.get_input("Please enter id number: ")
            record = terminal_view.get_inputs(
                ["ID: ", "Name and surname: ", "Year of birth: "],
                "Please provide new information")
            common.update(table, id_, record)
            hr.save_table(table)
        elif answer == "4":
            print(hr.get_oldest_person(table))
            # result = hr.get_oldest_person(table)
            # terminal_view.print_result(result, "Oldest person is: ")
        elif answer == "5":
            hr.get_persons_closest_to_average(table)
        elif answer == "0":
            program_works = False
        else:
            terminal_view.print_error_message(
                "There is no such choice. Choose from 1 to 5")
    return
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    title_list = ["* id",
                  "* title",
                  "* price",
                  "* month of the sale",
                  "* day of the sale",
                  "* year of the sale",
                  "* id of customer"]

    options = ["Add new record to table",
               "Remove a record with a given id from the table",
               "Update specified record in the table",
               "ID of the item that was sold for the lowest price",
               "Items that are sold between two given dates",
               "Print table"]
    os.system('clear')
    file = "model/sales/sales.csv"
    choice = None
    while choice != "0":
        terminal_view.print_menu("What do you want to do:", options, "Back to main menu")
        choice = terminal_view.get_choice(options)
        if choice == "1":
            common.all_add(title_list, file)
        elif choice == "2":
            common.all_remove(title_list, file)
        elif choice == "3":
            common.all_updates(title_list, file)
        elif choice == "4":
            file_name = common.get_input("Choose a file: ")
            if file_name == "":
                file_name = file
            table = common.get_table_from_file(file_name)
            item_the_lowest_price = sales.get_lowest_price_item_id(table)
            os.system("clear")
            print("id of the item that was sold for the lowest price: ", item_the_lowest_price)
            common.waiting()
            os.system("clear")
        elif choice == "5":
            pass
        elif choice == "6":
            common.all_print_table(title_list, file)

        else:
            if choice != "0":
                terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 26
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code

    menu_inventory = [
        "Print inventory list", "Add to inventory list",
        "Remove form inventory list", "Update record in inventory list",
        "Available items", "Average durability"
    ]
    title = ["ID", "Name", "Manufacturer", "Purchase_year", "Durability"]
    title_del = ["Input ID: "]
    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(menu_inventory)

        if choice == "1":
            terminal_view.print_table(inventory.get_data(), title)

        if choice == "2":
            inventory.new_record(
                common.get_user_inp_record(
                    terminal_view.get_inputs(title[1:], "")),
                "model/inventory/inventory.csv")
        if choice == "3":
            inventory.delete_record(
                inventory.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                "model/inventory/inventory.csv")
        if choice == "4":
            inventory.update_record(
                inventory.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                terminal_view.get_inputs(title[1:], ""),
                "model/inventory/inventory.csv")
        if choice == "5":
            terminal_view.print_result(
                str(inventory.get_available_items(inventory.get_data())),
                "Available items: ")
        if choice == "6":
            terminal_view.print_result(
                str(
                    inventory.get_average_durability_by_manufacturers(
                        inventory.get_data())), "Oldest persons: ")
Ejemplo n.º 27
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    # your code
    menu_hr = [
        "Print hr list", "Add to hr list", "Remove form hr list",
        "Update record in hr list", "Oldest employe", "Average age"
    ]
    title = ["Id", "Name", "Year"]
    title_del = ["Input ID: "]
    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(menu_hr)

        if choice == "1":
            terminal_view.print_table(hr.get_data(), title)

        if choice == "2":
            hr.new_record(
                common.get_user_inp_record(
                    terminal_view.get_inputs(title[1:], "")),
                "model/hr/persons.csv")

        if choice == "3":
            hr.delete_record(
                hr.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                "model/hr/persons.csv")

        if choice == "4":
            hr.update_record(
                hr.get_data(),
                common.get_user_inp_record(
                    terminal_view.get_inputs(title_del, "")),
                terminal_view.get_inputs(title[1:], ""),
                "model/hr/persons.csv")

        if choice == "5":
            terminal_view.print_result(
                str(hr.get_oldest_person(hr.get_data())), "Oldest persons: ")
        if choice == "6":
            terminal_view.print_result(
                str(hr.get_persons_closest_to_average(hr.get_data())),
                "Closest to average age: ")
Ejemplo n.º 28
0
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """
    list_options = [
        "1. Add new record to table",
        "2. Remove a record with a given id from the table",
        "3. Update specified record in the table",
        "4. What is the id of the customer with the longest name?",
        "5. Which customers has subscribed to the newsletter?"
    ]

    program_works = True
    while program_works:
        table = crm.get_table()
        title_list = [
            "ID",
            "NAME",
            "EMAIL",
            "SUBSCRIBED? y/n",
        ]
        terminal_view.print_table(table, title_list)
        answer = terminal_view.get_choice(list_options)

        if answer == "1":
            record = terminal_view.get_inputs(
                ["ID: ", "Name: ", "E-mail: ", "Subscription? Yes/ No"],
                "Please provide information: \n")
            common.add(table, record)
            crm.save_table(table)
        elif answer == "2":
            id_ = terminal_view.get_input("Please enter id number: ")
            common.remove(table, id_)
            crm.save_table(table)
        elif answer == "3":
            common.update(table, id_, record)
        elif answer == "4":
            crm.get_longest_name_id(table)
        elif answer == "5":
            crm.get_subscribed_emails(table)
        elif answer == "0":
            program_works = False
        else:
            terminal_view.print_error_message(
                "There is no such choice. Choose from 1 to 5")
    return
def run():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """


    list_options = ["1. Add new record to table", 
                    "2. Remove a record with a given id from the table", 
                    "3. Update specified record in the table", 
                    "4. How many different kinds of game are available of each manufacturer?", 
                    "5. What is the average amount of games in stock of a given manufacturer?"]

    
    program_works = True

    while program_works:
        table = store.get_table()
        title_list = ["ID", "TITLE", "MANUFACTURER", "PRICE (in $)", "IN STOCK"]
        terminal_view.print_table(table, title_list)
        
        answer = terminal_view.get_choice(list_options)

        if answer == "1":
            record = terminal_view.get_inputs(["ID: ","Title of the game: ","Manufacturer: ","Price in dollars: ","In stock (number): "],"Please provide information: \n")
            common.add(table, record)
            store.save_table(table)
        elif answer == "2":
            id_ = terminal_view.get_input("Please enter id number: ")
            common.remove(table, id_)
            store.save_table(table)
        elif answer == "3":
            id_ = terminal_view.get_input("Please enter id number: ")
            record = terminal_view.get_inputs(["ID: ","Title of the game: ","Manufacturer: ","Price in dollars: ","In stock (number): "],"Please provide information: \n")
            common.update(table, id_, record)
            store.save_table(table)
        elif answer =="4":
            store.get_counts_by_manufacturers(table)
        elif answer == "5":
            store.get_average_by_manufacturer(table, manufacturer)
        elif answer == "0":
            program_works = False
        else:
            terminal_view.print_error_message("There is no such choice. Choose from 1 to 5")
    return 
Ejemplo n.º 30
0
def run():
    options = ["Store manager",
               "Human resources manager",
               "Customer Relationship Management (CRM)"]

    choice = None
    while choice != "0":
        choice = terminal_view.get_choice(options)
        if choice == "1":
            store_controller.run()
        elif choice == "2":
            hr_controller.run()
        elif choice == "3":
            crm_controller.run()
        else:
            terminal_view.print_error_message("There is no such choice.")