finish multiline adress on facture also

This commit is contained in:
Tiavina 2025-02-05 21:12:26 +03:00
parent 2b1381bd2a
commit ff594aba51

View File

@ -105,7 +105,6 @@ class InvoicePdfHandler extends FPDF {
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1);
$this->Cell(0, 5, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
}
private function DrawInvoiceClientInfo(){
$this->SetFont('ComicSans', '', 10);
$clientName = $this->factureData['client_nom'];
@ -113,12 +112,22 @@ class InvoicePdfHandler extends FPDF {
$clientName = $this->factureData['group_name'];
}
$clientInfoXAxis = 125;
$clientInfoYAxis = 40;
$clientAddress = FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress']);
$clientAdressWidth = $this->GetStringWidth($clientAddress);
$maxWidth = $this->GetPageWidth();
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress'])));
$this->MultiCell( 0, 5, trim($clientAddress));
if($clientAdressIsMultiline){
$clientInfoYAxis += 5;
}
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));