Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exportoption #455

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Zizaco\Entrust\EntrustServiceProvider',
'Barryvdh\DomPDF\ServiceProvider',

),

Expand Down Expand Up @@ -175,6 +176,7 @@
'View' => 'Illuminate\Support\Facades\View',
'SoftDeletingTrait' => 'Illuminate\Database\Eloquent\SoftDeletingTrait',
'Entrust' => 'Zizaco\Entrust\EntrustFacade',
'PDF' => 'Barryvdh\DomPDF\Facade',
),

);
95 changes: 92 additions & 3 deletions app/controllers/ReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ public function viewPatientReport($id, $visit = null, $testId = null){
->with('accredited', $accredited);
return Response::make($content,200, $headers);
}

else if(Input::has('pdf')){
$date = date("Ymdhi");
$fileName = "blispatient_".$id."_".$date.".pdf";

$content = View::make('reports.patient.exportpdf')
->with('patient', $patient)
->with('tests', $tests)
->with('from', $from)
->with('to', $to)
->with('visit', $visit)
->with('accredited', $accredited);

$pdf = App::make('dompdf');
$pdf->loadHTML($content);
return $pdf->download($fileName);
}
else{
return View::make('reports.patient.report')
->with('patient', $patient)
Expand Down Expand Up @@ -218,6 +235,19 @@ public function dailyLog()
->with('accredited', $accredited)
->withInput(Input::all());
return Response::make($content,200, $headers);
}
else if(Input::has('pdf')){
$date = date("Ymdhi");
$fileName = "daily_visits_log_".$date.".pdf";

$content = View::make('reports.daily.exportPatientLog')
->with('visits', $visits)
->with('accredited', $accredited)
->withInput(Input::all());
$pdf = App::make('dompdf');
$pdf->loadHTML($content);
return $pdf->download($fileName);

}
else{
return View::make('reports.daily.patient')
Expand Down Expand Up @@ -273,6 +303,21 @@ public function dailyLog()
->with('accredited', $accredited)
->withInput(Input::all());
return Response::make($content,200, $headers);
}
else if(Input::has('pdf')){
$date = date("Ymdhi");
$fileName = "daily_rejected_specimen_".$date.".pdf";

$content = View::make('reports.daily.exportSpecimenLog')
->with('specimens', $specimens)
->with('testCategory', $testCategory)
->with('testType', $testType)
->with('accredited', $accredited)
->withInput(Input::all());
$pdf = App::make('dompdf');
$pdf->loadHTML($content);
return $pdf->download($fileName);

}
else
{
Expand Down Expand Up @@ -343,6 +388,22 @@ public function dailyLog()
->with('accredited', $accredited)
->withInput(Input::all());
return Response::make($content,200, $headers);
}
else if(Input::has('pdf')){
$date = date("Ymdhi");
$fileName = "daily_test_records_".$date.".pdf";

$content = View::make('reports.daily.exportTestLog')
->with('tests', $tests)
->with('testCategory', $testCategory)
->with('testType', $testType)
->with('pendingOrAll', $pendingOrAll)
->with('accredited', $accredited)
->withInput(Input::all());
$pdf = App::make('dompdf');
$pdf->loadHTML($content);
return $pdf->download($fileName);

}
else
{
Expand Down Expand Up @@ -974,14 +1035,29 @@ public function infectionReport(){
$testCategory = Input::get('test_category');

$infectionData = Test::getInfectionData($from, $toPlusOne, $testCategory); // array for counts data for each test type and age range

return View::make('reports.infection.index')
if(Input::has('pdf')){
$fileName = "surveillance_".$date.".pdf";
$content = View::make('reports.infection.exportinfection')
->with('gender', $gender)
->with('ageRanges', $ageRanges)
->with('ranges', $ranges)
->with('infectionData', $infectionData)
->with('accredited', $accredited)
->withInput(Input::all());

$pdf = App::make('dompdf');
$pdf->loadHTML($content);
return $pdf->stream();
}
else {
return View::make('reports.infection.index')
->with('gender', $gender)
->with('ageRanges', $ageRanges)
->with('ranges', $ranges)
->with('infectionData', $infectionData)
->with('accredited', $accredited)
->withInput(Input::all());
}
}

/**
Expand Down Expand Up @@ -1123,7 +1199,20 @@ public function surveillance(){
->with('accredited', $accredited)
->withInput(Input::all());
return Response::make($content,200, $headers);
}else{
}
else if(Input::has('pdf')){
$fileName = "surveillance_".$date.".pdf";
$content = View::make('reports.surveillance.exportSurveillance')
->with('surveillance', $surveillance)
->with('tests', $tests)
->with('accredited', $accredited)
->withInput(Input::all());

$pdf = App::make('dompdf');
$pdf->loadHTML($content);
return $pdf->download($fileName);
}
else{
return View::make('reports.surveillance.index')
->with('accredited', $accredited)
->with('tests', $tests)
Expand Down
Loading