Пример #1
0
def add_new_item():
    """ add new item """
    #global full_inventory
    item_code = input("Enter item code: ")
    item_description = input("Enter item description: ")
    item_rental_price = input("Enter item rental price: ")

    # Get price from the market prices module
    item_price = market_prices.get_latest_price(item_code)

    is_furniture = input("Is this item a piece of furniture? (Y/N): ")
    if is_furniture.lower() == "y":
        item_material = input("Enter item material: ")
        item_size = input("Enter item size (S,M,L,XL): ")
        new_item = furniture.Furniture(item_code, item_description, item_price,
                                       item_rental_price, item_material,
                                       item_size)
    else:
        is_electric_appliance = input(
            "Is this item an electric appliance? (Y/N):")
        if is_electric_appliance.lower() == "y":
            item_brand = input("Enter item brand: ")
            item_voltage = input("Enter item voltage: ")
            new_item = electric_appliances.Electric(item_code,
                                                    item_description,
                                                    item_price,
                                                    item_rental_price,
                                                    item_brand, item_voltage)
        else:
            new_item = inventory.Inventory(item_code, item_description,
                                           item_price, item_rental_price)

    FULL_INVENTORY[item_code] = new_item.return_as_dictionary()
    print("New inventory item added")
    return FULL_INVENTORY
Пример #2
0
def add_furniture(properties, pricing):
    '''
    Add new furniture item

    :param properties: furniture properties
    '''
    inventory_item = furniture.Furniture(
        properties["product_code"], properties["description"],
        pricing.get_latest_price(properties["product_code"]),
        properties["rental_price"], properties["material"], properties["size"])
    FULL_INVENTORY[properties["product_code"]] = inventory_item
Пример #3
0
def add_new_item():
    """
    Adds new item to the inventory
    """
    # global FULL_INVENTORY
    item_code = input("Enter item code: ")
    item_description = input("Enter item description: ")
    item_rental_price = input("Enter item rental price: ")

    # Get price from the market prices module
    item_price = market_prices.get_latest_price(item_code)

    is_furniture = input("Is this item a piece of furniture? (Y/N): ")
    print(f"is_furniture={is_furniture}")
    if is_furniture.lower() == "y":
        item_material = input("Enter item material: ")
        item_size = input("Enter item size (S,M,L,XL): ")
        print(item_size)
        new_item = furniture.Furniture(
            product_code=item_code,
            description=item_description,
            market_price=item_price,
            rental_price=item_rental_price,
            material=item_material,
            size=item_size,
        )
    else:
        is_electric_appliance = input(
            "Is this item an electric appliance? (Y/N): ")
        if is_electric_appliance.lower() == "y":
            item_brand = input("Enter item brand: ")
            item_voltage = input("Enter item voltage: ")
            new_item = electric_appliances.ElectricAppliances(
                product_code=item_code,
                description=item_description,
                market_price=item_price,
                rental_price=item_rental_price,
                brand=item_brand,
                voltage=item_voltage,
            )
        else:
            new_item = inventory.Inventory(
                product_code=item_code,
                description=item_description,
                market_price=item_price,
                rental_price=item_rental_price,
            )
    FULL_INVENTORY[item_code] = new_item.return_as_dictionary()
    print("New inventory item added")