Billing Credits

{% set total_credits_orig = 0 %} {% set total_credits_markup = 0 %} {% set total_credits_profit = 0 %} {% set total_markup = 0 %} {% set total_profit = 0 %} {% for res in billing_credits %} {% set total_credits_orig = total_credits_orig + res['orig_total'] %} {% set total_credits_markup = total_credits_markup + res['markup_total'] %} {% set total_credits_profit = total_credits_profit + (res['markup_total'] - res['orig_total']) %} {% set total_markup = total_markup + res['markup_total'] %} {% set total_profit = total_profit + (res['markup_total'] - res['orig_total']) %} {% endfor %}
Sales Item Orig ex Vat MA ex Vat Profit ex Vat
{{ res['sales_code'] }} R {{ (0 - res['orig_total'])|number_format(2, '.', ' ') }} R {{ (0 - res['markup_total'])|number_format(2, '.', ' ') }} R {{ (0 - (res['markup_total'] - res['orig_total']))|number_format(2, '.', ' ') }}
R {{ (0 - total_credits_orig)|number_format(2, '.', ' ')}} R {{ (0 - total_credits_markup)|number_format(2, '.', ' ') }} R {{ (0 - total_credits_profit)|number_format(2, '.', ' ') }}
{% if total_markup != 0 %}

Gross Profit Margin: {{ (0 - ((total_profit/total_markup)*100))|number_format(2, '.', ' ') }} %

{% else %}

Gross Profit Margin: CALC ERROR

{% endif %}