2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-04-27 13:16:43 +00:00

Report pricing data (#451)

* Add documentation for currency rendering

* Fix typo
This commit is contained in:
Oliver 2023-03-08 22:27:37 +11:00 committed by GitHub
parent af26664164
commit 5c6981d016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,29 @@ Some common functions are provided for use in custom report and label templates.
{% endraw %} {% endraw %}
``` ```
!!! tip "Use the Source, Luke"
To see the full range of available helper functions, refer to the source file [report.py](https://github.com/inventree/InvenTree/blob/master/InvenTree/report/templatetags/report.py) where these functions are defined!
## Rendering Currency
The helper function `render_currency` allows for simple rendering of currency data. This function can also convert the specified amount of currency into a different target currency:
```html
{% raw %}
{% load report %}
<em>Line Item Unit Pricing:</em>
<ul>
{% for line in order.lines %}
<li>{% render_currency line.price currency=order.supplier.currency %}</li>
{% endfor %}
</ul>
Total Price: {% render_currency order.total_price currency='NZD' decimal_places=2 %}
{% endraw %}
```
## Maths Operations ## Maths Operations
Simple mathematical operators are available, as demonstrated in the example template below: Simple mathematical operators are available, as demonstrated in the example template below: