{% block content %}
{#
#} {#

DOCUMENTO CONTROLADO

#} {#
#} {% set zonesKeys = [] %} {% set zonesWithPendingCountries = [] %} {% set weightsKeys = [] %} {% for w in weights %} {% if (w <= 10) or (((w % 2) == 0) and w <= 20 and ((w|round()) == w )) or (((w % 5) == 0) and (w > 20 and w <= 50) and ((w|round()) == w )) or (((w % 10) == 0) and ((w|round()) == w )) %} {% set weightsKeys = weightsKeys|merge([w]) %} {% endif %} {% endfor %} {% set totalColumns = weightsKeys|length %} {% if totalColumns <= 36 %} {% set fontSizeTable = '0.68rem' %} {% set fontSizeCountry = '0.6rem' %} {% set pageBreak= 50 %} {% elseif totalColumns > 36 and totalColumns <= 50 %} {% set fontSizeTable = '0.55rem' %} {% set fontSizeCountry = '0.4rem' %} {% set pageBreak= 59 %} {% elseif totalColumns > 50 and totalColumns <= 100 %} {% set fontSizeTable = '0.4rem' %} {% set fontSizeCountry = '0.35rem' %} {% set pageBreak= 62 %} {% else %} {% set fontSizeTable = '0.2rem' %} {% set fontSizeCountry = '0.05rem' %} {% set pageBreak= 100 %} {% endif %} {% set pendingCountries = [] %} {% set colors = [] %} {% set defaultColors = {1:'#5a3820', 2:'#30317f', 3:'#fb510d'} %} {% set fuelSurcharges = [] %} {% set codes = [] %} {% for cs in courierServices %} {#{% set colors = colors|merge({ ('id-' ~ cs.id): cs.color }) %}#} {% set colors = colors|merge({ ('id-' ~ cs.id):defaultColors[loop.index] }) %} {% set fuelSurcharges = fuelSurcharges|merge({ ('id-' ~ cs.id): cs.fuel_surcharge }) %} {% set codes = codes|merge({ ('id-' ~ cs.id): cs.code }) %} {% endfor %} {#{{ dump(colors) }}#}
{% for w in weightsKeys %} {% endfor %} {#{{ dump(zonesKeys) }}#} {#{% set colors = {'4': '#5a3820', '14':'#30317f', '8': '#fb510d'} %}#} {% set totalCurrentZones= weightsKeys|length - 1 %} {% set countRegisters = 0 %} {% set pages = 0 %} {% for country in ratesByCountry %} {#{% for country in ratesByCountry %}#} {#{% if loop.index == 150 %}#} {##} {##} {##} {#{% else %}#} {% set countRegisters = countRegisters + 1 %} {% if countRegisters == pageBreak %} {% set countRegisters = 0 %} {% set pageBreak = pageBreak - 1 %} {##} {##} {##} {% for w in weightsKeys %} {% endfor %} {% set pages = pages + 1 %} {% endif %} {##} {% set weightsByCountry = country.result |json_decode(true) %} {#{{ dump(country.result) }}#} {% set currentValue = 0 %} {% for i in 0..totalCurrentZones %} {#{{ dump(weightsKeys, weightsByCountry ) }}#} {% if weightsKeys[i] is defined and weightsByCountry[weightsKeys[i]] is defined %} {% set data = weightsByCountry[weightsKeys[i]] |split('-') %} {% set courierServiceId = data[0] %} {% set currentValue = data[1] %} {% set fuelSurcharge = fuelSurcharges['id-' ~ courierServiceId] %} {% set code = codes['id-' ~ courierServiceId] %} {% set suse = 0 %} {% if code == 'TNT' %} {% set suse = 0.02 * weightsKeys[i] %} {% if suse < 0.50 %} {% set suse = 0.50 %} {% elseif suse > 10 %} {% set suse = 10 %} {% endif %} {% set currentValue = currentValue + suse %} {% endif %} {% if fuelSurcharge is not null and fuelSurcharge > 0 %} {% set currentValue = (currentValue * (1+(fuelSurcharge/100)))|round(2) %} {% endif %} {% if margin > 0 %} {% set currentValue = (currentValue/(1-(margin/100)))|round(2) %} {% endif %} {##} {% else %} {% endif %} {% endfor %} {#{% for weight, value in weightsByCountry %}#} {#{% set data = value|split('-') %}#} {#{{ dump(data) }}#} {#{% set courierServiceId = data[0] %}#} {#{% set currentValue = data[1] %}#} {##} {#{% if courierCode == 'TNT' %}#} {#{% set suse = 0.02 * rate.name %}#} {#{% if suse < 0.50 %}#} {#{% set suse = 0.50 %}#} {#{% elseif suse > 10 %}#} {#{% set suse = 10 %}#} {#{% endif %}#} {#{% set currentValue = currentValue + suse %}#} {#{% endif %}#} {##} {#{% if fuelSurcharge > 0 and fuelSurcharge is not null %}#} {#{% set currentValue = (currentValue * (1+(fuelSurcharge/100)))|round(2) %}#} {#{% endif %}#} {##} {#{% if margin > 0 %}#} {#{% set currentValue = (currentValue/(1-(margin/100)))|round(2) %}#} {#{% endif %}#} {#{% if weight in weightsKeys %}#} {##} {##} {#{% else %}#} {##} {#{% endif %}#} {#{% endfor %}#} {#{% endif %}#} {% endfor %} {#{{ dump(zonesKeys) }}#} {#{% set colors = {'4': '#5a3820', '14':'#30317f', '8': '#fb510d'} %}#} {#{% set countRegisters = 0 %}#} {#{% for country in ratesByCountry %}#} {#{% set countRegisters = countRegisters + 1 %}#} {#{% if countRegisters == pageBreak - 1 %}#} {#{% set countRegisters = 0 %}#} {##} {##} {##} {##} {##} {##} {##} {#{% for w in weightsKeys %}#} {##} {#{% endfor %}#} {##} {#{% endif %}#} {#{% else %}#} {##} {##} {##} {#{% set weightsByCountry = country.result |json_decode(true) %}#} {#{{ dump(country.result) }}#} {#{% set currentValue = 0 %}#} {#{% for weight, value in weightsByCountry %}#} {#{% set break = false %}#} {#{% for weightKey in weightsKeys if not break %}#} {#{% if weight == weightKey %}#} {#{% set currentValue = value %}#} {#{% set data = value|split('-') %}#} {#{{ dump(data) }}#} {#{% set courierServiceId = data[0] %}#} {#{% set currentValue = data[1] %}#} {#{% set suse = 0 %}#} {##} {#{% set breakCourier = false %}#} {#{% for cs in courierServices if not breakCourier %}#} {#{% if cs.id == courierServiceId %}#} {#{% set breakCourier = true %}#} {#{% if cs.code == 'TNT' %}#} {#{% set suse = 0.02 * weight %}#} {#{% if suse < 0.50 %}#} {#{% set suse = 0.50 %}#} {#{% elseif suse > 10 %}#} {#{% set suse = 10 %}#} {#{% endif %}#} {#{% set currentValue = currentValue + suse %}#} {#{% endif %}#} {##} {#{% if cs.fuel_surcharge > 0 and cs.fuel_surcharge is not null %}#} {#{% set currentValue = (currentValue * (1+(cs.fuel_surcharge/100)))|round(1) %}#} {#{% endif %}#} {#{% endif %}#} {#{% endfor %}#} {##} {#{% if margin > 0 %}#} {#{% set currentValue = (currentValue/(1-(margin/100)))|round(1) %}#} {#{% endif %}#} {##} {##} {#{% set break = true %}#} {#{% endif %}#} {#{% endfor %}#} {#{% if weight in weightsKeys %}#} {##} {##} {#{% else %}#} {##} {#{% endif %}#} {#{% endfor %}#} {##} {#{% endif %}#} {#{% endfor %}#} {##} {##} {##} {##} {#{{ dump(zonesWithPendingCountries) }}#} {##} {#{% for zone, countries in zonesWithPendingCountries %}#} {##} {##} {##} {##} {#{% endfor %}#}
País {{ w }}
#} {#
#} {#
País {{ w }}
{{ country.name }}{{ country.name |length > 11 ? country.name |slice(0, 11) ~ '.' : country.name }}{{ currentValue }}{{ currentValue }} -{{ currentValue }}{{ currentValue }} -
#} {#
#} {#
País#} {#{{ w }}#} {#
{{ country.name }}{{ country.name |length > 11 ? country.name |slice(0, 11) ~ '.' : country.name }}{{ currentValue }}{{ currentValue }}{{ currentValue }}{{ currentValue }} -
#} {#Zonas#} {##} {#Otros países*#} {#
#} {#{{ zone }}#} {##} {#{{ countries[0]|join(',') }}#} {#{{ dump(countries) }}#} {#
{% endblock %}