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.prix_unitaire as produit_price,
|
||||||
produit.reference as produit_reference,
|
produit.reference as produit_reference,
|
||||||
produit.description as produit_description,
|
produit.description as produit_description,
|
||||||
|
produit.fk_product_type_id as fk_product_type_id,
|
||||||
produit.vat as produit_vat,
|
produit.vat as produit_vat,
|
||||||
devis.id_client as devis_client_id
|
devis.id_client as devis_client_id
|
||||||
FROM ".$this->tableprefix ."produit_devis as produit_devis
|
FROM ".$this->tableprefix ."produit_devis as produit_devis
|
||||||
@ -2855,6 +2856,17 @@ class Bdd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$products = $this->getDevisProduits($devis["devis_id"]);
|
$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){
|
foreach($products as $product){
|
||||||
$valueHt = $product['produit_price'] * $product['quantite'];
|
$valueHt = $product['produit_price'] * $product['quantite'];
|
||||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
||||||
|
|||||||
@ -227,6 +227,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
|||||||
$devisDate = DateTime::createFromFormat('Y-m-d',$devisDate);
|
$devisDate = DateTime::createFromFormat('Y-m-d',$devisDate);
|
||||||
$devisDate = $devisDate->format('d-m-Y');
|
$devisDate = $devisDate->format('d-m-Y');
|
||||||
$products = $currentDevis["products"];
|
$products = $currentDevis["products"];
|
||||||
|
$productIncrement = 0;
|
||||||
foreach($products as $product){
|
foreach($products as $product){
|
||||||
$valueHt = $product['produit_price'] * $product["quantite"];
|
$valueHt = $product['produit_price'] * $product["quantite"];
|
||||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
||||||
@ -234,7 +235,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
|||||||
$totalTtc+=$valueTtc;
|
$totalTtc+=$valueTtc;
|
||||||
$productDescription = $product["produit_description"] ?? "";
|
$productDescription = $product["produit_description"] ?? "";
|
||||||
$dateValue = "";
|
$dateValue = "";
|
||||||
if($product === end($products)){
|
if($productIncrement == 0){
|
||||||
$dateValue = $devisDate;
|
$dateValue = $devisDate;
|
||||||
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
|
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
|
||||||
}
|
}
|
||||||
@ -272,6 +273,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
|||||||
if($productDescriptionWidthIsGreaterThanMaxWidth){
|
if($productDescriptionWidthIsGreaterThanMaxWidth){
|
||||||
$yValue += 6;
|
$yValue += 6;
|
||||||
}
|
}
|
||||||
|
$productIncrement++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->currentIndexPosition = $currentIndexPosition;
|
$this->currentIndexPosition = $currentIndexPosition;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user