<?php

//require_once('config/lang/eng.php');
require_once('tcpdf6.php');

// extend TCPF with custom functions
class CDPDF6 extends TCPDF6 {

    public $aprobado = " "; //aprobado - 20200917::LAVILA
    public $tipo;
    public $titulo;
    public $version;
    public $contrato;
    public $contratista;
    public $tipo_contrato;

    public function settipocontrato($tipo_contrato) {
        $this->tipo_contrato = $tipo_contrato;
    }

    public function setAprobado($aprobado) {
        //$aprobado = strtoupper($aprobado);
        $this->aprobado = $aprobado;
    }

    public function setTipo($tipo) {
        $tipo = strtoupper($tipo);
        $this->tipo = $tipo;
    }

    public function setTitulo($titulo) {
        $this->titulo = $titulo;
    }

    public function setVersion($version) {
        $this->version = $version;
    }

    public function setContrato($contrato) {
        $this->contrato = $contrato;
    }

    public function setContratista($contratista) {
        $this->contratista = $contratista;
    }

    public function HeaderOff() {
        $html = '<table cellspacing="0" cellpadding="1" border="0"><tr><td rowspan="3">test</td><td>test</td><td>test</td></tr></table>';
        $this->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'top', $autopadding = true);
    }

    public function Header() {

        $this->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        if ($this->tipo == 1) {

            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, (PDF_MARGIN_RIGHT - 5));
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="1" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="40%" align="center"><br/><br/><b>' . $this->titulo . '</b></td>';
            $html .= '<td width="30%"><table border="1" width="100%">';
            $html .= '<tr><td width="100%"><img width="150px" height="30px" src="images/minminas_prospe.png"/></td></tr>';
            $html .= '<tr><td width="100%" align="center">Version 7</td></tr>';
            $html .= '<tr><td width="100%" align="center">F-CIN-PER-002</td></tr>';
            $html .= '<tr><td width="100%" align="center">Página ' . $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages() . '</td></tr>';
            $html .= '</table></td></tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT - 5, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - (PDF_MARGIN_RIGHT - 5), $this->getPageHeight() - PDF_MARGIN_BOTTOM);
            //Marca de agua
            //$this->Image(K_PATH_IMAGES . 'borrador.jpg', 0, 30, 200, 200, '', '', '', true, 150);
        }
        if ($this->tipo == 2) {

            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="2" cellpadding="5" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="40%" rowspan="4" align="center"><br/><br/><b>' . $this->titulo . '</b></td>';
            $html .= '<td width="30%"><table border="2" width="100%">';
            $html .= '<tr><td width="100%"><img width="150px" height="30px" src="images/minminas_prospe.png" /></td></tr>';
            $html .= '<tr><td width="100%">Version </td></tr>';
            $html .= '<tr><td width="100%">Codigo </td></tr>';
            $html .= '<tr><td width="100%">Página ' . $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages() . '</td></tr></table></td></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
            //Marca de agua
            $this->Image(K_PATH_IMAGES . 'borrador.jpg', 0, 30, 200, 200, '', '', '', true, 150);
        }
        if ($this->tipo == 4) {

            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="2" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="40%" align="center"><br/><br/><b>' . $this->titulo . '</b></td>';
            $html .= '<td width="30%"><table border="2" width="100%">';
            $html .= '<tr><td width="100%"><img width="150px" height="30px" src="images/minminas_prospe.png"/></td></tr>';
            $html .= '<tr><td width="100%" align="center">Version 2</td></tr>';
            $html .= '<tr><td width="100%" align="center">Codigo F-CIN-LIC-014</td></tr>';
            $html .= '<tr><td width="100%" align="center">Página ' . $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages() . '</td></tr>';
            $html .= '</table></td></tr></table>';
            $this->writeHTML($html);
        }

        if ($this->tipo == 5) {

            $date = date('d-M-y');
            //Margenes
            $this->SetMargins(30, 15, 30);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="2" width="100%"><tr><td width="30%"><img width="100px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="40%" align="center"><br/><br/><b>' . $this->titulo . '</b></td>';
            $html .= '<td width="30%"><table border="2" width="100%">';
            $html .= '<tr><td width="100%"><img width="100px" height="30px" src="images/minminas_prospe.png"/></td></tr>';
            $html .= '<tr><td width="100%" align="center">Fecha: ' . $date . '</td></tr>';
            $html .= '<tr><td width="100%" align="center">Página ' . $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages() . '</td></tr>';
            $html .= '</table></td></tr></table>';
            $this->writeHTML($html);
        }

        if ($this->tipo == 6) {

            $date = date('d-M-y');
            //Margenes
            $this->SetMargins(30, 15, 30);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);

            $this->titulo = '';

            $html = '<table border="2" width="100%">';
            $html .= '<tr>';
            $html .= '<td width="25%" align="left" valign="bottom"><img src="images/LogoEmpresa2.png" alt="" width="80px" height="83px" /></td>';
            $html .= '<td width="60%"><br /><br /></td>';
            $html .= '<td width="25%" align="center" valign="bottom"><br/><img src="images/prosperidad.png" alt="" width="130px" height="60px" /></td>';
            $html .= '</tr>';
            $html .= '</table>';

            //$this->writeHTML($html);
        }
        if ($this->tipo == 7) {//Version Remplaza el Tipo 1 a partir de 20190701 
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, (PDF_MARGIN_RIGHT - 5));
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="2" width="100%"><tr><td width="70%"><img width="320px" height="65px" src="images/LogoEmpresa.png" /></td>';
            //$html .= '<td width="40%" style="align:center;vertical-align: middle"><img width="200px" height="40px" src="images/minminas_props20190701.png"/></td>';
            $html .= '<td width="30%"><table border="2" width="100%" height="100%">';
            $html .= '<tr><td width="100%" align="center">Version 7</td></tr>';
            $html .= '<tr><td width="100%" align="center">F-CIN-PER-002</td></tr>';
            $html .= '<tr><td width="100%" align="center">Página ' . $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages() . '</td></tr>';
            $html .= '</table></td></tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
        }
        if ($this->tipo == 8) {//Version Remplaza el Tipo 2 a partir de 20190701 
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, (PDF_MARGIN_RIGHT - 5));
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="1" width="100%"><tr><td width="70%"><img width="320px" height="65px" src="images/LogoEmpresa.png" /></td>';
            //$html .= '<td width="40%" style="align:center;vertical-align: middle"><img width="200px" height="40px" src="images/minminas_props20190701.png" /></td>';
            $html .= '<td width="30%"><table border="1" width="100%" height="100%">';
            $html .= '<tr><td width="100%">Version </td></tr>';
            $html .= '<tr><td width="100%">Codigo </td></tr>';
            $html .= '<tr><td width="100%">Página ' . $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages() . '</td></tr></table></td></tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT - 5, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - (PDF_MARGIN_RIGHT - 5), $this->getPageHeight() - PDF_MARGIN_BOTTOM);
            //Marca de agua
            $this->Image(K_PATH_IMAGES . 'borrador.jpg', 0, 30, 200, 200, '', '', '', true, 150);
        }
        if ($this->tipo == 9) {//Header CEV
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '';
            $html .= '<table border="2" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="center">';
            $html .= '<table width="100%">';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<br/>';
            $html .= '<b>' . $this->titulo . '</b>';
            $html .= '<br/>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<table border="1" width="100%">';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= 'Proceso: Gestión Jurídica y Contractual';
            $html .= '</td>';
            $html .= '<td>';
            $html .= 'Versión: 1';
            $html .= '</td>';
            $html .= '<td>';
            $html .= 'Código:F2.M1.JC';
            $html .= '</td>';
            $html .= '<td>';
            $html .= 'Fecha Publicación: 30/07/2019';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</td>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
        }
        if ($this->tipo == 10) {//HEADER CEV BORRADOR
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '';
            $html .= '<table border="2" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="center">';
            $html .= '<table width="100%">';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<br/>';
            $html .= '<b>' . $this->titulo . '</b>';
            $html .= '<br/>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<table border="1" width="100%">';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= 'Proceso: Gestión Jurídica y Contractual';
            $html .= '</td>';
            $html .= '<td>';
            $html .= 'Versión: 1';
            $html .= '</td>';
            $html .= '<td>';
            $html .= 'Código:F2.M1.JC';
            $html .= '</td>';
            $html .= '<td>';
            $html .= 'Fecha Publicación: 30/07/2019';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</td>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
            //Marca de agua
            $this->Image(K_PATH_IMAGES . 'borrador.jpg', 0, 30, 200, 200, '', '', '', true, 150);
        }
        if ($this->tipo == 11) {//Header ANM
            //Margenes
            //$this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            //$this->SetTopMargin(2);
            $this->SetFont('helvetica', '', 7);
            $html = '';
            $html .= '<table border="1" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="center">';
            $html .= '<table width="100%">';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<br/>';
            $html .= '<b>ESTUDIOS PREVIOS</b>';
            $html .= '<br/>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<b>' . $this->titulo . '</b>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</td>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
            //$this->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'top', $autopadding = true);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
            //Marca de agua
            //$this->Image(K_PATH_IMAGES . 'borrador.jpg', 0, 30, 200, 200, '', '', '', true, 150);
        }
        if ($this->tipo == 12) {//HEADER ANM BORRADOR
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '';
            $html .= '<table border="2" width="100%"><tr><td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="center">';
            $html .= '<table width="100%">';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<br/>';
            $html .= '<b>ESTUDIOS PREVIOS</b>';
            $html .= '<br/>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '<tr>';
            $html .= '<td>';
            $html .= '<b>' . $this->titulo . '</b>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</td>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
            //Marca de agua
            $this->Image(K_PATH_IMAGES . 'borrador.jpg', 0, 30, 200, 200, '', '', '', true, 150);
        }
        if ($this->tipo == 13) {//HEADER CONTRATO ESTANDART
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="2" width="100%"><tr><td width="30%"></td>';
            $html .= '<td width="40%" align="center"><br/><br/><b></b></td>';
            $html .= '<td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
            //Linea Pie de pGAINA
            $this->Line(PDF_MARGIN_LEFT, $this->getPageHeight() - PDF_MARGIN_BOTTOM, $this->getPageWidth() - PDF_MARGIN_RIGHT, $this->getPageHeight() - PDF_MARGIN_BOTTOM);
        }
        if ($this->tipo == 14) {//HEADER CONTRATO CEV
            //Margenes
            $tagvs = array(
                'p' => array(0 => array('n' => 0.1, 'h' => ''), 1 => array('n' => 0, 'h' => '')),
                'div' => array(0 => array('n' => 0, 'h' => ''), 1 => array('n' => 0, 'h' => ''))
            );
            $this->setHtmlVSpace($tagvs);
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 7);
            $html = '<table border="0" width="100%"><tr><td width="30%"></td>';
            $html .= '<td width="40%" align="center"><br/><br/><b></b></td>';
            $html .= '<td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
        }
        if ($this->tipo == 15) {//HEADER CONTRATO CEV ARRENDAMIENTO
            $tagvs = array(
                'p' => array(0 => array('n' => 0.1, 'h' => ''), 1 => array('n' => 0, 'h' => '')),
                'div' => array(0 => array('n' => 0, 'h' => ''), 1 => array('n' => 0, 'h' => ''))
            );
            $this->setHtmlVSpace($tagvs);
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 14, PDF_MARGIN_RIGHT);
            //$this->SetTopMargin(2);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER - 2);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 11);
            $html = '<table border="0" width="100%"><tr><td width="30%"></td>';
            $html .= '<td width="40%" align="center"><br/><br/><b></b></td>';
            $html .= '<td width="30%"><img width="150px" height="55px" src="images/LogoEmpresa.png" /></td>';
            $html .= '</tr>';
            $html .= '<tr>';
            $html .= '<td colspan="3"  style="text-align:justify;">';
            $html .= '<strong>CONTRATO DE ARRENDAMIENTO DE BIEN INMUEBLE No. CO-AJ-' . $this->contrato . ' SUSCRITO ENTRE LA COMISIÓN PARA EL ESCLARECIMIENTO DE LA VERDAD, LA CONVIVENCIA Y LA NO REPETICIÓN Y PROKSOL S.A.S.</strong>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</tr></table>';
            $this->writeHTML($html);
        }
        if ($this->tipo == 16) {//HEADER CONTRATO ANM PRESTACION SERVICIOS PERSONA NATURAL
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 10);
            $html = '<table border="0" width="100%"><tr>';
            $html .= '<td width="30%"><img width="120px" height="44px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="left">';
            $html .= '<strong>CLAUSULADO COMPLEMENTARIO AL CONTRATO DE ' . $this->tipo_contrato . ' No. ' . $this->contrato . ' SUSCRITO ENTRE LA AGENCIA NACIONAL DE MINERIA Y ' . $this->contratista . '.</strong>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $this->writeHTML($html);
        }
        if ($this->tipo == 17) {//HEADER CONTRATO ESTANDART ANM
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 10);
            $html = '<table border="0" width="100%"><tr>';
            $html .= '<td width="30%"><img width="120px" height="44px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="left">';
            //$html .= '<strong>CLAUSULADO COMPLEMENTARIO AL CONTRATO DE PRESTACIÓN DE SERVICIOS PROFESIONALES No. '.$this->contrato.' SUSCRITO ENTRE LA AGENCIA NACIONAL DE MINERIA Y '.$this->contratista.'.</strong>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $this->writeHTML($html);
        }
        if ($this->tipo == 18) {//HEADER CONTRATO ESTANDART ANM
            //Margenes
            $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 1, PDF_MARGIN_RIGHT);
            $this->SetHeaderMargin(PDF_MARGIN_HEADER);
            $this->SetFooterMargin(PDF_MARGIN_FOOTER);
            $this->SetFont('helvetica', '', 10);
            $html = '<table border="2" width="100%"><tr>';
            $html .= '<td width="30%"><img width="120px" height="44px" src="images/LogoEmpresa.png" /></td>';
            $html .= '<td width="70%" align="left">';
            $html .= '<strong>COMUNICACIÓN ACEPTACION DE OFERTA No. ' . $this->contrato . '.</strong>';
            $html .= '</td>';
            $html .= '</tr>';
            $html .= '</table>';
            $this->writeHTML($html);
        }
    }

    public function Footer() {
        $html = "";
        switch ($this->tipo) {
            CASE 11:
                $date = date('d-M-y  h:m');
                $time = time();
                $html = "";
                $this->SetFont('helvetica', '', 7);
                $this->SetY(-20);
                $html = '';
                $html .= '<table align="right">';
                $html .= '<tr>';
                $html .= '<td>';
                //$html .= 'APO1-P-001-F-030 / v' . $this->version;
                $html .= 'APO1-P-001-F-030';
                $html .= '</td>';
                $html .= '</tr>';
                $html .= '<tr>';
                $html .= '<td>';
                $html .= $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages();
                $html .= '</td>';
                $html .= '</tr>';
                $html .= '</table>';
                break;
            CASE 12:
                $date = date('d-M-y  h:m');
                $time = time();
                $html = "";
                $this->SetFont('helvetica', '', 7);
                $this->SetY(-20);
                $html = '';
                $html .= '<table align="right">';
                $html .= '<tr>';
                $html .= '<td>';
                //$html .= 'APO1-P-001-F-030 / v' . $this->version;
                $html .= 'APO1-P-001-F-030';
                $html .= '</td>';
                $html .= '</tr>';
                $html .= '<tr>';
                $html .= '<td>';
                $html .= $this->getAliasNumPage() . ' de ' . $this->getAliasNbPages();
                $html .= '</td>';
                $html .= '</tr>';
                $html .= '</table>';
                break;
            CASE 14:
                $date = date('d-M-y  h:m');
                $time = time();
                $html = "";
                $this->SetFont('helvetica', '', 7);
                $this->SetY(-20);

                $html = '<table style="width:600px">
                                <tr>';
                $html .= '<td style="color: #999" align="center">Comisión para el Esclarecimiento de la Verdad, la Convivencia y No Repetición.<br />
    Carrera 9 No.12 C – 10-Bogotá D.C.</td></tr>
		</table>';
                break;
            CASE 6:
                break;
            CASE 17:
                $date = date('d-M-y  h:m');
                $time = time();
                $html = "";
                $this->SetFont('helvetica', '', 7);
                $this->SetY(-20);

                $html = '<table style="width:600px">
                                <tr>
                                <td style="color: #999">' . $this->aprobado . '</td>';
                $html .= '<td style="color: #999">APO1-P-001-F-030 / v5</td>
                         <td style="color: #999">Fecha de Impresion: ' . $date . '</td></tr>
			    
                        </table>';
                break;
            CASE 16:
                $date = date('d-M-y  h:m');
                $time = time();
                $html = "";
                $this->SetFont('helvetica', '', 7);
                $this->SetY(-20);

                $html = '<table style="width:600px">
                                <tr>
                                <td style="color: #999">' . $this->aprobado . '</td>';
                $html .= '<td style="color: #999">APO1-P-001-F-030 / v5</td>
                         <td style="color: #999">Fecha de Impresion: ' . $date . '</td></tr>
                
                        </table>';
                break;
            default:
                $date = date('d-M-y  h:m');
                $time = time();
                $html = "";
                $this->SetFont('helvetica', '', 7);
                $this->SetY(-20);

                $html = '<table style="width:600px">
                                <tr>
                                <td style="color: #999">' . $this->aprobado . '</td>';
                $html .= '<td style="color: #999"></td>
                         <td style="color: #999">Fecha de Impresion: ' . $date . '</td></tr>
			    
                        </table>';
                break;
        }

        $this->writeHTML($html);
    }

    function fechaEspanol($fecha) {


        $transf = strtotime($fecha);
        $dia = date("d", $transf);
        $mes = date("F", $transf);

        if ($mes == "January")
            $mes = "Enero";
        if ($mes == "February")
            $mes = "Febrero";
        if ($mes == "March")
            $mes = "Marzo";
        if ($mes == "April")
            $mes = "Abril";
        if ($mes == "May")
            $mes = "Mayo";
        if ($mes == "June")
            $mes = "Junio";
        if ($mes == "July")
            $mes = "Julio";
        if ($mes == "August")
            $mes = "Agosto";
        if ($mes == "September")
            $mes = "Septiembre";
        if ($mes == "October")
            $mes = "Octubre";
        if ($mes == "November")
            $mes = "Noviembre";
        if ($mes == "December")
            $mes = "Diciembre";
        $ano = date("Y", $transf);
        $fecha_resol = $dia . " " . $mes . " " . $ano;
        return $fecha_resol;
    }

}
