diff --git a/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php b/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php index 95b3492..a94c51a 100644 --- a/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php +++ b/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php @@ -331,29 +331,31 @@ class InvoiceRecapService { // le cadre des articles // *********************** // cadre avec 18 lignes max ! et 118 de hauteur --> 80 + 118 = 198 pour les traits verticaux - $pdf->SetLineWidth(0.2); $pdf->Rect(5, 80, 200, 153, "D"); + $pdf->SetLineWidth(0.2); + $pdf->Rect(5, 80, 200, 153, "D"); // cadre titre des colonnes $pdf->SetFillColor(255); $pdf->Line(5, 90, 205, 90); // les traits verticaux colonnes - $pdf->Line(145, 80, 145, 233); $pdf->Line(163, 80, 163, 233); + $pdf->Line(145, 80, 145, 233); + $pdf->Line(163, 80, 163, 233); if($num_page == $nb_page){ $pdf->Line(183, 80, 183, 240); $pdf->Line(25, 80, 25, 225); $pdf->Line(46, 80, 46, 225); - $pdf->Line(84, 80, 84, 225); + $pdf->Line(99, 80, 99, 225); } else{ $pdf->Line(183, 80, 183, 233); $pdf->Line(25, 80, 25, 233); $pdf->Line(46, 80, 46, 233); - $pdf->Line(84, 80, 84, 233); + $pdf->Line(99, 80, 99, 233); } // titre colonne $pdf->SetXY( 1, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 30, 8, FileExportHelpers::FormatTextForExport("N°"), 0, 0, 'C'); $pdf->SetXY( 26, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 18, 8, "Date", 0, 0, 'C'); - $pdf->SetXY( 47, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 35, 8, FileExportHelpers::FormatTextForExport("Défunt"), 0, 0, 'C'); - $pdf->SetXY( 85, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 60, 8, FileExportHelpers::FormatTextForExport("Articles"), 0, 0, 'C'); + $pdf->SetXY( 47, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 50, 8, FileExportHelpers::FormatTextForExport("Défunt"), 0, 0, 'C'); + $pdf->SetXY( 100, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 45, 8, FileExportHelpers::FormatTextForExport("Articles"), 0, 0, 'C'); $pdf->SetXY( 147, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 13, 8, "H.T.", 0, 0, 'C'); $pdf->SetXY( 168, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 10, 8, "TVA 20%", 0, 0, 'C'); $pdf->SetXY( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C'); @@ -372,10 +374,19 @@ 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']); $defuntNameText = $mois[$index_facture_position]['defunt']; + $defuntNameTextWidth = $pdf->GetStringWidth($defuntNameText); + $defuntNameTextIsMultiline = $defuntNameTextWidth >= 50; $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, FileExportHelpers::FormatTextForExport($defuntNameText),0,'L'); - $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( 47, $y_facture ); + $pdf->SetFont('ComicSans','',8); + if($defuntNameTextIsMultiline){ + $pdf->MultiCell( 50, 5, FileExportHelpers::FormatTextForExport($defuntNameText),0,'L'); + } + else{ + $pdf->Cell( 50, 5, FileExportHelpers::FormatTextForExport($defuntNameText),0); + } + $pdf->SetXY( 100, $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'); @@ -384,8 +395,6 @@ class InvoiceRecapService { $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; } @@ -749,19 +758,19 @@ class InvoiceRecapService { $pdf->Line(183, 80, 183, 240); $pdf->Line(25, 80, 25, 225); $pdf->Line(46, 80, 46, 225); - $pdf->Line(84, 80, 84, 225); + $pdf->Line(99, 80, 99, 225); } else{ $pdf->Line(183, 80, 183, 233); $pdf->Line(25, 80, 25, 233); $pdf->Line(46, 80, 46, 233); - $pdf->Line(84, 80, 84, 233); + $pdf->Line(99, 80, 99, 233); } // titre colonne $pdf->SetXY( 1, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 30, 8, FileExportHelpers::FormatTextForExport("N°"), 0, 0, 'C'); $pdf->SetXY( 26, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 18, 8, "Date", 0, 0, 'C'); - $pdf->SetXY( 47, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 35, 8, FileExportHelpers::FormatTextForExport("Défunt"), 0, 0, 'C'); - $pdf->SetXY( 85, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 60, 8, "Articles", 0, 0, 'C'); + $pdf->SetXY( 47, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 50, 8, FileExportHelpers::FormatTextForExport("Défunt"), 0, 0, 'C'); + $pdf->SetXY( 100, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 45, 8, "Articles", 0, 0, 'C'); $pdf->SetXY( 147, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 13, 8, "H.T.", 0, 0, 'C'); $pdf->SetXY( 168, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 10, 8, "TVA 20%", 0, 0, 'C'); $pdf->SetXY( 183, 81 ); $pdf->SetFont('ComicSans','B',8); $pdf->Cell( 22, 8, "T.T.C", 0, 0, 'C'); @@ -780,10 +789,18 @@ 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']); $defuntNameText = $client[$index_facture_position]['defunt']; + $defuntNameTextWidth = $pdf->GetStringWidth($defuntNameText); + $defuntNameTextIsMultiline = $defuntNameTextWidth >= 50; $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, FileExportHelpers::FormatTextForExport($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( 47, $y_facture ); $pdf->SetFont('ComicSans','',8); + if($defuntNameTextIsMultiline){ + $pdf->MultiCell( 50, 5, FileExportHelpers::FormatTextForExport($defuntNameText)); + } + else{ + $pdf->Cell( 50, 5, FileExportHelpers::FormatTextForExport($defuntNameText),0); + } + $pdf->SetXY( 100, $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'); @@ -791,9 +808,6 @@ class InvoiceRecapService { $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; }