示例#1
0
文件: Test.php 项目: iamonuwa/ivote
 public function index()
 {
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Times', '', 12);
     for ($i = 1; $i <= 40; $i++) {
         $pdf->Cell(0, 10, 'Printing line number ' . $i, 0, 1);
     }
     $pdf->Output();
 }
示例#2
0
 function index()
 {
     // Instanciation of inherited class
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Times', '', 12);
     for ($i = 1; $i <= 40; $i++) {
         $pdf->Cell(0, 10, 'Printing line number ' . $i, 0, 1);
     }
     $pdf->Output();
 }
 public function listadoAction($aditionalFilter = '')
 {
     $pdf = new PDF("P", 'mm', "A4");
     $pdf->SetTopMargin(15);
     $pdf->SetLeftMargin(10);
     $pdf->AliasNbPages();
     $pdf->SetFillColor(210);
     $per = new Permisos();
     $em = new EntityManager($per->getConectionName());
     $query = "select t1.IdPerfil,t1.Permisos,t4.Perfil,t2.Titulo as Opcion,t3.Titulo as SubOpcion\n                from AgtPermisos as t1,menu as t2, submenu as t3, perfiles as t4\n                where t1.IDOpcion=t2.IDOpcion\n                and t1.IDOpcion=t3.IDOpcion\n                and t3.Id=t1.IDSubOpcion\n                and t1.IdPerfil=t4.Id\n                order by t1.IdPerfil,t1.IDOpcion,t1.IDSubOpcion;";
     $em->query($query);
     $rows = $em->fetchResult();
     $em->desConecta();
     unset($per);
     $perant = "";
     $opcant = "";
     foreach ($rows as $row) {
         if ($perant != $row['IDPerfil']) {
             $pdf->AddPage();
             $pdf->Cell(40, 5, $row['Perfil'], 0, 0, "L", 1);
         } else {
             $pdf->Cell(40, 5, "", 0, 0, "L", 0);
         }
         $pdf->SetFillColor(240);
         if ($opcant != $row['Opcion']) {
             $pdf->Cell(30, 5, $row['Opcion'], 0, 0, "L", 1);
         } else {
             $pdf->Cell(30, 5, "", 0, 0, "L", 0);
         }
         $perant = $row['IDPerfil'];
         $opcant = $row['Opcion'];
         $pdf->Cell(40, 5, $row['SubOpcion'], 0, 0, "L", 0);
         $permisos = array('C' => substr($row['Permisos'], 0, 1), 'I' => substr($row['Permisos'], 1, 1), 'B' => substr($row['Permisos'], 2, 1), 'A' => substr($row['Permisos'], 3, 1), 'L' => substr($row['Permisos'], 4, 1), 'E' => substr($row['Permisos'], 5, 1));
         $pdf->Cell(13, 5, $permisos['C'], 0, 0, "C", 0);
         $pdf->Cell(13, 5, $permisos['I'], 0, 0, "C", 1);
         $pdf->Cell(13, 5, $permisos['B'], 0, 0, "C", 0);
         $pdf->Cell(13, 5, $permisos['A'], 0, 0, "C", 1);
         $pdf->Cell(13, 5, $permisos['L'], 0, 0, "C", 0);
         $pdf->Cell(13, 5, $permisos['E'], 0, 1, "C", 1);
         $pdf->SetFillColor(210);
     }
     $archivo = "docs/docs" . $_SESSION['emp'] . "/pdfs/" . md5(date('d-m-Y H:i:s')) . ".pdf";
     $pdf->Output($archivo, 'F');
     $this->values['archivo'] = $archivo;
     return array('template' => '_global/listadoPdf.html.twig', 'values' => $this->values);
 }
示例#4
0
				case "10": $mes2 = Outubro; break;
				case "11": $mes2 = Novembro; break;
				case "12": $mes2 = Dezembro; break;
			};
	//SQL que retorna o ID do paciente
	$sqlpac = "SELECT nomepaciente FROM procodont WHERE convenio = '$convenio' AND data LIKE '$anoatual-$mesatual-%' GROUP BY nomepaciente;";
	$resultadopac = mysql_query($sqlpac);
	
	//Pega as informa��es na tabela convenios com o convenio informado
	$sqlconv = "SELECT nome FROM convenios WHERE id = '$convenio';";
	$resultadoconv = mysql_query($sqlconv);
	$resultconv = mysql_fetch_array($resultadoconv);
	
	//Instanciação da classe herdada
	$pdf=new PDF("P","mm","A4"); //P->Retrato, L->Paisagem; mm-> milímetros; A4-> padrão da folha
	$pdf->AliasNbPages(); //Recebe o total de páginas
	$pdf->AddPage(); //Coloca uma página em branco
	$pdf->SetFont('Arial','B',16);
	$pdf->Cell(65);
	$pdf->Cell(70,10,utf8_decode('Relatório por Convênio'),0,0,'C');
	$pdf->SetFont('Arial','U',12);
	$pdf->Ln(7);
	$pdf->Cell(50,10,'                                                                                                                                                                  ',0,0);
	$pdf->Ln(7);
	$pdf->SetFont('Arial','U',12);
	$pdf->Cell(15);
	$pdf->Cell(50,10,utf8_decode('Convênio: ').$resultconv[0],0,0);
	$pdf->Ln(7);
	$pdf->Cell(15);
	$pdf->Cell(30,10,utf8_decode('Mês: ').utf8_decode($mes2),0,0);
	$pdf->Cell(10);
示例#5
0
function Imprimir_Checks($codper, $codsol, $link, $swInit, $pdf)
{
    /*	echo "SELECT a.codchkser,
    			CONCAT(c.apepatper,' ',c.apematper,', ',c.nomper) AS nombre,
    			d.despue AS puesto,
    			a.imgreniec,
    			a.obsimgreniec,
    			a.indrefpol, a.refpolchk,
    			a.indantpol,
    			a.indreqjud,
    			a.indrefter,
    			a.indrefdro,
    			a.indimpsalpai,
    			a.indinvpen,a.invpenchk,
    			e.desdel,
    			a.recchk
    			FROM tb_chkservice AS a
    			LEFT JOIN tb_detallesolicitud AS b ON b.codper=a.codper AND b.codsol=a.codsol
    			LEFT JOIN tb_persona AS c ON c.codper=a.codper
    			LEFT JOIN tb_puesto AS d ON d.codpue=b.codpue
    			LEFT JOIN tb_delito AS e ON e.coddel=a.coddel
    			WHERE a.codper in ($codper) AND a.codsol=$codsol";*/
    /*Check Service*/
    $result = mysql_query("SELECT a.codchkser,\r\n\t\t\tCONCAT(c.apepatper,' ',c.apematper,', ',c.nomper) AS nombre,\r\n\t\t\td.despue AS puesto,\r\n\t\t\ta.imgreniec,\r\n\t\t\ta.obsimgreniec,\r\n\t\t\ta.indrefpol, a.refpolchk,\r\n\t\t\ta.indantpol,\r\n\t\t\ta.indreqjud,\r\n\t\t\ta.indrefter,\r\n\t\t\ta.indrefdro,\r\n\t\t\ta.indimpsalpai,\r\n\t\t\ta.indinvpen,a.invpenchk,\r\n\t\t\ta.recchk\r\n\t\t\tFROM tb_chkservice AS a\r\n\t\t\tLEFT JOIN tb_detallesolicitud AS b ON b.codper=a.codper AND b.codsol=a.codsol\r\n\t\t\tLEFT JOIN tb_persona AS c ON c.codper=a.codper\r\n\t\t\tLEFT JOIN tb_puesto AS d ON d.codpue=b.codpue\r\n\t\t\tWHERE a.codper in ({$codper}) AND a.codsol={$codsol}", $link);
    if (!isset($pdf)) {
        $pdf = new PDF();
        $pdf->AliasNbPages();
    }
    while ($row = mysql_fetch_array($result)) {
        $nombre = utf8_decode($row['nombre']);
        $puesto = utf8_decode($row['puesto']);
        $imgreniec = utf8_decode($row['imgreniec']);
        $obs = utf8_decode($row['obsimgreniec']);
        $indrefpol = utf8_decode($row['indrefpol']);
        $refpolchk = utf8_decode($row['refpolchk']);
        $indantpol = utf8_decode($row['indantpol']);
        $indreqjud = utf8_decode($row['indreqjud']);
        $indrefter = utf8_decode($row['indrefter']);
        $indrefdro = utf8_decode($row['indrefdro']);
        $indimpsalpai = utf8_decode($row['indimpsalpai']);
        $indinvpen = utf8_decode($row['indinvpen']);
        $invpenchk = utf8_decode($row['invpenchk']);
        $delitos = mysql_query("SELECT cd.coddel,d.nomdel,d.desdel FROM tb_delito_chkservice cd\r\n                                                    LEFT JOIN tb_delito d ON cd.coddel=d.coddel\r\n                                                    where cd.codsol=" . $codsol . " and cd.codper=" . $codper);
        $desdel = "";
        while ($fildel = mysql_fetch_array($delitos)) {
            $desdel = $desdel . utf8_decode($fildel['nomdel']) . " : " . utf8_decode($fildel['desdel']) . "\n\n";
        }
        //			$desdel= utf8_decode($row['desdel']);
        $recchk = utf8_decode($row['recchk']);
        $sw1 = 0;
        if ($indrefpol == 0) {
            $TXTindrefpol = 'No Registra';
        } else {
            $TXTindrefpol = 'Si Registra';
            $sw1 = 1;
        }
        if ($indantpol == 0) {
            $TXTindantpol = 'No Registra';
        } else {
            $TXTindantpol = 'Si Registra';
            $sw1 = 1;
        }
        if ($indreqjud == 0) {
            $TXTindreqjud = 'No Registra';
        } else {
            $TXTindreqjud = 'Si Registra';
            $sw1 = 1;
        }
        if ($indrefter == 0) {
            $TXTindrefter = 'No Registra';
        } else {
            $TXTindrefter = 'Si Registra';
            $sw1 = 1;
        }
        if ($indrefdro == 0) {
            $TXTindrefdro = 'No Registra';
        } else {
            $TXTindrefdrol = 'Si Registra';
            $sw1 = 1;
        }
        if ($indimpsalpai == 0) {
            $TXTindimpsalpai = 'No Registra';
        } else {
            $TXTindimpsalpai = 'Si Registra';
            $sw1 = 1;
        }
        $sw2 = 0;
        if ($indinvpen == 0) {
            $TXTindinvpen = 'No Registra';
        } else {
            $TXTindinvpen = 'Si Registra';
            $sw2 = 1;
        }
        //Creación del objeto de la clase heredada
        //	$pdf=new PDF();
        //	$pdf->AliasNbPages();
        $pdf->AddPage();
        $pdf->SetDisplayMode('fullpage');
        $pdf->SetMargins(20, 20, 20);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(70, 125, 25);
        $pdf->Cell(0, 10, 'CHECK SERVICE', 0, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'CHECK IDENTIDAD', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nombre, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'PUESTO AL QUE POSTULA', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $puesto, 1, 1, 'L');
        $pdf->Ln(2);
        //$pdf->Image('../files/images_dni/imagen1.png',40,null,0,130);
        $pdf->Image('../files/images_dni/' . $imgreniec, 40, null, 0, 130);
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(0, 7, 'OBSERVACIONES', 1, 1, 'C');
        $pdf->SetFont('Arial', '', 12);
        $pdf->MultiCell(0, 5, $obs, 1, 'J');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(0, 7, 'CHECK DELICTIVO', 1, 1, 'C');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Referencia Policial:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindrefpol == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindrefpol, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindrefpol, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Antecedente Policial:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindantpol == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindantpol, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindantpol, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Requisitoria Judicial:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindreqjud == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindreqjud, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindreqjud, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Referencia por Terrorismo', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindrefter == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindrefter, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindrefter, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Referencia por Drogas:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindrefdro == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindrefdro, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindrefdro, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, utf8_decode('Impedimento de salida del país:'), 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindimpsalpai == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindimpsalpai, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindimpsalpai, 1, 1, 'C');
        }
        //$str = utf8_decode('Investigación Penal:');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, utf8_decode('Investigación Penal:'), 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindinvpen == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindinvpen, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindinvpen, 1, 1, 'C');
        }
        if ($sw1 == 1 or $sw2 == 1) {
            $pdf->AddPage();
            $pdf->SetXY(20, 25);
            //$pdf->SetDisplayMode('fullpage');
            //$pdf->SetMargins(20, 20,20);
            $pdf->SetFont('Arial', 'BU', 14);
            $pdf->SetTextColor(70, 125, 25);
            $pdf->Cell(0, 10, 'ANEXO CHECK DELICTIVO', 0, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
            $pdf->Ln(2);
            if ($sw1 == 1) {
                $pdf->SetFont('Arial', 'B', 12);
                $pdf->Cell(0, 7, 'INVESTIGACION POLICIAL', 1, 1, 'L');
                $pdf->SetFont('Arial', '', 12);
                $pdf->MultiCell(0, 5, $refpolchk, 1, 'J');
                $pdf->Ln(2);
            }
            if ($sw2 == 1) {
                $pdf->SetFont('Arial', 'B', 12);
                $pdf->Cell(0, 7, 'INVESTIGACION PENAL', 1, 1, 'L');
                $pdf->SetFont('Arial', '', 12);
                $pdf->MultiCell(0, 5, $invpenchk, 1, 'J');
                $pdf->Ln(2);
            }
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->Cell(0, 7, 'DEFINICION DEL DELITO', 1, 1, 'L');
            $pdf->SetFont('Arial', '', 12);
            $pdf->MultiCell(0, 5, $desdel, 1, 'J');
            $pdf->Ln(2);
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->Cell(0, 7, 'RECOMENDACION', 1, 1, 'L');
            $pdf->SetFont('Arial', '', 12);
            $pdf->MultiCell(0, 5, $recchk, 1, 'J');
            $pdf->Ln(2);
        }
    }
    /*Check Familiar*/
    $result = mysql_query("SELECT a.codchkser,\r\n                        a.nombre,\r\n                        p.despar AS parentesco,\r\n                        a.imgreniec,\r\n                        a.obsimgreniec,\r\n                        a.indrefpol, a.refpolchk,\r\n                        a.indantpol,\r\n                        a.indreqjud,\r\n                        a.indrefter,\r\n                        a.indrefdro,\r\n                        a.indimpsalpai,\r\n                        a.indinvpen,a.invpenchk,\r\n                        a.recchk\r\n                        FROM tb_chkfamiliar AS a\r\n                        LEFT JOIN tb_detallesolicitud AS b ON b.codper=a.codper AND b.codsol=a.codsol\r\n                        LEFT JOIN tb_persona AS c ON c.codper=a.codper\r\n                        LEFT JOIN tb_parentesco AS p ON a.codpar=p.codpar\r\n                        WHERE a.codper in ({$codper}) AND a.codsol={$codsol}", $link);
    if (!isset($pdf)) {
        $pdf = new PDF();
        $pdf->AliasNbPages();
    }
    while ($row = mysql_fetch_array($result)) {
        $codchkser = utf8_decode($row['codchkser']);
        $nombre = utf8_decode($row['nombre']);
        $parentesco = utf8_decode($row['parentesco']);
        $imgreniec = utf8_decode($row['imgreniec']);
        $obs = utf8_decode($row['obsimgreniec']);
        $indrefpol = utf8_decode($row['indrefpol']);
        $refpolchk = utf8_decode($row['refpolchk']);
        $indantpol = utf8_decode($row['indantpol']);
        $indreqjud = utf8_decode($row['indreqjud']);
        $indrefter = utf8_decode($row['indrefter']);
        $indrefdro = utf8_decode($row['indrefdro']);
        $indimpsalpai = utf8_decode($row['indimpsalpai']);
        $indinvpen = utf8_decode($row['indinvpen']);
        $invpenchk = utf8_decode($row['invpenchk']);
        $delitos = mysql_query("SELECT cd.coddel,d.nomdel,d.desdel FROM tb_chkfamilia_delito cd\r\n                                                    LEFT JOIN tb_delito d ON cd.coddel=d.coddel\r\n                                                    where cd.codchkser=" . $codchkser);
        $desdel = "";
        while ($fildel = mysql_fetch_array($delitos)) {
            $desdel = $desdel . utf8_decode($fildel['nomdel']) . " : " . utf8_decode($fildel['desdel']) . "\n\n";
        }
        //$desdel= utf8_decode($row['desdel']);
        $recchk = utf8_decode($row['recchk']);
        $sw1 = 0;
        if ($indrefpol == 0) {
            $TXTindrefpol = 'No Registra';
        } else {
            $TXTindrefpol = 'Si Registra';
            $sw1 = 1;
        }
        if ($indantpol == 0) {
            $TXTindantpol = 'No Registra';
        } else {
            $TXTindantpol = 'Si Registra';
            $sw1 = 1;
        }
        if ($indreqjud == 0) {
            $TXTindreqjud = 'No Registra';
        } else {
            $TXTindreqjud = 'Si Registra';
            $sw1 = 1;
        }
        if ($indrefter == 0) {
            $TXTindrefter = 'No Registra';
        } else {
            $TXTindrefter = 'Si Registra';
            $sw1 = 1;
        }
        if ($indrefdro == 0) {
            $TXTindrefdro = 'No Registra';
        } else {
            $TXTindrefdrol = 'Si Registra';
            $sw1 = 1;
        }
        if ($indimpsalpai == 0) {
            $TXTindimpsalpai = 'No Registra';
        } else {
            $TXTindimpsalpai = 'Si Registra';
            $sw1 = 1;
        }
        $sw2 = 0;
        if ($indinvpen == 0) {
            $TXTindinvpen = 'No Registra';
        } else {
            $TXTindinvpen = 'Si Registra';
            $sw2 = 1;
        }
        //Creación del objeto de la clase heredada
        //	$pdf=new PDF();
        //	$pdf->AliasNbPages();
        $pdf->AddPage();
        $pdf->SetDisplayMode('fullpage');
        $pdf->SetMargins(20, 20, 20);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(70, 125, 25);
        $pdf->Cell(0, 10, 'CHECK FAMILIAR', 0, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'NOMBRE', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nombre, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'PARENTESCO', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $parentesco, 1, 1, 'L');
        $pdf->Ln(2);
        //$pdf->Image('../files/images_dni/imagen1.png',40,null,0,130);
        $pdf->Image('../files/images_dni/fam/' . $imgreniec, 40, null, 0, 130);
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(0, 7, 'OBSERVACIONES', 1, 1, 'C');
        $pdf->SetFont('Arial', '', 12);
        $pdf->MultiCell(0, 5, $obs, 1, 'J');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(0, 7, 'CHECK DELICTIVO', 1, 1, 'C');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Referencia Policial:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindrefpol == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindrefpol, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindrefpol, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Antecedente Policial:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindantpol == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindantpol, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindantpol, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Requisitoria Judicial:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindreqjud == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindreqjud, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindreqjud, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Referencia por Terrorismo', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindrefter == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindrefter, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindrefter, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Referencia por Drogas:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindrefdro == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindrefdro, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindrefdro, 1, 1, 'C');
        }
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, utf8_decode('Impedimento de salida del país:'), 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindimpsalpai == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindimpsalpai, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindimpsalpai, 1, 1, 'C');
        }
        //$str = utf8_decode('Investigación Penal:');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, utf8_decode('Investigación Penal:'), 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        if ($TXTindinvpen == 'Si Registra') {
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->SetTextColor(255, 0, 0);
            $pdf->Cell(0, 7, $TXTindinvpen, 1, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
        } else {
            $pdf->Cell(0, 7, $TXTindinvpen, 1, 1, 'C');
        }
        if ($sw1 == 1 or $sw2 == 1) {
            $pdf->AddPage();
            $pdf->SetXY(20, 25);
            //$pdf->SetDisplayMode('fullpage');
            //$pdf->SetMargins(20, 20,20);
            $pdf->SetFont('Arial', 'BU', 14);
            $pdf->SetTextColor(70, 125, 25);
            $pdf->Cell(0, 10, 'ANEXO CHECK DELICTIVO', 0, 1, 'C');
            $pdf->SetTextColor(0, 0, 0);
            $pdf->Ln(2);
            if ($sw1 == 1) {
                $pdf->SetFont('Arial', 'B', 12);
                $pdf->Cell(0, 7, 'INVESTIGACION POLICIAL', 1, 1, 'L');
                $pdf->SetFont('Arial', '', 12);
                $pdf->MultiCell(0, 5, $refpolchk, 1, 'J');
                $pdf->Ln(2);
            }
            if ($sw2 == 1) {
                $pdf->SetFont('Arial', 'B', 12);
                $pdf->Cell(0, 7, 'INVESTIGACION PENAL', 1, 1, 'L');
                $pdf->SetFont('Arial', '', 12);
                $pdf->MultiCell(0, 5, $invpenchk, 1, 'J');
                $pdf->Ln(2);
            }
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->Cell(0, 7, 'DEFINICION DEL DELITO', 1, 1, 'L');
            $pdf->SetFont('Arial', '', 12);
            $pdf->MultiCell(0, 5, $desdel, 1, 'J');
            $pdf->Ln(2);
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->Cell(0, 7, 'RECOMENDACION', 1, 1, 'L');
            $pdf->SetFont('Arial', '', 12);
            $pdf->MultiCell(0, 5, $recchk, 1, 'J');
            $pdf->Ln(2);
        }
    }
    /*Check Domiciliario*/
    $result = mysql_query("SELECT a.codchkdom,\r\n\t\t\tCONCAT(c.nomper,' ',c.apepatper,' ',c.apematper) AS nombre,\r\n\t\t\tCONCAT(i.destipvia,' ',a.nomviadom,' ',a.numdom,' ',a.urbdom,' - ',h.desdist,' ',g.despro,' ',desdpto) AS domicilio,\r\n\t\t\ta.domici,\r\n\t\t\ta.perent,IF (a.codpar=6,a.otroparent,(SELECT w.despar FROM tb_parentesco AS w WHERE w.codpar=a.codpar LIMIT 1)) AS parentesco,\r\n\t\t\ta.anoresdom, a.mesresdom,\r\n\t\t\t(SELECT GROUP_CONCAT(z2.desres ORDER BY z2.codres ASC SEPARATOR ',') FROM tb_residentesdomicilio AS z1 LEFT JOIN tb_residentes AS z2 ON z1.codres=z2.codres WHERE z1.codchkdom=a.codchkdom GROUP BY z1.codchkdom) AS residecon,\r\n\t\t\td.desviv,\r\n\t\t\tIF (a.codtipviv=3,otrtipviv,(SELECT z3.destipviv FROM tb_tipovivienda AS z3 WHERE z3.codtipviv=a.codtipviv LIMIT 1)) AS tipo_vivienda,\r\n\t\t\ta.numpis, a.pisres,\r\n\t\t\tIF (a.codtipmat=4,otrmatcon,(SELECT z4.destipmat FROM tb_tipomaterial AS z4 WHERE z4.codtipmat=a.codtipmat LIMIT 1)) AS tipo_material,\r\n\t\t\te.desestcon,\r\n\t\t\ta.arever,\r\n\t\t\ta.colfac, a.numpue,a.numven, a.tipmat, a.rejpro, a.pueaccveh, a.obsinmu,\r\n\t\t\tIF (a.codzonif=8,otrzonif,(SELECT z5.deszonif FROM tb_zonificacion AS z5 WHERE z5.codzonif=a.codzonif LIMIT 1)) AS zonificacion,\r\n\t\t\tj.deszonrie,\r\n\t\t\tk.descon,\r\n\t\t\tobscon,\r\n\t\t\t(SELECT GROUP_CONCAT(z.nomimgdom ORDER BY z.numimgdom ASC SEPARATOR ',') FROM tb_imgdomicilio AS z WHERE z.codchkdom=a.codchkdom GROUP BY z.codchkdom) AS fotos\r\n\t\t\tFROM tb_chkdomicilio AS a\r\n\t\t\tLEFT JOIN tb_persona AS c ON c.codper=a.codper\r\n\t\t\tLEFT JOIN tb_vivienda AS d ON d.codviv=a.codviv\r\n\t\t\tLEFT JOIN tb_estadoconstruccion AS e ON e.codestcon=a.codestcon\r\n\t\t\tLEFT JOIN tb_departamento AS f ON f.coddpto=a.coddpto\r\n\t\t\tLEFT JOIN tb_provincia AS g ON g.coddpto=a.coddpto AND g.codpro=a.codpro\r\n\t\t\tLEFT JOIN tb_distrito AS h ON h.coddpto=a.coddpto AND h.codpro=a.codpro AND h.coddist=a.coddist\r\n\t\t\tLEFT JOIN tb_tipvias AS i ON i.codtipvia=a.codtipvia\r\n\t\t\tLEFT JOIN tb_zonariesgo AS j ON j.codzonrie=a.codzonrie\r\n\t\t\tLEFT JOIN tb_conclusion AS k ON k.codcon=a.codcon\r\n\t\t\tWHERE a.codper in ({$codper}) AND a.codsol={$codsol}", $link);
    if (!isset($pdf)) {
        $pdf = new PDF();
        $pdf->AliasNbPages();
    }
    while ($row = mysql_fetch_array($result)) {
        $nombre = utf8_decode($row['nombre']);
        $domicilio = utf8_decode($row['domicilio']);
        $domiciliado = utf8_decode($row['domici']);
        $txtdomiciliadoSI = '';
        $txtdomiciliadoNO = '';
        if ($domiciliado == 1) {
            $txtdomiciliadoSI = 'X';
        } else {
            $txtdomiciliadoNO = 'X';
        }
        $persona_entrevistada = utf8_decode($row['perent']);
        $parentesco = utf8_decode($row['parentesco']);
        $anoresdom = utf8_decode($row['anoresdom']);
        $mesresdom = utf8_decode($row['mesresdom']);
        $reside_con = utf8_decode($row['residecon']);
        $vivienda = utf8_decode($row['desviv']);
        $tipo_vivienda = utf8_decode($row['tipo_vivienda']);
        $numpis = utf8_decode($row['numpis']);
        $pisres = utf8_decode($row['pisres']);
        $tipo_material = utf8_decode($row['tipo_material']);
        $desestcon = utf8_decode($row['desestcon']);
        $arever = utf8_decode($row['arever']);
        $txtareverSI = '';
        $txtareverNO = '';
        if ($arever == 1) {
            $txtareverSI = 'X';
        } else {
            $txtareverNO = 'X';
        }
        $colfac = utf8_decode($row['colfac']);
        $tipmat = utf8_decode($row['tipmat']);
        $numpue = utf8_decode($row['numpue']);
        $numven = utf8_decode($row['numven']);
        $rejpro = utf8_decode($row['rejpro']);
        if ($rejpro == 1) {
            $txtrejpro = 'X';
        } else {
            $txtrejpro = '';
        }
        $pueaccveh = utf8_decode($row['pueaccveh']);
        if ($pueaccveh == 1) {
            $txtpueaccveh = 'X';
        } else {
            $txtpueaccveh = '';
        }
        $obsinmu = utf8_decode($row['obsinmu']);
        $zonificacion = utf8_decode($row['zonificacion']);
        $deszonrie = utf8_decode($row['deszonrie']);
        $descon = utf8_decode($row['descon']);
        $obscon = utf8_decode($row['obscon']);
        $fotos = explode(",", $row['fotos']);
        //Creación del objeto de la clase heredada
        //$pdf=new PDF();
        //$pdf->AliasNbPages();
        /*	if (!isset($pdf)) {
        					$pdf=new PDF();
        					$pdf->AliasNbPages();
        				}
        			*/
        $pdf->AddPage();
        $pdf->SetDisplayMode('fullpage');
        $pdf->SetMargins(20, 20, 20);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(70, 125, 25);
        $pdf->Cell(0, 10, 'FICHA DE CHECK DOMICILIARIO', 0, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(55, 7, 'NOMBRES Y APELLIDOS', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nombre, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(55, 7, 'DIRECCION', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->MultiCell(0, 7, $domicilio, 1, 'L');
        //$pdf->Ln(2);
        //$pdf->Image('../files/images_dni/imagen1.png',40,null,0,130);
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(35);
        $pdf->Cell(33, 7, 'DOMICILIADO', 0, 0, 'L');
        $pdf->SetFont('Arial', '', 16);
        $pdf->Cell(6, 7, $txtdomiciliadoSI, 1, 0, 'C');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(5);
        $pdf->Cell(40, 7, 'NO DOMICILIADO', 0, 0, 'L');
        $pdf->SetFont('Arial', '', 16);
        $pdf->Cell(6, 7, $txtdomiciliadoNO, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'BU', 12);
        $pdf->Cell(0, 7, 'I. INFORMACION PROPORCIONADA POR EL ENTREVISTADO:', 0, 1, 'L');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(47, 7, 'Persona Entrevistada:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(60, 7, $persona_entrevistada, 1, 0, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(27, 7, 'Parentesco:', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $parentesco, 1, 1, 'L');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, 'Tiempo que Reside:', 0, 0, 'L');
        $pdf->Cell(15, 7, utf8_decode('Años'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $anoresdom, 1, 0, 'C');
        $pdf->Cell(5);
        $pdf->Cell(40, 7, 'Meses', 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $mesresdom, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, 'Reside con:', 0, 0, 'L');
        $pdf->Cell(0, 7, $reside_con, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, 'Vivienda:', 0, 0, 'L');
        $pdf->Cell(0, 7, $vivienda, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'BU', 12);
        $pdf->Cell(0, 7, 'II. DESCRIPCION DEL INMUEBLE:', 0, 1, 'L');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, 'Tipo de Vivienda:', 0, 0, 'L');
        $pdf->Cell(0, 7, $tipo_vivienda, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->Cell(65, 7, utf8_decode('Número de Pisos:'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $numpis, 1, 0, 'C');
        $pdf->Cell(5);
        $pdf->Cell(40, 7, 'Piso en el que reside', 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $pisres, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Material de Construcción:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $tipo_material, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(55, 7, utf8_decode('Estado de la Construcción:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $desestcon, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, 'Vivienda con Areas Verdes:', 0, 0, 'L');
        $pdf->Cell(15, 7, utf8_decode('Si'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $txtareverSI, 1, 0, 'C');
        $pdf->Cell(5);
        $pdf->Cell(40, 7, 'No', 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $txtareverNO, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Color de la Fachada:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $colfac, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Tipo de Material:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $tipmat, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(65, 7, utf8_decode('Nº Puertas de Ingreso'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $numpue, 1, 0, 'C');
        $pdf->Cell(5);
        $pdf->Cell(40, 7, utf8_decode('Nº Ventanas'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $numven, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(65, 7, utf8_decode('Rejas de Protección'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $txtrejpro, 1, 0, 'C');
        $pdf->Cell(5);
        $pdf->Cell(40, 7, utf8_decode('P. de Acc. Vehicular'), 0, 0, 'R');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(10, 7, $txtpueaccveh, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Observaciones:'), 0, 0, 'L');
        $pdf->MultiCell(0, 5, $obsinmu, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'BU', 12);
        $pdf->Cell(0, 7, 'III. DESCRIPCION DE LA ZONA:', 0, 1, 'L');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Zonificación:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $zonificacion, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Zona de Riesgo Delictivo:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $deszonrie, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Conclusiones:'), 0, 0, 'L');
        $pdf->Cell(0, 7, $descon, 1, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(50, 7, utf8_decode('Observaciones:'), 0, 0, 'L');
        $pdf->MultiCell(0, 5, $obscon, 1, 'C');
        $pdf->AddPage();
        $pdf->SetXY(20, 25);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(70, 125, 25);
        $pdf->Cell(0, 10, 'CHECK FOTOGRAFICO DE LA VIVIENDA Y ALREDEDORES', 0, 1, 'C');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(55, 7, 'NOMBRES Y APELLIDOS', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nombre, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(55, 7, 'DIRECCION', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->MultiCell(0, 7, $domicilio, 1, 'C');
        $pdf->Ln(7);
        $pdf->Image("../files/images_dom/{$fotos['0']}", 40, null, 130, 100);
        $pdf->Ln(4);
        $pdf->Image("../files/images_dom/{$fotos['1']}", 40, null, 130, 100);
        $pdf->Ln(2);
        $pdf->AddPage();
        $pdf->SetXY(20, 25);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(70, 125, 25);
        $pdf->Cell(0, 10, 'MAPA DE ZONIFICACION - CHECK DOMICILIARIO', 0, 1, 'C');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(55, 7, 'NOMBRES Y APELLIDOS', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nombre, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(55, 7, 'DIRECCION', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->MultiCell(0, 7, $domicilio, 1, 'L');
        $pdf->Ln(10);
        $pdf->Image("../files/images_dom/{$fotos['2']}", 30, null, 0, 120);
    }
    /*Check laboral*/
    $result = mysql_query("SELECT a.codchklab,\r\n\t\t\tCONCAT(c.apepatper,' ',c.apematper,', ',c.nomper) AS nombre,\r\n\t\t\td.despue AS puesto,\r\n\t\t\ta.nomperref,\r\n\t\t\ta.nomemp,\r\n\t\t\ta.telemp,\r\n\t\t\ta.perlab,\r\n\t\t\ta.motces,\r\n\t\t\ta.percont,\r\n\t\t\ta.carpercont,\r\n\t\t\ta.fecent,\r\n\t\t\ta.obsent,\r\n\t\t\ta.noment\r\n\t\t\tFROM tb_chklaboral AS a\r\n\t\t\tLEFT JOIN tb_detallesolicitud AS b ON b.codper=a.codper AND b.codsol=a.codsol\r\n\t\t\tLEFT JOIN tb_persona AS c ON c.codper=a.codper\r\n\t\t\tLEFT JOIN tb_puesto AS d ON d.codpue=b.codpue\r\n\t\t\tWHERE a.codper in ({$codper}) AND a.codsol={$codsol}", $link);
    if (!isset($pdf)) {
        $pdf = new PDF();
        $pdf->AliasNbPages();
    }
    $sw = 0;
    while ($row = mysql_fetch_array($result)) {
        $sw = $sw + 1;
        $codchklab = utf8_decode($row['codchklab']);
        $nombre = utf8_decode($row['nombre']);
        $puesto = utf8_decode($row['puesto']);
        $nomperref = utf8_decode($row['nomperref']);
        $nomemp = utf8_decode($row['nomemp']);
        $telemp = utf8_decode($row['telemp']);
        $perlab = utf8_decode($row['perlab']);
        $motces = utf8_decode($row['motces']);
        $percont = utf8_decode($row['percont']);
        $carpercont = utf8_decode($row['carpercont']);
        $fecent = utf8_decode($row['fecent']);
        $obsent = utf8_decode($row['obsent']);
        $noment = utf8_decode($row['noment']);
        //Creación del objeto de la clase heredada
        $pdf->AddPage();
        $pdf->SetDisplayMode('fullpage');
        $pdf->SetMargins(20, 20, 20);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(70, 125, 25);
        $pdf->Cell(0, 10, 'CHECK LABORAL ' . $sw, 0, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Candidato', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nombre, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Puesto al que postula', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $puesto, 1, 1, 'L');
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Persona dada como referencia', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nomperref, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Empresa', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $nomemp, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, utf8_decode('Teléfono'), 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $telemp, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Periodo laboral', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $perlab, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Motivo de Cese', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $motces, 1, 1, 'L');
        $qryPreguntas = "SELECT b.despre,a.respre FROM tb_respuestas AS a\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN tb_preguntas AS b ON a.codpre=b.codpre\r\n\t\t\t\t\t\t\t\t\tWHERE a.codchklab={$codchklab}";
        $result_qryPreguntas = mysql_query($qryPreguntas);
        $pdf->SetFont('Arial', 'BU', 14);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Cell(0, 10, 'CUESTIONARIO', 0, 1, 'C');
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $sw2 = 0;
        while ($row2 = mysql_fetch_array($result_qryPreguntas)) {
            $sw2 = $sw2 + 1;
            $pdf->SetFont('Arial', 'B', 12);
            //$pdf->Cell(70,7,utf8_decode($row2['despre']),1,1,'L');
            $pdf->MultiCell(0, 5, $sw2 . ' ' . utf8_decode($row2['despre']), 1, 'L');
            $pdf->SetFont('Arial', '', 12);
            //$pdf->Cell(0,7,utf8_decode($row2['respre']),1,1,'L');
            $pdf->MultiCell(0, 5, utf8_decode($row2['respre']), 1, 'L');
            $pdf->Ln(1);
        }
        $pdf->AddPage();
        $pdf->Ln(2);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Persona de contacto', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $percont, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Cargo de contacto', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $carpercont, 1, 1, 'L');
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Fecha de entrevista', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $fecent, 1, 1, 'L');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(0, 7, 'Observaciones del entrevistador', 1, 1, 'L');
        $pdf->SetFont('Arial', '', 12);
        //$pdf->Cell(0,7,$percont,1,1,'C');
        $pdf->MultiCell(0, 5, utf8_decode($obsent), 1, 'J');
        $pdf->Ln(2);
        $pdf->SetFont('Arial', 'B', 12);
        $pdf->Cell(70, 7, 'Nombre del entrevistador', 1, 0, 'L');
        $pdf->SetFont('Arial', '', 12);
        $pdf->Cell(0, 7, $noment, 1, 1, 'L');
    }
}
         $this->Cell($wlain / 100 * $width, $height, $_SESSION['lang']['selisih'], 1, 0, 'C', 1);
         $this->Cell($wlain / 100 * $width, $height, $_SESSION['lang']['realisasi'], 1, 0, 'C', 1);
         $this->Cell($wlain / 100 * $width, $height, $_SESSION['lang']['anggaran'], 1, 0, 'C', 1);
         $this->Cell($wlain / 100 * $width, $height, $_SESSION['lang']['selisih'], 1, 0, 'C', 1);
         $this->Ln();
     }
     function Footer()
     {
         $this->SetY(-15);
         $this->SetFont('Arial', 'I', 8);
         $this->Cell(10, 10, 'Page ' . $this->PageNo() . " / {totalPages}", 0, 0, 'L');
     }
 }
 //================================
 $pdf = new PDF('L', 'pt', 'A4');
 $pdf->AliasNbPages('{totalPages}');
 $width = $pdf->w - $pdf->lMargin - $pdf->rMargin;
 $height = 15;
 $pdf->AddPage();
 $pdf->SetFillColor(255, 255, 255);
 $pdf->SetFont('Arial', '', 9);
 $no = 1;
 // pdf array content =========================================================================
 //    $pdf->Cell($wkiri/100*$width,$height,$_SESSION['lang']['tbsdiolah'],1,0,'L',1);
 //    $pdf->Cell($wlain/100*$width,$height,number_format($bireal_tbsdiolah,0),1,0,'R',1);
 //    $pdf->Cell($wlain/100*$width,$height,number_format($bibudget_tbsdiolah,0),1,0,'R',1);
 //    $pdf->Cell($wlain/100*$width,$height,number_format($biselisih_tbsdiolah,0),1,0,'R',1);
 //    $pdf->Cell($wlain/100*$width,$height,number_format($sdbireal_tbsdiolah,0),1,0,'R',1);
 //    $pdf->Cell($wlain/100*$width,$height,number_format($sdbibudget_tbsdiolah,0),1,0,'R',1);
 //    $pdf->Cell($wlain/100*$width,$height,number_format($sdbiselisih_tbsdiolah,0),1,0,'R',1);
 //    $pdf->Ln();
    function process_inclusive_dates() {
        if (func_num_args()>0) {
            $arg_list = func_get_args();
            $menu_id = $arg_list[0];
            $post_vars = $arg_list[1];
            $get_vars = $arg_list[2];
            $validuser = $arg_list[3];
            $isadmin = $arg_list[4];
            print_r($arg_list);
        }
        // loop through m_consult_disease_notifiable
        $sql = "select p.patient_id, c.consult_id, concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, c.onset_date, ".
               "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, c.disease_id  ".
               "from m_consult_disease_notifiable c, m_patient p ".
               "where c.patient_id = p.patient_id";
        if ($result = mysql_query($sql)) {
            if (mysql_num_rows($result)) {
                while ($report = mysql_fetch_array($result)) {
                    // blank variables
                    $family_id = 0;
                    $patient_address = '';
                    $barangay_name = '';
                    $disease_name = '';
                    $icd_code = '';
                    // retrieve other data
                    $family_id = family::get_family_id($report["patient_id"]);
                    if ($family_id) {
                        $patient_address = family::show_address($family_id);
                        $barangay_name = family::barangay_name($family_id);
                    }
                    $disease_name = notifiable::get_notifiable_disease_name($report["disease_id"]);
                    $icd_code = notifiable_report::get_disease_icdcode($report["disease_id"]);

                    // insert data into tcl
                    $sql_insert = "insert into m_patient_notifiable_tcl (consult_id, patient_id, ".
                                  "patient_name, onset_date, patient_age, patient_gender, patient_address, ".
                                  "barangay_name, diagnosis, icd10) ".
                                  "values ('".$report["consult_id"]."', '".$report["patient_id"]."', ".
                                  "'".$report["patient_name"]."', '".$report["onset_date"]."', '".$report["patient_age"]."', ".
                                  "'".$report["patient_gender"]."', '$patient_address', '$barangay_name', ".
                                  "'$disease_name', '$icd_code')";
                    $result_insert = mysql_query($sql_insert);
                } // while
                print $sql = "select patient_name, onset_date, patient_age, patient_gender, ".
                       "patient_address, barangay_name, diagnosis, icd10 ".
                       "from m_patient_notifiable_tcl order by diagnosis";
                $pdf = new PDF('P','pt','A4');
                $pdf->SetFont('Arial','',10);
                $pdf->AliasNbPages();
                $pdf->connect('localhost','root','kambing','game');
                $attr=array('titleFontSize'=>14,'titleText'=>'NOTIFIABLE DISEASE REGISTER');
                $pdf->mysql_report($sql,false,$attr, "../modules/_uploads/ntp_tcl.pdf");
                header("location: ".$_SERVER["PHP_SELF"]."?page=".$get_vars["page"]."&menu_id=".$get_vars["menu_id"]."&report_menu=TCL");
            }
        }
    }
 function display_pdf()
 {
     $array = $this->load();
     if (empty($array)) {
         return;
     }
     $pdf = new PDF($this->db);
     $pdf->Setdossierinfo(dossier::name());
     $pdf->setTitle("Balance analytique", true);
     $pdf->SetAuthor('NOALYSS');
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pa = new Anc_Plan($this->db, $this->pa_id);
     $pa->get();
     $pb = new Anc_Plan($this->db, $this->pa_id2);
     $pb->get();
     $pdf->SetFont('DejaVu', 'B', 9);
     $pdf->Cell(0, 7, sprintf("Balance croise plan %s %s ", $pa->name, $pb->name), 1, 0, 'C');
     $filtre_date = "";
     $filtre_pa = "";
     $filtre_pb = "";
     if ($this->from != "" || $this->to != "") {
         $filtre_date = sprintf("Filtre date  %s %s", $this->from, $this->to);
     }
     if ($this->from_poste != "" || $this->to_poste != "") {
         $filtre_pa = sprintf("Filtre poste plan1  %s %s", $this->from_poste != "" ? "de " . $this->from_poste : " ", $this->to_poste != "" ? "jusque " . $this->to_poste : "");
     }
     if ($this->from_poste2 != "" || $this->to_poste2 != "") {
         $filtre_pb = sprintf("Filtre poste plan2   %s  %s", $this->from_poste2 != "" ? "de " . $this->from_poste2 : " ", $this->to_poste2 != "" ? "jusque " . $this->to_poste2 : "");
     }
     $pdf->SetFont('DejaVu', '', 8);
     $pdf->Cell(50, 7, $filtre_date);
     $pdf->Cell(50, 7, $filtre_pa);
     $pdf->Cell(50, 7, $filtre_pb);
     $pdf->Ln();
     $pdf->SetFont('DejaVu', '', 6);
     $pdf->Cell(20, 7, 'id', 'B');
     $pdf->Cell(100, 7, 'Poste Comptable', 'B');
     $pdf->Cell(20, 7, 'Débit', 'B', 0, 'L');
     $pdf->Cell(20, 7, 'Crédit', 'B', 0, 'L');
     $pdf->Cell(20, 7, 'Solde', 'B', 0, 'L');
     $pdf->Cell(20, 7, 'D/C', 'B', 0, 'L');
     $pdf->Ln();
     for ($i = 0; $i < count($array); $i++) {
         $row = $array[$i];
         $pdf->Cell(20, 6, $row['a_po_name'], 0, 0, 'L');
         $pdf->Cell(40, 6, mb_substr($row['a_po_description'], 0, 31), 0, 0, 'L');
         $pdf->Cell(20, 6, $row['b_po_name'], 0, 0, 'L');
         $pdf->Cell(40, 6, mb_substr($row['b_po_description'], 0, 31), 0, 0, 'L');
         $pdf->Cell(20, 6, $row['a_d'], 0, 0, 'R');
         $pdf->Cell(20, 6, $row['a_c'], 0, 0, 'R');
         $pdf->Cell(20, 6, $row['a_solde'], 0, 0, 'R');
         $pdf->Cell(20, 6, $row['a_debit'], 0, 0, 'C');
         $pdf->Ln();
     }
     $sum = $this->show_sum($array);
     $pdf->SetFont('DejaVu', 'B', 8);
     $pdf->Cell(70, 6, 'Somme', 1, 0, 'C');
     $pdf->Ln(5);
     $pdf->SetFont('DejaVu', '', 6);
     $pdf->Cell(20, 7, 'Poste');
     $pdf->Cell(60, 7, 'Description', 'B');
     $pdf->Cell(20, 7, 'Débit', 'B', 0, 'L');
     $pdf->Cell(20, 7, 'Crédit', 'B', 0, 'L');
     $pdf->Cell(20, 7, 'Solde', 'B', 0, 'L');
     $pdf->Cell(20, 7, 'D/C', 'B', 0, 'L');
     $pdf->Ln();
     for ($i = 0; $i < count($sum); $i++) {
         $row = $sum[$i];
         $pdf->Cell(20, 6, $row['poste'], 0, 0, 'L');
         $pdf->Cell(60, 6, $row['desc'], 0, 0, 'L');
         $pdf->Cell(20, 6, sprintf('%.2f', $row['debit']), 0, 0, 'R');
         $pdf->Cell(20, 6, sprintf('%.2f', $row['credit']), 0, 0, 'R');
         $pdf->Cell(20, 6, sprintf('%.2f', $row['solde']), 0, 0, 'R');
         $pdf->Cell(20, 6, $row['dc'], 0, 0, 'R');
         $pdf->Ln();
     }
     $fDate = date('dmy-Hi');
     $pdf->output('crossbalance-' . $fDate . '.pdf', 'D');
 }
 public function pdfreportmakerAction()
 {
     require "fpdf/pdfheader.php";
     $month = $this->getRequest()->getParam('pdf_month');
     $year = $this->getRequest()->getParam('pdf_year');
     $email = $this->getRequest()->getParam('email');
     $apper_id = $this->getRequest()->getParam('apper_id');
     $cc = Mage::getModel('customer/customer')->load($apper_id);
     $apper_email = $cc->getEmail();
     $zmodel = Mage::getModel('zcredit/zcredit');
     $cus = $zmodel->checkmail($apper_email);
     $s_id = $cus[s_id];
     //$cus_id=$cus['cus_id'];
     $customer = Mage::getModel('customer/customer')->loadByEmail($email);
     $cus_data = $customer->getData();
     $agent_name = $cus_data['agent_name'];
     $defaultBilling = $customer->getDefaultBillingAddress();
     $address = $defaultBilling->getData();
     $full_name = $address['firstname'] . " " . $address['lastname'];
     $cus_id = $customer->getId();
     $results1 = $zmodel->frontsortorderpdf($s_id);
     $tot_amt_paid1 = 0;
     $tot_amt_invoice1 = 0;
     foreach ($results1 as $result) {
         $or_id = $result[order_id];
         $getdate = $zmodel->getbaltablecomdate($or_id);
         $date = $getdate['amt_paid_date'];
         $byear = date('Y', strtotime($date));
         $bmonth = date('m', strtotime($date));
         $inv_detail = $zmodel->getBaltrantopdf($result[order_id]);
         //$pdf->SetX(5);
         //$pdf->Cell(40,7,"$result[payment_status],");
         $tot_balsheet = $zmodel->getTotCnOaa($or_id);
         if ($year == $byear && $month == $bmonth && $result[maker] == $email) {
             foreach ($inv_detail as $inv) {
                 $tot_amt_invoice1 = $tot_amt_invoice1 + $inv[invoice_amount];
             }
             $tot_amt_paid1 = $tot_amt_paid1 + $tot_balsheet[amt_paid] + $tot_balsheet[sus_ac_use_pay];
         }
     }
     $pdf = new PDF();
     //$m_start=date('Y', strtotime($year));
     //$m_end=date('F', strtotime($month));
     $m_start = $year;
     $m_end = date('F', mktime(0, 0, 0, $month, 10));
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetY(30);
     $pdf->Line(10, 31, 200, 31);
     $pdf->SetFont('Times', 'B', 12);
     $pdf->Cell(40, 7, 'CREDIT STATEMENT');
     $pdf->setX(120);
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(40, 7, "Year: {$m_start}");
     $pdf->Cell(20, 7, "Month: {$m_end}", 2, 2, 'C');
     $pdf->Line(10, 36, 200, 36);
     //$pdf->Ln(10);
     //Customer detail start//
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Customer Name');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$full_name}");
     $pdf->SetX(120);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Total Amount Paid');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(35, 5, ": {$tot_amt_paid1}", 2, 2, 'L');
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Company Name &');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ":{$cus['company_name']}");
     $pdf->SetX(120);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Total Amount Invoice');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(35, 5, ": {$tot_amt_invoice1}", 2, 2, 'L');
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Address ');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(20, 5, ": {$address['street']}");
     //$pdf->Cell(20,5,'Address1',2,2);
     //$pdf->Cell(20,5,'Address1');
     $pdf->SetX(120);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Credit Limit');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(35, 5, ": {$cus['credit_limit']}", 2, 2, 'L');
     $pdf->SetX(45);
     $pdf->Cell(25, 5, "  {$address['city']},{$address['region']}");
     $pdf->SetX(120);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Available Limit ');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(35, 5, ": {$cus['avail_bal']}", 2, 2, 'L');
     $pdf->SetX(45);
     $pdf->Cell(25, 5, "  {$address['postcode']}");
     $pdf->SetX(120);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'A/C Mgr Name ');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(35, 5, ': ' . $agent_name, 2, 2, 'L');
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Customer Email Id ');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$email}", 2, 2, 'L');
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Customer Id :');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$cus_id}", 2, 2);
     //Customer detail end//
     //data start//
     $linestyle = array('width' => 1.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 10, 'color' => array(255, 0, 0));
     $pdf->SetX(10);
     $pdf->Line(10, 72, 200, 72);
     //$pdf->Line(10,85.5,200,85.5);
     $pdf->SetX(80);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(30, 5, 'Transction Details', 2, 2, 'C');
     $pdf->Line(10, 77, 200, 77);
     $pdf->Line(10, 77.3, 200, 77.3);
     $pdf->SetX(10);
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(10, 5, 'S.No.', 0, 0, 'C');
     $pdf->Cell(25, 5, 'Order #', 0, 0, 'C');
     $pdf->Cell(25, 5, 'Inv #', 0, 0, 'C');
     $pdf->Cell(15, 5, 'Inv Amt', 0, 0, 'C');
     $pdf->Cell(20, 5, 'Inv Date', 0, 0, 'C');
     $pdf->Cell(25, 5, 'Amt Paid', 0, 0, 'C');
     $pdf->Cell(15, 5, 'Credit Note', 0, 0, 'C');
     $pdf->Cell(30, 5, 'Payment Status', 0, 0, 'C');
     //$pdf->MultiCell(20,5,'Payment Status');
     $pdf->Cell(25, 5, 'Pending Amt', 2, 2, 'C');
     $pdf->Line(10, 83, 200, 83);
     $pdf->Ln();
     //data end//
     //order data start//
     $i = 1;
     //$height=count($results)*5+83+5;
     $height = 83;
     $results = $zmodel->frontsortorderpdf($s_id);
     //echo "<pre>"; print_r($results);
     foreach ($results as $res) {
         $order_id = $res['order_id'];
         $getdate = $zmodel->getbaltablecomdate($order_id);
         $date = $getdate['amt_paid_date'];
         $byear = date('Y', strtotime($date));
         $bmonth = date('m', strtotime($date));
         if ($year == $byear && $month == $bmonth && $res[maker] == $email) {
             $inv_detail = $zmodel->getBaltrantopdf($res[order_id]);
             $tot_balsheet = $zmodel->getTotCnOaa($res[order_id]);
             $cur_bal1 = $zmodel->getCurBalData($res[order_id]);
             $pdf->SetX(10);
             $pdf->Cell(10, 5, "{$i}");
             $pdf->Cell(25, 5, "{$res['order_id']}", 0, 0, 'C');
             foreach ($inv_detail as $inv) {
                 $pdf->SetX(20);
                 $pdf->Cell(25, 5, "");
                 $pdf->Cell(25, 5, "{$inv['invoice_id']}", 0, 0, 'C');
                 $pdf->Cell(15, 5, "{$inv['invoice_amount']}", 0, 0, 'C');
                 $pdf->Cell(20, 5, "{$inv['amt_paid_date']}", 0, 0, 'C');
                 if ($inv[amt_paid] == 0) {
                     $amt_paid = '-';
                 } else {
                     $amt_paid = $inv[amt_paid];
                 }
                 if ($inv[cash_off] == 0) {
                     $cash_off = '-';
                 } else {
                     $cash_off = $inv[cash_off];
                 }
                 $pdf->Cell(25, 5, "{$amt_paid}", 0, 0, 'C');
                 $pdf->Cell(15, 5, "{$cash_off}", 0, 0, 'C');
                 $pdf->Cell(30, 5, "-", 0, 0, 'C');
                 $pdf->Cell(25, 5, "-", 2, 2, 'C');
                 $height = $height + 5;
             }
             $pdf->SetX(20);
             $pdf->Cell(25, 5, "");
             $pdf->Cell(25, 5, "-", 0, 0, 'C');
             $pdf->Cell(15, 5, "-", 0, 0, 'C');
             $pdf->Cell(20, 5, "-", 0, 0, 'C');
             $tot_amt_paid = $tot_balsheet[amt_paid] + $tot_balsheet[sus_ac_use_pay];
             $pdf->SetFont('Times', 'B', 10);
             $pdf->Cell(25, 5, "{$tot_amt_paid}", 0, 0, 'C');
             $pdf->Cell(15, 5, "{$tot_balsheet['cn']}", 0, 0, 'C');
             $pdf->Cell(30, 5, "{$res['payment_status']}", 0, 0, 'C');
             $pdf->Cell(25, 5, "{$cur_bal1['bal_amt']}", 2, 2, 'C');
             $i = $i + 1;
             $height = $height + 10;
             $pdf->SetFont('Times', '', 10);
             //$pdf->Line(10,$height,200,$height);
             $pdf->Ln();
         }
     }
     $height = $height + 3;
     $pdf->Line(10, $height, 200, $height);
     $height = $height + 0.5;
     $pdf->Line(10, $height, 200, $height);
     //order data end//
     $pdf->SetX(150);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(50, 5, "Total Pending Amount: 0", 2, 2, 'L');
     $height = $height + 5;
     $pdf->Line(10, $height, 200, $height);
     $pdf->Line(5, 290, 205, 290);
     $pdf->Line(5, 6, 205, 6);
     $pdf->Line(5, 6, 5, 290);
     $pdf->Line(205, 6, 205, 290);
     $pdf->Output('credit invoice.pdf', 'D');
 }
 function createPDF($ignoreStockStatusDepot = false, $output = 'D', $add_to_daily_statistic = false, $print_per_orders = true)
 {
     /*
         OUTPUT : D -> WILL PRODUCE ONE PDF FOR ALL ORDERS WITH ITEMS IN IT
         OUTPUT : F -> WILL PRODUCE MULTI PDF PER ORDER ITEMS
     */
     global $class_jo, $class_o, $class_do;
     $pi_printed_jg = array();
     $pi_printed_sp = array();
     $pi_printed_dp = array();
     if ($output == 'D') {
         //PRODUCE SINGLE PDF FILE
         $pdf = new PDF('P', 'mm', 'A4');
         $pdf->setTitle('Production Instruction');
         $pdf->SetAuthor('JULIE GRACE / Bonofactum');
         $pdf->SetCreator('k-Auto Generated PDF');
         $pdf->SetDisplayMode('real');
         $pdf->SetAutoPageBreak(false);
         $pdf->AliasNbPages();
         $pdf->SetFillColor(191, 191, 191);
     }
     $item_printed = 0;
     $oiid_last_printed = '';
     /* Moved this on function constructPIContent and replace using below $print_per_orders, 
      * so eventhough we use $output='F' we still could create pi which consists of collection of orders */
     //foreach($this->orders as $order) {
     //    $o = $order['detail'];
     //    foreach($order['items'] as $oiid=>$i) {
     //        if($i['status']<8) $this->pi_printed[strtolower($o['type'])][] = $oiid;
     //        //if($i['status']<8) ${'pi_printed_'.strtolower($o['type'])}[] = $oiid;
     //        $this->constructPIContent($pdf, $output, $order, $oiid, $ignoreStockStatusDepot, $print_per_orders);
     //        $item_printed++;
     //        $oiid_last_printed = $oiid;
     //    }
     //}
     if ($print_per_orders) {
         foreach ($this->orders as $order) {
             $this->constructPIContent($pdf, $output, $order, $ignoreStockStatusDepot, true);
             $item_printed++;
         }
     } else {
         $this->constructPIContent($pdf, $output, $this->orders, $ignoreStockStatusDepot, false);
     }
     #PI Print Counter
     if (count($this->pi_printed['sp']) > 0) {
         $class_jo->printCountAdd($this->pi_printed['sp']);
     }
     if (count($this->pi_printed['jg']) > 0) {
         $class_o->printCountAdd($this->pi_printed['jg']);
     }
     if (count($this->pi_printed['dp']) > 0) {
         $class_do->printCountAdd($this->pi_printed['dp']);
     }
     /* D: Download; F: Save File on Server */
     if ($output == 'D') {
         $infix = '';
         //$infix = count($this->orders)>1 ? '' : strtoupper($o['type']).'O'.$o['id'].'-';
         //if($item_printed==1) $infix = strtoupper($o['type']).'-'.$oiid_last_printed.'-';
         if ($item_printed == 1) {
             $infix = array_keys($this->orders);
             $infix = $infix[0] . '-';
         }
         $filename = 'PI-' . $infix . date('YmdHi');
         $pdf->Output($filename . '.pdf', $output);
         //$pdf->Output($filename.'.pdf','D');
     }
     if ($add_to_daily_statistic) {
         $pt = new production_target();
         $timestamp = date('Y-m-d H:i:s');
         if ($this->qty_total_first_printed > 0) {
             $pt->addDataToField($timestamp, 'start', $this->qty_total_first_printed);
         }
     }
 }
示例#11
0
function home__memberlist_printview()
{
    global $base_url, $files_dir, $config;
    // $content='<html><head><meta http-equiv="Content-Type" content="application/pdf; charset=utf-8" />';
    // drupal_add_css(BOOTSTRAP.'/css/bootstrap.min.css');
    // drupal_add_css(CHURCHDB.'/cdb_printview.css');
    // $content=$content.drupal_get_header();
    if (!user_access("view memberliste", "churchdb")) {
        addErrorMessage(t("no.permission.for", t("list.of.members")));
        return " ";
    }
    require_once ASSETS . '/fpdf17/fpdf.php';
    $compact = true;
    if (isset($_GET["compact"])) {
        $compact = $_GET["compact"];
    }
    // Instanciation of inherited class
    $pdf = new PDF('P', 'mm', 'A4');
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 9);
    $res = home_getMemberList();
    $pdf->SetLineWidth(0.4);
    $pdf->SetDrawColor(200, 200, 200);
    $fields = _home__memberlist_getSettingFields()->fields;
    foreach ($res as $p) {
        $pdf->Line(8, $pdf->GetY() - 1, 204, $pdf->GetY() - 1);
        $pdf->Cell(10, 10, "", 0);
        if ($p->imageurl == null || !file_exists("{$files_dir}/fotos/{$p->imageurl}")) {
            $p->imageurl = "nobody.gif";
        }
        $pdf->Image("{$files_dir}/fotos/{$p->imageurl}", $pdf->GetX() - 10, $pdf->GetY() + 1, 9);
        $pdf->Cell(2);
        $pdf->Cell(13, 9, $p->anrede, 0, 0, 'L');
        $pdf->Cell(48, 9, utf8_decode("{$p->name}, {$p->vorname}"), 0, 0, 'L');
        $pdf->Cell(45, 9, utf8_decode("{$p->strasse}"), 0, 0, 'L');
        // TODO: second occurence of code part - whats this for?
        $birthday = "";
        if ($p->geburtsdatum != null) {
            if ($p->year < 7000) {
                $birthday = "{$p->day}.{$p->month}.";
            }
            if ($p->year != 1004 && $fields["memberlist_birthday_full"]->getValue()) {
                if ($p->year < 7000) {
                    $birthday = $birthday . $p->year;
                } else {
                    $birthday = $birthday . $p->year - 7000;
                }
            }
        }
        $pdf->Cell(20, 9, $birthday, 0, 0, 'L');
        if ($fields["memberlist_telefonprivat"]->getValue() && $p->telefonprivat != "") {
            $pdf->Cell(30, 9, $p->telefonprivat, 0, 0, 'L');
        } else {
            if ($fields["memberlist_telefongeschaeftlich"]->getValue() && $p->telefongeschaeftlich != "") {
                $pdf->Cell(30, 9, $p->telefongeschaeftlich, 0, 0, 'L');
            } else {
                if ($fields["memberlist_telefongeschaeftlich"]->getValue() && $p->fax != "") {
                    $pdf->Cell(30, 9, $p->fax . " (Fax)", 0, 0, 'L');
                } else {
                    $pdf->Cell(30, 9, "", 0, 0, 'L');
                }
            }
        }
        if ($fields["memberlist_telefonhandy"]->getValue() && $p->telefonhandy != "") {
            $pdf->Cell(30, 9, $p->telefonhandy, 0, 0, 'L');
        }
        // Zeilenumbruch
        $pdf->Ln(5);
        $pdf->Cell(73);
        $pdf->Cell(48, 10, "{$p->plz} " . utf8_decode($p->ort), 0, 0, 'L');
        $pdf->Cell(17);
        if ($fields["memberlist_email"]->getValue() && $p->email != "") {
            $pdf->SetFont('Arial', '', 8);
            $pdf->Cell(30, 9, $p->email);
            $pdf->SetFont('Arial', '', 9);
        }
        $pdf->Ln(12);
    }
    $pdf->Output(t("list.of.members") . '.pdf', 'I');
}
示例#12
0
function generapdfadmin($args)
{
    $dom = ZLanguage::getModuleDomain('IWbooks');
	require_once(ModUtil::getVar('IWbooks', 'fpdf').'fpdf.php');
	
//	print_r($args);
	
	// directori amb fitxers temporals (ha de tenir perm�s d'escriptura))
	       // $dir = "modules/IWbooks/tmp/";
	$dir = ModUtil::getVar('IWmain', 'documentRoot')."/".ModUtil::getVar('IWmain', 'tempFolder')."/";
	$dir = ModUtil::getVar('IWmain', 'documentRoot')."/".ModUtil::getVar('IWmain', 'tempFolder')."/";
	// mida de la lletra llibres
	$mida = 9;

	// Netegem els fitxers temporals amb X segons d'antiguitat
	NetejaFitxers($dir);

	$file = $dir."tmp".date('h'.'m'.'s'.'d').".pdf";

	extract($args);
	$cursacad    = ModUtil::apiFunc('IWbooks', 'user', 'cursacad', array('any' => $any));
	
	if ($materia == 'TOT'){
	    $nommateria = __('All subjects', $dom);
	}else{
	    $nommateria  = ModUtil::apiFunc('IWbooks', 'user', 'nommateria', array('codi_mat' => $materia));    
	}
	
	if ($nivell == ''){
	    $nivell_abre = __('All courses', $dom);
	}else{
	    $nivell_abre = ModUtil::apiFunc('IWbooks', 'user', 'reble', array('nivell' => $nivell));    
	}
	
	if ($etapa == 'TOT'){
	    $mostra_pla = __('All stages', $dom);    
	}else{
	     $mostra_pla = ModUtil::apiFunc('IWbooks', 'user', 'descriplans', array('etapa' => $etapa));   
	}

	if ($materia == "TOT")
	$mostra_codis = 1;

	$items = ModUtil::apiFunc('IWbooks',
                          'user',
                          'getall',
	array('startnum' => $startnum,
                                'any'      => $any,
                                'etapa'    => $etapa,
                                'nivell'   => $nivell,
                                'text'     => $text,
                                'lectura'  => $lectura,
                                'materia'  => $materia,
                                'materials'=> $materials,
                                'observacions' => $observacions,
                                'flag'     => 'admin',
                                'numitems' => 1000));

	$pdf=new PDF();
	$pdf->AliasNbPages();
	$pdf->Open();
	$pdf->SetMargins(25,20);
	$pdf->AddPage();

	//$marge_esq = 40;
	//$marge_sup = 36;
	$alt       = 5;
	$fita      = 0;

	if (count($items) == 0){
		$pdf->Write($alt, utf8_decode(__('There aren\'t books for your selection', $dom)));
		$pdf->Output($file);
		System::redirect(ModUtil::func('IWbooks', 'user', 'getFile', array('fileName' => str_replace(ModUtil::getVar('IWmain', 'documentRoot')."/",'',$file))));
		return $file;
	}
	$pdf->SetFillColor(230,230,230);
	$pdf->SetFont('Arial','B', 14);
	$pdf->MultiCell(0,7,utf8_decode(__('List of books · Course', $dom).$cursacad." · ".$nommateria.', '.$nivell_abre.' - '.$mostra_pla),1,'C',1);

	$pdf->Ln(10);
	$pdf->SetFont('Arial','BU', 12);
	$pdf->Write($alt, utf8_decode(__('Textbooks', $dom)));
	$pdf->Ln(7);

	// $amaterials = array();

	foreach ($items as $item) {
		if( $item[lectura] == 1 and $fita_lect != 1){
			$fita_lect = 1;
			$pdf->SetFont('Arial','BU',12);
			$pdf->Ln(7);
			$pdf->Write($alt, utf8_decode(__('Reading Books', $dom)));
			$pdf->Ln(7);
		}

		if( $item[optativa] == 1 and $fita_opt != 1){
			$fita_lect = 0;
			$fita_opt  = 1;
			$pdf->SetFont('Arial','BU',12);
			$pdf->Ln(10);
			$pdf->SetFont('Arial','B', 14);
			$pdf->MultiCell(0,7,utf8_decode("Matèries optatives"),1,'C',1);
			$pdf->SetFont('Arial','BU',12);
			$pdf->Ln(7);

			if ($item[lectura] == 1){
				$fita_lect = 1;
				$pdf->Write($alt, __('Reading Books', $dom));
				$pdf->Ln(7);
			}else{
				$pdf->Write($alt, __('Textbooks', $dom));
				$pdf->Ln(7);
			}
		}
		if ($item['optativa'] == 1)
		$optativa =  utf8_decode(__('**', $dom)) ;

		$nommateria = utf8_decode(ModUtil::apiFunc('IWbooks', 'user', 'nommateria', array('codi_mat' => $item['codi_mat'])));
		$nivell_abre = ModUtil::apiFunc('IWbooks', 'user', 'reble', array('nivell' => $item['nivell']));
		$pdf->SetFont('Arial','B',$mida);


		//       if ( $item['codi_mat'] != "AAA"){
		if ( substr($item['codi_mat'],0, 2) != "AA"){

			$codis = "";

			if ($mostra_codis == 1)
			$codis = " (".$item['codi_mat'].") ";

			$pdf->Write($alt, utf8_decode(chr(149)." ".$optativa." ".$nivell_abre." ".$item[etapa].$codis." -  "));
			$pdf->SetFont('Arial','',$mida);
			$m_autor = "";
			if ($item[autor] != "")
			$m_autor = utf8_decode($item[autor]).", ";
			$pdf->Write($alt, $m_autor);
			$pdf->SetFont('Arial','I',$mida);
			$pdf->Write($alt, utf8_decode($item[titol]));
			$pdf->SetFont('Arial','',$mida);
			$m_aval = '';
			if( $item[avaluacio] != "")
			$m_aval = ", (".$item[avaluacio]. utf8_decode(__('to avaluation', $dom)).")";
			$m_publi = "";
			if( $item[any_publi] != "")
			$m_publi = ", ".$item[any_publi];
			$m_isbn = "";
			if($item[isbn] != "")
			$m_isbn = ", (ISBN: ". $item[isbn].")";
			$pdf->Write($alt,", ".utf8_decode($item[editorial]).$m_publi.$m_aval.$m_isbn);

			$m_obs = "";

			if($item[observacions] != "")
			$m_obs = " -- (". utf8_decode($item[observacions]).")";

			$pdf->SetFont('Arial','I',$mida_font);
			$pdf->Write($alt,$m_obs);

			$pdf->Ln(6);
		}
			
		if ( $item[materials] != ""){
			$amaterials[] = array( 'nom_mat'   => $nommateria,
                                       'materials' => $item[materials],
                                       'etapa'     => $item[etapa],
                                       'optativa'  => $optativa,
									   'nivell'	   => $item[nivell]);
		}
	}

	$fita_mat = 0;
	$llis_mat = ModUtil::getVar('IWbooks', 'llistar_materials');

	foreach($amaterials as $row){
		if ($llis_mat == "1"){
			if( $llis_mat == 1 and $fita_mat != 1){
				$fita_mat = 1;
				$pdf->SetFont('Arial','B',14);
				$pdf->Ln(7);
				$pdf->MultiCell(0,7, utf8_decode(__('Materials', $dom)),1,'C',1);
				//                    $pdf->Write($alt, __('Materials', $dom));
				$pdf->Ln(7);
			}

			$pdf->SetFont('Arial','B',$mida);
			$nivell_abre = ModUtil::apiFunc('IWbooks', 'user', 'reble', array('nivell' => $row[nivell]));
			$pdf->Write($alt,chr(149)." ".$row[optativa]." ".$nivell_abre." ".$row[etapa]." - ".$row[nom_mat]);
			$pdf->Ln(6);
			$pdf->SetFont('Arial','',$mida);
			$posicio = $pdf->GetX();
			$pdf->SetX($posicio+8);
			$pdf->Multicell(0,$alt,utf8_decode($row[materials]));
			$pdf->SetX($posicio);
			$pdf->Ln(5);
		}
	}


	$pdf->Output($file);

	System::redirect(ModUtil::func('IWbooks', 'user', 'getFile', array('fileName' => str_replace(ModUtil::getVar('IWmain', 'documentRoot')."/",'',$file))));

//    System::redirect($file);
    
	return $file;
}
示例#13
0
文件: base.php 项目: royer21/staff2
 protected function generaReporte($data, $titulo = '')
 {
     $this->load->library('Pdf');
     $pdf = new PDF('L', 'mm', 'A4');
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 10);
     //if ($titulo != '')
     //{
     //	$pdf->Cell(40, 10, $titulo, 1);
     //	$pdf->Ln();
     //	$pdf->Ln();
     //}
     $header = array('N°', 'Nombre', 'Ubicación', 'Presidente(a)', 'Celular');
     $w = array(10, 80, 80, 80, 25);
     $pdf->SetFont('Arial', 'B', 10);
     for ($i = 0; $i < count($header); $i++) {
         $pdf->Cell($w[$i], 8, utf8_decode($header[$i]), 1, 0, 'C');
     }
     $pdf->Ln();
     $pdf->SetFont('Arial', '', 12);
     foreach ($data as $row) {
         $pdf->Cell($w[0], 6, utf8_decode($row->orden), 1);
         $pdf->Cell($w[1], 6, utf8_decode($row->nombre), 1);
         $pdf->Cell($w[2], 6, utf8_decode($row->ubicacion), 1);
         $pdf->Cell($w[3], 6, utf8_decode($row->jefe), 1);
         $pdf->Cell($w[4], 6, utf8_decode($row->celular), 1);
         $pdf->Ln();
     }
     $pdf->Cell(array_sum($w), 0, '', 'T');
     $pdf->Output();
 }
示例#14
0
forum_opt($last['opt'], $last['optvalue'], $last['id']);
$start = $_GET['page'] * $config['topiczahl'];
$start = $start - $config['topiczahl'];
// Some speed optimisation
$speeder = $info['posts'] + 1;
if ($speeder > $config['topiczahl']) {
    $searchsql = " LIMIT " . $start . "," . $config['topiczahl'];
} else {
    $searchsql = " LIMIT " . $speeder;
}
$bbcode = initBBCodes();
$memberdata = cache_memberdata();
$pdftitle = html_entity_decode($config['fname'] . ": " . $pre . $info['topic']);
$pdf = new PDF();
$pdf->SetCompression($config['pdfcompress']);
$pdf->AliasNbPages('[Pages]');
$pdf->SetCreator('Viscacha ' . $config['version']);
$pdf->SetAuthor($config['fname']);
$pdf->SetSubject($pre . $info['topic']);
$pdf->SetTitle($pre . $info['topic']);
$pdf->AddPage();
$inner['body'] = '';
// prepare for vote
if (!empty($info['vquestion']) && $_GET['page'] == 1) {
    $votes = 0;
    $inner['head'] = $lang->phrase('pdf_vote') . $info['vquestion'];
    $cachev = array();
    $aids = array();
    $vresult = $db->query("\n\tSELECT COUNT(r.id) as votes, v.id, v.answer\n\tFROM {$db->pre}vote AS v LEFT JOIN {$db->pre}votes AS r ON r.aid=v.id \n\tWHERE v.tid = '{$info['id']}' GROUP BY v.id ORDER BY v.id", __LINE__, __FILE__);
    while ($row = $db->fetch_assoc($vresult)) {
        $row['answer'] = $gpc->prepare($row['answer']);
示例#15
0
 /**
  * Main
  *
  * @param object $order Order
  * @param string $mode Download or display (optional)
  */
 public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false)
 {
     global $cookie;
     if (!Validate::isLoadedObject($order) or !$cookie->id_employee and (!OrderState::invoiceAvailable($order->getCurrentState()) and !$order->invoice_number)) {
         die('Invalid order or invalid order state');
     }
     self::$order = $order;
     self::$orderSlip = $slip;
     self::$delivery = $delivery;
     self::$_iso = strtoupper(Language::getIsoById((int) self::$order->id_lang));
     if ((self::$_priceDisplayMethod = $order->getTaxCalculationMethod()) === false) {
         die(self::l('No price display method defined for the customer group'));
     }
     if (!$multiple) {
         $pdf = new PDF('P', 'mm', 'A4');
     }
     $pdf->SetAutoPageBreak(true, 35);
     $pdf->StartPageGroup();
     self::$currency = Currency::getCurrencyInstance((int) self::$order->id_currency);
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $width = 100;
     $pdf->SetX(10);
     $pdf->SetY(25);
     $pdf->SetFont(self::fontname(), '', 12);
     $pdf->Cell($width, 10, self::l('Billing Address'), 0, 'L');
     $pdf->Cell($width, 10, self::l('Delivery Address'), 0, 'L');
     $pdf->Ln(5);
     $pdf->SetFont(self::fontname(), '', 9);
     $addressType = array('invoice' => array(), 'delivery' => array());
     $patternRules = array('optional' => array('address2', 'company'), 'avoid' => array('State:iso_code'));
     $addressType = self::generateHeaderAddresses($pdf, $order, $addressType, $patternRules, $width);
     if (Configuration::get('VATNUMBER_MANAGEMENT') and !empty($addressType['invoice']['addressObject']->vat_number)) {
         $vat_delivery = '';
         if ($addressType['invoice']['addressObject']->id != $addressType['delivery']['addressObject']->id) {
             $vat_delivery = $addressType['delivery']['addressObject']->vat_number;
         }
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $vat_delivery), 0, 'L');
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->vat_number), 0, 'L');
         $pdf->Ln(5);
     }
     if ($addressType['invoice']['addressObject']->dni != NULL) {
         $pdf->Cell($width, 10, self::l('Tax ID number:') . ' ' . Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->dni), 0, 'L');
     }
     /*
      * display order information
      */
     $boxTop = $pdf->GetY();
     $pdf->Rect(10, $boxTop, 90, 45);
     $pdf->Rect(110, $boxTop, 90, 45);
     //$pdf->SetY(70);
     $pdf->SetFillColor(240, 240, 240);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Cell(90, 6, self::l('Order Details'), 1, 2, 'C', 1);
     $carrier = new Carrier(self::$order->id_carrier);
     if ($carrier->name == '0') {
         $carrier->name = Configuration::get('PS_SHOP_NAME');
     }
     $history = self::$order->getHistory(self::$order->id_lang);
     foreach ($history as $h) {
         if ($h['id_order_state'] == _PS_OS_SHIPPING_) {
             $shipping_date = $h['date_add'];
         }
     }
     //$pdf->Ln(12);
     //Initialize price calculations
     $priceBreakDown = array();
     $pdf->priceBreakDownCalculation($priceBreakDown);
     if (!self::$orderSlip or self::$orderSlip and self::$orderSlip->shipping_cost) {
         $priceBreakDown['totalWithoutTax'] += Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2) + Tools::ps_round($priceBreakDown['wrappingCostWithoutTax'], 2);
         $priceBreakDown['totalWithTax'] += self::$order->total_shipping + self::$order->total_wrapping + self::$order->total_cod + $priceBreakDown['customizationCost'];
     }
     if (!self::$orderSlip) {
         $taxDiscount = self::$order->getTaxesAverageUsed();
         if ($taxDiscount != 0) {
             $priceBreakDown['totalWithoutTax'] -= Tools::ps_round(self::$order->total_discounts / (1 + self::$order->getTaxesAverageUsed() * 0.01), 2);
         } else {
             $priceBreakDown['totalWithoutTax'] -= self::$order->total_discounts;
         }
         $priceBreakDown['totalWithTax'] -= self::$order->total_discounts;
     }
     $pdf->SetFont(self::fontname(), '', 9);
     /*if (self::$orderSlip)
     			$pdf->Cell(0, 6, self::l('SLIP #').' '.sprintf('%06d', self::$orderSlip->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
     		elseif (self::$delivery)
     			$pdf->Cell(0, 6, self::l('DELIVERY SLIP #').Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', (int)($cookie->id_lang))).sprintf('%06d', self::$delivery).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
     		else
     			$pdf->Cell(0, 6, self::l('Order Details'), 1, 2, 'L', 1);*/
     $pdf->SetFontSize(10);
     $pdf->Ln(3);
     $pdf->Cell(90, 6, self::l('Order No. :') . ' ' . sprintf('%06d', self::$order->id), 0, 2, 'C');
     $pdf->Cell(90, 6, self::l('Order Date:') . ' ' . Tools::displayDate($order->invoice_date, self::$order->id_lang), 0, 2, 'C');
     $pdf->Cell(90, 6, 'Invoice No.' . ' ' . Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', (int) $cookie->id_lang)) . sprintf('%06d', self::$order->invoice_number), 0, 2, 'C');
     $pdf->SetY($boxTop);
     $pdf->SetX(110);
     $pdf->SetFontSize(10);
     $pdf->Cell(90, 6, self::l('Shipment Details'), 1, 2, 'C', 1);
     $pdf->SetFontSize(10);
     //$pdf->Cell(45, 6, self::l('Payment:').($order->gift ? ' '.Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 0, 0, 'C');
     if (strpos($order->payment, 'COD') === false) {
         $pdf->Cell(90, 6, 'Payment: ' . Tools::iconv('utf-8', self::encoding(), 'Online Payment'), 0, 2, 'C');
         $pdf->Cell(90, 6, 'PAID', 'B', 2, 'C');
     } else {
         $pdf->Cell(90, 6, 'Payment: ' . Tools::iconv('utf-8', self::encoding(), 'COD'), 0, 2, 'C');
         $pdf->Cell(90, 6, 'Collect: ' . self::convertSign(Tools::displayPrice(self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax'], self::$currency, true)), 'B', 2, 'C');
     }
     $pdf->Cell(90, 6, self::l('Shipping: ') . $carrier->name, 0, 2, 'C');
     //$pdf->Ln(5);
     $tracking_number = '';
     if ($order->shipping_number) {
         $tracking_number = 'Tracking code: ' . $order->shipping_number;
         $pdf->Cell(90, 6, $tracking_number, 'B', 2, 'C');
         $pdf->addBarcode($order->shipping_number);
     }
     $pdf->SetY($boxTop + 45);
     $pdf->Ln(5);
     $pdf->ProdTab(self::$delivery ? true : '');
     /* Exit if delivery */
     if (!self::$delivery) {
         //if (!self::$orderSlip)
         //$pdf->DiscTab();
         if (self::$orderQuantity) {
             $pdf->Ln(3);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell(150, 4, self::l('Total Quantity') . ' : ', 'B', 0, 'R');
             $pdf->Cell(0, 4, self::$orderQuantity, 'B', 2, 'L');
             $pdf->Ln(6);
         }
         /*
          * Display price summation
          */
         if (Configuration::get('PS_TAX') or $order->total_products_wt != $order->total_products) {
             /*$pdf->Ln(5);
             		$pdf->SetFont(self::fontname(), 'B', 8);
             		$width = 165;
             		$pdf->Cell($width, 0, self::l('Order Total').' : ', 0, 0, 'R');
             		$pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
             		$pdf->Ln(4);
             		*/
             /*
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products (tax incl.)').' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
             */
         } else {
             $pdf->Ln(5);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products ') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         if (isset(self::$order->total_wrapping) and (double) self::$order->total_wrapping > 0) {
             $pdf->Cell($width, 0, self::l('Total gift-wrapping') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['wrappingCostWithoutTax'], self::$currency, true)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_wrapping, self::$currency, true)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         /*
         $pdf->Cell($width, 0, self::l('Tax').' : ', 0, 0, 'R');
         $pdf->Cell(0, 0, self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'] - $priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
         $pdf->Ln(4);
         */
         if ($priceBreakDown['customizationCost'] > 0) {
             $pdf->Cell($width, 0, self::l('Stitching and Customizations') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['customizationCost'], self::$currency, true)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['customizationCost'], self::$currency, true)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (isset(self::$order->total_cod) and (double) self::$order->total_cod > 0) {
             $pdf->Cell($width, 0, self::l('COD Charges') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_cod, self::$currency, true)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_cod, self::$currency, true)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (self::$order->total_shipping != '0.00' and (!self::$orderSlip or self::$orderSlip and self::$orderSlip->shipping_cost)) {
             $pdf->Cell($width, 0, self::l('Shipping') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2), self::$currency, true)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (!self::$orderSlip and self::$order->total_discounts != '0.00') {
             $pdf->Cell($width, 0, self::l('Discounts') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (!self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_discounts, self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
             /*$pdf->Cell($width, 0, self::l('Sub-total').' : ', 0, 0, 'R');
             		$pdf->Cell(0, 0, self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'] - self::$order->total_discounts, self::$currency, true)), 0, 0, 'R');
             		$pdf->Ln(4);*/
         }
         if (Configuration::get('PS_TAX') or $order->total_products_wt != $order->total_products) {
             $pdf->Cell($width, 0, self::l('Total') . ' ' . (self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax excl.)') : self::l(' (tax incl.)')) . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         } else {
             $pdf->Cell($width, 0, self::l('Total') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalWithoutTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         $pdf->TaxTab($priceBreakDown);
         $pdf->addShopAddress1();
     }
     Hook::PDFInvoice($pdf, self::$order->id);
     if (!$multiple) {
         return $pdf->Output('IndusDiva Order #' . sprintf('%06d', self::$order->id) . '.pdf', $mode);
     }
 }
 public function printviewAction()
 {
     require_once 'fpdf/pdf.php';
     $cdrequest = $_GET["cdrequest"];
     $Request = new RequestModel();
     $Attribute = new AttributeModel();
     $AttributeExaminationMaterial = new AppraisalcontrolModel();
     $Factor = new FactorModel();
     $array = array();
     $req = $Request->fetchAll($Request->getAllRequestData($cdrequest));
     if (count($req) <= 0) {
         die;
     }
     foreach ($req as $row) {
         $dtbirth = new Zend_Date($row['dtbirth'], 'dd-MM-YYYY');
         $dtrequest = new Zend_Date($row['dtrequest'], 'dd-MM-YYYY HH:mm:ss');
         $year = $dtbirth->toString('YYYY');
         $month = $dtbirth->toString('MM');
         $day = $dtbirth->toString('dd');
         $today = new Zend_Date();
         $tdYear = $today->toString('YYYY');
         $tdMonth = $today->toString('MM');
         $tdDay = $today->toString('dd');
         $nrage = 0;
         $nrage = GslabUtils::calcAgeDifference($row['dtbirth']);
         $idade = GslabUtils::calcula_idade($row['dtbirth']);
         if ($tdMonth < $month || $tdMonth == $month && $tdDay < $day) {
             $nrage--;
         }
         if ($row['fgsex'] == 1) {
             $fgsex = "Masculino";
         } else {
             $fgsex = "Feminino";
         }
         $array['nmclient'] = $row['nmclient'];
         $array['nmforward'] = $row['nmforward'];
         $array['nmcompany'] = $row['nmcompany'];
         $array['nmbarcodesample'] = $row['nmbarcodesample'];
         $array['nmcovenant'] = $row['nmcovenant'];
         $array['dtrequest'] = $dtrequest;
         $array['idade'] = $nrage;
         $array['sexo'] = $fgsex;
     }
     $GLOBALS = $array;
     $ano = explode(" ", $nrage);
     $pdf = new PDF();
     $pdf->AddPage();
     $pdf->ln(30);
     $pdf->AliasNbPages('{total}');
     $req2 = $Request->fetchAll($Request->getAllRequestData($cdrequest));
     $appraisalCommon = AppraisalCommon::getInstance($this);
     foreach ($req2 as $rows) {
         $fgstatus = true;
         /* NOME DO EXAME */
         $pdf->SetFont('Courier', 'BI', 11);
         $pdf->Cell(0, 10, strtoupper(utf8_decode($rows['nmexamination'])), 0, 2, 'L');
         $pdf->SetFont('Courier', '', 9);
         $pdf->Cell(0, 0, utf8_decode("Material: " . strtoupper($rows['nmmaterial'])), 0, 0, 'L');
         $pdf->Cell(-30, 0, utf8_decode("Método: Automação CELL-DYN 3000/3500"), 0, 2, 'R');
         $pdf->ln(2);
         // $pdf->Cell(250, 5, utf8_decode("Valores referenciais"), 0, 1, 'C');
         $pdf->ln(2);
         $sons = $this->getExamSons($rows['cdexamination']);
         if (count($sons) > 0) {
             for ($aux_i = 0; $aux_i < count($sons); $aux_i++) {
                 $pdf->SetFont('Courier', '', 10);
                 $pdf->Cell(-360, 5, strtoupper(utf8_decode($sons[$aux_i]['nmexamination'])), 0, 0, 'L');
                 /* NOME DO ATRIBUTO E VALOR */
                 $attributes = $appraisalCommon->getExamAttribs($sons[$aux_i]['cdexaminationmaterial']);
                 //print_r($attributes);
                 $fgstatus = true;
                 foreach ($attributes as $attr) {
                     $vlattr = '';
                     $cdattr = '';
                     $obj = new stdClass();
                     $obj->cdexaminationmaterial = $sons[$aux_i]['cdexaminationmaterial'];
                     $obj->cdrequest = $cdrequest;
                     $obj->cdexamination = $rows['cdexamination'];
                     $obj->cdattribute = $attr['cdattribute'];
                     $vlattribute = $appraisalCommon->getAppraisalAttributeValue($obj);
                     foreach ($vlattribute as $kAttr => $vAttr) {
                         if ($kAttr == 'vlattribute') {
                             $vlattr = $vAttr['vlattribute'];
                         }
                         if ($kAttr == 'cdattribute') {
                             $cdattr = $vAttr['cdattribute'];
                         }
                     }
                     $AttributeData = $Attribute->fetchAll($Attribute->getAtributeNotation($cdattr));
                     foreach ($AttributeData as $key => $value) {
                         if ($key == 'idnotation') {
                             $idnotation = $value['idnotation'];
                         }
                     }
                     $pdf->SetFont('Courier', '', 10);
                     $pdf->ln();
                     $pdf->Cell(40, 5, "    " . str_pad(utf8_decode($attr['nmattribute']), 15, "."), 0, 0, 'L');
                     $pdf->SetFont('Courier', 'B', 10);
                     $pdf->Cell(65, 5, str_pad($vlattr . " " . $idnotation, 15, ".", STR_PAD_LEFT), 0, 0, 'L');
                     $ref = $appraisalCommon->getExamFactors($sons[$aux_i]['cdexaminationmaterial'], $cdattr);
                     foreach ($ref as $vlref) {
                         if ($vlref['fgfactor'] == 1) {
                             $fator = "Idade            Valores referenciais";
                         } else {
                             if ($vlref['fgfactor'] == 2) {
                                 $fator = "Masculino                    Feminino";
                             } else {
                                 if ($vlref['fgfactor'] == 3) {
                                     $fator = "Idade       Masculino        Feminino";
                                 }
                             }
                         }
                     }
                     if ($fgstatus == true) {
                         $pdf->Cell(-1);
                         $pdf->Cell(1, -5, $fator, 0, 0, 'L');
                         $fgstatus = false;
                     }
                     /* VALORES DE REFERÊNCIA */
                     foreach ($ref as $vlref) {
                         /*
                          * AQUI SÃO DEFINIDAS AS REGRAS DE EXIBIÇÃO DO PDF, COLUNAS POR IDADE, SEXO OU AMBOS:
                          * 
                          * fgfactor = 1
                          * ATRIBUTO........VALOR        IDADE    REFERÊNCIA
                          * 
                          * fgfactor = 2
                          * ATRIBUTO........VALOR        MASCULINO    FEMININO
                          * 
                          * fgfactor = 3
                          * ATRIBUTO........VALOR        IDADE    MASCULINO    FEMININO
                          * 
                          */
                         $pdf->SetFont('Courier', '', 9);
                         /* DEFINE QUAL CAMPO DA TABELA ESTÁ PREENCHIDO (VALOR OU NUMÉRICO) E ALOCA À UMA VARIÁVEL */
                         if ($vlref['nrminvalue'] == '' && $vlref['nrmaxvalue'] == '' && $vlref['vlminvalue'] != '' && $vlref['vlmaxvalue'] != '') {
                             $minvalue = $vlref['vlminvalue'];
                             $maxvalue = $vlref['vlmaxvalue'];
                         } else {
                             if ($vlref['nrminvalue'] != '' && $vlref['nrmaxvalue'] != '' && $vlref['vlminvalue'] == '' && $vlref['vlmaxvalue'] == '') {
                                 $minvalue = $vlref['nrminvalue'];
                                 $maxvalue = $vlref['nrmaxvalue'];
                             }
                         }
                         if ($vlref['fgfactor'] == 1) {
                             //SEPARADOS PELA IDADE, DEFINE UMA COLUNA DE RESULTADOS
                             if ($vlref['nrminage'] <= $ano[0] && $vlref['nrmaxage'] >= $ano[0]) {
                                 $pdf->Cell(12, 5, utf8_decode($vlref['nrminage'] . " à " . $vlref['nrmaxage'] . " " . $vlref['nmtimetype']), 0, 0, 'R');
                                 $pdf->Cell(67, 5, utf8_decode($minvalue . " à " . $maxvalue), 0, 0, 'R');
                             }
                         } else {
                             if ($vlref['fgfactor'] == 2) {
                                 //SEPARADOS PELO SEXO, DEFINE DUAS COLUNAS DE RESULTADOS
                                 if ($vlref['fggender'] == 1) {
                                     // MASCULINO
                                     $pdf->Cell(20, 5, utf8_decode($vlref['vlminvalue'] . " à " . $vlref['vlmaxvalue']), 0, 0, 'R');
                                 } else {
                                     if ($vlref['fggender'] == 2) {
                                         // FEMININO
                                         $pdf->Cell(60, 5, utf8_decode($vlref['vlminvalue'] . " à " . $vlref['vlmaxvalue']), 0, 1, 'R');
                                     }
                                 }
                             } else {
                                 if ($vlref['fgfactor'] == 3) {
                                     //SEPARADOS PELO SEXO E IDADE, DEFINE TRÊS COLUNAS DE RESULTADOS
                                     if ($vlref['fggender'] == 1) {
                                         // MASCULINO
                                         $pdf->Cell(12, 5, utf8_decode($vlref['nrminage'] . " à " . $vlref['nrmaxage'] . " " . $vlref['nmtimetype']), 0, 0, 'R');
                                         $pdf->Cell(33, 5, utf8_decode($vlref['vlminvalue'] . " à " . $vlref['vlmaxvalue']), 0, 0, 'R');
                                     } else {
                                         if ($vlref['fggender'] == 2) {
                                             // FEMININO
                                             $pdf->Cell(35, 5, utf8_decode($vlref['vlminvalue'] . " à " . $vlref['vlmaxvalue']), 0, 1, 'R');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     unset($obj);
                 }
                 $pdf->ln();
                 $pdf->ln();
             }
         }
     }
     $pdf->Output();
     //IMPRIME O PDF NA TELA
     $pdf->Output("teste.pdf");
     //IMPRIME O PDF NO ARQUIVO
 }
示例#17
0
 /**
  * Main
  *
  * @param object $order Order
  * @param string $mode Download or display (optional)
  */
 public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false)
 {
     global $cookie, $ecotax;
     if (!Validate::isLoadedObject($order) or !$cookie->id_employee and (!OrderState::invoiceAvailable($order->getCurrentState()) and !$order->invoice_number)) {
         die('Invalid order or invalid order state');
     }
     self::$order = $order;
     self::$orderSlip = $slip;
     self::$delivery = $delivery;
     self::$_iso = strtoupper(Language::getIsoById(intval(self::$order->id_lang)));
     if ((self::$_priceDisplayMethod = $order->getTaxCalculationMethod()) === false) {
         die(self::l('No price display method defined for the customer group'));
     }
     if (!$multiple) {
         $pdf = new PDF('P', 'mm', 'A4');
     }
     $pdf->SetAutoPageBreak(true, 35);
     $pdf->StartPageGroup();
     self::$currency = Currency::getCurrencyInstance(intval(self::$order->id_currency));
     $pdf->AliasNbPages();
     $pdf->AddPage();
     /* Display address information */
     $invoice_address = new Address(intval($order->id_address_invoice));
     $invoiceState = $invoice_address->id_state ? new State($invoice_address->id_state) : false;
     $delivery_address = new Address(intval($order->id_address_delivery));
     $deliveryState = $delivery_address->id_state ? new State($delivery_address->id_state) : false;
     $shop_country = Configuration::get('PS_SHOP_COUNTRY');
     $invoice_customer = new Customer(intval($invoice_address->id_customer));
     $width = 100;
     $pdf->SetX(10);
     $pdf->SetY(25);
     $pdf->SetFont(self::fontname(), '', 12);
     $pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');
     $pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L');
     $pdf->Ln(5);
     $pdf->SetFont(self::fontname(), '', 9);
     if (!empty($delivery_address->company) or !empty($invoice_address->company)) {
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->company), 0, 'L');
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->company), 0, 'L');
         $pdf->Ln(5);
     }
     $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->firstname) . ' ' . Tools::iconv('utf-8', self::encoding(), $delivery_address->lastname), 0, 'L');
     $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->firstname) . ' ' . Tools::iconv('utf-8', self::encoding(), $invoice_address->lastname), 0, 'L');
     $pdf->Ln(5);
     $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address1), 0, 'L');
     $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address1), 0, 'L');
     $pdf->Ln(5);
     if (!empty($invoice_address->address2) or !empty($delivery_address->address2)) {
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address2), 0, 'L');
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address2), 0, 'L');
         $pdf->Ln(5);
     }
     $pdf->Cell($width, 10, $delivery_address->postcode . ' ' . Tools::iconv('utf-8', self::encoding(), $delivery_address->city), 0, 'L');
     $pdf->Cell($width, 10, $invoice_address->postcode . ' ' . Tools::iconv('utf-8', self::encoding(), $invoice_address->city), 0, 'L');
     $pdf->Ln(5);
     $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->country . ($deliveryState ? ' - ' . $deliveryState->name : '')), 0, 'L');
     $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->country . ($invoiceState ? ' - ' . $invoiceState->name : '')), 0, 'L');
     $pdf->Ln(5);
     $pdf->Cell($width, 10, $delivery_address->phone, 0, 'L');
     if ($invoice_customer->dni != NULL) {
         $pdf->Cell($width, 10, self::l('Tax ID number:') . ' ' . Tools::iconv('utf-8', self::encoding(), $invoice_customer->dni), 0, 'L');
     }
     if (!empty($delivery_address->phone_mobile)) {
         $pdf->Ln(5);
         $pdf->Cell($width, 10, $delivery_address->phone_mobile, 0, 'L');
     }
     /*
      * display order information
      */
     $carrier = new Carrier(self::$order->id_carrier);
     if ($carrier->name == '0') {
         $carrier->name = Configuration::get('PS_SHOP_NAME');
     }
     $history = self::$order->getHistory(self::$order->id_lang);
     foreach ($history as $h) {
         if ($h['id_order_state'] == _PS_OS_SHIPPING_) {
             $shipping_date = $h['date_add'];
         }
     }
     $pdf->Ln(12);
     $pdf->SetFillColor(240, 240, 240);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont(self::fontname(), '', 9);
     if (self::$orderSlip) {
         $pdf->Cell(0, 6, self::l('SLIP #') . sprintf('%06d', self::$orderSlip->id) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
     } elseif (self::$delivery) {
         $pdf->Cell(0, 6, self::l('DELIVERY SLIP #') . Configuration::get('PS_DELIVERY_PREFIX', intval($cookie->id_lang)) . sprintf('%06d', self::$delivery) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
     } else {
         $pdf->Cell(0, 6, self::l('INVOICE #') . Configuration::get('PS_INVOICE_PREFIX', intval($cookie->id_lang)) . sprintf('%06d', self::$order->invoice_number) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
     }
     $pdf->Cell(55, 6, self::l('Order #') . sprintf('%06d', self::$order->id), 'L', 0);
     $pdf->Cell(70, 6, self::l('Carrier:') . ($order->gift ? ' ' . Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
     $pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
     $pdf->Ln(5);
     $pdf->Cell(55, 6, isset($shipping_date) ? self::l('Shipping date:') . ' ' . Tools::displayDate($shipping_date, self::$order->id_lang) : ' ', 'LB', 0);
     $pdf->Cell(70, 6, $order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name), 'LRB');
     $pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
     $pdf->Ln(15);
     $pdf->ProdTab(self::$delivery ? true : '');
     /* Exit if delivery */
     if (!self::$delivery) {
         if (!self::$orderSlip) {
             $pdf->DiscTab();
         }
         $priceBreakDown = array();
         $pdf->priceBreakDownCalculation($priceBreakDown);
         if (!self::$orderSlip or self::$orderSlip and self::$orderSlip->shipping_cost) {
             $priceBreakDown['totalWithoutTax'] += Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2) + Tools::ps_round($priceBreakDown['wrappingCostWithoutTax'], 2);
             $priceBreakDown['totalWithTax'] += self::$order->total_shipping + self::$order->total_wrapping;
         }
         if (!self::$orderSlip) {
             $taxDiscount = self::$order->getTaxesAverageUsed();
             if ($taxDiscount != 0) {
                 $priceBreakDown['totalWithoutTax'] -= Tools::ps_round(self::$order->total_discounts / (1 + self::$order->getTaxesAverageUsed() * 0.01), 2);
             } else {
                 $priceBreakDown['totalWithoutTax'] -= self::$order->total_discounts;
             }
             $priceBreakDown['totalWithTax'] -= self::$order->total_discounts;
         }
         /*
          * Display price summation
          */
         if (Configuration::get('PS_TAX') or $order->total_products_wt != $order->total_products) {
             $pdf->Ln(5);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products (tax excl.)') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products (tax incl.)') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'], self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
         } else {
             $pdf->Ln(5);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products ') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         if (!self::$orderSlip and self::$order->total_discounts != '0.00') {
             $pdf->Cell($width, 0, self::l('Total discounts (tax incl.)') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (!self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_discounts, self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         if (isset(self::$order->total_wrapping) and floatval(self::$order->total_wrapping) > 0) {
             $pdf->Cell($width, 0, self::l('Total wrapping') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['wrappingCostWithoutTax'], self::$currency, true, false)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_wrapping, self::$currency, true, false)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (self::$order->total_shipping != '0.00' and (!self::$orderSlip or self::$orderSlip and self::$orderSlip->shipping_cost)) {
             $pdf->Cell($width, 0, self::l('Total shipping') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2), self::$currency, true, false)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true, false)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (Configuration::get('PS_TAX') or $order->total_products_wt != $order->total_products) {
             $pdf->Cell($width, 0, self::l('Total') . ' ' . (self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax incl.)') : self::l(' (tax excl.)')) . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithTax'] : $priceBreakDown['totalWithoutTax'], self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
             $pdf->Cell($width, 0, self::l('Total') . ' ' . (self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax excl.)') : self::l(' (tax incl.)')) . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax'], self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
         } else {
             $pdf->Cell($width, 0, self::l('Total') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalWithoutTax'], self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         if ($ecotax != '0.00' and !self::$orderSlip) {
             $pdf->Cell($width, 0, self::l('Eco-participation') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, self::convertSign(Tools::displayPrice($ecotax, self::$currency, true, false)), 0, 0, 'R');
             $pdf->Ln(5);
         }
         $pdf->TaxTab($priceBreakDown);
     }
     Hook::PDFInvoice($pdf, self::$order->id);
     if (!$multiple) {
         return $pdf->Output(sprintf('%06d', self::$order->id) . '.pdf', $mode);
     }
 }
/**
 * 
 * @global array $DIAMOND_BRAND_IDS
 * @global string $server
 * @global jng_sp $class_sp
 * @global products_minierp $class_pm
 * @global logger $logger
 * @global string $icon_diamond
 * @global string $icon_gold_585_w
 * @global string $icon_gold_585_g
 * @param string $timestamp
 * @param int $jng_sp_id
 * @return boolean
 */
function generateReports($timestamp, $jng_sp_id)
{
    global $DIAMOND_BRAND_IDS, $server, $class_sp, $class_pm, $logger, $icon_diamond, $icon_gold_585_w, $icon_gold_585_g;
    $log_date = strtotime($timestamp);
    $sp_detail = $jng_sp_id > 0 ? $class_sp->retrieveDetail($jng_sp_id) : array('package_prefix' => 'JG.DE');
    $filter_sold = 1;
    $filter_age = 56;
    $logger->write("GENERATING REPORT {$sp_detail['package_prefix']}");
    /*
     * Query get new products which:
     * 1) age <= 8 weeks (56 days)
     * 2) total sold >= 1
     */
    $q = "SELECT p.products_id, p.products_model, p.products_image, p.products_price, p.material_expenses, p.stars ";
    $q .= " , ptc.categories_id AS catid, cd.categories_name";
    $q .= " , IFNULL(plps.sold_monthly_1, 0) AS sold_monthly_1, IFNULL(plps.sold_monthly_2, 0) AS sold_monthly_2";
    if ($jng_sp_id > 0) {
        $q .= " , ((jc.total_returned / jc.total_sold) * 100) AS returned_rate, jc.active_age";
    } else {
        $q .= " , 'N/A' AS returned_rate, DATEDIFF(NOW(), p.products_date_added) AS active_age";
    }
    $q .= " FROM products p";
    if ($jng_sp_id > 0) {
        $q .= " INNER JOIN jng_sp_catalog jc ON jc.jng_sp_id = {$jng_sp_id} AND jc.products_id = p.products_id";
    } else {
        $q .= " INNER JOIN orders_products op ON op.products_id = p.products_id";
    }
    $q .= " LEFT JOIN products_log_per_sp plps ON plps.products_id = p.products_id AND plps.jng_sp_id = {$jng_sp_id}";
    $q .= " LEFT JOIN products_to_categories ptc ON ptc.products_id = p.products_id";
    $q .= " LEFT JOIN categories_description cd ON cd.categories_id = ptc.categories_id AND cd.language_id = 1";
    $q .= " WHERE";
    if ($jng_sp_id > 0) {
        $q .= " jc.active_age <= {$filter_age}";
        $q .= " AND jc.active_status = 1";
        $q .= " AND total_sold >= {$filter_sold}";
    } else {
        //$q .= " p.products_date_added >= '2013-01-01 00:00:00'";
        $q .= " DATEDIFF(NOW(), p.products_date_added) <= {$filter_age}";
        $q .= " AND p.products_status = 1";
        $q .= " AND op.status NOT IN (10, 12)";
        $q .= " GROUP BY p.products_id";
        $q .= " HAVING SUM(op.products_quantity) >= {$filter_sold}";
    }
    //$q .= " LIMIT 5";
    $dbq = tep_db_query($q);
    $products = array();
    while ($row = tep_db_fetch_array($dbq)) {
        $row['margin'] = $class_pm->calculateMargin($row['products_price'], $row['material_expenses'], 1);
        $products[$row['catid']][$row['products_id']] = $row;
    }
    if (count($products) == 0) {
        $logger->write("NO DATA RETRIEVED");
        return false;
    }
    //Start Creating PDF Reports
    $margin = 20;
    $ypos = 10;
    $col_width = 48;
    $col_height = 77;
    $line_height = 5;
    $cell_text_width = $col_width - 3;
    $no = 0;
    $row = 1;
    $icon_w = 4;
    $icon_h = 4;
    $first_page = true;
    $pdf = new PDF('P', 'mm', 'A4');
    $pdf->setTitle('New Comer Report');
    $pdf->SetAuthor('JULIE GRACE');
    $pdf->SetCreator('Manobo PDF Generator');
    $pdf->SetDisplayMode('real');
    $pdf->SetAutoPageBreak(true, 25);
    $pdf->AliasNbPages();
    $pdf->AddPage('L');
    $pdf->setXY($margin, $ypos);
    $pdf->setFont('Arial', 'B', '14');
    $pdf->cell(240, 5, 'SALES REPORT NEWCOMER PRODUCT ' . $sp_detail['package_prefix'] . ' (' . date('d.m.Y', $log_date) . ')', 0, 0, 'C');
    $pdf->setFont('Arial', '', '10');
    $ypos += 15;
    $pdf->setXY($margin, $ypos);
    $catids = load_config('products-categories-sorting');
    foreach ($catids as $catid) {
        $xpos = $margin;
        if (is_array($products[$catid])) {
            foreach ($products[$catid] as $pid => $p) {
                $obj_product = new product($pid);
                $no++;
                if ($ypos >= 150 || $no == 1 && !$first_page) {
                    //Reset vars to new page state
                    $xpos = $margin;
                    $ypos = 25;
                    $row = 1;
                    $pdf->AddPage('L');
                    $pdf->setXY($margin, $ypos);
                }
                //Draw product box
                $pdf->Cell($col_width, $col_height, '', 1, 0);
                //Start drawing contents
                $pdf->drawProductsImage($xpos + 10, $ypos + 1, $p['products_image']);
                if (is_object($obj_product) && in_array($obj_product->brand_id, $DIAMOND_BRAND_IDS)) {
                    $ypos_icon = $ypos + 3;
                    $pdf->drawIcon($icon_diamond, $xpos + 39.5, $ypos_icon, $icon_w, $icon_h);
                }
                if (is_object($obj_product) && ($obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925)) {
                    $icon_gold_selected = "icon_gold_" . $obj_product->metal_stamp_code . '_' . strtolower(substr($obj_product->metal_stamp_info, 0, 1));
                    $icon_gold = ${$icon_gold_selected};
                    $ypos_icon += $icon_h;
                    //gold icon dimension is 21 x 16
                    $icon_gold_w = 21 / 16 * $icon_h;
                    $pdf->drawIcon($icon_gold, $xpos + 38, $ypos_icon, $icon_gold_w, $icon_h);
                }
                $pdf->setXY($xpos + 2, $ypos + 3);
                $pdf->setFont('Arial', 'B', '10');
                $pdf->Cell($col_width, $line_height, $no . ". " . ($no == 1 ? $p['categories_name'] : ''));
                $pdf->setFont('Arial', '', '10');
                $pdf->drawStar($p['stars'], $xpos + 15, $ypos + 29);
                $pdf->setXY($xpos + 2, $ypos + 35);
                $link = "http://{$server}/?open=product-detail&products_id=" . $pid;
                $pdf->SetFont('Arial', 'U');
                $pdf->SetTextColor(0, 0, 255);
                $pdf->Cell($cell_text_width, $line_height, $pid . ' / ' . $p['products_model'], 0, 0, 'C', 0, $link);
                $pdf->SetFont('Arial', '');
                $pdf->SetTextColor(0, 0, 0);
                $pdf->setXY($xpos + 2, $ypos + 40);
                $pdf->Cell($cell_text_width, $line_height, 'Price: ' . displayCurrency('EUR', $p['products_price'], false) . ' EUR', 0, 0, 'C');
                $pdf->setXY($xpos + 2, $ypos + 45);
                $pdf->Cell($cell_text_width, $line_height, 'Margin: ' . number_format($p['margin'], 1) . '%', 0, 0, 'C');
                $pdf->setXY($xpos + 2, $ypos + 50);
                $pdf->Cell($cell_text_width, $line_height, 'Return Rate: ' . ($jng_sp_id > 0 ? number_format($p['returned_rate'], 1) . '%' : $p['returned_rate']), 0, 0, 'C');
                $pdf->setXY($xpos + 2, $ypos + 60);
                $pdf->Cell($cell_text_width, $line_height, 'Age in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['active_age'] . ' days', 0, 0, 'C');
                $pdf->setXY($xpos + 2, $ypos + 65);
                $pdf->Cell($cell_text_width, $line_height, 'Sold L30D in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['sold_monthly_1'], 0, 0, 'C');
                $pdf->setXY($xpos + 2, $ypos + 70);
                $pdf->Cell($cell_text_width, $line_height, 'Sold L60D in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['sold_monthly_2'], 0, 0, 'C');
                if ($no % 5 == 0) {
                    $row++;
                    $xpos = $margin;
                    $ypos += $col_height * ($row - 1) + 5;
                } else {
                    $xpos += $col_width + 5;
                }
                $pdf->setXY($xpos, $ypos);
            }
            $first_page = false;
        }
        $no = 0;
    }
    $filepath = 'sales-report-newcomer-products/';
    $yeardir = $filepath . date('Y/', $log_date);
    if (!file_exists(DIR_FS_ARCHIVES . $yeardir) || !is_dir(DIR_FS_ARCHIVES . $yeardir)) {
        mkdir(DIR_FS_ARCHIVES . $yeardir);
    }
    $monthdir = $yeardir . date('m/', $log_date);
    if (!file_exists(DIR_FS_ARCHIVES . $monthdir) || !is_dir(DIR_FS_ARCHIVES . $monthdir)) {
        mkdir(DIR_FS_ARCHIVES . $monthdir);
    }
    $path_location = DIR_FS_ARCHIVES . $monthdir;
    $filename = date('YmdHi', strtotime($timestamp)) . '-sales-report-newcomer-products-' . $sp_detail['package_prefix'] . '.pdf';
    $pdf->Output($path_location . $filename, 'F');
    $logger->write("PDF CREATED: {$filename}");
    //$pdf->Output($filename, 'D');
    return true;
}
示例#19
0
 /**
  * Main
  *
  * @param object $order Order
  * @param string $mode Download or display (optional)
  */
 public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false)
 {
     global $cookie;
     if (!Validate::isLoadedObject($order) or !$cookie->id_employee and (!OrderState::invoiceAvailable($order->getCurrentState()) and !$order->invoice_number)) {
         die('Invalid order or invalid order state');
     }
     self::$order = $order;
     self::$orderSlip = $slip;
     self::$delivery = $delivery;
     self::$_iso = strtoupper(Language::getIsoById((int) self::$order->id_lang));
     if ((self::$_priceDisplayMethod = $order->getTaxCalculationMethod()) === false) {
         die(self::l('No price display method defined for the customer group'));
     }
     if (!$multiple) {
         $pdf = new PDF('P', 'mm', 'A4');
     }
     $pdf->SetAutoPageBreak(true, 35);
     $pdf->StartPageGroup();
     self::$currency = Currency::getCurrencyInstance((int) self::$order->id_currency);
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $width = 100;
     $pdf->SetX(10);
     $pdf->SetY(25);
     $pdf->SetFont(self::fontname(), '', 12);
     $pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');
     $pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L');
     $pdf->Ln(5);
     $pdf->SetFont(self::fontname(), '', 9);
     $addressType = array('delivery' => array(), 'invoice' => array());
     $patternRules = array('optional' => array('address2', 'company'), 'avoid' => array('State:iso_code'));
     $addressType = self::generateHeaderAddresses($pdf, $order, $addressType, $patternRules, $width);
     if (Configuration::get('VATNUMBER_MANAGEMENT') and !empty($addressType['invoice']['addressObject']->vat_number)) {
         $vat_delivery = '';
         if ($addressType['invoice']['addressObject']->id != $addressType['delivery']['addressObject']->id) {
             $vat_delivery = $addressType['delivery']['addressObject']->vat_number;
         }
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $vat_delivery), 0, 'L');
         $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->vat_number), 0, 'L');
         $pdf->Ln(5);
     }
     if ($addressType['invoice']['addressObject']->dni != NULL) {
         $pdf->Cell($width, 10, self::l('Tax ID number:') . ' ' . Tools::iconv('utf-8', self::encoding(), $addressType['invoice']['addressObject']->dni), 0, 'L');
     }
     /*
      * display order information
      */
     $carrier = new Carrier(self::$order->id_carrier);
     if ($carrier->name == '0') {
         $carrier->name = Configuration::get('PS_SHOP_NAME');
     }
     $history = self::$order->getHistory(self::$order->id_lang);
     foreach ($history as $h) {
         if ($h['id_order_state'] == Configuration::get('PS_OS_SHIPPING')) {
             $shipping_date = $h['date_add'];
         }
     }
     $pdf->Ln(12);
     $pdf->SetFillColor(240, 240, 240);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont(self::fontname(), '', 9);
     if (self::$orderSlip) {
         $pdf->Cell(0, 6, self::l('SLIP #') . ' ' . sprintf('%06d', self::$orderSlip->id) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
     } elseif (self::$delivery) {
         $pdf->Cell(0, 6, self::l('DELIVERY SLIP #') . Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', (int) $cookie->id_lang)) . sprintf('%06d', self::$delivery) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
     } elseif ((int) self::$order->invoice_date) {
         $pdf->Cell(0, 6, self::l('INVOICE #') . ' ' . Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', (int) $cookie->id_lang)) . sprintf('%06d', self::$order->invoice_number) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
     } else {
         $pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);
     }
     $pdf->Cell(55, 6, self::l('Order #') . ' ' . sprintf('%06d', self::$order->id), 'L', 0);
     $pdf->Cell(70, 6, self::l('Carrier:') . ($order->gift ? ' ' . Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
     $pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
     $pdf->Ln(5);
     $pdf->Cell(55, 6, isset($shipping_date) ? self::l('Shipping date:') . ' ' . Tools::displayDate($shipping_date, self::$order->id_lang) : ' ', 'LB', 0);
     $pdf->Cell(70, 6, $order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name), 'LRB');
     $pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
     $pdf->Ln(15);
     $pdf->ProdTab(self::$delivery ? true : '');
     /* Canada */
     $taxable_address = new Address((int) self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
     if (!self::$delivery && strtoupper(Country::getIsoById((int) $taxable_address->id_country)) == 'CA') {
         $pdf->Ln(15);
         $taxToDisplay = Db::getInstance()->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'order_tax WHERE id_order = ' . (int) self::$order->id);
         foreach ($taxToDisplay as $t) {
             $pdf->Cell(0, 6, utf8_decode($t['tax_name']) . ' (' . number_format($t['tax_rate'], 2, '.', '') . '%)      ' . self::convertSign(Tools::displayPrice($t['amount'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(5);
         }
     }
     /* End */
     /* Exit if delivery */
     if (!self::$delivery) {
         if (!self::$orderSlip) {
             $pdf->DiscTab();
         }
         $priceBreakDown = array();
         $pdf->priceBreakDownCalculation($priceBreakDown);
         if (!self::$orderSlip or self::$orderSlip and self::$orderSlip->shipping_cost) {
             $priceBreakDown['totalWithoutTax'] += Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2) + Tools::ps_round($priceBreakDown['wrappingCostWithoutTax'], 2);
             $priceBreakDown['totalWithTax'] += self::$order->total_shipping + self::$order->total_wrapping;
         }
         if (!self::$orderSlip) {
             $taxDiscount = self::$order->getTaxesAverageUsed();
             if ($taxDiscount != 0) {
                 $priceBreakDown['totalWithoutTax'] -= Tools::ps_round(self::$order->total_discounts / (1 + self::$order->getTaxesAverageUsed() * 0.01), 2);
             } else {
                 $priceBreakDown['totalWithoutTax'] -= self::$order->total_discounts;
             }
             $priceBreakDown['totalWithTax'] -= self::$order->total_discounts;
         }
         /*
          * Display price summation
          */
         if (Configuration::get('PS_TAX') or $order->total_products_wt != $order->total_products) {
             $pdf->Ln(5);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products (tax excl.)') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products (tax incl.)') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         } else {
             $pdf->Ln(5);
             $pdf->SetFont(self::fontname(), 'B', 8);
             $width = 165;
             $pdf->Cell($width, 0, self::l('Total products ') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalProductsWithoutTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         if (!self::$orderSlip and self::$order->total_discounts != '0.00') {
             $pdf->Cell($width, 0, self::l('Total discounts (tax incl.)') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (!self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_discounts, self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         if (isset(self::$order->total_wrapping) and (double) self::$order->total_wrapping > 0) {
             $pdf->Cell($width, 0, self::l('Total gift-wrapping') . ' : ', 0, 0, 'R');
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['wrappingCostWithoutTax'], self::$currency, true)), 0, 0, 'R');
             } else {
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_wrapping, self::$currency, true)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (self::$order->total_shipping != '0.00' and (!self::$orderSlip or self::$orderSlip and self::$orderSlip->shipping_cost)) {
             if (self::$_priceDisplayMethod == PS_TAX_EXC) {
                 $pdf->Cell($width, 0, self::l('Total shipping (tax excl.)') . ' : ', 0, 0, 'R');
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(Tools::ps_round($priceBreakDown['shippingCostWithoutTax'], 2), self::$currency, true)), 0, 0, 'R');
             } else {
                 $pdf->Cell($width, 0, self::l('Total shipping (tax incl.)') . ' : ', 0, 0, 'R');
                 $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true)), 0, 0, 'R');
             }
             $pdf->Ln(4);
         }
         if (Configuration::get('PS_TAX') or $order->total_products_wt != $order->total_products) {
             $pdf->Cell($width, 0, self::l('Total') . ' ' . (self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax incl.)') : self::l(' (tax excl.)')) . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithTax'] : $priceBreakDown['totalWithoutTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
             $pdf->Cell($width, 0, self::l('Total') . ' ' . (self::$_priceDisplayMethod == PS_TAX_EXC ? self::l(' (tax excl.)') : self::l(' (tax incl.)')) . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice(self::$_priceDisplayMethod == PS_TAX_EXC ? $priceBreakDown['totalWithoutTax'] : $priceBreakDown['totalWithTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         } else {
             $pdf->Cell($width, 0, self::l('Total') . ' : ', 0, 0, 'R');
             $pdf->Cell(0, 0, (self::$orderSlip ? '-' : '') . self::convertSign(Tools::displayPrice($priceBreakDown['totalWithoutTax'], self::$currency, true)), 0, 0, 'R');
             $pdf->Ln(4);
         }
         $pdf->TaxTab($priceBreakDown);
     }
     Hook::PDFInvoice($pdf, self::$order->id);
     if (!$multiple) {
         return $pdf->Output(sprintf('%06d', self::$order->id) . '.pdf', $mode);
     }
 }
示例#20
0
 function format($text)
 {
     include_once 'lib/Template.php';
     global $request;
     $tokens['page'] = $this->_page;
     $tokens['CONTENT'] = $this->_transform($text);
     $pagename = $this->_page->getName();
     // This is a XmlElement tree, which must be converted to PDF
     // We can make use of several pdf extensions. This one - fpdf
     // - is pure php and very easy, but looks quite ugly and has a
     // terrible interface, as terrible as most of the othes.
     // The closest to HTML is htmldoc which needs an external cgi
     // binary.
     // We use a custom HTML->PDF class converter from PHPWebthings
     // to be able to use templates for PDF.
     require_once 'lib/fpdf.php';
     require_once 'lib/pdf.php';
     $pdf = new PDF();
     $pdf->SetTitle($pagename);
     $pdf->SetAuthor($this->_page->get('author'));
     $pdf->SetCreator(WikiURL($pagename, false, 1));
     $pdf->AliasNbPages();
     $pdf->AddPage();
     //TODO: define fonts
     $pdf->SetFont('Times', '', 12);
     //$pdf->SetFont('Arial','B',16);
     // PDF pagelayout from a special template
     $template = new Template('pdf', $request, $tokens);
     $pdf->ConvertFromHTML($template);
     // specify filename, destination
     $pdf->Output($pagename . ".pdf", 'I');
     // I for stdin or D for download
     // Output([string name [, string dest]])
     return $pdf;
 }
 function printUsers()
 {
     $db = $this->conn;
     $result = mysqli_query($db, "SELECT * FROM system_users WHERE deleted=0");
     $num = 0;
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->SetFont('Arial', '', 12);
     $data = array();
     while ($row = mysqli_fetch_array($result)) {
         $num++;
         $name = $row['first_name'] . " " . $row['middle_name'] . ' ' . $row['last_name'];
         $appointment = $row['appointment'];
         $email = $row['email'];
         $role = $row['role'];
         $data[] = [$num, $name, $appointment, $email, $role];
     }
     $pdf->AddPage();
     $pdf->FancyTable($data);
     $pdf->Output("../files/List of Users.pdf");
 }
 function process_inclusive_dates()
 {
     if (func_num_args() > 0) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
         $validuser = $arg_list[3];
         $isadmin = $arg_list[4];
         //print_r($arg_list);
     }
     $sql_delete = "delete from m_patient_epi_tcl";
     $result_delete = mysql_query($sql_delete);
     list($month, $day, $year) = explode("/", $post_vars["start_date"]);
     $start_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT);
     list($month, $day, $year) = explode("/", $post_vars["end_date"]);
     $end_date = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($day, 2, "0", STR_PAD_LEFT);
     /*$sql = "select p.patient_id, p.patient_dob, concat(p.patient_lastname, ', ', p.patient_firstname) ".
     	       "patient_name, p.patient_mother, ".
     	       "date_format(adddate(p.patient_dob, interval 1 year), '%b %y') month_reaches_age1, m.fully_immunized_date ".
                    "from m_patient p, m_patient_ccdev m ".
                    "where p.patient_id = m.patient_id and ".
                    "to_days(adddate(p.patient_dob,interval 1 year)) >= to_days('$start_date') and ".
     	       "to_days(adddate(p.patient_dob,interval 1 year)) <= to_days('$end_date') order by p.patient_dob ";
     	*/
     /*$sql = "select patient_id, patient_dob, concat(patient_lastname, ', ', patient_firstname) ".
       "patient_name, patient_mother, ".
       "date_format(adddate(patient_dob, interval 1 year), '%b %y') month_reaches_age1 ".
              "from m_patient ".
              "where to_days(adddate(patient_dob,interval 1 year)) >= to_days('$start_date') and ".
       "to_days(adddate(patient_dob,interval 1 year)) <= to_days('$end_date') order by patient_dob ";*/
     $sql = "select patient_id, patient_dob, concat(patient_lastname, ', ', patient_firstname) " . "patient_name, patient_mother, " . "date_format(adddate(patient_dob, interval 1 year), '%b %y') month_reaches_age1 " . "from m_patient " . "where to_days(registration_date) >= to_days('{$start_date}') and " . "to_days(registration_date) <= to_days('{$end_date}') order by registration_date ";
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while ($report = mysql_fetch_array($result)) {
                 // blank variables
                 $patient_age = patient::get_age($report[patient_id]);
                 if ($patient_age <= 1) {
                     $family_id = 0;
                     $patient_address = '';
                     $barangay_id = '';
                     // retrieve other data
                     $family_id = family::get_family_id($report["patient_id"]);
                     if ($family_id) {
                         $patient_address = family::show_address($family_id);
                         $barangay_id = family::barangay_id($family_id);
                     }
                     $fully_immunized_date = $this->get_fully_immunized_date($report[patient_id]);
                     // insert data into tcl
                     $sql_insert = "insert into m_patient_epi_tcl (patient_id, patient_dob, family_id, patient_name, " . "patient_mother, patient_address, barangay_name, month_reaches_age1, " . "fully_immunized_date) values ('" . $report["patient_id"] . "', " . "'" . $report["patient_dob"] . "', '{$family_id}', '" . $report["patient_name"] . "', " . "'" . $report["patient_mother"] . "', '{$patient_address}', '{$barangay_id}', " . "'" . $report["month_reaches_age1"] . "', '{$fully_immunized_date}')";
                     $result_insert = mysql_query($sql_insert) or die(mysql_error());
                     $this->get_vaccine_date($report["patient_id"], $start_date, $end_date);
                 }
             }
             // while
             $sql = "select patient_id 'PATIENT ID', date_format(patient_dob,'%c/%e/%y') 'DATE OF BIRTH', " . "family_id 'FAMILY ID', patient_name 'NAME OF INFANT', patient_mother 'NAME OF MOTHER', " . "patient_address 'ADDRESS', barangay_name 'BRGY', month_reaches_age1 'MONTH REACHES AGE 1', " . "fully_immunized_date 'DATE FULLY IMMUNIZED', " . "BCG 'BCG', DPT1 'DPT 1', " . "DPT2 'DPT 2', DPT3 'DPT 3', " . "OPV1 'POLIO 1', OPV2 'POLIO 2', " . "OPV3 'POLIO 3', MSL 'MEASLES', " . "HEPB1 'HEPA B1', HEPB2 'HEPA B2', " . "HEPB3 'HEPA B3' " . "from m_patient_epi_tcl order by barangay_name, patient_dob ";
             //"where to_days(actual_vaccine_date) >= to_days('$start_date') and ".
             //"to_days(actual_vaccine_date) <= to_days('$end_date') ".
             //"order by barangay_name, patient_dob ";
             $pdf = new PDF('L', 'pt', 'Legal');
             //$pdf->SetMargins('0.5','0.5','0.5');
             $pdf->SetFont('Arial', '', 10);
             //$pdf->SetMargins('0.5','0.5','0.5');
             $pdf->AliasNbPages();
             $pdf->connect('localhost', 'root', '', 'game');
             $attr = array('titleFontSize' => 14, 'titleText' => 'TARGET CLIENT LIST FOR EPI (' . $post_vars["start_date"] . ' - ' . $post_vars["end_date"] . ')');
             $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/epi_tcl.pdf");
             header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
         }
     }
 }
示例#23
0
 protected function generaReporte($data, $titulo = '')
 {
     $this->load->library('Pdf');
     $pdf = new PDF('L', 'mm', 'A4');
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 10);
     //if ($titulo != '')
     //{
     //	$pdf->Cell(40, 10, $titulo, 1);
     //	$pdf->Ln();
     //	$pdf->Ln();
     //}
     $header = array('#', 'Base', 'DNI', 'Nombres', 'A.Paterno', 'A.Materno', 'Celular', 'Est', 'Area', 'Cargo', 'Fecha Ini', 'T.Emp.');
     $w = array(5, 40, 13, 20, 20, 20, 14, 5, 60, 45, 15, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
     $pdf->SetFont('Arial', 'B', 7);
     for ($i = 0; $i < count($header); $i++) {
         $pdf->Cell($w[$i], 8, utf8_decode($header[$i]), 1, 0, 'C');
     }
     $pdf->Ln();
     $pdf->SetFont('Arial', '', 7);
     $j = 1;
     foreach ($data as $row) {
         $pdf->Cell($w[0], 6, utf8_decode($j), 1);
         $pdf->Cell($w[1], 6, utf8_decode($row->base_nombre), 1);
         $pdf->Cell($w[2], 6, utf8_decode($row->dni), 1);
         $pdf->Cell($w[3], 6, utf8_decode($row->nombres), 1);
         $pdf->Cell($w[4], 6, utf8_decode($row->apellido_pat), 1);
         $pdf->Cell($w[5], 6, utf8_decode($row->apellido_mat), 1);
         $pdf->Cell($w[6], 6, utf8_decode($row->telefono), 1);
         //$pdf->Cell($w[7], 6, utf8_decode($row->ocupacion), 1);
         $pdf->Cell($w[7], 6, utf8_decode($row->estado), 1);
         $pdf->Cell($w[8], 6, utf8_decode($row->area_nombre), 1);
         $pdf->Cell($w[9], 6, utf8_decode($row->cargo), 1);
         $pdf->Cell($w[10], 6, utf8_decode($row->fecha_inicio), 1);
         $pdf->Cell($w[11], 6, utf8_decode($row->tiempo_empleo), 1);
         $pdf->Ln();
         $j++;
     }
     $pdf->Cell(array_sum($w), 0, '');
     $pdf->Output();
 }
 public function pdfSusAction()
 {
     $img_path = $_GET['img_path'];
     require "fpdf/pdfheader.php";
     $email = $_GET['email'];
     $model = Mage::getModel('zcredit/zcredit');
     $detail = $model->checkmail($_GET['email']);
     $full_name = $detail['fname'] . " " . $detail['lname'];
     $date1 = $_GET['Priod'];
     $cus_id = $detail['cus_id'];
     $company_name = $detail['company_name'];
     $m_start = date("M d, Y", strtotime("{$date1} first day of this month"));
     $m_end = date("M d, Y", strtotime("{$date1} last day of this month"));
     $s_id = $_GET['s_id'];
     $customer = Mage::getModel('customer/customer')->load($cus_id);
     $defaultBilling = $customer->getDefaultBillingAddress();
     $address = $defaultBilling->getData();
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetY(30);
     $pdf->Line(10, 31, 200, 31);
     $pdf->SetFont('Times', 'B', 12);
     $pdf->Cell(40, 7, 'SUSPENSE ACCOUNT STATEMENT');
     $pdf->setX(120);
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(40, 7, "Date: ");
     $pdf->Cell(20, 7, "To: ", 2, 2, 'C');
     $pdf->Line(10, 36, 200, 36);
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Customer Name');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$full_name}", 0, 0, 'L');
     $pdf->SetX(120);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(20, 5, 'Address');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$address['street']}", 2, 2, 'L');
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Company Name &');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$company_name}", 0, 0, 'L');
     $pdf->SetX(140);
     $pdf->Cell(150, 5, ": {$address['city']},{$address['region']}", 2, 2, 'L');
     /*$pdf->SetX(10);
     		$pdf->SetFont('Times','B',10);
     		$pdf->Cell(35,7,'Address');
     		$pdf->SetFont('Times','',10);
     		$pdf->Cell(150,7,": $address[street]",2,2,'L');
     		$pdf->SetX(45);
     		$pdf->Cell(150,7,": $address[city],$address[region]",2,2,'L');
     		$pdf->Cell(150,7,": $address[postcode]",2,2,'L');
     		*/
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Customer Email Id');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$email}", 0, 0, 'L');
     $pdf->SetX(140);
     $pdf->Cell(150, 5, ": {$address['postcode']}", 2, 2, 'L');
     $pdf->SetX(10);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(35, 5, 'Customer Id');
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(150, 5, ": {$cus_id}", 2, 2, 'L');
     $linestyle = array('width' => 1.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 10, 'color' => array(255, 0, 0));
     $pdf->SetX(10);
     $pdf->Line(10, 57, 200, 57);
     $pdf->SetX(80);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(30, 5, 'Transction Details', 2, 2, 'C');
     $pdf->Line(10, 62, 200, 62);
     $pdf->Line(10, 62.3, 200, 62.3);
     $pdf->SetX(10);
     $pdf->SetFont('Times', '', 10);
     $pdf->Cell(10, 5, 'S.No.', 0, 0, 'C');
     $pdf->Cell(25, 5, 'Order #', 0, 0, 'C');
     $pdf->Cell(30, 5, 'Txn Date', 0, 0, 'C');
     $pdf->Cell(20, 5, 'Deposit', 0, 0, 'C');
     $pdf->Cell(20, 5, 'Withdrawl', 0, 0, 'C');
     $pdf->Cell(30, 5, 'Balance', 0, 0, 'C');
     $pdf->Cell(60, 5, 'Txn Details', 2, 2, 'C');
     $pdf->Line(10, 67, 200, 67);
     $pdf->Ln();
     $pdf->SetX(10);
     $sus_his = $model->getSusHis($s_id);
     $tot_bal = 0;
     $a = 1;
     $height = count($sus_his) * 5 + 67 + 5;
     foreach ($sus_his as $sus) {
         $pdf->SetX(10);
         $pdf->Cell(10, 5, "{$a}", 0, 0, 'C');
         $pdf->Cell(25, 5, "{$sus['order_id']}", 0, 0, 'C');
         $pdf->Cell(30, 5, "{$sus['tran_date']}", 0, 0, 'C');
         if ($sus[amt] > 0) {
             $pdf->Cell(20, 5, "{$sus['amt']}", 0, 0, 'C');
             $pdf->Cell(20, 5, "", 0, 0, 'C');
         } else {
             $susnatot = abs($sus[amt]);
             $pdf->Cell(20, 5, "", 0, 0, 'C');
             $pdf->Cell(20, 5, "{$susnatot}", 0, 0, 'C');
         }
         $pdf->Cell(30, 5, "{$sus['total_amt']}", 0, 0, 'C');
         $pdf->Cell(60, 5, "{$sus['trans_detail']}", 2, 2, 'C');
         $tot_bal = $sus[total_amt];
         $a = $a + 1;
     }
     $pdf->Line(10, $height, 200, $height);
     $height1 = $height + 0.4;
     $pdf->Line(10, $height1, 200, $height1);
     $pdf->SetX(89);
     $pdf->SetFont('Times', 'B', 10);
     $pdf->Cell(30, 6, "Total Balance Amount :  {$tot_bal}", 2, 2, 'L');
     $pdf->Line(10, $height = $height + 5, 200, $height);
     //$pdf->Cell(30,6,"$height,test,",1,1,'C');
     //outer box start//
     $pdf->Line(5, 290, 205, 290);
     $pdf->Line(5, 6, 205, 6);
     $pdf->Line(5, 6, 5, 290);
     $pdf->Line(205, 6, 205, 290);
     //outer box end//
     $pdf->Output('Suspence A/C Detail.pdf', 'D');
 }
示例#25
0
 function process_tcl_inclusive_dates()
 {
     if (func_num_args() > 0) {
         $arg_list = func_get_args();
         $menu_id = $arg_list[0];
         $post_vars = $arg_list[1];
         $get_vars = $arg_list[2];
         $validuser = $arg_list[3];
         $isadmin = $arg_list[4];
         print_r($arg_list);
     }
     // loop through m_patient_ntp
     if ($post_vars["start_date"] && $post_vars["end_date"]) {
     } else {
         print $sql = "select c.consult_timestamp, c.consult_id consult_id, p.patient_id, " . "concat(p.patient_lastname, ', ', p.patient_firstname) patient_name, " . "round((to_days(now())-to_days(p.patient_dob))/365 , 1) patient_age, p.patient_gender, n.tb_class, n.patient_type_id, " . "n.treatment_category_id, n.outcome_id, n.tb_class, n.treatment_partner_id " . "from m_patient_ntp n, m_patient p " . "where n.patient_id = p.patient_id";
     }
     if ($result = mysql_query($sql)) {
         if (mysql_num_rows($result)) {
             while ($ntp = mysql_fetch_array($result)) {
                 print_r($ntp);
                 // retrieve family address
                 $family_id = family::get_family_id($ntp["patient_id"]);
                 print $patient_address = family::show_address($family_id);
                 // retrieve sputum exams
                 $sputum_beforetx = sputum::get_sputum_results($ntp["ntp_id"], "DX");
                 $sputum_eo2 = sputum::get_sputum_results($ntp["ntp_id"], "EO2");
                 $sputum_eo3 = sputum::get_sputum_results($ntp["ntp_id"], "EO3");
                 $sputum_eo4 = sputum::get_sputum_results($ntp["ntp_id"], "EO4");
                 $sputum_eo5 = sputum::get_sputum_results($ntp["ntp_id"], "EO5");
                 $sputum_7m = sputum::get_sputum_results($ntp["ntp_id"], "7M");
                 $sql_insert = "insert into m_patient_ntp_tcl (ntp_id, " . "ntp_timestamp, patient_id, patient_name, " . "patient_age, patient_gender, patient_address, " . "facility_code, tb_class, patient_type, " . "treatment_category, sputum_beforetx_result, " . "sputum_beforetx_date, sputum_eo2_result, " . "sputum_eo2_date, sputum_eo3_result, sputum_eo3_date, " . "sputum_eo4_result, sputum_eo4_date, sputum_eo5_result, " . "sputum_eo5_date, sputum_7m_result, sputum_7m_date, " . "treatment_outcome, treatment_partner, remarks) " . "values ('" . $ntp["ntp_id"] . "', '" . $ntp["ntp_timestamp"] . "', " . "'" . $ntp["patient_id"] . "', '" . $ntp["patient_name"] . "', " . "'" . $ntp["patient_age"] . "', '" . $ntp["patient_gender"] . "', " . "'{$patient_address}', '" . $_SESSION["datanode"]["code"] . "', " . "'" . $ntp["tb_class"] . "','" . $ntp["patient_type_id"] . "', " . "'" . $ntp["treatment_category_id"] . "', '" . $sputum_beforetx["lab_diagnosis"] . "', " . "'" . $sputum_beforetx["lab_timestamp"] . "', '" . $sputum_eo2["lab_diagnosis"] . "', " . "'" . $sputum_eo2["lab_timestamp"] . "', '" . $sputum_eo3["lab_diagnosis"] . "', " . "'" . $sputum_eo3["lab_timestamp"] . "', '" . $sputum_eo4["lab_diagnosis"] . "', " . "'" . $sputum_eo4["lab_timestamp"] . "', '" . $sputum_eo5["lab_diagnosis"] . "', " . "'" . $sputum_eo5["lab_timestamp"] . "', '" . $sputum_7m["lab_diagnosis"] . "', " . "'" . $sputum_7m["lab_timestamp"] . "', '" . $ntp["outcome_id"] . "', " . "'" . $ntp["treatment_partner_id"] . "','')";
                 if ($result_insert = mysql_query($sql_insert)) {
                 } else {
                     $sql_update = "update m_patient_ntp_tcl set " . "sputum_beforetx_result = '" . $sputum_beforetx["lab_diagnosis"] . "', " . "sputum_beforetx_date = '" . $sputum_beforetx["lab_timestamp"] . "'," . "sputum_eo2_result = '" . $sputum_eo2["lab_diagnosis"] . "', " . "sputum_eo2_date = '" . $sputum_eo2["lab_timestamp"] . "', " . "sputum_eo3_result = '" . $sputum_eo3["lab_diagnosis"] . "', " . "sputum_eo3_date = '" . $sputum_eo3["lab_timestamp"] . "', " . "sputum_eo4_result = '" . $sputum_eo4["lab_diagnosis"] . "', " . "sputum_eo4_date = '" . $sputum_eo4["lab_timestamp"] . "', " . "sputum_eo5_result = '" . $sputum_eo5["lab_diagnosis"] . "', " . "sputum_eo5_date = '" . $sputum_eo5["lab_timestamp"] . "', " . "sputum_7m_result = '" . $sputum_7m["lab_diagnosis"] . "', " . "sputum_7m_date = '" . $sputum_7m["lab_timestamp"] . "' " . "where ntp_id = '" . $ntp["ntp_id"] . "'";
                     $result_update = mysql_query($sql_update) or die(mysql_error());
                 }
             }
             // while
             $sql = "select date_format(ntp_timestamp, '%Y-%m-%d') 'REG DATE', ntp_id 'ID', patient_name 'NAME', " . "concat(patient_age,'/',patient_gender) 'AGE/SEX', patient_address 'ADDRESS', " . "facility_code 'RHU/BHS', tb_class 'TB CLASS', patient_type 'PT TYPE', treatment_category 'TX CAT', " . "if(sputum_beforetx_result<>'', concat(sputum_beforetx_result,': ',sputum_beforetx_date),'NA') 'DX', " . "if(sputum_eo2_result<>'', concat(sputum_eo2_result,': ',sputum_eo2_date),'NA') 'EO Mo2', " . "if(sputum_eo3_result<>'', concat(sputum_eo3_result,': ',sputum_eo3_date), 'NA') 'EO Mo3', " . "if(sputum_eo4_result<>'', concat(sputum_eo4_result,': ',sputum_eo4_date), 'NA') 'EO Mo4', " . "if(sputum_eo5_result<>'', concat(sputum_eo5_result,': ',sputum_eo5_date), 'NA') 'EO Mo5', " . "if(sputum_7m_result<>'', concat(sputum_7m_result,': ',sputum_7m_date),'NA') '>7Mos', " . "treatment_outcome 'OUTCOME', treatment_partner 'PARTNER'" . "from m_patient_ntp_tcl order by ntp_timestamp";
             $pdf = new PDF('L', 'pt', 'A3');
             $pdf->SetFont('Arial', '', 10);
             $pdf->AliasNbPages();
             $pdf->connect('localhost', 'root', 'kambing', 'game');
             $attr = array('titleFontSize' => 14, 'titleText' => 'CONSULTS REGISTER');
             $pdf->mysql_report($sql, false, $attr, "../modules/_uploads/consult_tcl.pdf");
             header("location: " . $_SERVER["PHP_SELF"] . "?page=" . $get_vars["page"] . "&menu_id=" . $get_vars["menu_id"] . "&report_menu=TCL");
         }
     }
 }
 public function sendResults($collated, $notSold, $partners)
 {
     require 'libraries/fpdf/fpdf.php';
     require 'libraries/fpdf/fpdf-ex.php';
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Times', 'B', 12);
     $pdf->Cell(0, 10, 'Auctions', 0, 1);
     $pdf->SetFont('Times', '', 12);
     foreach ($collated as $key => $auctions) {
         $pdf->SetFont('Times', 'B', 12);
         $pdf->Cell(0, 10, 'Product:' . $key, 0, 1);
         $pdf->SetFont('Times', '', 12);
         foreach ($auctions as $auction) {
             $pdf->Cell(0, 10, $auction["quantity"] . " bought by " . $auction["buyerName"] . " (user ID: " . $auction["buyer"] . ") for \$" . $auction["price"] . " (order ID: " . $auction["orderid"] . ")", 0, 1);
         }
     }
     $pdf->SetFont('Times', 'B', 12);
     $pdf->Cell(0, 10, 'Remaining Stock', 0, 1);
     $pdf->SetFont('Times', '', 12);
     foreach ($notSold as $key => $remaining) {
         $pdf->Cell(0, 10, $key . " (product ID: " . $remaining["productid"] . "): " . $remaining["quantity"] . " unsold.", 0, 1);
     }
     $doc = $pdf->Output('', 'S');
     $this->sendEmail($partners, 'Auction Summary ' . date("d-m-Y"), "Attached in the summary from the Manawatu Flowers auction for the date " . date("d-m-Y"), $doc);
     return true;
 }
示例#27
0
 public function basket()
 {
     $this->start = $this->input->get('start');
     $this->end = $this->input->get('end');
     $this->view = "";
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     $basket = $this->session->get("basket");
     if (is_array($basket) && sizeof($basket) > 0) {
         foreach ($basket as $item) {
             # explode host::service::source
             $slices = explode("::", $item);
             if (sizeof($slices) == 2) {
                 $this->data->buildDataStruct($slices[0], $slices[1], $this->view);
             }
             if (sizeof($slices) == 3) {
                 $this->data->buildDataStruct($slices[0], $slices[1], $this->view, $slices[2]);
             }
         }
     }
     //echo Kohana::debug($this->data->STRUCT);
     /*
      * PDF Output
      */
     $pdf = new PDF();
     $pdf->AliasNbPages();
     $pdf->SetAutoPageBreak('off');
     $pdf->SetMargins(17.5, 30, 10);
     $pdf->AddPage();
     if ($this->use_bg) {
         $pdf->setSourceFile($this->config->conf['background_pdf']);
         $tplIdx = $pdf->importPage(1, '/MediaBox');
         $pdf->useTemplate($tplIdx);
     }
     $pdf->SetCreator('Created with PNP');
     $pdf->SetFont('Arial', '', 10);
     // Title
     foreach ($this->data->STRUCT as $data) {
         if ($pdf->GetY() > 200) {
             $pdf->AddPage();
             if ($this->use_bg) {
                 $pdf->useTemplate($tplIdx);
             }
         }
         if ($data['LEVEL'] == 0) {
             $pdf->SetFont('Arial', '', 12);
             $pdf->CELL(120, 10, $data['MACRO']['DISP_HOSTNAME'] . " -- " . $data['MACRO']['DISP_SERVICEDESC'], 0, 1);
             $pdf->SetFont('Arial', '', 10);
             $pdf->CELL(120, 5, $data['TIMERANGE']['title'] . " (" . $data['TIMERANGE']['f_start'] . " - " . $data['TIMERANGE']['f_end'] . ")", 0, 1);
             $pdf->SetFont('Arial', '', 8);
             $pdf->CELL(120, 5, "Datasource " . $data["ds_name"], 0, 1);
         } else {
             $pdf->SetFont('Arial', '', 8);
             $pdf->CELL(120, 5, "Datasource " . $data["ds_name"], 0, 1);
         }
         $image = $this->rrdtool->doImage($data['RRD_CALL'], $out = 'PDF');
         $img = $this->rrdtool->saveImage($image);
         $Y = $pdf->GetY();
         $cell_height = $img['height'] * 0.23;
         $cell_width = $img['width'] * 0.23;
         $pdf->Image($img['file'], 17.5, $Y, $cell_width, $cell_height, 'PNG');
         $pdf->CELL(120, $cell_height, '', 0, 1);
         unlink($img['file']);
     }
     $pdf->Output("pnp4nagios.pdf", "I");
 }
示例#28
0
$projectName = str2GBK(urldecode($budget[0]["businessAddress"] == "" ? $budget[0]["projectName"] : $budget[0]["businessRegion"] . " " . $budget[0]["businessAddress"]));
$budgetName = str2GBK(urldecode($budget[0]["budgetName"]));
$projectComments = str2GBK(urldecode($budget[0]["comments"]));
$action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "download";
$budgetItems = getBudgetItemsByBudgetId($_REQUEST["budgetId"], true);
$pdf = new PDF('L', 'mm', 'A4');
//创建新的FPDF对象
$pdf->AddGBFont();
//设置中文字体
$pdf->Open();
//开始创建PDF
$pdf->AddPage();
//增加一页
$pdf->SetFont("GB", '', $GfontSize);
//设置字体样式
$pdf->AliasNbPages("__totalPage__");
//echo $custName.":".$projectName;
foreach ($budgetItems as $bItem) {
    $fields = array('budgetItemId', 'itemName', 'budgetId', 'mainMaterialTotalPrice', 'auxiliaryMaterialTotalPrice', 'manpowerTotalPrice', 'mainMaterialTotalCost', 'manpowerTotalCost', 'machineryTotalPrice', 'remark', 'itemAmount', 'itemCode', 'itemUnit', 'mainMaterialPrice', 'auxiliaryMaterialPrice', 'lossPercent', 'machineryPrice', 'manpowerPrice');
    foreach ($fields as $field) {
        if (!isset($bItem[$field])) {
            $bItem[$field] = "";
        }
    }
    $amount = $bItem["itemAmount"];
    $itemCode = $bItem["itemCode"];
    $itemName = $bItem["itemName"];
    $remark = $bItem["remark"];
    $data = array($itemCode, $itemName, $bItem["itemUnit"], $amount, $bItem["mainMaterialPrice"], $bItem["mainMaterialTotalPrice"], $bItem["auxiliaryMaterialPrice"], $bItem["auxiliaryMaterialTotalPrice"], $bItem["manpowerPrice"], $bItem["manpowerTotalPrice"], $bItem["machineryPrice"], $bItem["machineryTotalPrice"], $bItem["lossPercent"], $remark);
    $fontSizes = array($GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, $GfontSize, 8);
    $borders = array('LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LB', 'LBR');
        $this->SetY(-15);
        //Arial italic 8
        $this->SetFont('Arial', 'I', 7);
        //Page number
        $this->Line(10, 281, 200, 281);
        $this->Cell(0, 3, 'Emitido por: ' . $usuarioNome);
    }
}
//Instancia a classe gerador de pdf
$pdf = new PDF();
//Define os atributos de propriedade do arquivo PDF
$pdf->SetCreator('work | eventos');
$pdf->SetAuthor($usuarioNome . " - " . $empresaNome);
$pdf->SetTitle('Relação de Momentos de Repertório');
$pdf->SetSubject('Relatório gerado automaticamente pelo sistema');
$pdf->AliasNbPages();
$pdf->AddPage();
//Títulos das colunas
$pdf->SetFont('Arial', 'B', 10);
//Define a cor RGB do fundo da celula
$pdf->SetFillColor(178, 178, 178);
//Faz a célula ser preenchida. Isso é feito setando 1 após a expressao de alinhamento
$pdf->Cell(0, 6, 'Descrição do Momento de Repertório', 1, 0, 'L', 1);
$pdf->SetX(170);
$pdf->Cell(0, 6, 'Ativo');
//Monta as linhas com os dados da query
$pdf->SetFont('Arial', '', 10);
while ($dados = mysql_fetch_array($sql)) {
    switch ($dados[ativo]) {
        case 0:
            $ativo = "Inativo";
示例#30
0
        //End if:Line 24
    }
    //End if:Line 9
}
//End if:Line 8
$pdf = new PDF($orientacion, 'mm', 'Letter');
$pdf->SetPathLogo($cfg_rpt['logo_imagen']);
$pdf->Setancho_imagen($cfg_rpt['alto_imagen']);
$pdf->Setalto_imagen($cfg_rpt['ancho_imagen']);
$pdf->Setimagen_position_x($cfg_rpt['position_x']);
$pdf->Setimagen_position_y($cfg_rpt['position_y']);
$pdf->setAuthor($cfg_rpt['autor']);
$pdf->setDisplayMode('real');
$pdf->setTitle("Reporte de Fiscalizacion");
$pdf->SetMargins(3, 2, 3);
$pdf->AliasNbPages('Total_page');
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 11.5);
$pdf->Cell(0, 0, $Title_Principal . $desc_solicitud, 0, 0, 'C');
$pdf->Ln(3);
if (isset($orientacion)) {
    if ($orientacion == 'P') {
        $new_line = 6;
        $pdf->Cell(150);
        $pdf->Cell(0, 0, 'Solicitud N: ' . str_pad($obj_solicitud->getId_solicitud(), 10, "0", STR_PAD_LEFT), 0, 1, 'L');
        $pdf->Ln(10);
        $pdf->Cell(10);
        //	$pdf->Cell(0,0,'Estatus: '.$obj_solicitud->getStatus(),0,0,'L');
        $pdf->Cell(21, 6, "Estatus: ", 0, 0, 'L');
        $pdf->Cell(4, 4, '', 1, 0, 'L', 1);
        $pdf->SetFont('Arial', 'B', 8);