Files
recipes/reports/cost.md.jinja
2025-11-11 02:44:31 +00:00

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 }}