Makes the sales report keep a total.
This commit is contained in:
parent
b7650ca772
commit
db8f428ee1
1 changed files with 8 additions and 1 deletions
|
@ -111,10 +111,17 @@ def items_sold(request):
|
|||
headings = ["description", "quantity", "price", "total"]
|
||||
|
||||
data = []
|
||||
total_income = 0
|
||||
for line in line_items:
|
||||
cost = line["total_quantity"] * line["price"]
|
||||
data.append([
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue