<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: 10px;
            }

            .new-page{ page-break-before: always; }
            
            #watermark 
            {
                position: fixed;
                opacity: 0.2;
                /** 
                    Establece una posición en la página para tu imagen
                    Esto debería centrarlo verticalmente
                **/
                bottom:   13cm;
                left:     6.5cm;

                /** Cambiar las dimensiones de la imagen **/
                width:    8cm;
                height:   8cm;

                /** Tu marca de agua debe estar detrás de cada contenido **/
                z-index:  -1000;
            }

        </style>
    </head>
    <!--<body style="page-break-before: always;">-->
    <body>
    
        <div id="watermark">
            <img src="web/images/logo/<?=$o_GSS_CompaniaBN->getRuc()?>_black.jpg" height="100%" width="100%" >
        </div>

        <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"  >
            <tr>
                <td style="width: 30%">

                    <div style="">
                        <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0"  >
                            <tr>
                                <td style=""> <img src="web/images/logo/<?=$o_GSS_CompaniaBN->getRuc()?>.jpg" style="width: <?=$o_GSS_CompaniaBN->getLogoFileAncho()?>px; height: <?=$o_GSS_CompaniaBN->getLogoFileAlto()?>px;" > </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td style="width: 38%">
                    <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0" >
                        <tr>
                            <td style="font-size: 18px;" align="center">
                                <label><b>REPORTE DE BANCOS</b></label>
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 30%;">

                    <table style="width: 100%;" border="0" cellpadding="0" cellspacing="0" >
                        <tr>
                            <td style="font-size: 10px;" align="center">
                                <label><b>Fecha : <?=date( "Y-m-d H:i:s" )?></b></label>
                            </td>
                        </tr>
                    </table>

                </td>
            </tr>
        </table>
        
        <div style="border-top-right-radius: 5px; border-top-left-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-top: 10px;
                    border: 1px solid #B9B5B5; padding: 5px; ">

            <table style="width: 100%;" border="0" cellpadding="2" cellspacing="0" >
                <tr>
                    <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid ; border-left: 1px solid; border-top: 1px solid; border-color: #B9B5B5;
                            border-top-left-radius: 5px; border-bottom-left-radius: 5px;
                            " align="center"><b>FECHA</b></td>
                    <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>NRO</b></td>
                    <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>DESCRIPCION</b></td>
                    <td style="width: 20%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>BENEFICIARIO</b></td>
                    <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>TC</b></td>
                    <td style="width: 10%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>DEBE</b></td>
                    <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-color: #B9B5B5;" align="center"><b>HABER</b></td>
                    <td style="width: 5%; background-color: #EEEEEE; border-bottom: 1px solid; border-top: 1px solid; border-right: 1px solid; border-color: #B9B5B5; 
                               border-bottom-right-radius: 5px; border-top-right-radius: 5px;" align="center"><b>SALDO</b></td>
                </tr>

                <?php
                $f_SaldoFinal['LO'] = 0;
                $f_SaldoFinal['EX'] = 0;
                $f_SaldoFinal['MN'] = 0;
                ?>
                <?php foreach ( $a_DataResult as $i_Key => $a_Data ){ ?>
                    <?php $s_Background = "background-color: #F0F0F0;"; ?>

                <tr style="height: 25; <?=$s_Background?>">
                    <td style="" align="center"><b>CUENTA :</b></td>
                    <td style="" align="left" colspan="2"><b><?=$a_Data['NumeroCuenta']?></b></td>
                    <td style="" align="left" colspan="2"><b>BCO. <?=$a_Data['DescripcionLocal']?></b></td>
                    <td style="" align="left"><b>MONEDA : </td>
                    <td style="" align="left"><b><?=$a_Data['NombreMoneda']?></b></td>
                    <td align="right">&nbsp;</td>
                </tr>

                <tr style="">
                    <td style="" align="center"><b> - - </b></td>
                    <td style="" align="center" colspan=""><b> - </b></td>
                    <td style="" align="center" colspan=""><b>SALDO INICIAL</b></td>
                    <td style="" align="left" colspan="2">&nbsp;</td>
                    <td style="" align="center"> <?=number_format( $a_Data['SaldoInicialDebe'], 2 )?> </td>
                    <td style="" align="center"> <?=number_format( $a_Data['SaldoInicialHaber'], 2 )?> </td>
                    <td align="right"> <?=number_format( $a_Data['SaldoInicialSaldo'], 2 )?> &nbsp;</td>
                </tr>

                    <?php $f_Saldo   = 0 ?>
                    <?php $f_SaldoMN = 0 ?>
                    <?php $f_Saldo   = $f_Saldo + $a_Data['SaldoInicialSaldo']; ?>
                    <?php $f_SaldoMN = $f_Saldo + $a_Data['SaldoInicialSaldoMN']; ?>

                    <?php foreach ( $a_Data['a_DocRecibo'] as $i_Key2 => $o_FCO_DocReciboBN ){ ?>
                <tr style="">
                    <td style="" align="center"><?=$o_FCO_DocReciboBN->getReciboFecha()?></td>
                    <td style="" align="center"><?=$o_FCO_DocReciboBN->getReciboNumero()?></td>
                    <td style="" align="center"><?=$o_FCO_DocReciboBN->getDescripcion()?></td>
                    <td style="" align="center"><?=$o_FCO_DocReciboBN->getNombreCliente()?></td>
                    <td style="" align="center"><?=number_format( $o_FCO_DocReciboBN->getTipoCambio(), 2 )?></td>
                    <td style="" align="center"><?=number_format( $o_FCO_DocReciboBN->getMontoDebe(), 2 )?></td>
                    <td style="" align="center"><?=number_format( $o_FCO_DocReciboBN->getMontoHaber(), 2 )?></td>
                    <td style="" align="center"><?=number_format( $f_Saldo + $o_FCO_DocReciboBN->getMontoDebe() - $o_FCO_DocReciboBN->getMontoHaber(), 2 )?></td>
                </tr>
                        <?php $f_Saldo = $f_Saldo + $o_FCO_DocReciboBN->getMontoDebe() - $o_FCO_DocReciboBN->getMontoHaber(); ?>
                        <?php $f_SaldoMN = $f_SaldoMN + $o_FCO_DocReciboBN->getMontoDebeMN() - $o_FCO_DocReciboBN->getMontoHaberMN(); ?>
                    <?php } ?>

                <tr style="">
                    <td style="" align="center"><b> - - </b></td>
                    <td style="" align="center" colspan=""><b> - </b></td>
                    <td style="" align="center" colspan=""><b>&nbsp;</b></td>
                    <td style="" align="left" colspan="2">&nbsp;</td>
                    <td style="" align="center"> &nbsp; </td>
                    <td style="" align="center"> <b>SALDO</b> </td>
                    <td align="right"><b><?=number_format( $f_Saldo, 2 )?></b></td>
                </tr>

                    <?php
                    if( $a_Data['IdMoneda'] == "LO" )
                    {
                        $f_SaldoFinal['LO'] = $f_SaldoFinal['LO'] + $f_Saldo;
                    }
                    if( $a_Data['IdMoneda'] == "EX" )
                    {
                        $f_SaldoFinal['EX'] = $f_SaldoFinal['EX'] + $f_Saldo;
                    }
                    $f_SaldoFinal['MN'] = $f_SaldoFinal['MN'] + $f_SaldoMN;
                    ?>

                <?php } ?>
                
            </table>

            <br>

            <table style="width: 100%;" border="0" cellpadding="2" cellspacing="0" >
                <tr style="background-color: #F0F0F0;">
                    <td style="width: 90%" align="right"> <b>SALDO FINAL EN DOLARES:</b> </td>
                    <td align="right"> <b><?=number_format( $f_SaldoFinal['EX'], 2 )?></b></td>
                </tr>
                <tr style="background-color: #F0F0F0;">
                    <td style="width: 90%" align="right"> <b>SALDO FINAL EN SOLES:</b> </td>
                    <td align="right"> <b><?=number_format( $f_SaldoFinal['LO'], 2 )?></b></td>
                </tr>
                <tr style="background-color: #F0F0F0;">
                    <td style="width: 90%" align="right"> <b>SALDO FINAL CONVERTIDO EN SOLES:</b> </td>
                    <td align="right"> <b><?=number_format( $f_SaldoFinal['MN'], 2 )?></b> </td>
                </tr>
            </table>
        </div>
        
    </body>
</html>