{% import "macros/money.html.twig" as money %} {#{ dump(order) }#} {% set promotionsTotal = 0 %} {% for item in order.items %} {% set inventory = item.inventory %} {% set variant = inventory.variant %} {% set product = variant.product %} {#{ dump(item) }#} {##} {% if promotionsItemTotal %} {% endif %} {% if item.adjustments|length %} {% endif %} {% endfor %}
# Descrição Qtd Unt Total
{#{ variant.id }#} {# {#{ product.name }#} {{ variant.name }} {% set options = [] %} {#% for o in variant.optionValues %}{% set options = options|merge([o.value|replace({' ':''})]) %}{% endfor %} {% if options|length %}({{ options|join('/') }}){% endif %#}
# {#% if variant.unidade %} {% set quant = (item.quantity/variant.unidade)|number_format(3,',','') %} {% else %#} {% set quant = item.quantity %} {#% endif %#} {{ quant }} {#{ money.format(item.unitPrice, order.currencyCode) }#} {{ money.format(item.unitPrice, 'BRL') }} {% set promotionsItemTotal = 0 %} {#% for unit in item.units %} {% if unit.adjustments|length %} {% set promotionsItemTotal = promotionsItemTotal + unit.adjustmentsTotal %} {% set promotionsTotal = promotionsTotal + promotionsItemTotal %} {% endif %} {% endfor %#} {% if promotionsItemTotal %} {{ money.format(item.quantity*item.unitPrice, 'BRL') }} {% endif %} {% if item.adjustments|length %} {{ money.format(item.total-item.adjustmentsTotal, 'BRL') }} {% elseif not promotionsItemTotal %} {{ money.format(item.total, 'BRL') }} {% endif %}
Promoção {{ money.format(promotionsItemTotal, 'BRL') }} {{ money.format(item.total, 'BRL') }}
Desconto {{ money.format(item.adjustmentsTotal, 'BRL') }} {{ money.format(item.total, 'BRL') }}
{#% set orderPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT') %} {% set orderShippingPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT') %} {% set itemPromotionAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::ORDER_ITEM_PROMOTION_ADJUSTMENT') %} {% set shippingAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::SHIPPING_ADJUSTMENT') %} {% set taxAdjustment = constant('Sylius\\Component\\Core\\Model\\AdjustmentInterface::TAX_ADJUSTMENT') %} {% set orderShippingPromotions = sylius_aggregate_adjustments(order.getAdjustmentsRecursively(orderShippingPromotionAdjustment)) %#} {% if order.itemsTotal > 0 %} {# UMA HORA ENTRA ISSO AQUI MAS PARECE QUE NAO AGORA #} {#% if order.orderPromotionTotal %} {% endif %#} {# COLOCANDO APENAS O DESCONTO TOTAL #} {#% for adjustment in order.adjustments %} {% endfor %#} {% for adjustment in order.adjustments %} {% endfor %} {#% if order.adjustmentstotal %} {% endif %#} {% set totalPago = 0 %} {#{ dump(order.payments) }#} {% for pag in order.payments %} {% if (pag.method and (pag.state=='completed' or pag.state=='cart')) %} {% set totalPago = totalPago + pag.amount %} {% endif %} {% endfor %}
SUBTOTAL: {{ money.format(order.itemsTotal ,'BRL') }}
{% set orderPromotions = sylius_aggregate_adjustments(order.getAdjustmentsRecursively(orderPromotionAdjustment)) %} {% if not orderPromotions is empty %}
{% for label, amount in orderPromotions %} {{ label }} {{ money.format(amount, 'BRL') }} {% endfor %}
{% else %}

{{ 'sylius.ui.no_promotion'|trans }} .

{% endif %}
{{ 'sylius.ui.promotion_total'|trans }} : {{ money.format(order.orderPromotionTotal, 'BRL') }}
DESCONTO {{ money.format(adjustment.amount, 'BRL') }}
{% if adjustment.type == 'shipping' %}FRETE:{% else %}DESCONTO:{% endif %} {{ money.format(adjustment.amount, 'BRL') }}
DESCONTOS: {{ money.format(order.adjustmentstotal, 'BRL') }}
Pagamento em {{ pag.method.name }} {{ money.format(pag.amount, 'BRL') }}
TOTAL: {{ money.format(order.total, 'BRL') }}
{{ ((totalPago-order.total)>0)? 'TROCO:': 'A PAGAR:' }} {% if (totalPago-order.total) == 0 %} PAGO {% else %} {{ money.format((totalPago-order.total)|abs, 'BRL') }} {% endif %}
{% endif %} {# Passando TOTAL para o sistema #} {% set payTotal = 0 %} {% for p in order.payments %} {% set payTotal = payTotal + p.amount %} {% endfor %}
{{ order.total or payTotal ? order.total - payTotal : '-1' }}