finish facture requirements (add nom defunt and sexe detunt add the last product in the table , add date to the last product in the table)

This commit is contained in:
Tiavina 2025-01-03 10:49:01 +03:00
parent fca12c05dc
commit 0fcbc2c0c9
3 changed files with 17 additions and 4 deletions

View File

@ -2322,6 +2322,7 @@ class Bdd {
client.entreprise as client_entreprise,
client.adresse as client_adresse,
defunt.nom as defunt_nom,
defunt.sexe as defunt_sexe,
lieu.nom as lieu_nom,
lieu.adresse as lieu_adresse,
thanato.nom as thanato_nom,

View File

@ -27,4 +27,8 @@ class FileExportHelpers
];
}
public static function GetSexeLabel(string $sexeKey){
return $sexeKey === 'f' ? 'Mme' : 'Mr';
}
}

View File

@ -28,6 +28,7 @@ namespace OCA\Gestion\Service;
use DateTime;
use \FPDF;
use OCA\Gestion\Helpers\FileExportHelpers;
use OCA\Gestion\Helpers\PriceHelpers;
class InvoicePdfHandler extends FPDF {
@ -133,17 +134,24 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod
$totalHt = 0;
$totalTtc = 0;
foreach($this->factureData["products"] as $product){
$products = $this->factureData["products"];
foreach($products as $product){
$valueHt = $product['produit_price'];
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
$totalHt+=$valueHt;
$totalTtc+=$valueTtc;
$descriptionLineNumber = $this->NbLines(90,$product["produit_description"]);
$articleListMaxHeight = $descriptionLineNumber * 10;
$productDescription = $product["produit_description"];
$dateValue = "";
if($product === end($products)){
$dateValue = $devisDate;
$productDescription .= " de " . FileExportHelpers::GetSexeLabel($this->factureData['defunt_sexe']) . ' '. $this->factureData["defunt_nom"];
}
$articleListMaxHeight = $descriptionLineNumber * 6;
$tvaAmount = $valueTtc - $valueHt;
$this->SetFont('Arial', '', 10);
$this->Cell(20, $articleListMaxHeight, $devisDate, 'LR',0);
$this->MultiAlignCell(90, $articleListMaxHeight, utf8_decode(html_entity_decode($product["produit_description"])),'LR','0',);
$this->Cell(20, $articleListMaxHeight, $dateValue, 'LR',0);
$this->MultiAlignCell(90, $articleListMaxHeight, utf8_decode(html_entity_decode($productDescription)),'LR','0',);
$this->Cell(30, $articleListMaxHeight, number_format($valueHt,2,'.','').chr(128), 'LR', 0, 'C');
$this->Cell(20, $articleListMaxHeight, number_format($tvaAmount,2,'.','').chr(128), 'LR', 0, 'C');
$this->Cell(30, $articleListMaxHeight, number_format($valueTtc,2,'.','').chr(128), 'LR', 1, 'C');