11 lines
358 B
Django/Jinja
11 lines
358 B
Django/Jinja
# Cost Report
|
|
{% set ns = namespace() %}
|
|
{%- set ns.total = 0 %}
|
|
{%- for ingredient in ingredients %}
|
|
{%- set price = db(ingredient.name ~ '.shopping.price_per_unit') * (ingredient.quantity.value | float) %}
|
|
* {{ ingredient.name }}: {{ price | number_to_currency }}
|
|
{%- set ns.total = ns.total + price %}
|
|
{%- endfor %}
|
|
|
|
Total: ${{ ns.total | format_price }}
|