45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
// ob_start();
|
|
|
|
$pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
|
|
$pdf->AddPage('P');
|
|
$i = 0;
|
|
foreach ($data as $value) {
|
|
$html = '</h4> <h2 align="center">LAPORAN RIWAYAT DARAH</h2>
|
|
<table width="100%">
|
|
<tr>
|
|
<td>Bulan: ' . date("F", strtotime($value->bulan)) . '</td>
|
|
<td style="text-align: right;">Tahun: ' . $tahun . ' </td>
|
|
</tr>
|
|
</table>
|
|
<h6> </h6>
|
|
<table cellspacing="1" border="1" bgcolor="#666666" cellpadding="2">
|
|
<tr bgcolor="#ffffff">
|
|
<th width="50%" align="center">Bulan dan Tahun</th>
|
|
<th width="25%" align="center">Nama</th>
|
|
<th width="25%" align="center">Status Tambah Darah</th>
|
|
</tr>';
|
|
}
|
|
$total = 0;
|
|
$jm = 0;
|
|
foreach ($data as $value) {
|
|
$i++;
|
|
$html .= '<tr bgcolor="#ffffff">
|
|
<td align="left">' . date("F Y", strtotime($value->bulan)). '</td>
|
|
<td align="center">' . $value->nama . '</td>
|
|
<td align="center">' . $value->status_darah . '</td>
|
|
</tr>';
|
|
if ($value->status != 0) {
|
|
$total += $value->status_darah;
|
|
$jm += 1;
|
|
}
|
|
}
|
|
|
|
|
|
$total = $total / $jm;
|
|
$html .= '</table>';
|
|
$pdf->writeHTML($html, true, false, true, false, '');
|
|
ob_end_clean();
|
|
$pdf->Output('LAPORAN_TAMBAH_DARAH_' . $bulan . '.pdf', 'I');
|
|
?>
|