42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
// ob_start();
|
|
|
|
$pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
|
|
$pdf->AddPage('P');
|
|
$i = 0;
|
|
$html = '</h4> <h2 align="center">LAPORAN RIWAYAT STATUS GIZI</h2>
|
|
<p>DARI TGL: ' . $mulai . ' S/D TGL: ' . $sampai . '</p>
|
|
<table cellspacing="1" border="1" bgcolor="#666666" cellpadding="2">
|
|
<tr bgcolor="#ffffff">
|
|
<th width="50%" align="center">Waktu</th>
|
|
<th width="25%" align="center">Nama</th>
|
|
<th width="25%" align="center">Keterangan</th>
|
|
</tr>';
|
|
|
|
$total = 0;
|
|
$jm = 0;
|
|
foreach ($data as $value) {
|
|
$i++;
|
|
$html .= '<tr bgcolor="#ffffff">
|
|
<td align="left">' . date("d-m-Y", strtotime($value->waktu)) . '</td>
|
|
<td align="center">' . $value->nama . '</td>';
|
|
if($value->total_kalori!=$value->energi && $value->total_karbohidrat!=$value->karbohidrat && $value->total_protein!=$value->protein && $value->total_lemak!=$value->lemak && $value->total_besi!=$value->besi && $value->total_vitamina!=$value->vitamina && $value->total_vitaminc!=$value->vitaminc){
|
|
$html .= '<td align="center">Gizi Kurang Mencukupi</td>';
|
|
}else{
|
|
$html .='<td align="center">Gizi Tercukupi</td>';
|
|
}
|
|
$html .='</tr>';
|
|
if ($value->total_kalori != 0) {
|
|
$total += $value->total_kalori;
|
|
$jm += 1;
|
|
}
|
|
}
|
|
|
|
|
|
$total = $total / $jm;
|
|
$html .= '</table>';
|
|
$pdf->writeHTML($html, true, false, true, false, '');
|
|
ob_end_clean();
|
|
$pdf->Output('LAPORAN_GIZI_' . $sampai . '.pdf', 'I');
|
|
?>
|