fix date and defunt name on invoice group pdf handler
This commit is contained in:
parent
059b0a6a1a
commit
746e71d75c
@ -2566,6 +2566,7 @@ class Bdd {
|
||||
produit.prix_unitaire as produit_price,
|
||||
produit.reference as produit_reference,
|
||||
produit.description as produit_description,
|
||||
produit.fk_product_type_id as fk_product_type_id,
|
||||
produit.vat as produit_vat,
|
||||
devis.id_client as devis_client_id
|
||||
FROM ".$this->tableprefix ."produit_devis as produit_devis
|
||||
@ -2855,6 +2856,17 @@ class Bdd {
|
||||
}
|
||||
}
|
||||
$products = $this->getDevisProduits($devis["devis_id"]);
|
||||
if(count($products) > 1){
|
||||
usort($products, function ($a, $b) {
|
||||
if ($a["fk_product_type_id"] === null && $b["fk_product_type_id"] !== null) {
|
||||
return -1;
|
||||
}
|
||||
if ($a["fk_product_type_id"] !== null && $b["fk_product_type_id"] === null) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
foreach($products as $product){
|
||||
$valueHt = $product['produit_price'] * $product['quantite'];
|
||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
||||
|
||||
@ -227,6 +227,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$devisDate = DateTime::createFromFormat('Y-m-d',$devisDate);
|
||||
$devisDate = $devisDate->format('d-m-Y');
|
||||
$products = $currentDevis["products"];
|
||||
$productIncrement = 0;
|
||||
foreach($products as $product){
|
||||
$valueHt = $product['produit_price'] * $product["quantite"];
|
||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
||||
@ -234,7 +235,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$totalTtc+=$valueTtc;
|
||||
$productDescription = $product["produit_description"] ?? "";
|
||||
$dateValue = "";
|
||||
if($product === end($products)){
|
||||
if($productIncrement == 0){
|
||||
$dateValue = $devisDate;
|
||||
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
|
||||
}
|
||||
@ -272,6 +273,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
if($productDescriptionWidthIsGreaterThanMaxWidth){
|
||||
$yValue += 6;
|
||||
}
|
||||
$productIncrement++;
|
||||
}
|
||||
}
|
||||
$this->currentIndexPosition = $currentIndexPosition;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user