<?php
include "../../konfig/dbconnect.php";
error_reporting(0);
$aksi=$_GET['aksi'];

if ($aksi=='pdfhasilakreditasi')
{
        require('htmlpdf.php');

	$pdf=new PDF();
        $pdf->AddPage();
        $pdf->SetFont('Arial','',12);
        
        $data=mysql_query("SELECT * FROM pengujian WHERE pengujian.status_uji = 'Terakreditasi' AND pengujian.no_permohonan = $_GET[no] ORDER BY pengujian.id_pengujian");

        $html="
        <table border=1>
                <tr>
                    <td width='200' height='30'>Nomer</td>
                    <td width='200' height='30'>Parameter Uji</td>
                    <td width='200' height='30'>Kode</td>
                    <td width='200' height='30'>Titik Uji</td>
                    <td width='200' height='30'>Hasil Pengujian</td>
                    <td width='200' height='30'>Batas Standart</td>
                    <td width='200' height='30'>Satuan</td>
                    <td width='200' height='30'>Metode Pengujian</td>
                </tr>";
            $no = 1;
            for($i=0;$p=mysql_fetch_array($data);$i++){
                                
                if($p[titik_uji]==1){
                    echo"
                    <tr>
                        <td width='200' height='30'>$no</td>
                        <td width='200' height='30'>".$p[parameter_uji]."</td>
                        <td width='200' height='30'>".$p[kode_ca]."</td>    
                        <td width='200' height='30'>".$p[titik_uji]."</td>    
                        <td width='200' height='30'>".$p[hasil]."<sup>".$p[pangkat]."</sup></td>
                        <td width='200' height='30'>".$p[standart_uji]."</td> 
                        <td width='200' height='30'>".$p[satuan]."</td>    
                        <td width='200' height='30'>".$p[metode_uji]."</td>  
                    </tr>";
                                        
                    $no++;
                }else{
                    echo"
                    <tr>
                        <td width='200' height='30'></td>
                        <td width='200' height='30'></td>
                        <td width='200' height='30'>".$p[kode_ca]."</td>
                        <td width='200' height='30'>".$p[titik_uji]."</td>    
                        <td width='200' height='30'>".$p[hasil]."<sup>".$p[pangkat]."</sup></td>
                        <td width='200' height='30'>".$p[standart_uji]."</td> 
                        <td width='200' height='30'>".$p[satuan]."</td>    
                        <td width='200' height='30'>".$p[metode_uji]."</td>  
                    </tr>";
                } 
                $i++;
            }
            unset($i);
            echo" 
        </table>";

        $pdf->WriteHTML($html);
        ob_end_clean();
        $pdf->Output();
        
}
?>

