<?php
/*****************************************************************************************************************************************
 * DEV: CONTRALORIA DE ESTADOS
 * PROYECTO: SISTEMA INTEGRAL ADMINISTRATIVO DE CONTRALORIAS DE ESTADOS
 * MODULO: index
 * PROCESO: index del sistema
 * PROGRAMADORES:
 * | # |          NOMBRES Y APELLIDOS              |               CORREO               |          TELEFONO              |
 * | 1 |          Daniel Muñoz                     |d.munoz@contraloriamonagas.gob.ve   |         0412-8358676           |
 * |   |                                           |                                    |                                |
 * |___|___________________________________________|____________________________________|________________________________|
 *
 * VERSION
 *
 * |          PROGRAMADOR                  |          FECHA          |       VERSION      |
 * |               #1                      |        27-08-2015       |         1.0        |
 * |                                       |                         |                    |
 * |_______________________________________|_________________________|____________________|
 *
 *****************************************************************************************************************************************/

require_once LIBRERIA_FPDF;


/**
*Cabecera reporte Libro banco
*/
class ReporteLibroBanco extends FPDF
{
    //Page header
    function Header(){

	$this->SetFillColor(255, 255, 255);
        $this->SetDrawColor(0, 0, 0);
        $this->Image('publico/imagenes/logos/CES.png', 7, 5, 18);
        $this->SetFont('Arial', 'B', 7);
        $this->SetXY(25,6); $this->Cell(100,5,utf8_decode('REPÚBLICA BOLIVARIANA DE VENEZUELA'),0,1,'L');
        $this->SetXY(25,10); $this->Cell(100,5,utf8_decode('CONTRALORÍA DEL ESTADO SUCRE'),0,1,'L');
        $this->SetXY(25,14); $this->Cell(100,5,utf8_decode('DIRECCIÓN DE ADMINISTRACIÓN - ÁREA DE FINANZAS'),0,1,'L');
        
        $this->SetXY(160,5); $this->Cell(25,5,utf8_decode('Fecha: ' . date('d-m-Y')),0,1,'L');
        //Cambio de fecha cabecera libro banco principal
        //$this->SetXY(160,5); $this->Cell(25,5,utf8_decode('Fecha: 01-05-2023' ),0,1,'L');
     
        $this->SetXY(160,10); $this->Cell(25,5,utf8_decode('Página: '),0,1,'L'); 
        $this->Image(ROOT.'publico'.DS.'imagenes'.DS.'logos'.DS."LOGOSNCF.png", 190, 5, 15, 13);
        $this->SetXY(170, 10);$this->Cell(25, 5, $this->PageNo().' de {nb}', 0, 1, 'L');
        $this->Ln(5);
        $desde = $_GET['desde'];
        $hasta = $_GET['hasta'];
        $this->SetFont('Arial', 'B', 10);
        $this->SetXY(10, 20); $this->Cell(190, 5, utf8_decode('REPORTE DE BANCOS'), 0, 1, 'C', 0);
        $this->SetFont('Arial', 'B', 10);
        $this->SetXY(10, 30); $this->Cell(190, 5, "Desde $desde  Hasta $hasta", 0, 1, 'C', 0);

        //Cambio de fecha cabecera libro banco desde hasta
        //$this->SetXY(10, 30); $this->Cell(190, 5, "Desde 2018-12-01  Hasta 2018-12-29", 0, 1, 'C', 0);

        $this->SetTextColor(0, 0, 0);
        $this->SetDrawColor(0, 0, 0);
        $this->SetFillColor(255, 255, 255);
        ##
        $this->Ln(5);
        $this->SetFont('Arial', 'B', 6);
        $this->SetWidths(array(15, 15, 17, 75,/*6,15,*/ 20, 20, 20));
        $this->SetAligns(array('C', 'C', 'C', 'L', /*'C', 'C',*/ 'R', 'R', 'R'));
        $this->Row(array('Fecha',
            'Voucher',
            'Comprobante',
            'Concepto',
            //'Est.',
            /*utf8_decode('Transacción'),*/
            'Debe',
            'Haber',
            'Saldo'));
        $this->Ln(1);
        $this->SetDrawColor(0, 0, 0);
        $this->SetFillColor(0, 0, 0);
        //$this->Rect(10, 270, 197, 0.1, 'DF');
//---------------------------------------------------
    
}

    //Page footer
    function Footer(){
        //Position at 1.5 cm from bottom

        //$this->SetXY(154,13);
        //Arial italic 8
        //$this->SetFont('Arial','I',8);
        //Page number
        //$this->Cell(0,10,' '.$this->PageNo().'/{nb}',0,0,'C');
    }
}

class pdf extends FPDF
{
    //Page header

    function cabecera()
    {



        $this->SetDrawColor(255, 255, 255);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0, 0, 0);
        $this->SetFont('Courier', 'B', 12);
        $this->SetXY(20, 10);
        $this->Cell(190, 5, utf8_decode(APP_ORGANISMO), 0, 1, 'L');
        $this->SetX(180);
        $this->Cell(0, 5, 'Pagina: '.$this->PageNo().'', 0, 1, 'L');
        $this->SetX(15);
        $this->SetFont('Courier', 'B', 10);
        $this->Cell(190, 5, 'Fecha de Emision:'.date('Y-m-d H:i:s'), 0, 1, 'R');

        $this->Ln(5);
        $this->SetDrawColor(0, 0, 0);
        $this->SetFillColor(255, 255, 255);
        $this->SetTextColor(0, 0, 0);
        $this->SetFont('Courier', 'B', 11);

        $this->SetWidths(array(70,65,60));
        $this->SetAligns(array('L','L','L','L'));
        $this->Ln(5);

    }

    function RoundedRect($x, $y, $w, $h, $r, $style = '') {
        $k = $this->k;
        $hp = $this->h;
        if($style=='F')
            $op='f';
        elseif($style=='FD' || $style=='DF')
            $op='B';
        else
            $op='S';
        $MyArc = 4/3 * (sqrt(2) - 1);
        $this->_out(sprintf('%.2F %.2F m',($x+$r)*$k,($hp-$y)*$k ));
        $xc = $x+$w-$r ;
        $yc = $y+$r;
        $this->_out(sprintf('%.2F %.2F l', $xc*$k,($hp-$y)*$k ));

        $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
        $xc = $x+$w-$r ;
        $yc = $y+$h-$r;
        $this->_out(sprintf('%.2F %.2F l',($x+$w)*$k,($hp-$yc)*$k));
        $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
        $xc = $x+$r ;
        $yc = $y+$h-$r;
        $this->_out(sprintf('%.2F %.2F l',$xc*$k,($hp-($y+$h))*$k));
        $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
        $xc = $x+$r ;
        $yc = $y+$r;
        $this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-$yc)*$k ));
        $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
        $this->_out($op);
    }

    function _Arc($x1, $y1, $x2, $y2, $x3, $y3) {
        $h = $this->h;
        $this->_out(sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $x1*$this->k, ($h-$y1)*$this->k,
            $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
    }

    //Page footer
    function Footer()
    {

    }
}
