Makes the sales report keep a total.

This commit is contained in:
Christopher Neugebauer 2016-08-26 13:40:49 +10:00
parent b7650ca772
commit db8f428ee1

View file

@ -111,10 +111,17 @@ def items_sold(request):
headings = ["description", "quantity", "price", "total"] headings = ["description", "quantity", "price", "total"]
data = [] data = []
total_income = 0
for line in line_items: for line in line_items:
cost = line["total_quantity"] * line["price"]
data.append([ data.append([
line["description"], line["total_quantity"], line["description"], line["total_quantity"],
line["price"], line["total_quantity"] * line["price"], line["price"], cost,
]) ])
total_income += cost
data.append([
"(TOTAL)", "--", "--", total_income,
])
return Report(title, form, headings, data) return Report(title, form, headings, data)