fix attestaion soins and pacemaker

This commit is contained in:
Tolotsoa 2025-09-05 13:39:37 +03:00
parent 409f0857de
commit c97b5dfab3
3 changed files with 71 additions and 42 deletions

View File

@ -64,6 +64,21 @@ class CertificateService {
}
return $signatureExist;
}
private function tamponImageExist(){
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
try{
if(isset($storage)){
$storage->get("/.gestion/sign.jpg"); // tampon image
$signatureExist = true;
}else{
$signatureExist = false;
}
}
catch(\OCP\Files\NotFoundException $e) {
$signatureExist = false;
}
return $signatureExist;
}
private function getLogo(){
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
@ -138,7 +153,8 @@ class CertificateService {
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
$signatureImageExist = $this->signatureImageExists();
$pdf->SetCareCertificateData($devisOfDefunt,$logo,$signatureImageExist);
$tamponImageExist = $this->tamponImageExist();
$pdf->SetCareCertificateData($devisOfDefunt,$logo,$signatureImageExist ,$tamponImageExist);
$pdf->SetCareCertificate();
try {
$storage->newFolder($folderDestination);
@ -202,7 +218,8 @@ class CertificateService {
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
$signatureImageExist = $this->signatureImageExists();
$pdf->SetPacemakerCertificateData($devisOfDefunt,$logo,$signatureImageExist);
$tamponImageExist = $this->tamponImageExist();
$pdf->SetPacemakerCertificateData($devisOfDefunt,$logo,$signatureImageExist ,$tamponImageExist);
$pdf->SetPacemakerCertificate();
try {
$storage->newFolder($folderDestination);

View File

@ -37,6 +37,7 @@ class CareCertificatePdfHandler extends FPDF {
private $devisOfDefunt = [];
private $logo = null;
private $signatureImageExist = false;
private $tamponImageExist = false;
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
function Header()
@ -51,15 +52,16 @@ class CareCertificatePdfHandler extends FPDF {
function Footer()
{
$this->SetY(-18);
$this->SetFont('ComicSans', '', 10);
$this->SetFont('Arial', '', 10);
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0,'C');
}
public function SetCareCertificateData(array $devisOfDefunt,$logo = null,$signatureImageExist = false){
public function SetCareCertificateData(array $devisOfDefunt,$logo = null,$signatureImageExist = false , $tamponImageExist = false){
$this->devisOfDefunt = $devisOfDefunt;
$this->logo = $logo;
$this->signatureImageExist = $signatureImageExist;
$this->tamponImageExist = $tamponImageExist;
}
public function SetCareCertificate(){
@ -71,38 +73,42 @@ class CareCertificatePdfHandler extends FPDF {
}
private function SetSigning(){
$this->SetXY(140,$this->GetY() + 15);
$this->Cell(0,10,'Cachet et signature');
$this->SetXY(140,$this->GetY() + 12);
//$this->Cell(0,10,'Cachet et signature');
if($this->tamponImageExist){
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY() + 9, 80, 35);
}
if($this->signatureImageExist){
$this->Image($this->imagePath."sign.png", 135, $this->GetY() + 12, 60, 40);
$this->Image($this->imagePath."sign.png", 140, $this->GetY() + 42, 40, 16);
}
}
private function SetCareCertificateContent(){
$this->SetFont('ComicSans', '', 14);
$this->SetFont('Arial', '', 14);
$this->MultiCell(0,7,FileExportHelpers::FormatTextForExport('La Société '. $this->devisOfDefunt['configuration']->entreprise. ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
$this->SetFont('ComicSans', 'B', 14);
$this->Cell(0,12, 'Mr/Mme ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']),0,1);
$this->SetFont('ComicSans', '', 14);
$this->SetFont('Arial', 'B', 14);
$this->Cell(0,12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']),0,1);
$this->SetFont('Arial', '', 14);
$this->MultiCell(0,7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a effectué des soins de conservation sur le corps du défunt :'));
$this->SetFont('ComicSans', 'B', 14);
$this->SetFont('Arial', 'B', 14);
$this->Cell(0,12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']),0,1);
$this->SetFont('ComicSans', '', 14);
$this->Cell(0,12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ',0,1);
$this->SetFont('ComicSans', 'B', 14);
$this->MultiCell(0,6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
$this->SetFont('ComicSans', '', 14);
$this->SetFont('Arial', '', 14);
// $this->Cell(0,12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ',0,1);
// $this->SetFont('Arial', 'B', 14);
// $this->MultiCell(0,6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
$this->SetFont('Arial', '', 14);
$this->Cell(0,12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."),0,5);
$this->Ln(5);
$this->MultiAlignCell(120,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->adresse),0);
$this->SetX(140);
$this->Cell(0,7,'le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'),0);
$this->MultiAlignCell(160,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']),0);
$this->SetXY(140, $this->GetY() + 10);
$this->Cell(0,7,'Le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'),0);
}
private function SetCareCertificateTitle(){
$this->SetY(60);
$this->SetFont('ComicSans', 'B', 20);
$this->SetFont('Arial', 'B', 20);
$this->Cell(0, 10, 'ATTESTATION DE SOINS DE CONSERVATION', 0, 1,'C');
$this->Ln(20);
}

View File

@ -38,6 +38,7 @@ class PacemakerCertificatePdfHandler extends FPDF
private $devisOfDefunt = [];
private $logo = null;
private $signatureImageExist = false;
private $tamponImageExist = false;
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
function Header()
@ -51,16 +52,17 @@ class PacemakerCertificatePdfHandler extends FPDF
function Footer()
{
$this->SetY(-18);
$this->SetFont('ComicSans', '', 10);
$this->SetFont('Arial', '', 10);
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
}
public function SetPacemakerCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false)
public function SetPacemakerCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false , $tamponImageExist = false)
{
$this->devisOfDefunt = $devisOfDefunt;
$this->logo = $logo;
$this->signatureImageExist = $signatureImageExist;
$this->tamponImageExist = $tamponImageExist;
}
public function SetPacemakerCertificate()
@ -74,30 +76,34 @@ class PacemakerCertificatePdfHandler extends FPDF
private function SetSigning()
{
$this->SetXY(140, $this->GetY() + 15);
$this->Cell(0, 10, 'Cachet et signature');
$this->SetXY(140, $this->GetY() + 12);
// $this->Cell(0, 10, 'Cachet et signature');
if($this->tamponImageExist){
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY() + 9, 80, 35);
}
if ($this->signatureImageExist) {
$this->Image($this->imagePath . "sign.png", 135, $this->GetY() + 12, 60, 40);
$this->Image($this->imagePath."sign.png", 140, $this->GetY() + 42, 40, 16);
}
}
private function SetPacemakerCertificateContent()
{
$this->SetFont('ComicSans', '', 14);
$this->SetFont('Arial', '', 14);
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société ' . $this->devisOfDefunt['configuration']->entreprise . ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
$this->SetFont('ComicSans', 'B', 14);
$this->Cell(0, 12, 'Mr/Mme ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']), 0, 1);
$this->SetFont('ComicSans', '', 14);
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a retiré ce jour, la prothèse fonctionnant à pile implantée sur le corps du défunt :'));
$this->SetFont('ComicSans', 'B', 14);
$this->SetFont('Arial', 'B', 14);
$this->Cell(0, 12,FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']), 0, 1);
$this->SetFont('Arial', '', 14);
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a retiré ce jour, une prothèse fonctionnant au moyen d\'une pile implantée dans le corps du défunt :'));
$this->SetFont('Arial', 'B', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']), 0, 1);
$this->SetFont('ComicSans', '', 14);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
$this->SetFont('ComicSans', 'B', 14);
$this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
$this->Ln(6);
$this->SetFont('ComicSans', '', 14);
//$this->SetFont('Arial', '', 14);
//$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
//$this->SetFont('Arial', 'B', 14);
//$this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
// $this->Ln(6);
$this->SetFont('Arial', '', 14);
$this->Cell(
0,
6,
@ -117,15 +123,15 @@ class PacemakerCertificatePdfHandler extends FPDF
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5);
$this->Ln(5);
$this->MultiAlignCell(120, 7, FileExportHelpers::FormatTextForExport('Fait à ') . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->adresse), 0);
$this->SetX(140);
$this->Cell(0, 7, 'le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
$this->MultiAlignCell(160, 7, FileExportHelpers::FormatTextForExport('Fait à ') . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']), 0);
$this->SetXY(140, $this->GetY() + 10);
$this->Cell(0, 7, 'Le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
}
private function SetPacemakerCertificateTitle()
{
$this->SetY(y: 50);
$this->SetFont('ComicSans', 'B', 20);
$this->SetFont('Arial', 'B', 20);
$this->Cell(0, 10, 'ATTESTATION DE RETRAIT DE LA', 0, 1, 'C');
$this->Cell(0, 10, 'PROTHESE FONCTIONNANT A PILE', 0, 1, 'C');
$this->Ln(20);