SetCreator(PDF_CREATOR); $pdf->SetAuthor('Masjid-E'); $pdf->SetTitle('Laporan Ikhtisar Kas ' . $bulanIndonesia); $pdf->SetMargins(10, 10, 10); $pdf->SetAutoPageBreak(TRUE, 10); $pdf->AddPage(); // Judul Laporan $pdf->SetFont('helvetica', 'B', 16); $pdf->Cell(0, 10, 'Rekapitulasi Dana Kas', 0, 1, 'C'); $pdf->SetFont('helvetica', '', 12); $pdf->Cell(0, 10, 'Periode: ' . $bulanIndonesia, 0, 1, 'C'); $pdf->Ln(5); // Buat tabel agar sejajar $pdf->SetFont('helvetica', '', 10); $html = ' '; $no = 1; $total_pemasukan = 0; $total_pengeluaran = 0; while ($row = mysqli_fetch_assoc($result)) { $total_pemasukan += $row['kas_pemasukan']; $total_pengeluaran += $row['kas_pengeluaran']; $html .= ''; $no++; } // Tambahkan total pemasukan & pengeluaran $html .= ''; $html .= '
No Kas Pemasukan Kas Pengeluaran Kas Keterangan Kas Jenis Kas Tanggal
' . $no . ' Rp ' . number_format($row['kas_pemasukan'], 0, ',', '.') . ' Rp ' . number_format($row['kas_pengeluaran'], 0, ',', '.') . ' ' . htmlspecialchars($row['kas_keterangan']) . ' ' . htmlspecialchars($row['kas_jenis']) . ' ' . date('d-m-Y', strtotime($row['kas_tanggal'])) . '
Total Pemasukan: Rp ' . number_format($total_pemasukan, 0, ',', '.') . ' Total Pengeluaran: Rp ' . number_format($total_pengeluaran, 0, ',', '.') . '
'; // Tambahkan tabel ke PDF $pdf->writeHTML($html, true, false, true, false, ''); // Pastikan tidak ada output sebelum header dikirim ob_end_clean(); // **Menampilkan PDF di browser, bukan mendownload langsung** header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="Ikhtisar_Kas_' . $search_bulan . '.pdf"'); $pdf->Output('Ikhtisar_Kas_' . $search_bulan . '.pdf', 'I'); ?>