diff --git a/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php b/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php index 1f8e3fb..74597e8 100644 --- a/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php +++ b/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php @@ -371,19 +371,24 @@ class InvoiceRecapService { for ($index_facture_position; $index_facture_position < ($init_index + $max_nb_toget) ; $index_facture_position++) { $date_soin_temp = new DateTime($mois[$index_facture_position]['date_soin']); - - $pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $mois[$index_facture_position]['num'], 0, 0, ''); - $pdf->SetXY( 29, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, ''); - $pdf->SetXY( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 8, utf8_decode(html_entity_decode($mois[$index_facture_position]['defunt'])), 0, 0, ''); - $pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, FileExportHelpers::FormatTextForExport($mois[$index_facture_position]['produit_references']), 0, 0, ''); - $pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 8, number_format($mois[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C'); - $pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 8, number_format($mois[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C'); - $pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 8, number_format($mois[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C'); + $defuntNameText = FileExportHelpers::FormatTextForExport($mois[$index_facture_position]['defunt']); + $pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 5, $mois[$index_facture_position]['num'], 0, 0, ''); + $pdf->SetXY( 29, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 5, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, ''); + $pdf->SetXY( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->MultiCell( 35, 5, $defuntNameText); + $pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 5, FileExportHelpers::FormatTextForExport($mois[$index_facture_position]['produit_references']), 0, 0, ''); + $pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 5, number_format($mois[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C'); + $pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 5, number_format($mois[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C'); + $pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 5, number_format($mois[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C'); $montant_ht_total = $montant_ht_total+$mois[$index_facture_position]['montant_htc']; $montant_tva_total = $montant_tva_total+$mois[$index_facture_position]['montant_tva']; $montant_ttc_total = $montant_ttc_total+$mois[$index_facture_position]['montant_ttc']; + $defuntNameTextWidth = $pdf->GetStringWidth($defuntNameText); + $defuntNameTextIsMultiline = $defuntNameTextWidth > 35; + if($defuntNameTextIsMultiline){ + $y_facture=$y_facture+5; + } $y_facture=$y_facture+5; } @@ -775,19 +780,24 @@ class InvoiceRecapService { for ($index_facture_position; $index_facture_position < ($init_index + $max_nb_toget) ; $index_facture_position++) { $date_soin_temp = new DateTime($client[$index_facture_position]['date_soin']); - - $pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, $client[$index_facture_position]['num'], 0, 0, ''); - $pdf->SetXY( 29, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 8, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, ''); - $pdf->SetXY( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 38, 8, utf8_decode(html_entity_decode($client[$index_facture_position]['defunt'])), 0, 0, ''); - $pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 8, utf8_decode(html_entity_decode($client[$index_facture_position]['produit_references'])), 0, 0, ''); - $pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 8, number_format($client[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C'); - $pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 8, number_format($client[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C'); - $pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 8, number_format($client[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C'); + $defuntNameText = FileExportHelpers::FormatTextForExport($client[$index_facture_position]['defunt']); + $pdf->SetXY( 6, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 5, $client[$index_facture_position]['num'], 0, 0, ''); + $pdf->SetXY( 29, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 18, 5, utf8_decode($formatter_ds->format($date_soin_temp)), 0, 0, ''); + $pdf->SetXY( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->MultiCell( 35, 5, $defuntNameText); + $pdf->SetXY( 85, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 28, 5, utf8_decode(html_entity_decode($client[$index_facture_position]['produit_references'])), 0, 0, ''); + $pdf->SetXY( 147, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 13, 5, number_format($client[$index_facture_position]['montant_htc'],2,'.','').chr(128), 0, 0, 'C'); + $pdf->SetXY( 168, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 10, 5, number_format($client[$index_facture_position]['montant_tva'],2,'.','').chr(128), 0, 0, 'C'); + $pdf->SetXY( 183, $y_facture ); $pdf->SetFont('ComicSans','',8); $pdf->Cell( 22, 5, number_format($client[$index_facture_position]['montant_ttc'],2,'.','').chr(128), 0, 0, 'C'); $montant_ht_total = $montant_ht_total+$client[$index_facture_position]['montant_htc']; $montant_tva_total = $montant_tva_total+$client[$index_facture_position]['montant_tva']; $montant_ttc_total = $montant_ttc_total+$client[$index_facture_position]['montant_ttc']; + $defuntNameTextWidth = $pdf->GetStringWidth($defuntNameText); + $defuntNameTextIsMultiline = $defuntNameTextWidth > 35; + if($defuntNameTextIsMultiline){ + $y_facture=$y_facture+5; + } $y_facture=$y_facture+5; }