<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* despatch2022.xml.twig */
class __TwigTemplate_35ee6407d62764565c33457055be720e extends Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        ob_start(function () { return ''; });
        // line 2
        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<DespatchAdvice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\" xmlns:ext=\"urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2\">
    <ext:UBLExtensions>
        <ext:UBLExtension>
            <ext:ExtensionContent/>
        </ext:UBLExtension>
    </ext:UBLExtensions>
    <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    <cbc:CustomizationID>2.0</cbc:CustomizationID>
    <cbc:ID>";
        // line 11
        echo twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "serie", [], "any", false, false, false, 11);
        echo "-";
        echo twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "correlativo", [], "any", false, false, false, 11);
        echo "</cbc:ID>
    <cbc:IssueDate>";
        // line 12
        echo twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "fechaEmision", [], "any", false, false, false, 12), "Y-m-d");
        echo "</cbc:IssueDate>
    <cbc:IssueTime>";
        // line 13
        echo twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "fechaEmision", [], "any", false, false, false, 13), "H:i:s");
        echo "</cbc:IssueTime>
    <cbc:DespatchAdviceTypeCode listAgencyName=\"PE:SUNAT\" listName=\"Tipo de Documento\" listURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01\">";
        // line 14
        echo twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "tipoDoc", [], "any", false, false, false, 14);
        echo "</cbc:DespatchAdviceTypeCode>

    ";
        // line 16
        if (((twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "serie", [], "any", false, false, false, 16) == "T001") || (twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "serie", [], "any", false, false, false, 16) == "TM01"))) {
            // line 17
            echo "
    ";
            // line 18
            if (twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "observacion", [], "any", false, false, false, 18)) {
                // line 19
                echo "        <cbc:Note><![CDATA[";
                echo twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "observacion", [], "any", false, false, false, 19);
                echo "]]></cbc:Note>
    ";
            }
            // line 21
            echo "    ";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "addDocs", [], "any", false, false, false, 21));
            foreach ($context['_seq'] as $context["_key"] => $context["rel"]) {
                // line 22
                echo "        <cac:AdditionalDocumentReference>
            <cbc:ID>";
                // line 23
                echo twig_get_attribute($this->env, $this->source, $context["rel"], "nro", [], "any", false, false, false, 23);
                echo "</cbc:ID>
            <cbc:DocumentTypeCode listAgencyName=\"PE:SUNAT\" listName=\"Documento relacionado al transporte\" listURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo61\">";
                // line 24
                echo twig_get_attribute($this->env, $this->source, $context["rel"], "tipo", [], "any", false, false, false, 24);
                echo "</cbc:DocumentTypeCode>
            <cbc:DocumentType>";
                // line 25
                echo twig_get_attribute($this->env, $this->source, $context["rel"], "tipoDesc", [], "any", false, false, false, 25);
                echo "</cbc:DocumentType>
            ";
                // line 26
                if (twig_get_attribute($this->env, $this->source, $context["rel"], "emisor", [], "any", false, false, false, 26)) {
                    // line 27
                    echo "                <cac:IssuerParty>
                    <cac:PartyIdentification>
                        <cbc:ID schemeID=\"6\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
                    // line 29
                    echo twig_get_attribute($this->env, $this->source, $context["rel"], "emisor", [], "any", false, false, false, 29);
                    echo "</cbc:ID>
                    </cac:PartyIdentification>
                </cac:IssuerParty>
            ";
                }
                // line 33
                echo "        </cac:AdditionalDocumentReference>
    ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['rel'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 35
            echo "    ";
            $context["emp"] = twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 35);
            // line 36
            echo "    <cac:Signature>
        <cbc:ID>";
            // line 37
            echo twig_get_attribute($this->env, $this->source, ($context["emp"] ?? null), "ruc", [], "any", false, false, false, 37);
            echo "</cbc:ID>
        <cac:SignatoryParty>
            <cac:PartyIdentification>
                <cbc:ID>";
            // line 40
            echo twig_get_attribute($this->env, $this->source, ($context["emp"] ?? null), "ruc", [], "any", false, false, false, 40);
            echo "</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name><![CDATA[";
            // line 43
            echo twig_get_attribute($this->env, $this->source, ($context["emp"] ?? null), "razonSocial", [], "any", false, false, false, 43);
            echo "]]></cbc:Name>
            </cac:PartyName>
        </cac:SignatoryParty>
        <cac:DigitalSignatureAttachment>
            <cac:ExternalReference>
                <cbc:URI>#GREENTER-SIGN</cbc:URI>
            </cac:ExternalReference>
        </cac:DigitalSignatureAttachment>
    </cac:Signature>
    <cac:DespatchSupplierParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID=\"6\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
            // line 55
            echo twig_get_attribute($this->env, $this->source, ($context["emp"] ?? null), "ruc", [], "any", false, false, false, 55);
            echo "</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName><![CDATA[";
            // line 58
            echo twig_get_attribute($this->env, $this->source, ($context["emp"] ?? null), "razonSocial", [], "any", false, false, false, 58);
            echo "]]></cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:DespatchSupplierParty>
    <cac:DeliveryCustomerParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID=\"";
            // line 65
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "destinatario", [], "any", false, false, false, 65), "tipoDoc", [], "any", false, false, false, 65);
            echo "\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "destinatario", [], "any", false, false, false, 65), "numDoc", [], "any", false, false, false, 65);
            echo "</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName><![CDATA[";
            // line 68
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "destinatario", [], "any", false, false, false, 68), "rznSocial", [], "any", false, false, false, 68);
            echo "]]></cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:DeliveryCustomerParty>
    ";
            // line 72
            if (twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "comprador", [], "any", false, false, false, 72)) {
                // line 73
                echo "        <cac:BuyerCustomerParty>
            <cac:Party>
                <cac:PartyIdentification>
                    <cbc:ID schemeID=\"";
                // line 76
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "comprador", [], "any", false, false, false, 76), "tipoDoc", [], "any", false, false, false, 76);
                echo "\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "comprador", [], "any", false, false, false, 76), "numDoc", [], "any", false, false, false, 76);
                echo "</cbc:ID>
                </cac:PartyIdentification>
                <cac:PartyLegalEntity>
                    <cbc:RegistrationName><![CDATA[";
                // line 79
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "comprador", [], "any", false, false, false, 79), "rznSocial", [], "any", false, false, false, 79);
                echo "]]></cbc:RegistrationName>
                </cac:PartyLegalEntity>
            </cac:Party>
        </cac:BuyerCustomerParty>
    ";
            }
            // line 84
            echo "    ";
            if (twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "tercero", [], "any", false, false, false, 84)) {
                // line 85
                echo "        <cac:SellerSupplierParty>
            <cac:Party>
                <cac:PartyIdentification>
                    <cbc:ID schemeID=\"";
                // line 88
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "tercero", [], "any", false, false, false, 88), "tipoDoc", [], "any", false, false, false, 88);
                echo "\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "tercero", [], "any", false, false, false, 88), "numDoc", [], "any", false, false, false, 88);
                echo "</cbc:ID>
                </cac:PartyIdentification>
                <cac:PartyLegalEntity>
                    <cbc:RegistrationName><![CDATA[";
                // line 91
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "tercero", [], "any", false, false, false, 91), "rznSocial", [], "any", false, false, false, 91);
                echo "]]></cbc:RegistrationName>
                </cac:PartyLegalEntity>
            </cac:Party>
        </cac:SellerSupplierParty>
    ";
            }
            // line 96
            echo "    ";
            $context["envio"] = twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 96);
            // line 97
            echo "    <cac:Shipment>
        <cbc:ID>SUNAT_Envio</cbc:ID>
        <cbc:HandlingCode listAgencyName=\"PE:SUNAT\" listName=\"Motivo de traslado\" listURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo20\">";
            // line 99
            echo twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "codTraslado", [], "any", false, false, false, 99);
            echo "</cbc:HandlingCode>
        ";
            // line 100
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "desTraslado", [], "any", false, false, false, 100)) {
                // line 101
                echo "            <cbc:HandlingInstructions>";
                echo twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "desTraslado", [], "any", false, false, false, 101);
                echo "</cbc:HandlingInstructions>
        ";
            }
            // line 103
            echo "        ";
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "sustentoPeso", [], "any", false, false, false, 103)) {
                // line 104
                echo "            <cbc:Information>";
                echo twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "sustentoPeso", [], "any", false, false, false, 104);
                echo "</cbc:Information>
        ";
            }
            // line 106
            echo "        <cbc:GrossWeightMeasure unitCode=\"";
            echo twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "undPesoTotal", [], "any", false, false, false, 106);
            echo "\">";
            echo $this->env->getFilter('n_format')->getCallable()(twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "pesoTotal", [], "any", false, false, false, 106), 3);
            echo "</cbc:GrossWeightMeasure>
        ";
            // line 107
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "pesoItems", [], "any", false, false, false, 107)) {
                // line 108
                echo "            <cbc:NetWeightMeasure unitCode=\"KGM\">";
                echo $this->env->getFilter('n_format')->getCallable()(twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "pesoItems", [], "any", false, false, false, 108), 3);
                echo "</cbc:NetWeightMeasure>
        ";
            }
            // line 110
            echo "        ";
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "numBultos", [], "any", false, false, false, 110)) {
                // line 111
                echo "            <cbc:TotalTransportHandlingUnitQuantity>";
                echo twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "numBultos", [], "any", false, false, false, 111);
                echo "</cbc:TotalTransportHandlingUnitQuantity>
        ";
            }
            // line 113
            echo "        ";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "indicadores", [], "any", false, false, false, 113));
            foreach ($context['_seq'] as $context["_key"] => $context["indicador"]) {
                // line 114
                echo "            <cbc:SpecialInstructions>";
                echo $context["indicador"];
                echo "</cbc:SpecialInstructions>
        ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['indicador'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 116
            echo "        <cac:ShipmentStage>
            <cbc:TransportModeCode listName=\"Modalidad de traslado\" listAgencyName=\"PE:SUNAT\" listURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo18\">";
            // line 117
            echo twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "modTraslado", [], "any", false, false, false, 117);
            echo "</cbc:TransportModeCode>
            ";
            // line 118
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "fecTraslado", [], "any", false, false, false, 118)) {
                // line 119
                echo "                <cac:TransitPeriod>
                    <cbc:StartDate>";
                // line 120
                echo twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "fecTraslado", [], "any", false, false, false, 120), "Y-m-d");
                echo "</cbc:StartDate>
                </cac:TransitPeriod>
            ";
            }
            // line 123
            echo "            ";
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "transportista", [], "any", false, false, false, 123)) {
                // line 124
                echo "                <cac:CarrierParty>
                    <cac:PartyIdentification>
                        <cbc:ID schemeID=\"";
                // line 126
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "transportista", [], "any", false, false, false, 126), "tipoDoc", [], "any", false, false, false, 126);
                echo "\">";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "transportista", [], "any", false, false, false, 126), "numDoc", [], "any", false, false, false, 126);
                echo "</cbc:ID>
                    </cac:PartyIdentification>
                    <cac:PartyLegalEntity>
                        <cbc:RegistrationName><![CDATA[";
                // line 129
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "transportista", [], "any", false, false, false, 129), "rznSocial", [], "any", false, false, false, 129);
                echo "]]></cbc:RegistrationName>
                        <cbc:CompanyID>";
                // line 130
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "transportista", [], "any", false, false, false, 130), "nroMtc", [], "any", false, false, false, 130);
                echo "</cbc:CompanyID>
                    </cac:PartyLegalEntity>
                </cac:CarrierParty>
            ";
            }
            // line 134
            echo "            ";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "choferes", [], "any", false, false, false, 134));
            foreach ($context['_seq'] as $context["_key"] => $context["chofer"]) {
                // line 135
                echo "                <cac:DriverPerson>
                    <cbc:ID schemeID=\"";
                // line 136
                echo twig_get_attribute($this->env, $this->source, $context["chofer"], "tipoDoc", [], "any", false, false, false, 136);
                echo "\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
                echo twig_get_attribute($this->env, $this->source, $context["chofer"], "nroDoc", [], "any", false, false, false, 136);
                echo "</cbc:ID>
                    <cbc:FirstName>";
                // line 137
                echo twig_get_attribute($this->env, $this->source, $context["chofer"], "nombres", [], "any", false, false, false, 137);
                echo "</cbc:FirstName>
                    <cbc:FamilyName>";
                // line 138
                echo twig_get_attribute($this->env, $this->source, $context["chofer"], "apellidos", [], "any", false, false, false, 138);
                echo "</cbc:FamilyName>
                    <cbc:JobTitle>";
                // line 139
                echo twig_get_attribute($this->env, $this->source, $context["chofer"], "tipo", [], "any", false, false, false, 139);
                echo "</cbc:JobTitle>
                    <cac:IdentityDocumentReference>
                        <cbc:ID>";
                // line 141
                echo twig_get_attribute($this->env, $this->source, $context["chofer"], "licencia", [], "any", false, false, false, 141);
                echo "</cbc:ID>
                    </cac:IdentityDocumentReference>
                </cac:DriverPerson>
            ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['chofer'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 145
            echo "        </cac:ShipmentStage>
        <cac:Delivery>
            <cac:DeliveryAddress>
                <cbc:ID schemeAgencyName=\"PE:INEI\" schemeName=\"Ubigeos\">";
            // line 148
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 148), "ubigueo", [], "any", false, false, false, 148);
            echo "</cbc:ID>
                ";
            // line 149
            if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 149), "codLocal", [], "any", false, false, false, 149)) {
                // line 150
                echo "                    <cbc:AddressTypeCode listID=\"";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 150), "ruc", [], "any", false, false, false, 150);
                echo "\">";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 150), "codLocal", [], "any", false, false, false, 150);
                echo "</cbc:AddressTypeCode>
                ";
            }
            // line 152
            echo "                <cac:AddressLine>
                    <cbc:Line>";
            // line 153
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 153), "direccion", [], "any", false, false, false, 153);
            echo "</cbc:Line>
                </cac:AddressLine>
            </cac:DeliveryAddress>
            <cac:Despatch>
                <cac:DespatchAddress>
                    <cbc:ID schemeAgencyName=\"PE:INEI\" schemeName=\"Ubigeos\">";
            // line 158
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 158), "ubigueo", [], "any", false, false, false, 158);
            echo "</cbc:ID>
                    ";
            // line 159
            if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 159), "codLocal", [], "any", false, false, false, 159)) {
                // line 160
                echo "                        <cbc:AddressTypeCode listID=\"";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 160), "ruc", [], "any", false, false, false, 160);
                echo "\">";
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 160), "codLocal", [], "any", false, false, false, 160);
                echo "</cbc:AddressTypeCode>
                    ";
            }
            // line 162
            echo "                    <cac:AddressLine>
                        <cbc:Line>";
            // line 163
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 163), "direccion", [], "any", false, false, false, 163);
            echo "</cbc:Line>
                    </cac:AddressLine>
                </cac:DespatchAddress>

            </cac:Despatch>
        </cac:Delivery>
        ";
            // line 169
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "contenedores", [], "any", false, false, false, 169));
            $context['loop'] = [
              'parent' => $context['_parent'],
              'index0' => 0,
              'index'  => 1,
              'first'  => true,
            ];
            if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
                $length = count($context['_seq']);
                $context['loop']['revindex0'] = $length - 1;
                $context['loop']['revindex'] = $length;
                $context['loop']['length'] = $length;
                $context['loop']['last'] = 1 === $length;
            }
            foreach ($context['_seq'] as $context["_key"] => $context["precinto"]) {
                // line 170
                echo "            <cac:TransportHandlingUnit>
                <cac:Package>
                    <cbc:ID>";
                // line 172
                echo twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 172);
                echo "</cbc:ID>
                    <cbc:TraceID>";
                // line 173
                echo $context["precinto"];
                echo "</cbc:TraceID>
                </cac:Package>
            </cac:TransportHandlingUnit>
        ";
                ++$context['loop']['index0'];
                ++$context['loop']['index'];
                $context['loop']['first'] = false;
                if (isset($context['loop']['length'])) {
                    --$context['loop']['revindex0'];
                    --$context['loop']['revindex'];
                    $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                }
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['precinto'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 177
            echo "        ";
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 177)) {
                // line 178
                echo "            <cac:TransportHandlingUnit>
                <cac:TransportEquipment>
                    <cbc:ID>";
                // line 180
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 180), "placa", [], "any", false, false, false, 180);
                echo "</cbc:ID>
                    ";
                // line 181
                if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 181), "nroCirculacion", [], "any", false, false, false, 181)) {
                    // line 182
                    echo "                        <cac:ApplicableTransportMeans>
                            <cbc:RegistrationNationalityID>";
                    // line 183
                    echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 183), "nroCirculacion", [], "any", false, false, false, 183);
                    echo "</cbc:RegistrationNationalityID>
                        </cac:ApplicableTransportMeans>
                    ";
                }
                // line 186
                echo "                    ";
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 186), "secundarios", [], "any", false, false, false, 186));
                foreach ($context['_seq'] as $context["_key"] => $context["sec"]) {
                    // line 187
                    echo "                        <cac:AttachedTransportEquipment>
                            <cbc:ID>";
                    // line 188
                    echo twig_get_attribute($this->env, $this->source, $context["sec"], "placa", [], "any", false, false, false, 188);
                    echo "</cbc:ID>
                            ";
                    // line 189
                    if (twig_get_attribute($this->env, $this->source, $context["sec"], "nroCirculacion", [], "any", false, false, false, 189)) {
                        // line 190
                        echo "                                <cac:ApplicableTransportMeans>
                                    <cbc:RegistrationNationalityID>";
                        // line 191
                        echo twig_get_attribute($this->env, $this->source, $context["sec"], "nroCirculacion", [], "any", false, false, false, 191);
                        echo "</cbc:RegistrationNationalityID>
                                </cac:ApplicableTransportMeans>
                            ";
                    }
                    // line 194
                    echo "                            ";
                    if (twig_get_attribute($this->env, $this->source, $context["sec"], "nroAutorizacion", [], "any", false, false, false, 194)) {
                        // line 195
                        echo "                                <cac:ShipmentDocumentReference>
                                    <cbc:ID schemeID=\"";
                        // line 196
                        echo twig_get_attribute($this->env, $this->source, $context["sec"], "codEmisor", [], "any", false, false, false, 196);
                        echo "\" schemeName=\"Entidad Autorizadora\" schemeAgencyName=\"PE:SUNAT\">";
                        echo twig_get_attribute($this->env, $this->source, $context["sec"], "nroAutorizacion", [], "any", false, false, false, 196);
                        echo "</cbc:ID>
                                </cac:ShipmentDocumentReference>
                            ";
                    }
                    // line 199
                    echo "                        </cac:AttachedTransportEquipment>
                    ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['sec'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 201
                echo "                    ";
                if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 201), "nroAutorizacion", [], "any", false, false, false, 201)) {
                    // line 202
                    echo "                        <cac:ShipmentDocumentReference>
                            <cbc:ID schemeID=\"";
                    // line 203
                    echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 203), "codEmisor", [], "any", false, false, false, 203);
                    echo "\" schemeName=\"Entidad Autorizadora\" schemeAgencyName=\"PE:SUNAT\">";
                    echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "vehiculo", [], "any", false, false, false, 203), "nroAutorizacion", [], "any", false, false, false, 203);
                    echo "</cbc:ID>
                        </cac:ShipmentDocumentReference>
                    ";
                }
                // line 206
                echo "                </cac:TransportEquipment>
            </cac:TransportHandlingUnit>
        ";
            }
            // line 209
            echo "        ";
            if (twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "puerto", [], "any", false, false, false, 209)) {
                // line 210
                echo "            <cac:FirstArrivalPortLocation>
                <cbc:ID schemeAgencyName=\"PE:SUNAT\" schemeName=\"Puertos\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo63\">";
                // line 211
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "puerto", [], "any", false, false, false, 211), "codigo", [], "any", false, false, false, 211);
                echo "</cbc:ID>
                <cbc:LocationTypeCode>1</cbc:LocationTypeCode>
                <cbc:Name>";
                // line 213
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "puerto", [], "any", false, false, false, 213), "nombre", [], "any", false, false, false, 213);
                echo "</cbc:Name>
            </cac:FirstArrivalPortLocation>
        ";
            } elseif (twig_get_attribute($this->env, $this->source,             // line 215
($context["envio"] ?? null), "aeropuerto", [], "any", false, false, false, 215)) {
                // line 216
                echo "            <cac:FirstArrivalPortLocation>
                <cbc:ID schemeAgencyName=\"PE:SUNAT\" schemeName=\"Aeropuertos\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo64\">";
                // line 217
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "aeropuerto", [], "any", false, false, false, 217), "codigo", [], "any", false, false, false, 217);
                echo "</cbc:ID>
                <cbc:LocationTypeCode>2</cbc:LocationTypeCode>
                <cbc:Name>";
                // line 219
                echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "aeropuerto", [], "any", false, false, false, 219), "nombre", [], "any", false, false, false, 219);
                echo "</cbc:Name>
            </cac:FirstArrivalPortLocation>
        ";
            }
            // line 222
            echo "    </cac:Shipment>
    ";
            // line 223
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "details", [], "any", false, false, false, 223));
            $context['loop'] = [
              'parent' => $context['_parent'],
              'index0' => 0,
              'index'  => 1,
              'first'  => true,
            ];
            if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
                $length = count($context['_seq']);
                $context['loop']['revindex0'] = $length - 1;
                $context['loop']['revindex'] = $length;
                $context['loop']['length'] = $length;
                $context['loop']['last'] = 1 === $length;
            }
            foreach ($context['_seq'] as $context["_key"] => $context["det"]) {
                // line 224
                echo "        <cac:DespatchLine>
            <cbc:ID>";
                // line 225
                echo twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 225);
                echo "</cbc:ID>
            <cbc:DeliveredQuantity unitCode=\"";
                // line 226
                echo twig_get_attribute($this->env, $this->source, $context["det"], "unidad", [], "any", false, false, false, 226);
                echo "\">";
                echo $this->env->getFilter('n_format_limit')->getCallable()(twig_get_attribute($this->env, $this->source, $context["det"], "cantidad", [], "any", false, false, false, 226), 10);
                echo "</cbc:DeliveredQuantity>
            <cac:OrderLineReference>
                <cbc:LineID>";
                // line 228
                echo twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 228);
                echo "</cbc:LineID>
            </cac:OrderLineReference>
            <cac:Item>
                <cbc:Description><![CDATA[";
                // line 231
                echo twig_get_attribute($this->env, $this->source, $context["det"], "descripcion", [], "any", false, false, false, 231);
                echo "]]></cbc:Description>
                <cac:SellersItemIdentification>
                    <cbc:ID>";
                // line 233
                echo twig_get_attribute($this->env, $this->source, $context["det"], "codigo", [], "any", false, false, false, 233);
                echo "</cbc:ID>
                </cac:SellersItemIdentification>
                ";
                // line 235
                if (twig_get_attribute($this->env, $this->source, $context["det"], "codProdSunat", [], "any", false, false, false, 235)) {
                    // line 236
                    echo "                    <cac:CommodityClassification>
                        <cbc:ItemClassificationCode listID=\"UNSPSC\" listAgencyName=\"GS1 US\" listName=\"Item Classification\">";
                    // line 237
                    echo twig_get_attribute($this->env, $this->source, $context["det"], "codProdSunat", [], "any", false, false, false, 237);
                    echo "</cbc:ItemClassificationCode>
                    </cac:CommodityClassification>
                ";
                }
                // line 240
                echo "                ";
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["det"], "atributos", [], "any", false, false, false, 240));
                foreach ($context['_seq'] as $context["_key"] => $context["atr"]) {
                    // line 241
                    echo "                    <cac:AdditionalItemProperty >
                        <cbc:Name>";
                    // line 242
                    echo twig_get_attribute($this->env, $this->source, $context["atr"], "name", [], "any", false, false, false, 242);
                    echo "</cbc:Name>
                        <cbc:NameCode>";
                    // line 243
                    echo twig_get_attribute($this->env, $this->source, $context["atr"], "code", [], "any", false, false, false, 243);
                    echo "</cbc:NameCode>
                        ";
                    // line 244
                    if (twig_get_attribute($this->env, $this->source, $context["atr"], "value", [], "any", false, false, false, 244)) {
                        // line 245
                        echo "                            <cbc:Value>";
                        echo twig_get_attribute($this->env, $this->source, $context["atr"], "value", [], "any", false, false, false, 245);
                        echo "</cbc:Value>
                        ";
                    }
                    // line 247
                    echo "                    </cac:AdditionalItemProperty>
                ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['atr'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 249
                echo "            </cac:Item>
        </cac:DespatchLine>
    ";
                ++$context['loop']['index0'];
                ++$context['loop']['index'];
                $context['loop']['first'] = false;
                if (isset($context['loop']['length'])) {
                    --$context['loop']['revindex0'];
                    --$context['loop']['revindex'];
                    $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                }
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['det'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 252
            echo "    ";
        }
        // line 253
        echo "    ";
        if ((twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "serie", [], "any", false, false, false, 253) == "V001")) {
            // line 254
            echo "    <cac:Signature>
        <cbc:ID>";
            // line 255
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 255), "ruc", [], "any", false, false, false, 255);
            echo "</cbc:ID>
        <cbc:Note>WWW.IVANFACT.COM</cbc:Note>
        <cac:SignatoryParty>
            <cac:PartyIdentification>
                <cbc:ID>";
            // line 259
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 259), "ruc", [], "any", false, false, false, 259);
            echo "</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name><![CDATA[";
            // line 262
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 262), "razonSocial", [], "any", false, false, false, 262);
            echo "]]></cbc:Name>
            </cac:PartyName>
        </cac:SignatoryParty>
        <cac:DigitalSignatureAttachment>
            <cac:ExternalReference>
                <cbc:URI>";
            // line 267
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 267), "ruc", [], "any", false, false, false, 267);
            echo "</cbc:URI>
            </cac:ExternalReference>
        </cac:DigitalSignatureAttachment>
    </cac:Signature>
    <cac:DespatchSupplierParty>
        <cbc:CustomerAssignedAccountID schemeID=\"6\">";
            // line 272
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 272), "ruc", [], "any", false, false, false, 272);
            echo "</cbc:CustomerAssignedAccountID>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID=\"6\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
            // line 275
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 275), "ruc", [], "any", false, false, false, 275);
            echo "</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName><![CDATA[";
            // line 278
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 278), "razonSocial", [], "any", false, false, false, 278);
            echo "]]></cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:DespatchSupplierParty>
    <cac:DeliveryCustomerParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID=\"6\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
            // line 285
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "destinatario", [], "any", false, false, false, 285), "numDoc", [], "any", false, false, false, 285);
            echo "</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>";
            // line 288
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "destinatario", [], "any", false, false, false, 288), "rznSocial", [], "any", false, false, false, 288);
            echo "</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:DeliveryCustomerParty>
        <cac:Shipment>
            <cbc:ID>SUNAT_Envio</cbc:ID>
            <cbc:GrossWeightMeasure unitCode=\"KGM\">14.0</cbc:GrossWeightMeasure>
            <cac:ShipmentStage>
                <cac:TransitPeriod>
                    <cbc:StartDate>";
            // line 297
            echo twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "fechaEmision", [], "any", false, false, false, 297), "Y-m-d");
            echo "</cbc:StartDate>
                </cac:TransitPeriod>
                <cac:CarrierParty>
                    <cac:PartyIdentification>
                        <cbc:ID schemeID=\"\"/>
                    </cac:PartyIdentification>
                    <cac:PartyLegalEntity>
                        <cbc:RegistrationName/>
                    </cac:PartyLegalEntity>
                </cac:CarrierParty>
                <cac:TransportMeans>
                    <cac:RoadTransport>
                        <cbc:LicensePlateID>";
            // line 309
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 309), "transportista", [], "any", false, false, false, 309), "placa", [], "any", false, false, false, 309);
            echo "</cbc:LicensePlateID>
                    </cac:RoadTransport>
                </cac:TransportMeans>
                <cac:DriverPerson>
                    <cbc:ID schemeID=\"1\">";
            // line 313
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 313), "transportista", [], "any", false, false, false, 313), "choferDoc", [], "any", false, false, false, 313);
            echo "</cbc:ID>
                    <cbc:FirstName>";
            // line 314
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 314), "transportista", [], "any", false, false, false, 314), "nombres", [], "any", false, false, false, 314);
            echo "</cbc:FirstName>
                    <cbc:FamilyName>";
            // line 315
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 315), "transportista", [], "any", false, false, false, 315), "apellidos", [], "any", false, false, false, 315);
            echo "</cbc:FamilyName>
                    <cbc:JobTitle>Principal</cbc:JobTitle>
                    <cac:IdentityDocumentReference>
                        <cbc:ID>";
            // line 318
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 318), "transportista", [], "any", false, false, false, 318), "licencia", [], "any", false, false, false, 318);
            echo "</cbc:ID>
                    </cac:IdentityDocumentReference>
                </cac:DriverPerson>
            </cac:ShipmentStage>
            <cac:Delivery>
                <cac:DeliveryAddress>
                    <cbc:ID schemeAgencyName=\"PE:INEI\" schemeName=\"Ubigeos\">";
            // line 324
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 324), "ubigueo", [], "any", false, false, false, 324);
            echo "</cbc:ID>
                    <cac:AddressLine>
                        <cbc:Line>";
            // line 326
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "llegada", [], "any", false, false, false, 326), "direccion", [], "any", false, false, false, 326);
            echo "</cbc:Line>
                    </cac:AddressLine>
                </cac:DeliveryAddress>
                <cac:Despatch>
                    <cac:DespatchAddress>
                        <cbc:ID schemeAgencyName=\"PE:INEI\" schemeName=\"Ubigeos\">";
            // line 331
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 331), "ubigueo", [], "any", false, false, false, 331);
            echo "</cbc:ID>
                        <cac:AddressLine>
                            <cbc:Line>";
            // line 333
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["envio"] ?? null), "partida", [], "any", false, false, false, 333), "direccion", [], "any", false, false, false, 333);
            echo "</cbc:Line>
                        </cac:AddressLine>
                    </cac:DespatchAddress>
                    <cac:DespatchParty>
                        <cac:PartyIdentification>
                            <cbc:ID schemeID=\"6\" schemeName=\"Documento de Identidad\" schemeAgencyName=\"PE:SUNAT\" schemeURI=\"urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06\">";
            // line 338
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 338), "ruc", [], "any", false, false, false, 338);
            echo "</cbc:ID>
                        </cac:PartyIdentification>
                        <cac:PartyLegalEntity>
                            <cbc:RegistrationName><![CDATA[";
            // line 341
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "company", [], "any", false, false, false, 341), "razonSocial", [], "any", false, false, false, 341);
            echo "]]></cbc:RegistrationName>
                        </cac:PartyLegalEntity>
                    </cac:DespatchParty>
                </cac:Despatch>
            </cac:Delivery>
            <cac:TransportHandlingUnit>
                <cac:TransportEquipment>
                    <cbc:ID>";
            // line 348
            echo twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 348), "transportista", [], "any", false, false, false, 348), "licencia", [], "any", false, false, false, 348);
            echo "</cbc:ID>
                    ";
            // line 349
            if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "envio", [], "any", false, false, false, 349), "transportista", [], "any", false, false, false, 349), "tuce", [], "any", false, false, false, 349)) {
                // line 350
                echo "                    <cac:ApplicableTransportMeans>
                        <cbc:RegistrationNationalityID>12345678912</cbc:RegistrationNationalityID>
                    </cac:ApplicableTransportMeans>
                    ";
            }
            // line 354
            echo "                </cac:TransportEquipment>
            </cac:TransportHandlingUnit>
        </cac:Shipment>

        ";
            // line 358
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["doc"] ?? null), "details", [], "any", false, false, false, 358));
            $context['loop'] = [
              'parent' => $context['_parent'],
              'index0' => 0,
              'index'  => 1,
              'first'  => true,
            ];
            if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
                $length = count($context['_seq']);
                $context['loop']['revindex0'] = $length - 1;
                $context['loop']['revindex'] = $length;
                $context['loop']['length'] = $length;
                $context['loop']['last'] = 1 === $length;
            }
            foreach ($context['_seq'] as $context["_key"] => $context["det"]) {
                // line 359
                echo "            <cac:DespatchLine>
                <cbc:ID>";
                // line 360
                echo twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 360);
                echo "</cbc:ID>
                <cbc:DeliveredQuantity unitCode=\"";
                // line 361
                echo twig_get_attribute($this->env, $this->source, $context["det"], "unidad", [], "any", false, false, false, 361);
                echo "\">";
                echo $this->env->getFilter('n_format_limit')->getCallable()(twig_get_attribute($this->env, $this->source, $context["det"], "cantidad", [], "any", false, false, false, 361), 10);
                echo "</cbc:DeliveredQuantity>
                <cac:OrderLineReference>
                    <cbc:LineID>";
                // line 363
                echo twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 363);
                echo "</cbc:LineID>
                </cac:OrderLineReference>
                <cac:Item>
                    <cbc:Description><![CDATA[";
                // line 366
                echo twig_get_attribute($this->env, $this->source, $context["det"], "descripcion", [], "any", false, false, false, 366);
                echo "]]></cbc:Description>
                    <cac:SellersItemIdentification>
                        <cbc:ID>";
                // line 368
                echo twig_get_attribute($this->env, $this->source, $context["det"], "codigo", [], "any", false, false, false, 368);
                echo "</cbc:ID>
                    </cac:SellersItemIdentification>
                    ";
                // line 370
                if (twig_get_attribute($this->env, $this->source, $context["det"], "codProdSunat", [], "any", false, false, false, 370)) {
                    // line 371
                    echo "                        <cac:CommodityClassification>
                            <cbc:ItemClassificationCode listID=\"UNSPSC\" listAgencyName=\"GS1 US\" listName=\"Item Classification\">";
                    // line 372
                    echo twig_get_attribute($this->env, $this->source, $context["det"], "codProdSunat", [], "any", false, false, false, 372);
                    echo "</cbc:ItemClassificationCode>
                        </cac:CommodityClassification>
                    ";
                }
                // line 375
                echo "                    ";
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["det"], "atributos", [], "any", false, false, false, 375));
                foreach ($context['_seq'] as $context["_key"] => $context["atr"]) {
                    // line 376
                    echo "                        <cac:AdditionalItemProperty >
                            <cbc:Name>";
                    // line 377
                    echo twig_get_attribute($this->env, $this->source, $context["atr"], "name", [], "any", false, false, false, 377);
                    echo "</cbc:Name>
                            <cbc:NameCode>";
                    // line 378
                    echo twig_get_attribute($this->env, $this->source, $context["atr"], "code", [], "any", false, false, false, 378);
                    echo "</cbc:NameCode>
                            ";
                    // line 379
                    if (twig_get_attribute($this->env, $this->source, $context["atr"], "value", [], "any", false, false, false, 379)) {
                        // line 380
                        echo "                                <cbc:Value>";
                        echo twig_get_attribute($this->env, $this->source, $context["atr"], "value", [], "any", false, false, false, 380);
                        echo "</cbc:Value>
                            ";
                    }
                    // line 382
                    echo "                        </cac:AdditionalItemProperty>
                    ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['atr'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 384
                echo "                </cac:Item>
            </cac:DespatchLine>
        ";
                ++$context['loop']['index0'];
                ++$context['loop']['index'];
                $context['loop']['first'] = false;
                if (isset($context['loop']['length'])) {
                    --$context['loop']['revindex0'];
                    --$context['loop']['revindex'];
                    $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                }
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['det'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
        }
        // line 388
        echo "</DespatchAdvice>
";
        $___internal_parse_0_ = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
        // line 1
        echo twig_spaceless($___internal_parse_0_);
    }

    public function getTemplateName()
    {
        return "despatch2022.xml.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  997 => 1,  993 => 388,  976 => 384,  969 => 382,  963 => 380,  961 => 379,  957 => 378,  953 => 377,  950 => 376,  945 => 375,  939 => 372,  936 => 371,  934 => 370,  929 => 368,  924 => 366,  918 => 363,  911 => 361,  907 => 360,  904 => 359,  887 => 358,  881 => 354,  875 => 350,  873 => 349,  869 => 348,  859 => 341,  853 => 338,  845 => 333,  840 => 331,  832 => 326,  827 => 324,  818 => 318,  812 => 315,  808 => 314,  804 => 313,  797 => 309,  782 => 297,  770 => 288,  764 => 285,  754 => 278,  748 => 275,  742 => 272,  734 => 267,  726 => 262,  720 => 259,  713 => 255,  710 => 254,  707 => 253,  704 => 252,  688 => 249,  681 => 247,  675 => 245,  673 => 244,  669 => 243,  665 => 242,  662 => 241,  657 => 240,  651 => 237,  648 => 236,  646 => 235,  641 => 233,  636 => 231,  630 => 228,  623 => 226,  619 => 225,  616 => 224,  599 => 223,  596 => 222,  590 => 219,  585 => 217,  582 => 216,  580 => 215,  575 => 213,  570 => 211,  567 => 210,  564 => 209,  559 => 206,  551 => 203,  548 => 202,  545 => 201,  538 => 199,  530 => 196,  527 => 195,  524 => 194,  518 => 191,  515 => 190,  513 => 189,  509 => 188,  506 => 187,  501 => 186,  495 => 183,  492 => 182,  490 => 181,  486 => 180,  482 => 178,  479 => 177,  461 => 173,  457 => 172,  453 => 170,  436 => 169,  427 => 163,  424 => 162,  416 => 160,  414 => 159,  410 => 158,  402 => 153,  399 => 152,  391 => 150,  389 => 149,  385 => 148,  380 => 145,  370 => 141,  365 => 139,  361 => 138,  357 => 137,  351 => 136,  348 => 135,  343 => 134,  336 => 130,  332 => 129,  324 => 126,  320 => 124,  317 => 123,  311 => 120,  308 => 119,  306 => 118,  302 => 117,  299 => 116,  290 => 114,  285 => 113,  279 => 111,  276 => 110,  270 => 108,  268 => 107,  261 => 106,  255 => 104,  252 => 103,  246 => 101,  244 => 100,  240 => 99,  236 => 97,  233 => 96,  225 => 91,  217 => 88,  212 => 85,  209 => 84,  201 => 79,  193 => 76,  188 => 73,  186 => 72,  179 => 68,  171 => 65,  161 => 58,  155 => 55,  140 => 43,  134 => 40,  128 => 37,  125 => 36,  122 => 35,  115 => 33,  108 => 29,  104 => 27,  102 => 26,  98 => 25,  94 => 24,  90 => 23,  87 => 22,  82 => 21,  76 => 19,  74 => 18,  71 => 17,  69 => 16,  64 => 14,  60 => 13,  56 => 12,  50 => 11,  39 => 2,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "despatch2022.xml.twig", "/var/www/html/lycetgrg/vendor/greenter/xml/src/Xml/Templates/despatch2022.xml.twig");
    }
}
