1
0
forked from s421507/eOSP2

Drukowanie sprzętu z uwzględnieniem łamania linii

This commit is contained in:
s421507 2020-07-20 11:42:06 +02:00
parent a5a5cae6e6
commit 5fce79275d
3 changed files with 74 additions and 27 deletions

View File

@ -3,7 +3,7 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="adc1032e-2c5f-4e68-bc22-d140f965f9d5" name="Default Changelist" comment=""> <list default="true" id="adc1032e-2c5f-4e68-bc22-d140f965f9d5" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Common/Helpers.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Common/Helpers.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentCreators.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentCreators.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/documentOverlayController.php" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -174,6 +174,11 @@
<property name="settings.editor.selected.configurable" value="database.main" /> <property name="settings.editor.selected.configurable" value="database.main" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\app\Common\fonts" />
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\resources\views" />
<recent name="$PROJECT_DIR$/database/migrations" />
</key>
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\app\Common" /> <recent name="C:\Users\czup\PhpstormProjects\eOSP2\app\Common" />
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\public\img\left_menu_icon" /> <recent name="C:\Users\czup\PhpstormProjects\eOSP2\public\img\left_menu_icon" />
@ -181,11 +186,6 @@
<recent name="C:\Users\czup\PhpstormProjects\eOSP2" /> <recent name="C:\Users\czup\PhpstormProjects\eOSP2" />
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\vendor" /> <recent name="C:\Users\czup\PhpstormProjects\eOSP2\vendor" />
</key> </key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\app\Common\fonts" />
<recent name="C:\Users\czup\PhpstormProjects\eOSP2\resources\views" />
<recent name="$PROJECT_DIR$/database/migrations" />
</key>
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration name="Unnamed" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker"> <configuration name="Unnamed" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
@ -262,7 +262,8 @@
<workItem from="1592243087933" duration="42000" /> <workItem from="1592243087933" duration="42000" />
<workItem from="1592276510207" duration="28000" /> <workItem from="1592276510207" duration="28000" />
<workItem from="1592478779386" duration="40397000" /> <workItem from="1592478779386" duration="40397000" />
<workItem from="1593829053562" duration="31388000" /> <workItem from="1593829053562" duration="35796000" />
<workItem from="1595090372365" duration="10211000" />
</task> </task>
<servers /> <servers />
</component> </component>
@ -282,10 +283,10 @@
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="519" y="347" key="NewPhpFileDialog/0.0.1536.824@0.0.1536.824" timestamp="1593832676565" /> <state x="519" y="347" key="NewPhpFileDialog/0.0.1536.824@0.0.1536.824" timestamp="1593832676565" />
<state x="482" y="276" key="com.intellij.ide.util.TipDialog" timestamp="1592243093163"> <state x="482" y="276" key="com.intellij.ide.util.TipDialog" timestamp="1595090435150">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="482" y="276" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1592243093163" /> <state x="482" y="276" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1595090435150" />
<state x="342" y="189" key="run.anything.popup" timestamp="1592234653450"> <state x="342" y="189" key="run.anything.popup" timestamp="1592234653450">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>

View File

@ -4,14 +4,15 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Codedge\Fpdf\Fpdf\Fpdf; #use Codedge\Fpdf\Fpdf\Fpdf;
use DB; use DB;
use App\fireStation; use App\fireStation;
use Carbon; use Carbon;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use App\Http\Controllers\AlphaPDF; use App\Http\Controllers\AlphaPDF;
use setasign\Fpdi\Fpdi;
class documentCreators extends Fpdf class documentCreators extends Controller
{ {
public function textConvert($text){ public function textConvert($text){
return iconv('utf-8','iso-8859-2',$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; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
$pdf->AddFont('arialpl', '', 'arialpl.php'); $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') ->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
->get(); ->get();
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -191,13 +194,15 @@ class documentCreators extends Fpdf
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }
public function createSingleUnitPDF2(){ public function createSingleUnitPDF2(){
$fireStation = fireStation::find(auth()->user()->fireStationID); $fireStation = fireStation::find(auth()->user()->fireStationID);
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -258,6 +263,7 @@ class documentCreators extends Fpdf
$pdf->SetFont('arialpl','',16); $pdf->SetFont('arialpl','',16);
$pdf->Cell(30,10, $this->textConvert($fireStation->email),0,0,''); $pdf->Cell(30,10, $this->textConvert($fireStation->email),0,0,'');
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }
@ -281,7 +287,8 @@ class documentCreators extends Fpdf
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id') ->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
->get(); ->get();
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -383,6 +390,7 @@ class documentCreators extends Fpdf
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; 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') ->select('users.id','users.name', 'users.surname', 'users.phoneNumber', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
->get(); ->get();
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
$pdf->fontpath = "../app/Common/fonts/";
$pdf->AddFont('arialpl', '', 'arialpl.php'); $pdf->AddFont('arialpl', '', 'arialpl.php');
$pdf->AddFont('arialpl', 'B', 'arialplb.php'); $pdf->AddFont('arialpl', 'B', 'arialplb.php');
@ -422,6 +430,7 @@ class documentCreators extends Fpdf
} }
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
@ -432,7 +441,8 @@ class documentCreators extends Fpdf
$equipment = DB::table('equipment')->where("fireStationID", '=', $fireStationID) $equipment = DB::table('equipment')->where("fireStationID", '=', $fireStationID)
->whereNull('deleted_at')->get(); ->whereNull('deleted_at')->get();
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -456,16 +466,43 @@ class documentCreators extends Fpdf
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$i=1; $i=1;
foreach( $equipment as $item){ foreach( $equipment as $item){
$pdf->Cell(10,10, $i, 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(85,10,$this->textConvert($item->name), 1, 0, '', $fill);
$pdf->Cell(80,10,$this->textConvert($item->parameter), 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(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(); $pdf->Ln();
$fill = !$fill; $fill = !$fill;
$i++; $i++;
} }
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }
@ -483,7 +520,8 @@ class documentCreators extends Fpdf
} }
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -515,6 +553,7 @@ class documentCreators extends Fpdf
} }
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }
@ -531,7 +570,8 @@ class documentCreators extends Fpdf
->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID') ->select('trainingsFirefighters.*', 'users.name', 'users.surname', 'users.id as userID')
->get(); ->get();
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -565,6 +605,7 @@ class documentCreators extends Fpdf
} }
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }
@ -573,7 +614,8 @@ class documentCreators extends Fpdf
$vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID)
->whereNull('deleted_at')->paginate(10); ->whereNull('deleted_at')->paginate(10);
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -606,6 +648,7 @@ class documentCreators extends Fpdf
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }
@ -614,7 +657,8 @@ class documentCreators extends Fpdf
$vehicle = DB::table('vehicles')->where("id", '=', $vehicleID) $vehicle = DB::table('vehicles')->where("id", '=', $vehicleID)
->first(); ->first();
$pdf = new AlphaPDF(); $pdf = new Fpdi();
$pdf->fontpath = "../app/Common/fonts/";
$fill = false; $fill = false;
$pdf->AddPage(); $pdf->AddPage();
@ -688,6 +732,7 @@ class documentCreators extends Fpdf
$pdf->Ln(); $pdf->Ln();
ob_end_clean();
$pdf->Output(); $pdf->Output();
exit; exit;
} }

View File

@ -87,7 +87,7 @@ class documentOverlayController extends Controller
$pdf->Output(); $pdf->Output();
exit;
} }
@ -164,5 +164,6 @@ class documentOverlayController extends Controller
} }
$pdf->Output(); $pdf->Output();
exit;
} }
} }