def show_product(id):
    product = product_repository.select(id)
    difference = product.sale_price - product.cost_price
    return render_template("/products/show.html",
                           product=product,
                           title="Inn-Ventory - Product",
                           difference=difference)
def edit_product(id):
    product = product_repository.select(id)
    suppliers = supplier_repository.select_all()
    return render_template("products/edit.html",
                           product=product,
                           all_suppliers=suppliers,
                           title="Inn-Ventory - Edit Product")
示例#3
0
def view_product_to_edit(id):
    product = product_repository.select(id)
    brands = brand_repository.select_all()
    types = product_type_repository.select_all()
    return render_template("editing/editProduct.html",
                           product=product,
                           brands=brands,
                           types=types)
示例#4
0
def select(id):
    sql = "SELECT * FROM stock WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    if result is not None:
        product = product_repository.select(result["product_id"])
        the_stock = Stock(product, result["count1"], result["basket"],
                          result["id"])

    return the_stock
示例#5
0
def select_all():
    all_stock = []
    sql = "SELECT * FROM stock"
    result = run_sql(sql)
    for row in result:

        product = product_repository.select(row[1])
        a_product_in_stock = Stock(product, row["count1"], row["basket"],
                                   row["id"])
        all_stock.append(a_product_in_stock)

    return all_stock
示例#6
0
def edit_a_product(id):
    old_product = product_repository.select(id)

    the_id = old_product.id

    updated_type = product_type_repository.select(request.form["type_choice"])

    updated_brand = brand_repository.select(request.form["brand_choice"])

    updated_product = Product(
        request.form["newProductName"],
        updated_type,
        updated_brand,
        request.form["newProductDescription"],
        request.form["newProductDistPrice"],
        request.form["newProductSalePrice"],
        request.form["newProductWarrantyLength"],
        the_id,
    )

    product_repository.update(updated_product)

    return redirect("/fullview")
def edit_product(id):
    product = product_repository.select(id)
    manufacturers = manufacturer_repository.select_all()
    return render_template("products/edit.html",
                           product=product,
                           manufacturers=manufacturers)
def show_product(id):
    product = product_repository.select(id)
    return render_template('products/show.html', product=product)
示例#9
0
def edit_product(id):
    product = product_repository.select(id)
    record_labels = record_label_repository.select_all()
    return render_template("/products/edit.html", title = "Edit Product", product=product, record_labels=record_labels)