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
    """

    table_headers = ['ID', 'Title', 'Price', 'Month', 'Day', 'Year']
    choice = None
    filename = 'model/sales/sales.csv'
    columns_headers = ['Title', 'Price', 'Month', 'Day', 'Year']
    ask_information = "Please provide your personal information"

    common.print_art(0)
    while choice != "0":
        choice = terminal_view.get_submenu_choice([
            'Add', 'Remove', 'Update', 'Check lowest price item',
            'Check items sold between dates'
        ])
        table = common.get_table_from_file(filename)

        if choice[0] == "1":
            common.clear_terminal()
            common.adding(table, table_headers, filename, columns_headers,
                          ask_information)
        elif choice[0] == "2":
            common.clear_terminal()
            common.removing(table, table_headers, id, filename)
        elif choice == "3":
            common.clear_terminal()
            common.updating(table, table_headers, id, filename,
                            columns_headers, ask_information)
        elif choice == "4":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            sales_id = sales.get_lowest_price_item_id(table)
            terminal_view.print_result("The lowest price item id is", sales_id)
        elif choice == "5":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            date_list = terminal_view.get_inputs([
                'month_from', 'day_from', 'year_from', 'month_to', 'day_to',
                'year_to'
            ], "Please provide dates information: ")
            sold_list = sales.get_items_sold_between(table, int(date_list[0]),
                                                     int(date_list[1]),
                                                     int(date_list[2]),
                                                     int(date_list[3]),
                                                     int(date_list[4]),
                                                     int(date_list[5]))
            terminal_view.print_result(
                "The items sold between given dates are:", sold_list)
        elif int(choice) >= 6:
            common.clear_terminal()
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 2
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
    """

    table_headers = [
        'ID', 'Name', 'Manufacturer', 'Purchase Year', 'Durability'
    ]
    choice = None
    filename = 'model/inventory/inventory.csv'
    columns_headers = ['Name', 'Manufacturer', 'Purchase Year', 'Durability']
    ask_information = "Please provide your personal information"
    common.print_art(0)
    while choice != "0":
        choice = terminal_view.get_submenu_choice([
            'Add', 'Remove', 'Update',
            "Items that have not exceeded their durability yet",
            "Average durability by manufactirers"
        ])
        table = common.get_table_from_file(filename)

        if choice[0] == "1":
            common.clear_terminal()
            common.adding(table, table_headers, filename, columns_headers,
                          ask_information)
        elif choice[0] == "2":
            common.clear_terminal()
            common.removing(table, table_headers, id, filename)
        elif choice == "3":
            common.clear_terminal()
            common.updating(table, table_headers, id, filename,
                            columns_headers, ask_information)
        elif choice == "4":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            availible_items = inventory.get_available_items(table)
            terminal_view.print_result(
                "Items that have not exceeded their durability yet",
                availible_items)
        elif choice == "5":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            average_durability = inventory.get_average_durability_by_manufacturers(
                table)
            terminal_view.print_result("Average durability by manufactirers:",
                                       average_durability)
        elif int(choice) >= 6:
            common.clear_terminal()
            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
    """

    table_headers = ['ID', 'Name', 'Birth Year']
    choice = None
    filename = 'model/hr/persons.csv'
    columns_headers = ['Name', 'Birth Year']
    ask_information = "Please provide your personal information"

    common.print_art(0)
    while choice != "0":
        choice = terminal_view.get_submenu_choice([
            'Add', 'Remove', 'Update', 'Get oldest person',
            'People closest to average age'
        ])
        table = common.get_table_from_file(filename)

        if choice[0] == "1":
            common.clear_terminal()
            common.adding(table, table_headers, filename, columns_headers,
                          ask_information)
        elif choice[0] == "2":
            common.clear_terminal()
            common.removing(table, table_headers, id, filename)
        elif choice == "3":
            common.clear_terminal()
            common.updating(table, table_headers, id, filename,
                            columns_headers, ask_information)
        elif choice == "4":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            hr_result = hr.get_oldest_person(table)
            terminal_view.print_result("\nThe oldest people are/ person is",
                                       hr_result)
        elif choice == "5":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            closest_to_average_people = hr.get_persons_closest_to_average(
                table)
            terminal_view.print_result("People closest to average age: ",
                                       closest_to_average_people)

        elif int(choice) >= 6:
            common.clear_terminal()
            terminal_view.print_error_message("There is no such choice.")
Ejemplo n.º 4
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
    """

    table_headers = ['ID', 'Title', 'Manufacturer', 'Price', 'In Stock']
    choice = None
    filename = 'model/store/games.csv'
    columns_headers = ['Title', 'Manufacturer', 'Price', 'In Stock']
    ask_information = "Please provide your personal information"

    common.print_art(0)
    while choice != "0":
        choice = terminal_view.get_submenu_choice(['Add', 'Remove', 'Update',\
            'How many different kinds of game are available of each manufacturer?',\
                'What is the average amount of games in stock of a given manufacturer?'])
        table = common.get_table_from_file(filename)

        if choice[0] == "1":
            common.clear_terminal()
            common.adding(table, table_headers, filename, columns_headers,
                          ask_information)
        elif choice[0] == "2":
            common.clear_terminal()
            common.removing(table, table_headers, id, filename)
        elif choice == "3":
            common.clear_terminal()
            common.updating(table, table_headers, id, filename,
                            columns_headers, ask_information)
        elif choice == "4":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            games_count = store.get_counts_by_manufacturers(table)
            terminal_view.print_result('Manufacturer', games_count)
        elif choice == "5":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            manufacturer = terminal_view.get_inputs(['Manufacturer'],
                                                    'Which manufacturer?')
            games_average = store.get_average_by_manufacturer(
                table, manufacturer[0])
            terminal_view.print_result('Avarage amount in stock: ',
                                       games_average)
        elif int(choice) >= 6:
            common.clear_terminal()
            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
    """

    table_headers = ['ID', 'Month', 'Day', 'Year', 'Type', 'Amount']
    choice = None
    filename = 'model/accounting/items.csv'
    columns_headers = ['Month', 'Day', 'Year', 'Type', 'Amount']
    ask_information = "Please provide your personal information"

    common.print_art(0)
    while choice != "0":
        choice = terminal_view.get_submenu_choice(['Add', 'Remove', 'Update', 'Which year has the highest profit?',\
            'What is the average (per item) profit in a given year?'])
        table = common.get_table_from_file(filename)

        if choice[0] == "1":
            common.clear_terminal()
            common.adding(table, table_headers, filename, columns_headers,
                          ask_information)
        elif choice[0] == "2":
            common.clear_terminal()
            common.removing(table, table_headers, id, filename)
        elif choice == "3":
            common.clear_terminal()
            common.updating(table, table_headers, id, filename,
                            columns_headers, ask_information)
        elif choice == "4":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            accounting_result = accounting.which_year_max(table)
            terminal_view.print_result("The year with the highest profit is: ",
                                       accounting_result)
        elif choice == "5":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            year = terminal_view.get_inputs(['Year'], 'Which year?')
            result = accounting.avg_amount(table, int(year[0]))
            terminal_view.print_result(
                'The average profit (per item) in a given year is/are: ',
                result)
        elif int(choice) >= 6:
            common.clear_terminal()
            terminal_view.print_error_message("There is no such choice.")
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
    """

    table_headers = ['ID','Name', 'Email', 'Subscribed']
    choice = None
    filename = 'model/crm/customers.csv'
    columns_headers = ['Name', 'Email', 'Subscribed']
    ask_information = "Please provide your personal information"
   
    common.print_art(0)
    while choice != "0":
        choice = terminal_view.get_submenu_choice(['Add', 'Remove', 'Update',\
            'Longest customer name - id',\
                'Newsletter subscribers'])
        table = common.get_table_from_file(filename)
        
        if choice[0] == "1":
            common.clear_terminal()
            common.adding(table, table_headers, filename, columns_headers, ask_information)
        elif choice[0] == "2":
            common.clear_terminal()
            common.removing(table, table_headers,  id, filename)
        elif choice == "3":
            common.clear_terminal()
            common.updating(table, table_headers, id, filename, columns_headers, ask_information)
        elif choice == "4":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            longest_name = crm.get_longest_name_id(table)
            terminal_view.print_result('Id of customer with the longest name: ', longest_name)
        elif choice == "5":
            common.clear_terminal()
            terminal_view.print_table(table, table_headers)
            subscribers = crm.get_subscribed_emails(table)
            terminal_view.print_result('Subscribers: ', subscribers)
        elif int(choice) >= 6:
            common.clear_terminal()
            terminal_view.print_error_message("There is no such choice.")