<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css" integrity="sha512-5Hs3dF2AEPkpNAR7UiOHba+lRSJNeM2ECkwxUIxC1Q/FLycGTbNapWXB4tP889k5T5Ju8fs4b1P5z/iB4nMfSQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <style type="text/css">
        {% include 'assets/style.css' %}
  html, body {
            height: 100%;
            margin: 0;
            padding: 0;
        }

        /* Contenedor del contenido para hacer que el pie de página esté al final */
        .content {
            min-height: calc(100% - 50px); /* Resta el tamaño del pie de página */
        }

        footer {
            width: 100%;
            text-align: center;
            font-size: 9px;
            padding: 7px 0;
            position: fixed;
            bottom: 0;
            left: 0;
        }

.footer-text {
    display: inline-block; /* Hace que el contenedor ocupe solo el espacio necesario */
    padding: 10px 10px; /* Ajusta el padding para que el fondo no sea tan grande */
    background-color: rgba(0, 0, 0, 0.1); /* Fondo suave */
    border: 1px solid black; /* Borde negro delgado */
    border-radius: 5px; /* Bordes curvados */
    font-weight: normal; /* Peso de la fuente */
    font-size: 10px;
    line-height: 1.5;
}
#hr-negro {
    border: 1px solid black;

}

.page-break {
    page-break-before: always;
}

.page-break-after {
    page-break-after: always;
}

.no-page-break {
    page-break-inside: avoid;
}


  </style>
      </head>
<body class="white-bg">
{% set cp = doc.company %}
{% set isNota = doc.tipoDoc in ['07', '08'] %}
{% set isAnticipo = doc.totalAnticipos is defined and doc.totalAnticipos > 0 %}
{% set name = doc.tipoDoc|catalog('01') %}

<div class="content">
<table width="100%">
    <tbody><tr>
        <td style="">
  {% if doc.tipoDoc == '08' %} 
   <table width="100%" height="200px" border="0" aling="center" cellpadding="0" cellspacing="0">
                <tbody><tr>
<td width="5%" align="center">
                        <span></span>
                    </td>

                    <td width="31%" align="center"  style="padding-left:0;vertical-align: top; padding-top: 2px;">
                        <span><img src="{{ params.system.logo|image_b64 }}" height="auto" width="auto" style="text-align:center; padding:3.5em" border="0"></span>
                    </td>
<td width="5%" align="center">
                        <span></span>
                    </td>
            <td width="30%" style=" vertical-align: top; padding-top: 70px;">
                        <div class="">
                            <table width="96%" height="100%" height="60" border="0" border-radius="" cellpadding="6" cellspacing="0">
                                <tbody><tr>
                                    <td align="left">
                                        <strong><span style="font-size:18px">{{ cp.razonSocial }}</span></strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left"  style="font-size:9px" >
                                        <strong>Almacen: </strong>{{ cp.address.direccion }}
                                    </td>
                                </tr>
<tr>
                                    <td align="left"  style="font-size:9px">
                                        <strong>E-mail: </strong> ventas@dubaumetalindustria.com 
                                    </td>
                                </tr>

<tr>
                                    <td align="left"  style="font-size:9px">
                                        <strong>Telefono: </strong> 937 063 014
                                    </td>
                                </tr>

                                <tr>
                                    <td align="left"  style="font-size:9px">
                                        {{ params.user.header|raw }}
                                    </td>
                                </tr>
                                </tbody></table>

 

                        </div>
                    </td>
                    <td width="30%" rowspan="1" valign="bottom" style="padding-left:0;vertical-align: top; padding-top: 70px;">
                        <div class="tabla_borde">
                            <table width="100%" border="0" height="60" cellpadding="6" cellspacing="0">
                                <tbody><tr>
    <td align="center">
        <strong> <span style="font-family:Tahoma, Geneva, sans-serif; font-size:22px" text-align="center">{{ name }}</span></strong>
        <div style="border-top:1px solid #000; margin: 10px 0;"></div> <!-- Línea horizontal -->
    </td>
</tr>
<tr>
    <td align="center">
        <span style="font-size:15px" text-align="center">R.U.C.: {{ cp.ruc }}</span>
    </td>
</tr><tr>
    <td align="center">
        <span style="font-size:15px" text-align="center"></span>
    </td>
</tr>

<tr>
    <td align="center">
        <strong><span style="font-size:20px">{{ doc.serie }}-{{ doc.correlativo }}</span></strong>
    </td>
</tr>
                                </tbody></table>
       </div>
                    </td>
                </tr>

                            </tbody></table>
                            <br />
{% else %}


<table width="100%" height="200px" border="0" align="center" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <!-- Primera columna con la imagen -->
           
            <td width="5%" align="center">
                        <span></span>
                    </td>

                    <td width="30%" align="center"  style="padding-left:0;vertical-align: top; padding-top: 2px;">
                        <span><img src="{{ params.system.logo|image_b64 }}" height="auto" width="auto" style="text-align:center; padding:3.5em" border="0"></span>
                    </td>
<td width="5%" align="center">
                        <span></span>
                    </td>


            <!-- Segunda columna combinada -->
            <td width="60%" style="vertical-align: top; padding-top: 10px;">
                <!-- Parte superior: Información general -->
                <div>
                    <table width="100%" border="0" cellpadding="6" cellspacing="0">
                        <tbody>
                            <tr>
                                <td align="left">
                                    <strong><span style="font-size:18px">{{ cp.razonSocial }}</span></strong>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" style="font-size:9px">
                                    <strong>Almacen: </strong>{{ cp.address.direccion }}
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <!-- Parte inferior: Información del documento -->
                <div style="margin-top: 5px; padding-top: 10px;">
<div class="tabla_borde">
                    <table width="100%" border="0" cellpadding="6" cellspacing="0">
                        <tbody>
                            <tr>
                                <td align="center">
                                   <strong> <span style="font-family:Tahoma, Geneva, sans-serif; font-size:22px" text-align="center">{{ name }} ELECTRONICA</span></strong>
                                    <div style="border-top:1px solid #000; margin: 10px 0;"></div> 
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <span style="font-size:15px" text-align="center">R.U.C.: {{ cp.ruc }}</span>
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    <strong>
                                        <span style="font-size:20px">{{ doc.serie }}-{{ doc.correlativo }}</span>
                                    </strong>
                                </td>
                            </tr>
                        </tbody>
                    </table>
</div>

                </div>
            </td>
        </tr>
    </tbody>
</table>



{% endif %}

                
            <div class="">
                {% set cl = doc.client %}
        <div style="display: flex; width: 100%; margin-bottom: 4px; background-color: #f5f5f5 !important;">
    <!-- Columna de 60% -->
    <div style="flex: 60%; display: flex; flex-direction: column; justify-content: space-between; padding: 2px; line-height: 1.2; vertical-align: top; box-sizing: border-box;">
        <div>
            <strong>Razon Social:</strong> {{ cl.rznSocial }}
        </div>
        <div>
            <strong>Direccion:</strong> {% if cl.address %}{{ cl.address.direccion }}{% endif %}
        </div>
        <div>
            <strong>Fecha Emision:</strong> {{ doc.fechaEmision|date('d/m/Y') }}
            {% if doc.fechaEmision|date('H:i:s') != '00:00:00' %} {{ doc.fechaEmision|date('H:i:s') }} {% endif %}
            {% if doc.fecVencimiento is defined and doc.fecVencimiento %}
                <br><br><strong>Fecha Vencimiento:</strong> {{ doc.fecVencimiento|date('d/m/Y') }}
            {% endif %}
        </div>
        
        <div>
            {% if isNota %}
            <strong>Documento Ref.:</strong> {{ doc.numDocfectado }}
             {% endif %}
        </div>
       
    </div>

    <!-- Columna de 40% -->
<div style="flex: 40%; display: flex; flex-direction: column; justify-content: space-between; padding: 2px; box-sizing: border-box;">
    <div style="border: 1px solid #000; border-radius: 8px; padding: 10px; margin-bottom: 8px;">
        <strong>{{ cl.tipoDoc|catalog('06') }}:</strong> {{ cl.numDoc }}
    </div>

    <div style="border: 1px solid #000; border-radius: 8px; padding: 10px; margin-bottom: 8px;">
          {% if isNota %}
        <strong>Tipo Doc. Ref.:</strong> {{ doc.tipDocAfectado|catalog('01') }}
         {% else %}
        <strong>Guias:</strong>
{% if doc.guias %}
                    
                        {% for guia in doc.guias %}
                            {{ guia.nroDoc }}&nbsp;&nbsp;
                        {% endfor %}
                    {% endif %}
        {% endif %} 
    </div>
    
    <div style="border: 1px solid #000; border-radius: 8px; padding: 10px;">
        <strong>Tipo Moneda:</strong> {{ doc.tipoMoneda|catalog('021') }}
    </div>
</div>
</div>
            </div><br>
            {% set moneda = doc.tipoMoneda|catalog('02') %}
<table width="100%" cellpadding="5" cellspacing="0" style=" border-top: 1px solid #000; border-bottom: 1px solid #000; border-left: none; border-right: none; border-collapse: collapse;">
    <thead style="font-size: 9px !important;">
        <tr>
            {% if doc.tipoDoc == '08' %}
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Cantidad</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Codigo</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Descripcion</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Valor Unitario</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Valor Total</th>
        {% else %}
        <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">N°</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Codigo</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Descripcion</th>
             <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Und.</th>
              <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Cant.</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">P.U. s/ IGV</th>
            <th style="font-size: 12px;background-color: #f0efe1 !important; font-weight: bold !important; text-align: center !important; border: none !important; padding: 5px !important;">Sub Total</th>
        {% endif %}
        </tr>
    </thead>
    <tbody style="font-size: 9px !important;">
        {% for det in doc.details %}
        <tr style="background-color: {% if loop.index is even %}#F5F5F5{% else %}#ffffff{% endif %} !important; border-top: 1px solid #f0efe1 !important;font-size: 9px; ">

          {% if doc.tipoDoc == '08' %}
            <td style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                {{ det.cantidad|n_format }} {{ det.unidad }}
            </td>
            <td style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                {{ det.codProducto }}
            </td>
            <td style="text-align: left !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                <span>{{ det.descripcion }}</span><br>
            </td>
            <td style="text-align: right !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                {{ moneda }} {{ det.mtoValorUnitario|n_format }}
            </td>
            <td style="text-align: right !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                {{ moneda }} {{ det.mtoValorVenta|n_format }}
            </td>
            {% else %}
            <td style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                {{ loop.index }}
            </td>
             <td style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px; ">
                {{ det.codProducto }}
            </td>
             <td style="text-align: left !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px;">
                <span>{{ det.descripcion }}</span><br>
            </td>

            <td style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px;">
                 {{ det.unidad }}
            </td>

<td style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px;">
                {{ det.cantidad|n_format }}
            </td>
           
           
            <td style="text-align: right !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px;">
                {{ moneda }} {{ det.mtoValorUnitario}}
            </td>
            <td style="text-align: right !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #f0efe1 !important;font-size: 9px;">
                {{ moneda }} {{ det.mtoValorVenta|n_format }}
            </td>
            {% endif %}
        </tr>
        {% if loop.last %}
        <tr style="border-bottom: 1px solid #000 !important;">
            <td colspan="7" style="text-align: center !important; padding: 5px !important; border-left: 1px solid #f0efe1 !important; border-right: 1px solid #f0efe1 !important; border-top: 0.5px solid #f0efe1 !important; border-bottom: 0.5px solid #000 !important;font-size: 9px;">
                <!-- Any additional content for the last row -->
            </td>
        </tr>
        {% endif %}
        {% endfor %}
    </tbody>
</table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tbody><tr>
                    <td width="50%" valign="top">
                        <table width="100%" border="0" cellpadding="5" cellspacing="0">
                            <tbody>
                            <tr>
                                <td colspan="4">
                                    <br>
                                    <br>
                                    <span style="font-family:Tahoma, Geneva, sans-serif; font-size:12px" text-align="center">
                                    {% if doc.tipoDoc == '08' %} 
                                        <strong>IMPORTE EN LETRAS: {{ legend(doc.legends, '1000')  }}</strong>
                                    {% else %} 
                                        <strong>SON: {{ legend(doc.legends, '1000')  }}</strong>
                                    {% endif %} 
                                    </span>
                                    </td>
                            </tr>
                            </tbody>
                        </table>
                                               {% if isAnticipo %}
                        <table width="100%" border="0" cellpadding="5" cellspacing="0">
                            <tbody>
                            <tr>
                                <td>
                                    <br>
                                    <strong>Anticipo</strong>
                                    <br>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <table width="100%" border="0" cellpadding="5" cellspacing="0" style="font-size: 10px;">
                            <tbody>
                            <tr>
                                <td width="30%"><b>Nro. Doc.</b></td>
                                <td width="70%"><b>Total</b></td>
                            </tr>
                            {% for atp in doc.anticipos %}
                            <tr class="border_top">
                                <td width="30%">{{ atp.nroDocRel }}</td>
                                <td width="70%">{{ moneda }} {{ atp.total|n_format }}</td>
                            </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                        {% endif %}
                    </td>
  <td width="20%" valign="top">
</td>
                    <td width="30%" valign="top">
                        <br>
   <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table table-valores-totales">
    <tbody>
        {% if isAnticipo %}
            <tr class="border_bottom">
                <td align="left" style="padding-right: 10px; width: 40%;background-color: #f5f5f5  !important;"><strong>Total Anticipo</strong></td>
                <td align="center" style="width: 10%;background-color: #f5f5f5  !important;">:</td>
                <td align="right" style="width: 50%;background-color: #eaeaea !important;"><span>{{ moneda }}  {{ doc.totalAnticipos|n_format }}</span></td>
            </tr>
        {% endif %}
        {% if doc.mtoOperGravadas %}
            <tr class="border_bottom">
                <td align="left" style="padding-right: 10px; width: 40%;background-color: #f5f5f5  !important;%"><strong>SUB TOTAL</strong></td>
                <td align="center" style="width: 10%;background-color: #f5f5f5  !important;">:</td>
                <td align="right" style="width: 50%;background-color: #eaeaea !important;"><span>{{ moneda }}  {{ doc.mtoOperGravadas|n_format }}</span></td>
            </tr>
        {% endif %}
        <tr>
            <td align="left" style="padding-right: 10px; width: 40% ;background-color: #f5f5f5  !important;"><strong>I.G.V - 18% {% if params.user.numIGV is defined %} {{ params.user.numIGV }}%{% endif %}</strong></td>
            <td align="center" style="width: 10% ;background-color: #f5f5f5  !important;">:</td>
            <td align="right" style="width: 50%;background-color: #eaeaea !important;"><span>{{ moneda }}  {{ doc.mtoIGV|n_format }}</span></td>
        </tr>
        <tr>
            <td align="left" style="padding-right: 10px; width: 40%;background-color: #eaeaea !important;"><strong>TOTAL</strong></td>
            <td align="center" style="width: 10%;background-color: #eaeaea !important;">:</td>
            <td align="right" style="width: 50%;background-color: #eaeaea !important;"><span id="ride-importeTotal" class="ride-importeTotal">{{ moneda }}  {{ doc.mtoImpVenta|n_format }}</span></td>
        </tr>
        {% if doc.perception and doc.perception.mto %}
            {% set perc = doc.perception %}
            {% set soles = 'PEN'|catalog('02') %}
            <tr>
                <td align="left" style="padding-right: 10px; width: 30%"><strong>Percepción</strong></td>
                <td align="center" style="width: 10%">:</td>
                <td align="right" style="width: 60%"><span>{{ soles }}  {{ perc.mto|n_format }}</span></td>
            </tr>
            <tr>
                <td align="left" style="padding-right: 10px; width: 30%"><strong>Total a Pagar</strong></td>
                <td align="center" style="width: 10%">:</td>
                <td align="right" style="width: 60%"><span>{{ soles }} {{ perc.mtoTotal|n_format }}</span></td>
            </tr>
        {% endif %}
    </tbody>


</table>
                    </td>
                </tr>
                </tbody></table>
{% if doc.tipoDoc != '08' %}
                <table width="30%" border="0" cellpadding="0" cellspacing="0" style="margin-top: -40px;">
                <tbody><tr>
                    <td width="50%" valign="top">
                        <table width="100%" border="0" cellpadding="5" cellspacing="0">
                            <tbody>
                            <tr>
                                <td colspan="4">
                                    <br>
                                    <strong>Informacion Adicional</strong>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <table width="100%" border="0" cellpadding="5" cellspacing="0">
                            <tbody>
                            <tr class="border_top">
                                <td width="45%" style="font-size: 10px;">
                                    LEYENDA
                                </td>
                                 <td width="5%" style="font-size: 10px; text-align: center;">:</td>
                                <td width="50%" style="font-size: 10px;">
                                    <p>
                                        {% for leg in doc.legends %}
                                        {% if leg.code != '1000' %}
                                            {{ leg.value }}<br>
                                        {% endif %}
                                        {% endfor %}
                                    </p>
                                </td>
                            </tr>

                            <tr class="border_top">
                                <td width="45%" style="font-size: 10px;">
                                    GUIA
                                </td>
                                 <td width="5%" style="font-size: 10px; text-align: center;">:</td>
                                <td width="50%" style="font-size: 10px;">
                                    <p>
                                        {% for guia in doc.guias %}
                                            {{ guia.nroDoc }}             
                                        {% endfor %}
                                    </p>
                                </td>
                            </tr>

                            {% if isNota %}
                            <tr class="border_top">
                                <td width="45%" style="font-size: 10px;">
                                    MOTIVO DE EMISION
                                </td>
                                 <td width="5%" style="font-size: 10px; text-align: center;">:</td>
                                <td width="50%" style="font-size: 10px;">
                                    {{ doc.desMotivo }}
                                </td>
                            </tr>
                            {% endif %}
                            {% if params.user.extras is defined %}
                                {% for item in params.user.extras %}
                                    <tr class="border_top">
                                        <td width="45%" style="font-size: 10px;">
                                            {{ item.name|upper }}
                                        </td>
                                         <td width="5%" style="font-size: 10px; text-align: center;">:</td>
                                        <td width="50%" style="font-size: 10px;">
                                            {{ item.value }}
                                        </td>               
                                    </tr>
                                       {% if loop.index % 4 == 0 and loop.index < params.user.extras|length %}
            
                                 <div style="page-break-after: always;"></div>
            {% endif %}
                                {% endfor %}
                            
                            {% endif %}
                            </tbody>
                        </table>
                        {% if isAnticipo %}
                        <table width="100%" border="0" cellpadding="5" cellspacing="0">
                            <tbody>
                            <tr>
                                <td>
                                    <br>
                                    <strong>Anticipo</strong>
                                    <br>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <table width="100%" border="0" cellpadding="5" cellspacing="0" style="font-size: 10px;">
                            <tbody>
                            <tr>
                                <td width="30%"><b>Nro. Doc.</b></td>
                                <td width="70%"><b>Total</b></td>
                            </tr>
                            {% for atp in doc.anticipos %}
                            <tr class="border_top">
                                <td width="30%">{{ atp.nroDocRel }}</td>
                                <td width="70%">{{ moneda }} {{ atp.total|n_format }}</td>
                            </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                        {% endif %}
                    </td>
                </tr>
                </tbody></table>
  {% endif %}
                
            <br>
            <br>
            <div>
            
            </div>
            {% if max_items is defined and doc.details|length > max_items %}
                <div style="page-break-after:always;"></div>
            {% endif %}
            <div>

              </table>
             </div>
        </td>
    </tr><table width="100%" style="height: 100%;">
 </table> </div>
<footer>
      <table width="100%" style="height: 100%;">
    <tbody>
        <tr>
            <td colspan="1" style="text-align: right;width:15%"></td>

            <td colspan="3" style="text-align: center; font-size: 9px; padding-top: 100px; width:auto">
             {% if doc.tipoDoc == '08' %}
                <div class="footer-text">
                    <span>La empresa <b>NO SE RESPONSABILIZA</b> por pagos en efectivo o cheques girados a nombre del vendedor</span>
                </div>
                {% endif %}
            </td>

            {% if doc.tipoDoc == '08' %}
                <td colspan="1" style="text-align: right;width:20%">
                    <img src="{{ qrCode(doc)|image_b64('svg+xml') }}" alt="Qr Image">
                </td>
            {% else %}
                <!-- Celda con fondo detrás del QR -->
                <td colspan="1" style="text-align: right; width: 20%; padding: 5px;">
                    <div style="display: inline-block; background-color: #eaeaea !important; padding: 20px;">
                        <img src="{{ qrCode(doc)|image_b64('svg+xml') }}" alt="Qr Image" style="display: block; max-width: 100%; height: auto;">
                    </div>
                </td>
            {% endif %}
        </tr>
{% if doc.tipoDoc != '08' %}
        <tr>
            {% if doc.tipoDoc in ['01', '03'] %}
            <td colspan="1" style="text-align: left; font-size: 9px; padding-top: 10px;">
            <p>*No se aceptan devoluciones*</p>
                 </td>
                 <td colspan="4" style="text-align: right; font-size: 9px; padding-top: 10px;">
                <div class="footer-text">
                    <span> Presentación Impresa de la <b>{{ name }} ELECTRONICA</b></span>
                </div>
            </td>
            {% else %}
            <td colspan="5" style="text-align: right; font-size: 9px; padding-top: 10px;">
                <div class="footer-text">
                    <span> Presentación Impresa de la <b>{{ name }} ELECTRONICA</b></span>
                </div>
            </td>
             {% endif %}
        </tr>
 {% endif %}
        <!-- Línea horizontal -->
        <tr>
            <td colspan="5">
                <hr id="hr-negro" style="padding: 0; margin: 0;">
            </td>
        </tr>
    </tbody>
</table>
 
<div style="display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 0;">
    <!-- Imagen izquierda -->
    <div style="width: 30%; text-align: left; margin-top: 12px;">
         </div>

    <!-- Espacio vacío -->
    <div style="width: 20%;"></div>

    <!-- Imagen derecha -->
    <div style="width: 50%; text-align: right;">
            </div>
</div>

    </footer>
</body>
</html>
