<html>
    <head>
        <style type="text/css">
            @page 
            {
                size: A4 portrait;
                margin: 0cm 0cm;
            }

            header 
            {
                font-family: Arial, Helvetica, sans-serif;
                font-size: 10px;
            }

            footer 
            {
                bottom: 0cm; 
                left: 0cm; 
                right: 0cm;
            }

            body 
            {
                margin : 0.5cm;
                /*margin-top: 1cm;*/
                font-family: Arial, Helvetica, sans-serif;
                font-size: 10px;
                /*margin-top: 0.5cm;
                margin-left: 0.5cm;
                margin-right: 0.5cm;
                margin-bottom: 0.5cm;*/
            }

            table
            {
                font-family: Arial, Helvetica, sans-serif;
                font-size: 9px;
            }

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

        </style>
    </head>
    <!--<body style="page-break-before: always;">-->
    <body>
        <br>

        <h2 style="background-color: #C9CACC; padding: 5px;"> <?=$s_Title?> </h2>

        <table style="width: 100%; font-size: 10px;" border="0" cellpadding="2" cellspacing="0" >
            <tr>
                <th style="text-align: left; width: 10%;">Pto Vta</th>
                <th style="text-align: left; width: 2%;">:</th>
                <th style="text-align: left; width: 30%;"><?=$o_FCO_CajaBN->getObjectSucursal()->getDescripcion()?></th>
                <th style="text-align: left; width: 10%;">Caja</th>
                <th style="text-align: left; width: 2%;">:</th>
                <th style="text-align: left; width: 30%;"><?=$o_FCO_CajaBN->getDescripcion()?></th>
            </tr>
            <tr>
                <th style="text-align: left; ">Fecha</th>
                <th style="text-align: left; ">:</th>
                <th style="text-align: left; "><?=$s_FechaResumenDia?></th>
                <th style="text-align: left; ">Fec. Cierre</th>
                <th style="text-align: left; ">:</th>
                <th style="text-align: left; "><?=$s_FechaHoraCierre?></th>
            </tr>
            <tr>
                <th style="text-align: left; ">Cajero</th>
                <th style="text-align: left; ">:</th>
                <th style="text-align: left; "><?=$s_NombreCajero?></th>
                <th style="text-align: left; ">Usuario</th>
                <th style="text-align: left; ">:</th>
                <th style="text-align: left; "><?=implode( ", ", $a_Usuarios )?></th>
            </tr>
            <tr>
                <th style="text-align: left; ">Turno</th>
                <th style="text-align: left; ">:</th>
                <th style="text-align: left; "><?=$o_FCO_CierreBN->getTipoTunoDesc()?></th>
                <th style="text-align: left; ">&nbsp;</th>
                <th style="text-align: left; ">&nbsp;</th>
                <th style="text-align: left; ">&nbsp;</th>
            </tr>
        </table>

        <hr>
        
        <h4 style="margin-bottom: 0px;"> Resumen de Documentos </h4>
        <table style="width: 100%; " border="0" cellpadding="2" cellspacing="0" >
            <tr style="background-color: #ECEBEC;">
                <th align="center" style="width: 10%;">Tipo</th>
                <th align="center" style="width: 10%;">Serie</th>
                <th align="center" style="width: 10%;">Inicio</th>
                <th align="center" style="width: 10%;">Fin</th>
                <th align="center" style="width: 10%;">Comp Cant</th>
                <th align="center" style="width: 10%;">Comp Anul</th>
                <th align="center" style="width: 10%;">Comp Pend</th>
            </tr>
            <?php foreach ( $a_ResumenDocumentos as $s_Key => $a_Values ) { ?>
                <?php
                $a_Data = explode( "_", $s_Key );
                ?>
            <tr>
                <td align="center"><?=$a_Data[0]?></td>
                <td align="center"><?=$a_Data[1]?></td>
                <td align="center"><?=$a_Values['Inicio']?></td>
                <td align="center"><?=$a_Values['Fin']?></td>
                <td align="center"><?=$a_Values['Cant']?></td>
                <td align="center"><?=$a_Values['CantAnu']?></td>
                <td align="center"><?=$a_Values['CantPen']?></td>
            </tr>
            <?php } ?>
        </table>

        <h4 style="margin-bottom: 0px;"> Resumen de Caja </h4>
        <table style="width: 100%; " border="0" cellpadding="2" cellspacing="0" >
            <tr style="background-color: #ECEBEC;">
                <th align="center" style="width: 20%;">Medio de Pago</th>
                <th align="center" style="width: 20%;">Moneda</th>
                <th align="center" style="width: 20%;">Banco</th>
                <th align="center" style="width: 20%;">Cuenta</th>
                <th style="width: 20%;" align="center">Comprobantes</th>
                <th style="width: 20%;" align="right">Total</th>
            </tr>
            <?php $f_TotalMedioPago = 0; ?>
            <?php foreach ( $a_ResumnenCaja as $s_Key => $a_Values ) { ?>
                <?php
                ?>
            <tr>
                <td align="center"><?=$a_Values['TipoPagoNombre']?></td>
                <td align="center"><?=$a_Values['MonedaDes']?></td>
                <td align="center"><?=$a_Values['BancoDesc']?></td>
                <td align="center"><?=$a_Values['CuentaBancaria']?></td>
                <td align="center"><?=$a_Values['CantTrx']?></td>
                <td align="right"><?=number_format( $a_Values['MontoAplicado'], 2 )?></td>
            </tr>
                <?php $f_TotalMedioPago = $f_TotalMedioPago + $a_Values['MontoAplicado']; ?>
            <?php } ?>

            <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td style="border-top: solid 1px #000;" align="center">TOTAL</td>
                <td style="border-top: solid 1px #000;" align="right"><?=number_format( $f_TotalMedioPago, 2 )?></td>
            </tr>

        </table>
        
        <div class="new-page"></div>
        
        <h2 style="background-color: #C9CACC; padding: 5px;">Detalle de Movimiento de Caja</h2>

        <?php if( $a_DOC_VTA_Documento ){ ?>
            <h4 style="margin-bottom: 0px;"> Documentos Anulados </h4>
            <table style="width: 100%; " border="0" cellpadding="2" cellspacing="0" >
                <tr style="background-color: #ECEBEC;">
                    <th align="center" style="width: 10%;">Documento</th>
                    <th align="center" style="width: 10%;">Fecha</th>
                    <th align="center" style="width: 10%;">Moneda</th>
                    <th align="right" style="width: 10%;">Total Comp</th>
                    <th align="center" style="width: 20%;">Cliente</th>
                    <th align="center" style="width: 10%;">&nbsp;</th>
                    <th align="right" style="width: 10%;">&nbsp;</th>
                </tr>
                <?php foreach( $a_DOC_VTA_Documento as $o_DOC_VTA_DocumentoBN ){ ?>
                    <tr>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getDocumentoSerieNumero()?></td> <?php //$o_DOC_VTA_DocumentoBN->getDocumentoCod() ?>
                        <td align="center"><?=substr( $o_DOC_VTA_DocumentoBN->getFechaDocumento(), 0, 10 )?></td>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getMonedaDocumento()=='LO'?'SOLES':'DOLARES'?></td>
                        <td align="right"><?=number_format( $o_DOC_VTA_DocumentoBN->getMontoTotal(), 2)?></td>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getClienteNombre()?></td>
                        <td align="center">&nbsp;</td>
                        <td align="right">&nbsp;</td>
                    </tr>
                <?php } ?>
            </table>
        <?php } ?>

        <?php if( $a_PE_VTA_Documento ){ ?>
            <h4 style="margin-bottom: 0px;"> Documentos Pendiente de Cobro </h4>
            <table style="width: 100%; " border="0" cellpadding="2" cellspacing="0" >
                <tr style="background-color: #ECEBEC;">
                    <th align="center" style="width: 10%;">Documento</th>
                    <th align="center" style="width: 10%;">Fecha</th>
                    <th align="center" style="width: 10%;">Moneda</th>
                    <th align="right" style="width: 10%;">Total Comp</th>
                    <th align="center" style="width: 20%;">Cliente</th>
                    <th align="center" style="width: 10%;">Condicion Venta</th>
                    <th align="right" style="width: 10%;">&nbsp;</th>
                </tr>
                <?php foreach( $a_PE_VTA_Documento as $o_DOC_VTA_DocumentoBN ){ ?>
                    <tr>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getDocumentoSerieNumero()?></td>
                        <td align="center"><?=substr( $o_DOC_VTA_DocumentoBN->getFechaDocumento(), 0, 10 )?></td>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getMonedaDocumento()=='LO'?'SOLES':'DOLARES'?></td>
                        <td align="right"><?=number_format( $o_DOC_VTA_DocumentoBN->getMontoTotal(), 2)?></td>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getClienteNombre()?></td>
                        <td align="center"><?=$o_DOC_VTA_DocumentoBN->getFormaPagoDes()?></td>
                        <td align="right">&nbsp;</td>
                    </tr>
                <?php } ?>
            </table>
        <?php } ?>

        <?php $f_SumaTotal = 0 ?>
        <?php foreach ( $a_DetMovimiento as $s_Key => $a_Values ) { ?>
            <?php //$a_Values = array_shift( $a_Values ); ?>
        <h4 style="margin-bottom: 0px;"> <?=$a_Values['TipoPagoNombre']?> - <?=$a_Values['MonedaDes']?> - <?=$a_Values['BancoDesc']?> - <?=$a_Values['CuentaBancaria']?> </h4>
        <table style="width: 100%; " border="0" cellpadding="2" cellspacing="0" >
            <tr style="background-color: #ECEBEC;">
                <th align="center" style="width: 10%;">Documento</th>
                <th align="center" style="width: 10%;">Fecha</th>
                <th align="center" style="width: 10%;">Moneda</th>
                <th align="right" style="width: 10%;">Total Comp</th>
                <th align="center" style="width: 20%;">Cliente</th>
                <th align="center" style="width: 10%;">No Operacion</th>
                <th align="right" style="width: 10%;">Imp Cobrado</th>
                <!-- <th align="center" style="width: 10%;">Usuario</th> -->
            </tr>
            <?php 
            $s_SumaTotal = 0;
            $s_SumaImportePago = 0;
            ?>
            <?php foreach ( $a_Values['DetCaja'] as $i_Key2 => $o_FCO_AplicacionBN ) { ?>
                <?php
                //pr( $o_FCO_AplicacionBN );
                ?>
            <tr>
                <td align="center"><?=$o_FCO_AplicacionBN->getSerieNumeroDocRef()?></td>
                <td align="center"><?=substr( $o_FCO_AplicacionBN->getFechaDocRef(), 0, 10 )?></td>
                <td align="center"><?=$o_FCO_AplicacionBN->getIdMonedaRef()=='LO'?'SOLES':'DOLARES'?></td>
                <td align="right"><?=number_format( $o_FCO_AplicacionBN->getMontoTotalDocRef(), 2)?></td>
                <td align="center"><?=$o_FCO_AplicacionBN->getNombreCliente()?></td>
                <td align="center"><?=$o_FCO_AplicacionBN->getReciboNumero()?></td>
                <td align="right"><?=number_format( $o_FCO_AplicacionBN->getMontoAplicado(), 2 )?></td>
                <!-- <td align="center"><?=$o_FCO_AplicacionBN->getCodVendedorRef()?></td> -->
            </tr>
                <?php
                $s_SumaTotal = $s_SumaTotal + $o_FCO_AplicacionBN->getMontoTotalDocRef();
                $s_SumaImportePago = $s_SumaImportePago + $o_FCO_AplicacionBN->getMontoAplicado();
                ?>
            <?php } ?>
            <!-- 
            <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td align="right" style="border-top: solid 1px #000;"><?=number_format( $s_SumaTotal, 2)?></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td align="right" style="border-top: solid 1px #000;"><?=number_format( $s_SumaImportePago, 2)?></td>
            </tr>
            -->
        </table>
            <?php $f_SumaTotal = $f_SumaTotal + $s_SumaImportePago ?>
        <?php } ?>
        <!-- 
        <BR>
        <table style="width: 100%; " border="0" cellpadding="2" cellspacing="0" >
            <tr>
                <td align="right" width="80%"> <b>TOTAL</b> </td>
                <td align="right" width="20%" style="border-top: solid 1px #000;"> <?=number_format( $f_SumaTotal, 2 )?> </td>
            </tr>
        </table>
        -->
    </body>
</html>