From 307c06dfc36c50cf2e9d9e7cf2d923f55013dcb3 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 12 Jan 2017 16:26:09 +0100 Subject: [PATCH 1/4] FIX : pdf invoice when we use situation --- .../modules/facture/doc/pdf_crabe.modules.php | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index d50ddcfb2a0..042e22791a2 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -129,7 +129,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxqty=145; } $this->posxdiscount=162; - $this->posxprogress=174; // Only displayed for situation invoices + $this->posxprogress=132; // Only displayed for situation invoices $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images @@ -317,8 +317,11 @@ class pdf_crabe extends ModelePDFFactures $this->posxtva -= $progress_width; $this->posxup -= $progress_width; $this->posxqty -= $progress_width; - $this->posxdiscount -= $progress_width; - $this->posxprogress -= $progress_width; + if(empty($conf->global->PRODUCT_USE_UNITS)) { + $this->posxprogress += $progress_width; + } + /*$this->posxdiscount -= $progress_width; + $this->posxprogress -= $progress_width;*/ } // New page @@ -513,6 +516,14 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R'); } + // Situation progress + if ($this->situationinvoice) + { + $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxprogress, $curY); + $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); + } + // Unit if($conf->global->PRODUCT_USE_UNITS) { @@ -526,15 +537,7 @@ class pdf_crabe extends ModelePDFFactures { $pdf->SetXY($this->posxdiscount-2, $curY); $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); - $pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); - } - - // Situation progress - if ($this->situationinvoice) - { - $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); - $pdf->SetXY($this->posxprogress, $curY); - $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); } // Total HT line @@ -1376,7 +1379,12 @@ class pdf_crabe extends ModelePDFFactures if (empty($hidetop)) { $pdf->SetXY($this->posxqty-1, $tab_top+1); - if($conf->global->PRODUCT_USE_UNITS) + + if($this->situationinvoice) + { + $pdf->MultiCell($this->posxprogress-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); + } + else if($conf->global->PRODUCT_USE_UNITS) { $pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } @@ -1385,6 +1393,23 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } } + + if ($this->situationinvoice) { + $pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height); + $pdf->SetXY($this->posxprogress, $tab_top+1); + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + } + else if ($this->atleastonediscount) + { + $pdf->MultiCell($this->posxdiscount-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + } + else + { + $pdf->MultiCell($this->postotalht-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + } + } if($conf->global->PRODUCT_USE_UNITS) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); From 1886e68731e9737d0ce5ef25e36585aced5003be Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 12 Jan 2017 17:07:22 +0100 Subject: [PATCH 2/4] FIX : progress size --- .../modules/facture/doc/pdf_crabe.modules.php | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 042e22791a2..662c06cb4dc 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -129,7 +129,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxqty=145; } $this->posxdiscount=162; - $this->posxprogress=132; // Only displayed for situation invoices + $this->posxprogress=126; // Only displayed for situation invoices $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images @@ -313,7 +313,7 @@ class pdf_crabe extends ModelePDFFactures if ($object->situation_cycle_ref) { $this->situationinvoice = True; - $progress_width = 14; + $progress_width = 18; $this->posxtva -= $progress_width; $this->posxup -= $progress_width; $this->posxqty -= $progress_width; @@ -443,7 +443,7 @@ class pdf_crabe extends ModelePDFFactures $curX = $this->posxdesc-1; $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX-$progress_width,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -507,7 +507,12 @@ class pdf_crabe extends ModelePDFFactures $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); // Enough for 6 chars - if($conf->global->PRODUCT_USE_UNITS) + + if ($this->situationinvoice) + { + $pdf->MultiCell($this->posxprogress-$this->posxqty-0.8, 4, $qty, 0, 'R'); + } + else if($conf->global->PRODUCT_USE_UNITS) { $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); } @@ -521,7 +526,18 @@ class pdf_crabe extends ModelePDFFactures { $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxprogress, $curY); - $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxprogress-1, 3, $progress, 0, 'R'); + } + else if ($this->atleastonediscount) + { + $pdf->MultiCell($this->posxdiscount-$this->posxprogress-1, 3, $progress, 0, 'R'); + } + else + { + $pdf->MultiCell($this->postotalht-$this->posxprogress-1, 3, $progress, 0, 'R'); + } } // Unit @@ -1399,15 +1415,15 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->posxprogress, $tab_top+1); if($conf->global->PRODUCT_USE_UNITS) { - $pdf->MultiCell($this->posxunit-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + $pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); } else if ($this->atleastonediscount) { - $pdf->MultiCell($this->posxdiscount-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + $pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); } else { - $pdf->MultiCell($this->postotalht-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + $pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); } } From a90ec7a8c736a3b330c01a253e132453c3e321d2 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 13 Jan 2017 14:59:29 +0100 Subject: [PATCH 3/4] FIX : hidetop progression --- .../modules/facture/doc/pdf_crabe.modules.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 662c06cb4dc..0fbbd82e11a 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1412,19 +1412,26 @@ class pdf_crabe extends ModelePDFFactures if ($this->situationinvoice) { $pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height); - $pdf->SetXY($this->posxprogress, $tab_top+1); - if($conf->global->PRODUCT_USE_UNITS) - { - $pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); - } - else if ($this->atleastonediscount) - { - $pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); - } - else - { - $pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + + if (empty($hidetop)) { + + $pdf->SetXY($this->posxprogress, $tab_top+1); + + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + } + else if ($this->atleastonediscount) + { + $pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + } + else + { + $pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + } + } + } if($conf->global->PRODUCT_USE_UNITS) { From a944c82d86a54c3f217910e21b65ff6a6a105313 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 19 Jan 2017 09:11:06 +0100 Subject: [PATCH 4/4] FIX : $progress_width initialized --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0fbbd82e11a..d31761b3a42 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -309,6 +309,7 @@ class pdf_crabe extends ModelePDFFactures //$this->postotalht; } + $progress_width = 0; // Situation invoice handling if ($object->situation_cycle_ref) {