<div class="window-lista resumen_cuenta">
    <div class="table-content">
        <div class="ctamadre">
            <label>CTA-MADRE: <?php echo $comprobantes['saldos']['cliente']['cta'] ?></label>
            <label><?php echo $comprobantes['saldos']['cliente']['cli'] ?></label>
        </div>       
        <ul class="title">
            <li>
                <?php if (FLAG_HO == false) { ?>
                    <span class="emp">Empresa</span>
                <?php } ?>
                <span class="fec">Fecha</span>
                <span class="comp">Comprobante</span>
                <span class="fpa">FPA</span>
                <span class="tco">TCO</span>
                <span class="deb">Debito</span>
                <span class="cred">Credito</span>
                <span class="sal">Saldo</span>
                <span class="rtos">Rtos.Pend.</span>
                <span class="obs">Observaciones</span>
                <span class="venc">Vencimientos</span>
                <span class="con">Conductor</span>
                <span class="veh">Vehiculo</span>
            </li>
        </ul>
        <?php if ($comprobantes['saldos']['tipo']=="resumen" ): ?>
        <div class="div_saldo titulos">
            <?php if (FLAG_HO == false) { ?>
            <div class="saldo" style="width: 310px;">Saldo al: <?php echo $comprobantes['saldos']['desde'] ?></div>
            <?php } else { ?>
            <div class="saldo" style="width: 230px;">Saldo al: <?php echo $comprobantes['saldos']['desde'] ?></div>
            <?php } ?>
            <div class="debito"><?php echo $comprobantes['saldos']['deb'] ?></div>
            <div class="credito"><?php echo $comprobantes['saldos']['cre'] ?></div>
            <div class="saldos"><?php echo $comprobantes['saldos']['sal'] ?></div>
            <div class="pendientes"><?php echo $comprobantes['saldos']['rpe'] ?></div>
        </div>
        <?php endif; ?>
        
        <div class="div_saldo titulos" id="tot_up">
            <?php if (FLAG_HO == false) { ?>
            <div class="saldo" style="width: 310px;">Totales al: <?php echo $comprobantes['totales']['hasta'] ?></div>
            <?php } else { ?>
            <div class="saldo" style="width: 230px;">Totales al: <?php echo $comprobantes['totales']['hasta'] ?></div>
            <?php } ?>
            <div class="debito"><?php echo $comprobantes['totales']['deb'] ?></div>
            <div class="credito"><?php echo $comprobantes['totales']['cre'] ?></div>
            <div class="saldos"><?php echo $comprobantes['totales']['sal'] ?></div>
            <div class="pendientes"><?php echo $comprobantes['totales']['rtos'] ?></div>
            <div class="obs"><?php echo $comprobantes['totales']['obs'] ?></div>
            <button onclick="total_abajo();" id="bt_arriba">Mostrar Abajo</button>
        </div>

        <div class="content-lista-scroll" id="lista_dat">
            <?php
            for ($i = 0; $i < count($comprobantes['ret']); $i++) {
                if ($comprobantes['ret'][$i] != ""){
                    if(isset($comprobantes['ret'][$i]['EMP'])){
                        $comprobantes['ret'][$i]['EMP'];
                    }else{
                        $comprobantes['ret'][$i]['EMP'] = 1;
                    } 
                ?> 
                <ul class="content">
                <?php if ($comprobantes['ret'][$i]['obs'] == "(Cancela Remitos)") {?>
                    <li id="lista" data-tco="<?= $comprobantes['ret'][$i]['tco_o'] ?>" data-nco="<?= $comprobantes['ret'][$i]['nco_o'] ?>" data-tip="<?= $comprobantes['ret'][$i]['tip_o'] ?>" data-suc="<?= $comprobantes['ret'][$i]['suc_o'] ?>" data-cod="<?= $comprobantes['ret'][$i]['cod_o'] ?>" data-emp="<?= $comprobantes['ret'][$i]['EMP'] ?>" data-remito="1">                       
                    <?php }else { ?>
                        <li id="lista" data-tco="<?= $comprobantes['ret'][$i]['tco_o'] ?>" data-nco="<?= $comprobantes['ret'][$i]['nco_o'] ?>" data-tip="<?= $comprobantes['ret'][$i]['tip_o'] ?>" data-suc="<?= $comprobantes['ret'][$i]['suc_o'] ?>" data-cod="<?= $comprobantes['ret'][$i]['cod_o'] ?>" data-emp="<?= $comprobantes['ret'][$i]['EMP'] ?>" data-remito="0">                       
                        <?php } ?>
                    <?php if (FLAG_HO == false) { ?>
                            <span class="emp"><?= $comprobantes['ret'][$i]['NOM'] ?></span>
                        <?php } ?>    
                        <span class="fec"><?= $comprobantes['ret'][$i]['fep']->date ?></span>                    
                        <span class="comp">&nbsp;<?= $comprobantes['ret'][$i]['ncNCO'] ?></span>
                        <span class="fpa">&nbsp;<?= $comprobantes['ret'][$i]['fpa'] ?></span>
                        <span class="tco">&nbsp;<?= isset($comprobantes['ret'][$i]['tco']) ? $comprobantes['ret'][$i]['tco'] : '' ?></span>
                        <span class="deb">&nbsp;<?= $comprobantes['ret'][$i]['DEB'] ?></span>
                        <span class="cred">&nbsp;<?= $comprobantes['ret'][$i]['CRED'] ?></span>
                        <span class="sal">&nbsp;<?= $comprobantes['ret'][$i]['SAL'] ?></span>
                        <span class="rtos">&nbsp;</span>                      
                        <span class="obs">&nbsp;<?= $comprobantes['ret'][$i]['obs'] ?></span>
                        <span class="venc">&nbsp;<?= $comprobantes['ret'][$i]['ven'] ?></span>
                        <?php if (isset($comprobantes['ret'][$i]['DET1'])) { ?><span class="con">&nbsp;<?= $comprobantes['ret'][$i]['DET1'] ?></span><?php } ?>
                        <?php if (isset($comprobantes['ret'][$i]['DET3'])) { ?><span class="veh">&nbsp;<?= $comprobantes['ret'][$i]['DET3'] ?></span><?php } ?>
                    </li>
                </ul>                
                <?php
                    if (FLAG_HO == false) {
                        //Nueva sub-cta
                        if (isset($comprobantes['ret'][$i + 1]['CLI']) && isset($comprobantes['ret'][$i]['CLI']) && ($comprobantes['ret'][$i]['CLI'] != $comprobantes['ret'][$i + 1]['CLI'])) {
                            echo " - ";
                            ?><div id = "titulo_sub_cta_madre" class="titulo_sub_cta_madre">SUB-CTA: <?php echo $comprobantes['ret'][$i + 1]['NOMCTA'] ?></div>
                            <?php
                        }
                    }
                }
            }
            ?>
            
            <?php if (!$comprobantes['ret']): ?>
                <div class="div_saldo msgnodata">
                    <div class="msg">Cliente sin Datos en Cta. Corriente. - Puede tener Remitos para facturar ( pendientes ). </div>
                </div>
            <?php endif; ?>

        </div>
        <div class="div_saldo titulos" id="tot_down" style="display:none;">
            <?php if (FLAG_HO == false) { ?>
            <div class="saldo" style="width: 310px;">Totales al: <?php echo $comprobantes['totales']['hasta'] ?></div>
            <?php } else { ?>
            <div class="saldo" style="width: 230px;">Totales al: <?php echo $comprobantes['totales']['hasta'] ?></div>
            <?php } ?>
            <div class="debito"><?php echo $comprobantes['totales']['deb'] ?></div>
            <div class="credito"><?php echo $comprobantes['totales']['cre'] ?></div>
            <div class="saldos"><?php echo $comprobantes['totales']['sal'] ?></div>
            <div class="pendientes"><?php echo $comprobantes['totales']['rtos'] ?></div>
            <div class="obs"><?php echo $comprobantes['totales']['obs'] ?></div>
            <button onclick="total_arriba();" id="bt_abajo">Mostrar Arriba</button>
        </div>
        <div class="button_form">
            <button class="botones-inferiores" onclick="cerrar_lista();">Cerrar</button>
            <button class="botones-inferiores" onclick="imprimir_excel();">Exportar</button>
        </div>

        <div class="mostrar_remitos" hidden>
            <div class="remitos">
                <label>REMITOS</label>
            </div> 
                <div class="table-remitos">      
                    <ul class="title">
                        <li>
                            <span class="fec">Fecha</span>
                            <span class="comp">Comprobante</span>
                            <span class="fpa">FPA</span>
                            <span class="tco">TCO</span>
                            <span class="deb">TOTAL</span>
                            <span class="obs">Observaciones</span>
                            <span class="venc">Vencimientos</span>
                        </li>
                    </ul>

                    <div class="content-lista-scroll" id="lista_dat_remitos">                
                    </div>

                    <div class="button_form_remito">
                    </div>
                </div>
        </div>
</div>