106 lines
1.9 KiB
PHP
106 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
use App\Models\ModelDarah;
|
|
use App\Models\ModelCurah;
|
|
use Dompdf\Dompdf;
|
|
|
|
|
|
class Laporan extends BaseController
|
|
{
|
|
|
|
|
|
protected $DarahModel;
|
|
protected $CurahModel;
|
|
|
|
function __construct()
|
|
{
|
|
$this->DarahModel = new ModelDarah();
|
|
$this->CurahModel = new ModelCurah();
|
|
}
|
|
|
|
|
|
|
|
// public function tes(){
|
|
|
|
// return view('template');
|
|
// }
|
|
|
|
public function lapdar()
|
|
{
|
|
|
|
$data = array(
|
|
|
|
'body' => 'Laporan/demam_berdarah',
|
|
'data_darah' => $this->DarahModel->getDarah(),
|
|
|
|
);
|
|
return view('template', $data);
|
|
|
|
}
|
|
|
|
public function lapcur()
|
|
{
|
|
|
|
$data = array(
|
|
|
|
'body' => 'Laporan/curah_hujan',
|
|
'data_curah' => $this->CurahModel->getCurah(),
|
|
|
|
);
|
|
return view('template', $data);
|
|
|
|
}
|
|
|
|
|
|
public function curah_cetak()
|
|
{
|
|
|
|
$data = array(
|
|
|
|
|
|
'data_curah' => $this->CurahModel->getCurah(),
|
|
|
|
);
|
|
|
|
// Create an instance of the class:
|
|
$dompdf = new Dompdf();
|
|
$dompdf->loadHtml(view('Laporan/cetak_curah', $data));
|
|
|
|
// (Optional) Setup the paper size and orientation
|
|
$dompdf->setPaper('A4', 'landscape');
|
|
|
|
// Render the HTML as PDF
|
|
$dompdf->render();
|
|
|
|
// Output the generated PDF to Browser
|
|
$dompdf->stream();
|
|
|
|
}
|
|
|
|
public function demam_cetak()
|
|
{
|
|
|
|
|
|
$data = array(
|
|
|
|
|
|
'data_darah' => $this->DarahModel->getDarah(),
|
|
|
|
);
|
|
// Create an instance of the class:
|
|
$dompdf = new Dompdf();
|
|
$dompdf->loadHtml(view('Laporan/cetak_demam', $data));
|
|
|
|
// (Optional) Setup the paper size and orientation
|
|
$dompdf->setPaper('A4', 'landscape');
|
|
|
|
// Render the HTML as PDF
|
|
$dompdf->render();
|
|
|
|
// Output the generated PDF to Browser
|
|
$dompdf->stream();
|
|
|
|
}
|
|
}
|