finsh address from facture recap, margin right from right text , WIP facture date
This commit is contained in:
parent
1536524090
commit
415b094314
@ -782,14 +782,17 @@ class PageController extends Controller {
|
||||
$pdf = new FPDF();
|
||||
|
||||
$current_client = '';
|
||||
$adresse = '';
|
||||
$clientAddress = '';
|
||||
$clientCity = '';
|
||||
$date_facture;
|
||||
$j=1;
|
||||
foreach ($client as $key => $facture) {
|
||||
if($j==1) {
|
||||
$current_client = $facture['prenoms_client'].' '.$facture['nom_client'];
|
||||
$adresse = $facture['adresse_client'];
|
||||
$date_facture = $facture['date_facture'];
|
||||
$clientAddresses = FileExportHelpers::GetAddressAndCityFromAddress($facture['adresse_client']);
|
||||
$clientAddress = $clientAddresses['address'];
|
||||
$clientCity = $clientAddresses['city'];
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
@ -804,19 +807,23 @@ class PageController extends Controller {
|
||||
$pdf->AddPage();
|
||||
// on sup les 2 cm en bas
|
||||
$pdf->SetAutoPagebreak(False);
|
||||
$pdf->SetMargins(0,0,0);
|
||||
$pdf->SetMargins(0,0,10);
|
||||
|
||||
// logo : 80 de largeur et 55 de hauteur
|
||||
if($isLogoExist){
|
||||
$pdf->Image($this->currentUserImagePath."logo.png", 10, 10, 55, 30);
|
||||
}
|
||||
// adresse du facture
|
||||
$pdf->SetFont('Arial','B',size: 11); $_x = 122 ; $_y = 40;
|
||||
$pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode($current_client), 0, 0, ''); $_y += 8;
|
||||
$pdf->SetXY( $_x, $_y ); $pdf->MultiCell( 80, 4, utf8_decode(html_entity_decode($adresse)), 0, 0, '');
|
||||
$pdf->SetFont('Arial','B',size: 11);
|
||||
$pdf->SetY(40);
|
||||
$pdf->Cell( 0, 8, utf8_decode($current_client), 0, 1, 'R');
|
||||
$pdf->Cell( 0, 8, utf8_decode(html_entity_decode($clientAddress)), 0,1,'R');
|
||||
if($clientCity != ''){
|
||||
$pdf->Cell( 0, 8, utf8_decode(html_entity_decode($clientCity)), 0, 1, 'R');
|
||||
}
|
||||
// date facture
|
||||
$pdf->SetFont('Arial','',11); $pdf->SetXY( 122, 60 );
|
||||
$pdf->MultiCell( 60, 8, $current_config[0]->adresse . " le, ".utf8_decode($date_formated), 0, 0, '');
|
||||
$pdf->SetFont('Arial','',11);
|
||||
$pdf->Cell( 0, 8, "Saint Senoux le, ".utf8_decode($date_formated), 0, 1, 'R');
|
||||
|
||||
// observations
|
||||
$pdf->SetFont( "Arial", "BU", 10 ); $pdf->SetXY( 10, 85 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
|
||||
@ -834,17 +841,17 @@ class PageController extends Controller {
|
||||
$pdf->SetFont( "Arial", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
|
||||
|
||||
// signature
|
||||
$pdf->SetFont('Arial','',11); $pdf->SetXY( 122, 145 );
|
||||
$pdf->SetFont('Arial','',11); $pdf->SetXY( 145, 145 );
|
||||
$pdf->Cell( $pdf->GetStringWidth($current_config[0]->nom.' '.$current_config[0]->prenom), 0, utf8_decode(html_entity_decode($current_config[0]->nom.' '.$current_config[0]->prenom)), 0, 0, 'L');
|
||||
$signatureExists = $this->signatureImageExists('sign.png');
|
||||
if($signatureExists){
|
||||
$pdf->Image($this->currentUserImagePath."sign.png", 122, 150, 55, 30);
|
||||
$pdf->Image($this->currentUserImagePath."sign.png", 135, 150, 55, 30);
|
||||
}
|
||||
|
||||
$y0 = 260;
|
||||
$pageWidth = $pdf->GetPageWidth();
|
||||
//Positionnement en bas et tout centrer
|
||||
$pdf->SetFont('Arial','',6);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY( 1, $y0 + 4 ); $pdf->Cell( $pageWidth, 5, utf8_decode(html_entity_decode($current_config[0]->mentions_default)), 0, 0, 'C');
|
||||
$pdf->SetXY( 1, $y0 + 8 ); $pdf->Cell( $pageWidth, 5, utf8_decode(html_entity_decode($current_config[0]->legal_one)), 0, 0, 'C');
|
||||
$pdf->SetXY( 1, $y0 + 12 ); $pdf->Cell( $pageWidth, 5, utf8_decode(html_entity_decode($current_config[0]->legal_two)), 0, 0, 'C');
|
||||
@ -866,7 +873,7 @@ class PageController extends Controller {
|
||||
$pdf->AddPage();
|
||||
// on sup les 2 cm en bas
|
||||
$pdf->SetAutoPagebreak(False);
|
||||
$pdf->SetMargins(0,0,0);
|
||||
$pdf->SetMargins(0,0,10);
|
||||
if($isLogoExist){
|
||||
$pdf->Image($this->currentUserImagePath."logo.png", 10, 10, 55, 30);
|
||||
}
|
||||
@ -877,21 +884,24 @@ class PageController extends Controller {
|
||||
}
|
||||
|
||||
// date facture
|
||||
$pdf->SetFont('Arial','',11); $pdf->SetXY( 122, y: 10 );
|
||||
$pdf->MultiCell( 60, 8, $current_config[0]->adresse . " le, ".utf8_decode($date_formated), 0, 0, '');
|
||||
$pdf->SetFont('Arial','',11);
|
||||
$pdf->SetY(10);
|
||||
$pdf->Cell( 0, 8,"Saint Senoux le, ".utf8_decode($date_formated), 0, 0, 'R');
|
||||
|
||||
// n° facture, date echeance et reglement et obs
|
||||
$pdf->SetLineWidth(0.1); $pdf->SetFillColor(255); $pdf->Rect(100, 30, 85, 8, "DF");
|
||||
$pdf->SetXY( 100, 30 ); $pdf->SetFont( "Arial", "B", 12 ); $pdf->Cell( 85, 8, 'FACTURE N'.utf8_decode('°').' FAC/'.$key_annee.'/'.strtoupper($this->convert_special_char(explode(' ', $date_formated)[1])), 0, 0, 'C');
|
||||
$pdf->SetLineWidth(0.1); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF");
|
||||
$pdf->SetXY( 114, 20 ); $pdf->SetFont( "Arial", "B", 12 ); $pdf->Cell( 85, 8, 'FACTURE N'.utf8_decode('°').' FAC/'.$key_annee.'/'.strtoupper($this->convert_special_char(explode(' ', $date_formated)[1])), 0, 0, 'C');
|
||||
|
||||
// adresse du facture
|
||||
$pdf->SetFont('Arial','B',11); $x = 122 ; $y = 45;
|
||||
$pdf->SetXY( $x, $y ); $pdf->Cell( 100, 8, utf8_decode($current_client), 0, 0, ''); $y += 8;
|
||||
$pdf->SetXY( $x, $y ); $pdf->MultiCell( 80, 4, utf8_decode(html_entity_decode($adresse)), 0, 0, ''); $y += 7;
|
||||
$pdf->SetXY( $x, $y ); $pdf->Cell( 100, 8, FileExportHelpers::FormatTextForExport('Numéro') . ' TVA:', 0, 0, ''); $x+=25;
|
||||
$pdf->SetXY( $x, $y ); $pdf->Cell( 100, 8, FileExportHelpers::FormatTextForExport($tvaIntraCommuValue), 0, 0, '');$y += 7;$x-=25;
|
||||
$pdf->SetXY( $x, $y ); $pdf->Cell( 100, 8, 'Email:', 0, 0, ''); $x+=13;
|
||||
$pdf->SetXY( $x, $y ); $pdf->Cell( 100, 8, utf8_decode(html_entity_decode($facture['mail_client'])), 0, 0, '');
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetY(y: 32);
|
||||
$pdf->Cell( 0, 6, utf8_decode($current_client), 0, 1, 'R');
|
||||
$pdf->Cell( 0, 6, utf8_decode(html_entity_decode($clientAddress)), 0, 1, 'R');
|
||||
if($clientCity != ''){
|
||||
$pdf->Cell( 0, 6, utf8_decode(html_entity_decode($clientCity)), 0, 1, 'R');
|
||||
}
|
||||
$pdf->Cell( 0, 6, FileExportHelpers::FormatTextForExport('Numéro') . ' TVA: ' . FileExportHelpers::FormatTextForExport($tvaIntraCommuValue), 0, 1, 'R');
|
||||
$pdf->Cell( 0, 6, 'Email: ' . utf8_decode(html_entity_decode($facture['mail_client'])), 0, 1, 'R');
|
||||
|
||||
// ***********************
|
||||
// le cadre des articles
|
||||
@ -972,7 +982,7 @@ class PageController extends Controller {
|
||||
// pied de page
|
||||
// **************************
|
||||
|
||||
$pdf->SetFont('Arial','',6);
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY( 1, $y0 + 4 ); $pdf->Cell( $pageWidth, 5, utf8_decode(html_entity_decode($current_config[0]->mentions_default)), 0, 0, 'C');
|
||||
$pdf->SetXY( 1, $y0 + 8 );$pdf->Cell( $pageWidth, 5, utf8_decode(html_entity_decode($current_config[0]->legal_one)), 0, 0, 'C');
|
||||
$pdf->SetXY( 1, $y0 + 12 );$pdf->Cell( $pageWidth, 5, utf8_decode(html_entity_decode($current_config[0]->legal_two)), 0, 0, 'C');
|
||||
|
||||
@ -11,4 +11,20 @@ class FileExportHelpers
|
||||
return $textFormatted;
|
||||
}
|
||||
|
||||
public static function GetAddressAndCityFromAddress(string $adresse){
|
||||
$adresseResult = "";
|
||||
$cityResult = "";
|
||||
$adresses = explode("-",$adresse);
|
||||
if(isset($adresses[0])){
|
||||
$adresseResult = trim($adresses[0]);
|
||||
}
|
||||
if(isset($adresses[1])){
|
||||
$cityResult = trim($adresses[1]);
|
||||
}
|
||||
return [
|
||||
"address" => $adresseResult,
|
||||
"city" => $cityResult
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user