eOSP2/app/Http/Controllers/documentCreators.php
2020-03-25 00:20:45 +01:00

695 lines
29 KiB
PHP

<?php
namespace App\Http\Controllers;
use Codedge\Fpdf\Fpdf\Fpdf;
use DB;
use App\fireStation;
use Carbon;
use Illuminate\Routing\Controller;
use App\Http\Controllers\AlphaPDF;
class documentCreators extends Fpdf
{
public function textConvert($text){
return iconv('utf-8','iso-8859-2',$text);
}
public function setWatermark($pdf){
$pdf->SetAlpha(0.5);
$pdf->Image('/home/czup/PhpstormProjects/untitled7/eOSP2/app/Http/Controllers/logo.jpg',120,30,100);
$pdf->SetAlpha(1);
}
public function createSingleOperationPDF2($operationID){
$operation = DB::table('operations')->where([
['operations.fireStationID', "=", auth()->user()->fireStationID],
['operations.id', '=', $operationID],
])
->whereNull('deleted_at')
->leftJoin('users', 'operations.commanderID', '=', 'users.id')
->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
->first();
$fireFighters = array();
$trucks = array();
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )
->Join('operationsMembers', function ($join) use($operationID){
$join->on('users.id', '=', 'operationsMembers.memberID');
$join->where('operationsMembers.operationID', '=', $operationID);
})
->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport')
->get();
$trucks = DB::table('vehicles')->where([
["vehicles.fireStationID", "=", auth()->user()->fireStationID ],
])
->Join('operationsTrucks', function ($join) use($operationID){
$join->on('vehicles.id', '=', 'operationsTrucks.truckID');
$join->where('operationsTrucks.operationID', '=', $operationID);
})
->leftJoin('users', 'operationsTrucks.driverID', '=', 'users.id')
->select('vehicles.*', 'operationsTrucks.truckID', 'operationsTrucks.driverID', 'users.name as driverName', 'users.surname as driverSurname')
->get();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(40,10, $this->textConvert("Data wyjazdu:"));
$pdf->SetFont('arialpl','',16);
$pdf->Cell(60,10,$this->textConvert($operation->operationDate), 0, 0, '', $fill);
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(25,10, $this->textConvert("Miejsce:"));
$pdf->SetFont('arialpl','',16);
$pdf->Cell(40,10,$this->textConvert($operation->location), 0, 0, '', $fill);
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(15,10, $this->textConvert("Cel:"));
$pdf->SetFont('arialpl','',16);
$pdf->Cell(80,10,$this->textConvert($operation->target), 0, 0, '', $fill);
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(55,10, $this->textConvert("Rodzaj zagrożenia:"));
$pdf->SetFont('arialpl','',16);
$pdf->Cell(60,10,$this->textConvert($operation->dangerType), 0, 0, '', $fill);
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(35,10, $this->textConvert("Dowodzący:"));
$pdf->SetFont('arialpl','',16);
$pdf->Cell(60,10,$this->textConvert($operation->name.' '.$operation->surname), 0, 0, '', $fill);
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(0,10, $this->textConvert("Opis Wyjazdu"),0,1,'C');
$pdf->Ln();
$pdf->SetFont('arialpl','',16);
$pdf->Write(8,$this->textConvert($operation->description));
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(28,10, $this->textConvert("Członkowie wyjazdu:"));
$pdf->Ln();
$pdf->SetFillColor(152,152,152);
$pdf->Cell(135,10, $this->textConvert("Członkowie akcji"), 1, 0, 'C', true);
$pdf->Cell(55,10, $this->textConvert("Transport własny"), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
foreach( $fireFighters as $fireFighter){
$text = $fireFighter->name." ".$fireFighter->surname;
$pdf->Cell(135,10,$this->textConvert($text), 1, 0, '', $fill);
if($fireFighter->privateTransport == 1){
$privateTransport = 'Tak';
}else{
$privateTransport = 'Nie';
}
$pdf->Cell(55,10,$this->textConvert($privateTransport), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
}
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(28,10, $this->textConvert("Pojazdy biorące udział w akcji:"));
$pdf->Ln();
$pdf->SetFillColor(152,152,152);
$pdf->Cell(115,10, $this->textConvert("Pojazd"), 1, 0, 'C', true);
$pdf->Cell(75,10, $this->textConvert("Kierowca"), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
foreach( $trucks as $truck){
$pdf->Cell(115,10,$this->textConvert($truck->name.' '.$truck->brand.' '.$truck->registrationNumber), 1, 0, '', $fill);
$pdf->Cell(75,10,$this->textConvert($truck->driverName.' '.$truck->driverSurname), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
}
$pdf->Ln();
// $this->setWatermark($pdf);
$pdf->Ln();
$pdf->Output();
exit;
}
public function createAllOperationsPDF($fireSationID){
$operations = DB::table('operations')->where('operations.fireStationID', "=", $fireSationID)
->whereNull('deleted_at')
->leftJoin('users', 'operations.commanderID', '=', 'users.id')
->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
->get();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert("Lista wyjazdów:"),0,0,'C');
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->SetFont('arialpl','',14);
$pdf->SetFillColor(224,224,224);
foreach( $operations as $operation){
$pdf->Cell(50,10, $this->textConvert("Dowódca: "), 1, 0, '', true);
$pdf->Cell(70,10, $this->textConvert($operation->name." ".$operation->surname), 1, 0, 'C' );
$pdf->Cell(20,10, $this->textConvert("Data: "), 1, 0, 'C', true);
$pdf->Cell(50,10, $this->textConvert($operation->operationDate), 1, 0, '');
$pdf->Ln();
$pdf->Cell(50,10,$this->textConvert("Miejsce: "), 1, 0, '', true);
$pdf->Cell(140,10,$this->textConvert($operation->location), 1, 0, '');
$pdf->Ln();
$pdf->Cell(50,10,$this->textConvert("Cel: "), 1, 0, '', true);
$pdf->Cell(140,10,$this->textConvert($operation->target), 1, 0, '');
$pdf->Ln();
$pdf->Cell(50,10, $this->textConvert("Rodzaj zagrożenia: "), 1, 0, '', true);
$pdf->Cell(140,10, $this->textConvert($operation->dangerType), 1, 0, '');
$pdf->Ln();
$pdf->Ln();
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function createSingleUnitPDF2(){
$fireStation = fireStation::find(auth()->user()->fireStationID);
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert($fireStation->name),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(45,10, $this->textConvert("Województwo:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(40,10, $this->textConvert($fireStation->voivodeship),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(25,10, $this->textConvert("Powiat:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->county),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(85,10, $this->textConvert("Gmina i numer Ewidencyjny:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->community.' '.$fireStation->number),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(85 ,10, $this->textConvert("Kod pocztowy, Miejscowość:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->zipCode.' '.$fireStation->name),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(45,10, $this->textConvert("Ulica i Numer:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->address),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(100,10, $this->textConvert("Szerokość i długość geograficzna:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(0,10, $this->textConvert($fireStation->latitude.'° | '.$fireStation->longitude.'°'),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(20,10, $this->textConvert("KRS:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->KRS),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(20,10, $this->textConvert("NIP:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->NIP),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(30,10, $this->textConvert("Telefon:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->phoneNumber),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(25,10, $this->textConvert("Email:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->email),0,0,'');
$pdf->Ln();
$pdf->Output();
exit;
}
public function createSingleFireFighterPDF($userID){
$user = DB::table('users')->where("users.id", '=', $userID)
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email','users.phoneNumber', 'users.number', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
->first();
$userTrainings = DB::table('trainingsFirefighters')->where("trainingsFirefighters.firefighterID", '=', $userID)
->leftJoin('trainings', 'trainingsFirefighters.trainingID', '=', 'trainings.id')
->whereNull('deleted_at')
->select('trainingsFirefighters.id','trainings.trainingName','trainingsFirefighters.dateOfComplete', 'trainingsFirefighters.dateOfExpiry')
->get();
$userDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $userID)
->whereNull('decorationsFirefighters.deleted_at')
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
->get();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert($user->name.' '.$user->surname),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(25,10, $this->textConvert("Pesel:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($user->PESEL),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(25,10, $this->textConvert("Telefon:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($user->phoneNumber),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(25,10, $this->textConvert("Email:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($user->email ),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(60,10, $this->textConvert("Numer ewidencyjny:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($user->number ),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(30,10, $this->textConvert("Stopień:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($user->rank ),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(30,10, $this->textConvert("Funkcja:"),0,0,'');
$pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($user->unitFunction ),0,0,'');
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(190,10, $this->textConvert("Ukończone szkolenia:"),0,0,'C');
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->Cell(10,10, $this->textConvert("#"), 1, 0, 'C', true);
$pdf->Cell(100,10, $this->textConvert("Szkolenie"), 1, 0, 'C', true);
$pdf->Cell(40,10, $this->textConvert("Data ukończenia"), 1, 0, 'C', true);
$pdf->Cell(40,10, $this->textConvert("Data ważności"), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
$i=1;
foreach( $userTrainings as $userTraining){
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
$pdf->Cell(100,10,$this->textConvert($userTraining->trainingName), 1, 0, '', $fill);
$pdf->Cell(40,10,$this->textConvert($userTraining->dateOfComplete), 1, 0, 'C', $fill);
$pdf->Cell(40,10,$this->textConvert($userTraining->dateOfExpiry), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
$i++;
}
$pdf->Ln();
$pdf->SetFont('arialpl','B',16);
$pdf->Cell(190,10, $this->textConvert("Nadane odznaczenia:"),0,0,'C');
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->Cell(10,10, $this->textConvert("#"), 1, 0, 'C', true);
$pdf->Cell(140,10, $this->textConvert("Odznaczenie"), 1, 0, 'C', true);
$pdf->Cell(40,10, $this->textConvert("Data przyznania"), 1, 0, 'C', true);;
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
$i=1;
foreach( $userDecorations as $userDecoration){
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
$pdf->Cell(140,10,$this->textConvert($userDecoration->decorationName), 1, 0, '', $fill);
$pdf->Cell(40,10,$this->textConvert($userDecoration->dateOfAward), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
$i++;
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function CreateAllFireFightersPDF($fireStationID){
$users = DB::table('users')->where("fireStationID", '=', $fireStationID)
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
->select('users.id','users.name', 'users.surname', 'users.phoneNumber', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
->get();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert("Lista strażaków"),0,0,'C');
$pdf->Ln();
foreach( $users as $user) {
$pdf->Ln();
$pdf->SetFont('arialpl', '', 14);
$pdf->SetFillColor(152, 152, 152);
$pdf->Cell(190, 10, $this->textConvert($user->name . ' ' . $user->surname), 1, 0, 'C', 'fill');
$pdf->SetFillColor(224, 224, 224);
$pdf->Ln();
$pdf->Cell(130, 10, $this->textConvert($user->email), 1, 0, 'C', 'fill');
$pdf->Cell(60, 10, $this->textConvert('tel: '.$user->phoneNumber), 1, 0, 'C', 'fill');
$pdf->Ln();
$pdf->Cell(90, 10, $this->textConvert('Stopień: ' . $user->rank), 1, 0, 'C', 'fill');
$pdf->Cell(100, 10, $this->textConvert('Funkcja:' . $user->unitFunction), 1, 0, 'C', 'fill');
$pdf->Ln();
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function createAllEquipmentPDF($fireStationID){
$equipment = DB::table('equipment')->where("fireStationID", '=', $fireStationID)
->whereNull('deleted_at')->get();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert("Stan sprzętu"),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->Cell(10,10, $this->textConvert("# "), 1, 0, 'C', true);
$pdf->Cell(85,10, $this->textConvert("Nazwa "), 1, 0, 'C', true);
$pdf->Cell(80,10, $this->textConvert("Param. char. "), 1, 0, 'C', true);
$pdf->Cell(15,10, $this->textConvert("Ilość"), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
$i=1;
foreach( $equipment as $item){
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
$pdf->Cell(85,10,$this->textConvert($item->name), 1, 0, '', $fill);
$pdf->Cell(80,10,$this->textConvert($item->parameter), 1, 0, '', $fill);
$pdf->Cell(15,10,$this->textConvert($item->amount), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
$i++;
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function createAllTrainingsPDF($fireStationID){
$trainings = DB::table('trainings')->where("fireStationID", '=', $fireStationID)
->whereNull('deleted_at')
->paginate(10);
$howMuch = array();
foreach($trainings as $training) {
$id = $training->id;
$howMuch[$id] = DB::table('trainingsFirefighters')->where('trainingID', '=', $id)->count();
}
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert("Lista badań/szkoleń"),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->Cell(10,10, $this->textConvert("# "), 1, 0, 'C', true);
$pdf->Cell(130,10, $this->textConvert("Nazwa "), 1, 0, 'C', true);
$pdf->Cell(50,10, $this->textConvert("Ilość z ukończonym"), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
$i=1;
foreach( $trainings as $training){
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
$pdf->Cell(130 ,10,$this->textConvert($training->trainingName), 1, 0, '', $fill);
$pdf->Cell(50,10,$this->textConvert($howMuch[$training->id]), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
$i++;
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function createSingleTrainingPDF($trainingID){
$training = DB::table('trainings')->where("id", '=', $trainingID)
->first();
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID)
->Join('trainingsFirefighters', function ($join) use ($trainingID) {
$join->on('users.id', '=', 'trainingsFirefighters.firefighterID');
$join->where('trainingsFirefighters.trainingID', '=', $trainingID);
})
->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID')
->get();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert("Lista z ukończonym: ".$training->trainingName),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->Cell(10,10, $this->textConvert("# "), 1, 0, 'C', true);
$pdf->Cell(100,10, $this->textConvert("Imię i Nazwisko "), 1, 0, 'C', true);
$pdf->Cell(45,10, $this->textConvert("Data ukończenia"), 1, 0, 'C', true);
$pdf->Cell(35,10, $this->textConvert("Ważne do"), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
$i=1;
foreach( $fireFighters as $fireFighter){
$pdf->Cell(10,10, $i, 1, 0, 'C', $fill);
$pdf->Cell(100 ,10,$this->textConvert($fireFighter->name.' '.$fireFighter->surname), 1, 0, '', $fill);
$pdf->Cell(45 ,10,$this->textConvert($fireFighter->dateOfComplete), 1, 0, 'C', $fill);
$pdf->Cell(35 , 10,$this->textConvert($fireFighter->dateOfExpiry), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
$i++;
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function createAllVehiclesPDF($fireStationID){
$vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID)
->whereNull('deleted_at')->paginate(10);
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert("Lista pojazdów:"),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','B',14);
$pdf->SetFillColor(152,152,152);
$pdf->Cell(70,10, $this->textConvert("Nazwa"), 1, 0, 'C', true);
$pdf->Cell(50,10, $this->textConvert("Marka"), 1, 0, 'C', true);
$pdf->Cell(35,10, $this->textConvert("Numer rej."), 1, 0, 'C', true);
$pdf->Cell(35,10, $this->textConvert("Rok prod."), 1, 0, 'C', true);
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$fill = false;
$pdf->SetFillColor(224,224,224);
foreach( $vehicles as $vehicle){
$pdf->Cell(70 ,10,$this->textConvert($vehicle->name), 1, 0, '', $fill);
$pdf->Cell(50 ,10,$this->textConvert($vehicle->brand), 1, 0, 'C', $fill);
$pdf->Cell(35 , 10,$this->textConvert($vehicle->registrationNumber), 1, 0, 'C', $fill);
$pdf->Cell(35 , 10,$this->textConvert($vehicle->productionYear), 1, 0, 'C', $fill);
$pdf->Ln();
$fill = !$fill;
}
$pdf->Ln();
$pdf->Output();
exit;
}
public function createSingleVehiclePDF($vehicleID){
$vehicle = DB::table('vehicles')->where("id", '=', $vehicleID)
->first();
$pdf = new AlphaPDF();
$fill = false;
$pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php');
$pdf->SetFont('arialpl','B',20);
$pdf->Cell(190,10, $this->textConvert($vehicle->name),0,0,'C');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('arialpl','',14);
$pdf->SetFillColor(224,224,224);
$pdf->Cell(50 ,10,$this->textConvert("Kryptonim: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->codename), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Marka: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->brand), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Numer rej: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->registrationNumber), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Rok Produkcji: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->productionYear), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Ważność przeglądu: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->examExpirationDate), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Termin ważności OC: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->insuranceExpirationDate), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Układ napędowy: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->driveType), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Typ podwozia: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->chassisType), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Producent nadwozia: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->bodyProducer), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Ilość osób w załodze: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->crewNumber), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Ilość piany w L: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->foamAgent), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Moc silnika w kW: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->enginePower), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Masa pojazdu: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->mass), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Numer podwozia: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->chassisNumber), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Numer Silnika: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->engineNumber), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Rodzaj paliwa: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->fuelType), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Rok prod. podwozia: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->chassisPoductionYear), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Data wprowadzenia: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->entryIntoServiceDate), 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(50 ,10,$this->textConvert("Opis Autopompy: "), 1, 0, '', true);
$pdf->Cell(140 , 10,$this->textConvert($vehicle->fireEnginePumpDescription), 1, 0, 'C');
$pdf->Ln();
$pdf->Ln();
$pdf->Output();
exit;
}
}