From 5fce79275d11981efc4652cdc04aa19a8079441f Mon Sep 17 00:00:00 2001 From: s421507 Date: Mon, 20 Jul 2020 11:42:06 +0200 Subject: [PATCH] =?UTF-8?q?Drukowanie=20sprz=C4=99tu=20z=20uwzgl=C4=99dnie?= =?UTF-8?q?niem=20=C5=82amania=20linii?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 19 ++--- app/Http/Controllers/documentCreators.php | 79 +++++++++++++++---- .../Controllers/documentOverlayController.php | 3 +- 3 files changed, 74 insertions(+), 27 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3eb070b..88ccede 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,7 @@ - + + + + + + @@ -181,11 +186,6 @@ - - - - - @@ -262,7 +262,8 @@ - + + @@ -282,10 +283,10 @@ - + - + diff --git a/app/Http/Controllers/documentCreators.php b/app/Http/Controllers/documentCreators.php index 58a089b..5afb79d 100644 --- a/app/Http/Controllers/documentCreators.php +++ b/app/Http/Controllers/documentCreators.php @@ -4,14 +4,15 @@ namespace App\Http\Controllers; -use Codedge\Fpdf\Fpdf\Fpdf; +#use Codedge\Fpdf\Fpdf\Fpdf; use DB; use App\fireStation; use Carbon; use Illuminate\Routing\Controller; use App\Http\Controllers\AlphaPDF; +use setasign\Fpdi\Fpdi; -class documentCreators extends Fpdf +class documentCreators extends Controller { public function textConvert($text){ return iconv('utf-8','iso-8859-2',$text); @@ -58,7 +59,8 @@ class documentCreators extends Fpdf - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); $pdf->AddFont('arialpl', '', 'arialpl.php'); @@ -155,7 +157,8 @@ class documentCreators extends Fpdf ->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(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -191,13 +194,15 @@ class documentCreators extends Fpdf $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } public function createSingleUnitPDF2(){ $fireStation = fireStation::find(auth()->user()->fireStationID); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -258,6 +263,7 @@ class documentCreators extends Fpdf $pdf->SetFont('arialpl','',16); $pdf->Cell(30,10, $this->textConvert($fireStation->email),0,0,''); $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } @@ -281,7 +287,8 @@ class documentCreators extends Fpdf ->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id') ->get(); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -383,6 +390,7 @@ class documentCreators extends Fpdf $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } @@ -395,10 +403,10 @@ class documentCreators extends Fpdf ->select('users.id','users.name', 'users.surname', 'users.phoneNumber', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction') ->get(); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); $fill = false; $pdf->AddPage(); - + $pdf->fontpath = "../app/Common/fonts/"; $pdf->AddFont('arialpl', '', 'arialpl.php'); $pdf->AddFont('arialpl', 'B', 'arialplb.php'); @@ -422,6 +430,7 @@ class documentCreators extends Fpdf } $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; @@ -432,7 +441,8 @@ class documentCreators extends Fpdf $equipment = DB::table('equipment')->where("fireStationID", '=', $fireStationID) ->whereNull('deleted_at')->get(); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -456,16 +466,43 @@ class documentCreators extends Fpdf $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->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); + $cellHeight = 10; + $calculateHeight = new Fpdi(); + $calculateHeight->fontpath = "../app/Common/fonts/"; + $calculateHeight->AddFont('arialpl', '', 'arialpl.php'); + $calculateHeight->SetFont('arialpl','',14); + $calculateHeight->addPage(); + $calculateHeight->setXY(0, 0); + $calculateHeight->MultiCell(85, 10, $this->textConvert($item->name), 0, 'L', 1); + $descriptionHeight = $calculateHeight->getY(); + $calculateHeight->setXY(100, 100); + $calculateHeight->Cell(15,10,$descriptionHeight, 1, 0, 'C', $fill); + +// +// $calculateHeight->Ln(); +// ob_end_clean(); +// $calculateHeight->Output(); +// exit; + + $start_X = $pdf->GetX(); + $start_Y = $pdf->GetY(); + $pdf->Cell(10, $descriptionHeight, $i, 1, 0, 'C', $fill); + $pdf->MultiCell(85, 10, $this->textConvert($item->name), 1, 'L' , $fill); + $pdf->SetXY($start_X+95, $start_Y); + $pdf->Cell(80, $descriptionHeight, $this->textConvert($item->parameter), 1, 0, 'L', $fill); + $pdf->Cell(15, $descriptionHeight, $this->textConvert($item->amount), 1, 0, 'C', $fill); + $pdf->Ln(); $fill = !$fill; $i++; } $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } @@ -483,7 +520,8 @@ class documentCreators extends Fpdf } - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -515,6 +553,7 @@ class documentCreators extends Fpdf } $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } @@ -531,7 +570,8 @@ class documentCreators extends Fpdf ->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID') ->get(); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -565,6 +605,7 @@ class documentCreators extends Fpdf } $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } @@ -573,7 +614,8 @@ class documentCreators extends Fpdf $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) ->whereNull('deleted_at')->paginate(10); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -606,6 +648,7 @@ class documentCreators extends Fpdf $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } @@ -614,7 +657,8 @@ class documentCreators extends Fpdf $vehicle = DB::table('vehicles')->where("id", '=', $vehicleID) ->first(); - $pdf = new AlphaPDF(); + $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; $fill = false; $pdf->AddPage(); @@ -688,6 +732,7 @@ class documentCreators extends Fpdf $pdf->Ln(); + ob_end_clean(); $pdf->Output(); exit; } diff --git a/app/Http/Controllers/documentOverlayController.php b/app/Http/Controllers/documentOverlayController.php index 778f3c8..9c8db52 100644 --- a/app/Http/Controllers/documentOverlayController.php +++ b/app/Http/Controllers/documentOverlayController.php @@ -87,7 +87,7 @@ class documentOverlayController extends Controller $pdf->Output(); - + exit; } @@ -164,5 +164,6 @@ class documentOverlayController extends Controller } $pdf->Output(); + exit; } }