{% macro renderResult(result) %} {% import _self as taxMacros %} {{ taxMacros.renderItems(result) }} {{ taxMacros.renderTaxes(result) }} {% endmacro %} {% macro _renderItemsHead() %} {{ 'oro.tax.result.short.includingTax'|trans }} {{ 'oro.tax.result.short.excludingTax'|trans }} {{ 'oro.tax.result.short.taxAmount'|trans }} {% endmacro %} {% macro renderItems(result) %} {% import _self as taxMacros %} {% if result is defined and result|length %} {{ taxMacros._renderItemsHead() }} {% for type, data in result %} {% if data.includingTax is defined %} {% endif %} {% endfor %}
{{ 'oro.tax.result.%s'|format(type)|trans }} {{ data.includingTax|oro_format_currency({currency: data.currency}) }} {{ data.excludingTax|oro_format_currency({currency: data.currency}) }} {{ data.taxAmount|oro_format_currency({currency: data.currency}) }}
{% endif %} {% endmacro %} {% macro _renderTaxesHead() %} {{ 'oro.tax.result.tax'|trans }} {{ 'oro.tax.result.rate'|trans }} {{ 'oro.tax.result.taxableAmount'|trans }} {{ 'oro.tax.result.taxAmount'|trans }} {% endmacro %} {% macro renderTaxes(result) %} {% import _self as taxMacros %} {% if result.taxes is defined and result.taxes|length %} {% set FRACTION_DIGITS = constant('\\NumberFormatter::FRACTION_DIGITS') %} {% set MIN_FRACTION_DIGITS = constant('\\NumberFormatter::MIN_FRACTION_DIGITS') %} {% set MAX_FRACTION_DIGITS = constant('\\NumberFormatter::MAX_FRACTION_DIGITS') %} {% set CALCULATION_SCALE_AS_PERCENT = constant('Oro\\Bundle\\TaxBundle\\Provider\\TaxationSettingsProvider::CALCULATION_SCALE_AS_PERCENT') %} {{ taxMacros._renderTaxesHead() }} {% for tax in result.taxes %} {% endfor %}
{{ tax.tax }} {{ tax.rate|oro_format_percent({ attributes: { FRACTION_DIGITS: CALCULATION_SCALE_AS_PERCENT, MIN_FRACTION_DIGITS: 0, MAX_FRACTION_DIGITS: CALCULATION_SCALE_AS_PERCENT } }) }} {{ tax.taxableAmount|oro_format_currency({currency: tax.currency}) }} {{ tax.taxAmount|oro_format_currency({currency: tax.currency}) }}
{% endif %} {% endmacro %} {% macro renderJsItems() %} {% import _self as taxMacros %} <% var translations = {{ { unit: 'oro.tax.result.unit'|trans, row: 'oro.tax.result.row'|trans, total: 'oro.tax.result.total'|trans, shipping: 'oro.tax.result.shipping'|trans }|json_encode|raw }}; %> <% var unit = unit; %> <% var row = row; %> <% var total = total; %> <% var shipping = shipping; %> <% var object = {unit: unit, row: row, shipping: shipping, total: total}; %> <% var data = _.pick(object, _.identity); %> <% if (data) { %> {{ taxMacros._renderItemsHead() }} <% _.each(data, function(item, key) { %> <% }); %>
<%= translations[key] %> <%= item.includingTax %> <%= item.excludingTax %> <%= item.taxAmount %>
<% } %> {% endmacro %} {% macro renderJsTaxes() %} {% import _self as taxMacros %} <% var taxes = taxes; %> <% if (!_.isEmpty(taxes)) { %> {{ taxMacros._renderTaxesHead() }} <% _.each(taxes, function(tax) { %> <% }); %>
<%= tax.tax %> <%= tax.rate %> <%= tax.taxableAmount %> <%= tax.taxAmount %>
<% } %> {% endmacro %}