finish rapport soin, wip rapport soin et rapport bijou

This commit is contained in:
Tiavina 2025-02-14 10:48:54 +03:00
parent a1a431e926
commit 0680890dfd
2 changed files with 57 additions and 19 deletions

View File

@ -2039,10 +2039,34 @@ class PageController extends Controller {
$pdf->SetFont('ComicSans', '', 10);
$pdf->MultiCell(0, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse.", le ".$today), '', 'R');
$pdf->SetY($pdf->GetY()+15);
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode($nomDefunt."\n".$age."ans\n".(strcmp($defunt->sexe, 'm')==0 ? 'Masculin' : 'Féminin'))), '', 'L');
$pdf->SetY($pdf->GetY()-15);
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Éffectuées le ".$date_devis."\nà ".$defunt->adresse_lieu."\nde ".$defunt->heure_debut." à ".$defunt->heure_fin)), '', 'R');
$rapportInfoHeaderY = $pdf->GetY() + 15;
$rapportDefuntInfoY = $rapportInfoHeaderY;
$rapportDevisInfoY = $rapportInfoHeaderY;
$pdf->SetY(y: $rapportDefuntInfoY);
$pdf->SetFont('ComicSans', '', 10);
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport($nomDefunt));
$rapportDefuntInfoY += 5;
$pdf->SetY($rapportDefuntInfoY);
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport($age. " ans"));
$rapportDefuntInfoY += 5;
$pdf->SetY($rapportDefuntInfoY);
$sexeText = strcmp($defunt->sexe, 'm')==0 ? 'Masculin' : 'Féminin';
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport($sexeText));
//devis info
$rapportDevisInfoX = 115;
$maxWidth = $pdf->GetPageWidth();
$availableWidhtForDevisInfo = $maxWidth - 10 - $rapportDevisInfoX;
$pdf->SetXY($rapportDevisInfoX,$rapportDevisInfoY);
$pdf->MultiCell(0,5,FileExportHelpers::FormatTextForExport("Éffectuées le ".$date_devis));
$rapportDevisInfoY += 5;
$pdf->SetXY($rapportDevisInfoX,$rapportDevisInfoY);
$addressText = "à ".$defunt->adresse_lieu;
$pdf->MultiCell(0,5,FileExportHelpers::FormatTextForExport($addressText),0,'L');
$addressLineCount = FileExportHelpers::GetLineCountForATextInAMaxWidth($pdf,$addressText,$availableWidhtForDevisInfo);
$rapportDevisInfoY += 5 * $addressLineCount;
$pdf->SetXY($rapportDevisInfoX,$rapportDevisInfoY);
$pdf->Cell(0,5,FileExportHelpers::FormatTextForExport("de ".$defunt->heure_debut." à ".$defunt->heure_fin));
$pdf->SetY($pdf->GetY()+10);
$pdf->Line(15, $pdf->GetY(), $pdf->GetPageWidth()-15, $pdf->GetY());
@ -2053,14 +2077,14 @@ class PageController extends Controller {
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Rigidité : ".$defunt->rigidite)), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Observations du corps : ".$defunt->observations_corps)), '', 'L');
$pdf->SetY($pdf->GetY()+10);
$pdf->SetY($pdf->GetY()+5);
$pdf->SetFont('ComicSans', 'B', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("ACCÈS")), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Arteriel : ".$defunt->acces)), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("Recherche : ".$defunt->acces_recherche)), '', 'L');
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("État : ".$defunt->acces_etat)), '', 'L');
$pdf->SetY($pdf->GetY()+10);
$pdf->SetY($pdf->GetY()+5);
$pdf->SetFont('ComicSans', 'B', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("INJECTION")), '', 'L');
$pdf->SetY($pdf->GetY()+3);
@ -2098,9 +2122,8 @@ class PageController extends Controller {
$pdf->SetXY(($col_width*2)+15, $pdf->GetY()-8); $pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell($col_width, 8, utf8_decode(html_entity_decode($defunt->drainage_etat)), 'LR', 'C');
$pdf->Line(15, $pdf->GetY(), $pdf->GetPageWidth()-15, $pdf->GetY());
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
@ -2165,9 +2188,8 @@ class PageController extends Controller {
$col_width = round(($pdf->GetPageWidth()-30)/2);
foreach ($observations as $key => $obs) {
if($pdf->getY()>=($pdf->GetPageHeight()-45)) {
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
}
$pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell($col_width, 8, utf8_decode(html_entity_decode($obs->designation)), 'LTRB', 'L');
@ -2177,9 +2199,8 @@ class PageController extends Controller {
$pdf->setY($pdf->GetY()+10);
if($pdf->getY()>=($pdf->GetPageHeight()-45)) {
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
}
@ -2197,9 +2218,8 @@ class PageController extends Controller {
$pdf->setY($pdf->GetY()-5);
$pdf->SetFont('ComicSans','',11); $pdf->Cell( $pdf->GetPageWidth()-80, 0, "Pour :", 0, 0, 'R');
$pdf->SetY(-30); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_two), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->telephone), '', 'C');
$pdf->SetY(-20); $pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->legal_one), '', 'C');
$pdf->SetFont('ComicSans', '', 8); $pdf->MultiCell($pdf->GetPageWidth()-30, 5, FileExportHelpers::FormatTextForExport($defaultConfig[0]->adresse), '', 'C');
$pdf->AddPage();
$pdf->Image($this->src_path.(($defunt->sexe=='m'?'facehomme.jpg':'facefemme.jpg')), 0, 0, $pdf->GetPageWidth(), $pdf->GetPageHeight());

View File

@ -7,7 +7,8 @@ class FileExportHelpers
public static function FormatTextForExport(string $text){
$textFormatted = utf8_decode(html_entity_decode($text));
$textFormatted = str_replace('', "'", $text);
$textFormatted = utf8_decode(html_entity_decode($textFormatted));
return $textFormatted;
}
@ -67,4 +68,21 @@ class FileExportHelpers
return $defuntFolder.'PACEMAKER/';
}
public static function GetLineCountForATextInAMaxWidth($pdf,$text,$maxWidth){
$words = explode(' ', $text);
$lineWidth = 0;
$lineCount = 1;
foreach ($words as $word) {
$wordWidth = $pdf->GetStringWidth($word . ' ');
if ($lineWidth + $wordWidth > $maxWidth) {
$lineCount++;
$lineWidth = $wordWidth;
} else {
$lineWidth += $wordWidth;
}
}
return $lineCount;
}
}