Again this works perfectly fine within my Windows Dev Server without the need of adding OPENSSL_CONF=/etc/ssl to the command.
On Windows:
PDF Export works with .pdf extension without modification to the vendor/koolreport/export/Handler.php file.
On Linux:
phantomjs fails to execute without modify the Handler.php file for export to include the OPENSSL_CONF setting.
When that is appended on the command the other error above is listed where you see the response from symphony.
ExportsController.php
public function compliance()
{
$report = new \App\Reports\tenant\compliance\ComplianceReportExport;
return $report->run()->export()->settings([
"useLocalTempFolder" => true,
"autoDeleteTempFile" => true,
])->pdf([
"format" => "A4",
"orientation" => "portrait",
"zoom" => -3
])->toBrowser(now()->timezone('America/Los_Angeles')->format('Ymd') . 'regional_compliance');
}
CompliaceReportExport.php
<?php
namespace App\Reports\tenant\compliance;
class ComplianceReportExport extends \koolreport\KoolReport
{
use \koolreport\laravel\Friendship;
use \koolreport\export\Exportable;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
use \koolreport\export\Exportable;
function settings(): array
{
return [
"dataSources" => [
"elo" => [
"class" => '\koolreport\laravel\Eloquent',
]
]
];
}
protected function defaultParamValues(): array
{
return [
"dateRange" => [now()->subDay()->timezone('America/Los_Angeles'), now()->addDays(90)->timezone('America/Los_Angeles')],
"dateRangeStart" => null,
"dateRangeEnd" => null,
];
}
protected function bindParamsToInputs(): array
{
return [
"dateRange",
"dateRangeStart",
"dateRangeEnd"
];
}
function setup(): void
{
if (isset($this->params['dateRangeStart']) && isset($this->params['dateRangeEnd'])) {
$dateRange = [$this->params['dateRangeStart'], $this->params['dateRangeEnd']];
} else {
$dateRange = $this->params['dateRange'];
}
$this->src("elo")->query(
\App\Models\Tenant\License::select('companies.name as Company Name', 'regions.name as Region Name', 'communities.name as Community Name', 'number as License Number', 'expiration_date as Expiration Date')
->join('communities', 'communities.id', '=', 'licenses.community_id')
->leftJoin('companies', 'companies.id', '=', 'communities.company_id')
->leftJoin('regions', 'regions.id', '=', 'communities.region_id')
->whereBetween('expiration_date', $dateRange)
->when(auth()->user()->communities()->count(), function ($query) {
return $query->whereIn('community_id', auth()->user()->communities()->pluck('community_id')->toArray());
})
->when(auth()->user()->companies()->count(), function ($query) {
return $query->whereIn('communities.company_id', auth()->user()->companies()->pluck('company_id')->toArray());
})
->when(auth()->user()->regions()->count(), function ($query) {
return $query->whereIn('communities.region_id', auth()->user()->regions()->pluck('region_id')->toArray());
})
->orderBy('expiration_date', 'asc')
)
->pipe($this->dataStore("license"));
$this->src("elo")->query(
\App\Models\Tenant\Permit::select('companies.name as Company Name', 'regions.name as Region Name', 'communities.name as Community Name', 'number as Permit Number', 'type as Permit Type', 'issuing_agency as Issuing Agency', 'expiration_date as Expiration Date')
->join('communities', 'communities.id', '=', 'permits.community_id')
->leftJoin('companies', 'companies.id', '=', 'communities.company_id')
->leftJoin('regions', 'regions.id', '=', 'communities.region_id')
->whereBetween('expiration_date', $dateRange)
->when(auth()->user()->communities()->count(), function ($query) {
return $query->whereIn('community_id', auth()->user()->communities()->pluck('community_id')->toArray());
})
->when(auth()->user()->companies()->count(), function ($query) {
return $query->whereIn('communities.company_id', auth()->user()->companies()->pluck('company_id')->toArray());
})
->when(auth()->user()->regions()->count(), function ($query) {
return $query->whereIn('communities.region_id', auth()->user()->regions()->pluck('region_id')->toArray());
})
->orderBy('expiration_date', 'asc')
)
->pipe($this->dataStore("permit"));
$this->src("elo")->query(
\App\Models\Tenant\Clia::select('companies.name as Company Name', 'regions.name as Region Name', 'communities.name as Community Name', 'number as CLIA Number', 'type as CLIA Type', 'expiration_date as Expiration Date')
->join('communities', 'communities.id', '=', 'clias.community_id')
->leftJoin('companies', 'companies.id', '=', 'communities.company_id')
->leftJoin('regions', 'regions.id', '=', 'communities.region_id')
->whereBetween('expiration_date', $dateRange)
->when(auth()->user()->communities()->count(), function ($query) {
return $query->whereIn('community_id', auth()->user()->communities()->pluck('community_id')->toArray());
})
->when(auth()->user()->companies()->count(), function ($query) {
return $query->whereIn('communities.company_id', auth()->user()->companies()->pluck('company_id')->toArray());
})
->when(auth()->user()->regions()->count(), function ($query) {
return $query->whereIn('communities.region_id', auth()->user()->regions()->pluck('region_id')->toArray());
})
->orderBy('expiration_date', 'asc')
)
->pipe($this->dataStore("clia"));
$this->src("elo")->query(
\App\Models\Tenant\Penalty::select('companies.name as Company Name', 'regions.name as Region Name', 'communities.name as Community Name', 'agency_reports.description as Agency Report Description', 'penalties.poc_due as POC Due Date', 'penalties.fine_due_date as Fine Due Date')
->join('agency_reports', 'agency_reports.id', '=', 'penalties.agency_report_id')
->join('communities', 'communities.id', '=', 'agency_reports.community_id')
->leftJoin('companies', 'companies.id', '=', 'communities.company_id')
->leftJoin('regions', 'regions.id', '=', 'communities.region_id')
->where(function ($query) use ($dateRange) {
$query->whereBetween('penalties.poc_due', $dateRange)->orWhereBetween('penalties.fine_due_date', $dateRange);
})
->when(auth()->user()->communities()->count(), function ($query) {
return $query->whereIn('agency_reports.community_id', auth()->user()->communities()->pluck('community_id')->toArray());
})
->when(auth()->user()->companies()->count(), function ($query) {
return $query->whereIn('communities.company_id', auth()->user()->companies()->pluck('company_id')->toArray());
})
->when(auth()->user()->regions()->count(), function ($query) {
return $query->whereIn('communities.region_id', auth()->user()->regions()->pluck('region_id')->toArray());
})
->where('penalties.status', 1)
->orderBy('penalties.poc_due', 'asc')
)
->pipe($this->dataStore("penalty"));
}
}
ComplianceReportExport.view.php
<html lang="en">
<head>
<title></title>
</head>
<style>
.table-header {
background-color: #f2f2f2;
border: 1px solid #ddd;
font-weight: bold;
text-align: center;
font-size: 12pt;
padding: 5px 0;
}
.table-data {
padding: 5px;
font-weight: normal;
text-align: left;
font-size: 10pt;
}
.table-row {
border: 1px solid #ddd;
}
.table-row:nth-child(even) {
background-color: #f2f2f2;
}
.table-row:nth-child(odd) {
background-color: #ffffff;
}
.table {
border-collapse: collapse;
width: 100%;
}
</style>
<body style="background-color: #ffffff; margin: 10px 20px 10px 20px;">
<div class="report-content">
<div style="text-align: center">
<h1>Compliance Report</h1>
<p class="lead">
Date Range: <?php echo Carbon\Carbon::parse($this->params["dateRangeStart"])->format('m-d-Y') ?>
to <?php echo Carbon\Carbon::parse($this->params["dateRangeEnd"])->format('m-d-Y') ?>
</p>
</div>
<div>
<h2>Licenses</h2>
<?php
\koolreport\widgets\koolphp\Table::create([
"dataSource" => $this->dataStore("license"),
"emptyValue" => "",
'cssClass' =>
[
'table' => 'table',
'tr' => 'table-row',
'th' => 'table-header',
'td' => 'table-data'
],
]);
?>
<div class="page-break"></div>
<h2>Permits</h2>
<?php
\koolreport\widgets\koolphp\Table::create([
"dataSource" => $this->dataStore("permit"),
"emptyValue" => "",
'cssClass' =>
[
'table' => 'table',
'tr' => 'table-row',
'th' => 'table-header',
'td' => 'table-data'
],
]);
?>
<div class="page-break"></div>
<h2>CLIAs</h2>
<?php
\koolreport\widgets\koolphp\Table::create([
"dataSource" => $this->dataStore("clia"),
"emptyValue" => "",
'cssClass' =>
[
'table' => 'table',
'tr' => 'table-row',
'th' => 'table-header',
'td' => 'table-data'
],
]);
?>
<div class="page-break"></div>
<h2>Defficiencies & Penalties</h2>
<?php
\koolreport\widgets\koolphp\Table::create([
"dataSource" => $this->dataStore("penalty"),
"emptyValue" => "",
'cssClass' =>
[
'table' => 'table',
'tr' => 'table-row',
'th' => 'table-header',
'td' => 'table-data'
],
]);
?>
</div>
</div>
</body>
</html>