diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index da90361..bae498e 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -661,7 +661,7 @@ class Bdd { public function getOneDevis($numdevis,$idNextcloud){ $sql = "SELECT ".$this->tableprefix."devis.id as devisid, ".$this->tableprefix."devis.version, ".$this->tableprefix."devis.comment, ".$this->tableprefix."devis.date, num," - .$this->tableprefix."devis.id_nextcloud as didnextcloud,".$this->tableprefix."devis.id_client, id_lieu, id_thanato," + .$this->tableprefix."devis.id_nextcloud as didnextcloud,".$this->tableprefix."devis.id_client, id_lieu, id_thanato,case_number,order_number," .$this->tableprefix."defunt.id as id_defunt, ".$this->tableprefix."defunt.nom as nom_defunt," .$this->tableprefix."client.id as clientid, ".$this->tableprefix."client.nom, " .$this->tableprefix."client.prenom, legal_one, entreprise, telephone, mail, ".$this->tableprefix."client.adresse," diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index e6859f7..4ed361c 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -39,6 +39,9 @@ class InvoicePdfHandler extends FPDF { private $factureData = []; private $logo = null; private $logoPath = "/var/www/html/data/admin/files/.gestion/"; + + private $thereIsOrderOrCaseNumber = false; + private $startingYOfArticlesTable = 95; function Header() { if($this->logo != "nothing"){ @@ -164,53 +167,58 @@ class InvoicePdfHandler extends FPDF { $this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C'); $this->Cell(40, 7, $factureDateEcheance, 1, 1, 'C'); - $this->Ln(2); $orderNumberIsProvided = (trim($this->factureData['order_number']) !== "" && trim($this->factureData['order_number']) !== "-" ); $caseNumberIsProvided = (trim($this->factureData['case_number']) !== "" && trim($this->factureData['case_number']) !== "-"); if($orderNumberIsProvided){ + $this->thereIsOrderOrCaseNumber = true; + $this->Ln(2); if($caseNumberIsProvided == false){ $this->Ln(3); } $this->Cell(0, 5, FileExportHelpers::FormatTextForExport("Bon de commande: ".$this->factureData['order_number']),0,1,'C'); } if($caseNumberIsProvided){ + $this->thereIsOrderOrCaseNumber = true; if($orderNumberIsProvided == false){ - $this->Ln(3); + $this->Ln(5); } $this->Cell(0, 5, FileExportHelpers::FormatTextForExport("Numéro de dossier: ".$this->factureData['case_number']),0,1,'C'); } - $this->Ln(8); + $this->startingYOfArticlesTable = $this->thereIsOrderOrCaseNumber ? 95 : 85; } private function DrawArticlesTable(){ - $this->SetLineWidth(0.2); - $this->Rect(3, 95, 204, 137, "D"); + $this->SetLineWidth(0.2); + $gapBetweenStartingOfArticlesTableAndColumnName = 10; + $tableHeight = $this->thereIsOrderOrCaseNumber ? 137 : 137 + 10; + $this->Rect(3, $this->startingYOfArticlesTable, 204, $tableHeight, "D"); // cadre titre des colonnes - $this->Line(3, 105, 207,105); + $this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207,$this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName); // les traits verticaux colonnes - $this->Line(35, 95, 35, 232); - $this->Line(135, 95, 135, 232); - $this->Line(160, 95, 160, 232); - $this->Line(180, 95, 180, 232); + $this->Line(35, $this->startingYOfArticlesTable, 35, 232); + $this->Line(135, $this->startingYOfArticlesTable, 135, 232); + $this->Line(160, $this->startingYOfArticlesTable, 160, 232); + $this->Line(180, $this->startingYOfArticlesTable, 180, 232); } private function DrawArticlesTableHeader(){ $tvaValue = $this->factureData["configuration"]->tva_default; + $columnNameY = $this->startingYOfArticlesTable + 1; $this->SetFont('ComicSans','',10); - $this->SetXY( 9,96 ); + $this->SetXY( 9,$columnNameY ); $this->Cell( 20, 8, "Date", 0, 0, 'C'); - $this->SetXY( 35,96 ); + $this->SetXY( 35,$columnNameY ); $this->Cell( 100, 8, "Description", 0, 0, 'C'); - $this->SetXY( 138,96 ); + $this->SetXY( 138,$columnNameY ); $this->Cell( 20, 8, "Prix Uni. HT", 0, 0, 'C'); - $this->SetXY( 160,96 ); + $this->SetXY( 160,$columnNameY ); $this->Cell( 20, 8, 'TVA ' . $tvaValue . '%', 0, 0, 'C'); - $this->SetXY( 181,96 ); + $this->SetXY( 181,$columnNameY ); $this->Cell( 25, 8, "Prix Uni. TTC", 0, 0, 'C'); } @@ -225,7 +233,7 @@ class InvoicePdfHandler extends FPDF { $totalTtc = 0; $totalTva = 0; $products = $this->factureData["products"]; - $yValue = 106; + $yValue = $this->startingYOfArticlesTable + 11; foreach($products as $product){ $valueHt = $product['produit_price']; $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue); diff --git a/gestion/templates/content/devisshow.php b/gestion/templates/content/devisshow.php index 05e5034..c3959f2 100644 --- a/gestion/templates/content/devisshow.php +++ b/gestion/templates/content/devisshow.php @@ -56,14 +56,32 @@ Date de soin : date))->format('d-m-Y');?>, devisid;?>>Défunt associé : nom_defunt;?>
Lieu : lieu;?> (adresse_soin;?>) +
-
-
comment == "" ) ? "-" : $_['devis'][0]->comment ; ?>
-
+ +
+ order_number == "" ) ? "-" : $_['devis'][0]->order_number ; ?> +
+
+
+
+
+ +
+ case_number == "" ) ? "-" : $_['devis'][0]->case_number ; ?> +
+
+

Articles