[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 11/12: Fix problem with PDF and the empty pag
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 11/12: Fix problem with PDF and the empty page due a wrong page break |
Date: |
Mon, 25 Jan 2016 22:58:39 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 41989ff6faadadd0035e603cb06ba95b62a2c663
Author: Dany De Bontridder <address@hidden>
Date: Mon Jan 25 23:50:14 2016 +0100
Fix problem with PDF and the empty page due a wrong page break
---
include/class/class_print_ledger_detail_item.php | 10 ++--
include/class/class_print_ledger_misc.php | 7 ++-
include/class/class_print_ledger_simple.php | 46 +++++++++++-----------
include/lib/class_pdf.php | 23 +++++++----
4 files changed, 46 insertions(+), 40 deletions(-)
diff --git a/include/class/class_print_ledger_detail_item.php
b/include/class/class_print_ledger_detail_item.php
index a14db41..6904037 100644
--- a/include/class/class_print_ledger_detail_item.php
+++ b/include/class/class_print_ledger_detail_item.php
@@ -54,10 +54,10 @@ class Print_Ledger_Detail_Item extends PDFLand
$this->Ln(20);
$high=6;
$this->SetFont('DejaVu', '', 6);
- $this->LongLine(20, $high, _('Date'),0, 'L', false);
+ $this->Cell(20, $high, _('Date'),0, 'L', false);
$this->Cell(20, $high, _('Numéro interne'), 0, 0, 'L', false);
- $this->LongLine(50, $high, _('Code'),0,'L',false);
- $this->LongLine(80, $high, _('Libellé'),0,'L',false);
+ $this->Cell(50, $high, _('Code'),0,'L',false);
+ $this->Cell(80, $high, _('Libellé'),0,'L',false);
$this->Cell(20, $high, _('Tot HTVA'), 0, 0, 'R', false);
$this->Cell(20, $high, _('Tot TVA NP'), 0, 0, 'R', false);
$this->Cell(20, $high, "", 0, 0, 'R', false);
@@ -144,7 +144,7 @@ class Print_Ledger_Detail_Item extends PDFLand
$this->write_cell(20,$high,'Code TVA');
$this->write_cell(20,$high,'TVA',0,0,'R');
$this->write_cell(20,$high,'TVAC',0,0,'R');
- $this->Ln(6);
+ $this->line_new(6);
$this->show_col=false;
}
}
@@ -161,7 +161,7 @@ class Print_Ledger_Detail_Item extends PDFLand
$this->write_cell(20,$high,nbm($row['vat']),0,0,'R');
$sum=bcadd($row['price'],$row['vat']);
$this->write_cell(20,$high,nbm($sum),0,0,'R');
- $this->Ln(6);
+ $this->line_new(6);
}
}
diff --git a/include/class/class_print_ledger_misc.php
b/include/class/class_print_ledger_misc.php
index f4c986d..ec0b78d 100644
--- a/include/class/class_print_ledger_misc.php
+++ b/include/class/class_print_ledger_misc.php
@@ -38,7 +38,7 @@ class Print_Ledger_Misc extends PDF
//Title
$this->Cell(0,10,$this->dossier, 'B', 0, 'C');
//Line break
- $this->line_new(20);
+ $this->Ln(20);
$this->SetFont('DejaVu', 'B', 7);
$this->Cell(30,6,'Piece');
$this->Cell(10,6,'Date');
@@ -56,10 +56,10 @@ class Print_Ledger_Misc extends PDF
//Arial italic 8
$this->SetFont('Arial', 'I', 8);
//Page number
- $this->Cell(0,8,'Date '.$this->date." - Page
".$this->PageNo().'/{nb}',0,0,'C');
+ $this->Cell(0,6,'Date '.$this->date." - Page
".$this->PageNo().'/{nb}',0,0,'C');
$this->Ln(3);
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on
http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+ $this->Cell(0,6,'Created by NOALYSS, online on
http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
}
/**
address@hidden print the pdf
@@ -77,6 +77,7 @@ class Print_Ledger_Misc extends PDF
for ( $i=0;$i<count($a_jrn);$i++)
{
$row=$a_jrn[$i];
+
$this->LongLine(30,5,$row['jr_pj_number']);
$this->write_cell(10,5, smaller_date($row['date']));
$this->write_cell(20,5,$row['jr_internal']);
diff --git a/include/class/class_print_ledger_simple.php
b/include/class/class_print_ledger_simple.php
index 26e0c93..1677651 100644
--- a/include/class/class_print_ledger_simple.php
+++ b/include/class/class_print_ledger_simple.php
@@ -77,9 +77,9 @@ class Print_Ledger_Simple extends PDF
//Arial bold 12
$this->SetFont('DejaVu', 'B', 12);
//Title
- $this->write_cell(0,10,$this->dossier, 'B', 0, 'C');
+ $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
//Line break
- $this->line_new(20);
+ $this->Ln(20);
$this->SetFont('DejaVu', 'B', 8);
/* column header */
//----------------------------------------------------------------------
@@ -90,46 +90,46 @@ class Print_Ledger_Simple extends PDF
$tmp1=$line_tva['tva_id'];
$this->rap_tva[$tmp1]=(isset($this->rap_tva[$tmp1]))?$this->rap_tva[$tmp1]:0;
}
- $this->write_cell(15,6,'Pièce');
- $this->write_cell(10,6,'Date');
- $this->write_cell(13,6,'ref');
+ $this->Cell(15,6,'Pièce');
+ $this->Cell(10,6,'Date');
+ $this->Cell(13,6,'ref');
if ( $this->jrn_type=='ACH')
- $this->write_cell(40,6,'Client');
+ $this->Cell(40,6,'Client');
else
- $this->write_cell(40,6,'Fournisseur');
+ $this->Cell(40,6,'Fournisseur');
$flag_tva=(count($this->a_Tva) > 4)?true:false;
- if ( !$flag_tva ) $this->write_cell(65,6,'Description');
+ if ( !$flag_tva ) $this->Cell(65,6,'Description');
- $this->write_cell(15,6,'HTVA',0,0,'R');
+ $this->Cell(15,6,'HTVA',0,0,'R');
if ( $this->jrn_type=='ACH')
{
- $this->write_cell(15,6,'Priv/DNA',0,0,'R');
- $this->write_cell(15,6,'TVA ND',0,0,'R');
+ $this->Cell(15,6,'Priv/DNA',0,0,'R');
+ $this->Cell(15,6,'TVA ND',0,0,'R');
}
- $this->write_cell(15,6,'TVA NP',0,0,'R'); // Unpaid TVA -->
autoliquidation, NPR
+ $this->Cell(15,6,'TVA NP',0,0,'R'); // Unpaid TVA --> autoliquidation,
NPR
foreach($this->a_Tva as $line_tva)
{
- $this->write_cell(15,6,$line_tva['tva_label'],0,0,'R');
+ $this->Cell(15,6,$line_tva['tva_label'],0,0,'R');
}
- $this->write_cell(15,6,'TVAC',0,0,'R');
- $this->line_new(5);
+ $this->Cell(15,6,'TVAC',0,0,'R');
+ $this->Ln(5);
$this->SetFont('DejaVu','',6);
// page Header
- $this->write_cell(143,6,'report',0,0,'R');
- $this->write_cell(15,6,nbm($this->rap_htva),0,0,'R'); /* HTVA */
+ $this->Cell(143,6,'report',0,0,'R');
+ $this->Cell(15,6,nbm($this->rap_htva),0,0,'R'); /* HTVA */
if ( $this->jrn_type != 'VEN')
{
- $this->write_cell(15,6,nbm($this->rap_priv),0,0,'R'); /* prive */
- $this->write_cell(15,6,nbm($this->rap_nd),0,0,'R'); /* Tva ND */
+ $this->Cell(15,6,nbm($this->rap_priv),0,0,'R'); /* prive */
+ $this->Cell(15,6,nbm($this->rap_nd),0,0,'R'); /* Tva ND */
}
- $this->write_cell(15,6,nbm($this->rap_tva_np),0,0,'R'); /* Tva ND */
+ $this->Cell(15,6,nbm($this->rap_tva_np),0,0,'R'); /* Tva ND */
foreach($this->rap_tva as $line_tva)
- $this->write_cell(15,6,nbm($line_tva),0,0,'R');
- $this->write_cell(15,6,nbm($this->rap_tvac),0,0,'R'); /* Tvac */
+ $this->Cell(15,6,nbm($line_tva),0,0,'R');
+ $this->Cell(15,6,nbm($this->rap_tvac),0,0,'R'); /* Tvac */
- $this->line_new(6);
+ $this->Ln(6);
//total page
$this->tp_htva=0.0;
$this->tp_tvac=0.0;
diff --git a/include/lib/class_pdf.php b/include/lib/class_pdf.php
index 503ab1d..122bdca 100644
--- a/include/lib/class_pdf.php
+++ b/include/lib/class_pdf.php
@@ -157,16 +157,21 @@ class PDF extends TFPDF
* nombre de lignes que le texte prendrait. Ensuite il faut
* faire un saut de page (renvoit true) si dépasse
*/
+
+ $sizetext=$this->GetStringWidth($this->cells[$i]->text);
+
+ // if text bigger than column width then check
+
$y=$this->GetY();
$nb_row=$this->count_nb_row($this->cells[$i]->text,
$this->cells[$i]->width);
$height=$this->cells[$i]->height*$nb_row;
- $sizetext=$this->GetStringWidth($this->cells[$i]->text);
-
+
// If the text is bigger than a sheet of paper then return
false
if ($height >= $this->h) return false;
-
- if ( $y + $height > ($this->h - $this->bMargin-20))
+
+ if ( $y + $height > ($this->h - $this->bMargin ))
return true;
+
}
}
return false;
@@ -197,7 +202,7 @@ class PDF extends TFPDF
$a->align,
$a->fill
);
- $x_m=$x_m+$this->cells[$i]->width;
+ $x_m=$x_m+$a->width;
$tmp=$this->GetY()-$y_m;
if ( $tmp > $this->bigger) $this->bigger=$tmp;
$this->SetXY($x_m,$y_m);
@@ -349,7 +354,7 @@ class PDFLand extends PDF
//Title
$this->Cell(0,10,$this->dossier, 'B', 0, 'C');
//Line break
- $this->line_new(20);
+ $this->Ln(20);
}
function Footer()
{
@@ -359,7 +364,7 @@ class PDFLand extends PDF
$this->SetFont('DejaVuCond', 'I', 8);
//Page number
$this->Cell(0,8,'Date '.$this->date." - Page
".$this->PageNo().'/{nb}',0,0,'C');
- $this->line_new(3);
+ $this->Ln(3);
// Created by NOALYSS
$this->Cell(0,8,'Created by NOALYSS, online on
http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
@@ -394,7 +399,7 @@ class PDFBalance_simple extends PDF
$this->to);
$this->Cell(0,7,$titre,1,0,'C');
- $this->line_new();
+ $this->Ln();
$this->SetFont('DejaVu','',6);
$this->Cell(20,7,'id','B');
$this->Cell(90,7,'Poste Comptable','B');
@@ -402,7 +407,7 @@ class PDFBalance_simple extends PDF
$this->Cell(20,7,'Crédit','B',0,'L');
$this->Cell(20,7,'Solde','B',0,'L');
$this->Cell(20,7,'D/C','B',0,'L');
- $this->line_new();
+ $this->Ln();
}
}
- [Noalyss-commit] [noalyss] branch master updated (8f47684 -> 01d9cf0), Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 05/12: Update comment for belong_ledger, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 01/12: Problem read README.export-PDF, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 07/12: Debugging info to remove, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 03/12: Task #3 - Problem avec export PDF depuis COMPTA/PRINT/PRINTJRN Cannot remove a shared note, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 04/12: #1251 : impression PDF Les Headers et Footer ne doivent pas utiliser write_celle et ln, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 10/12: Compute the height of a MultiCell and check is a page must be added, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 06/12: Update unit-test to new structure, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 12/12: Merge branch 'rel6912-export-pdf', Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 11/12: Fix problem with PDF and the empty page due a wrong page break,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 02/12: #1251 impression PDF Remove function Cell that fct cannot be overloaded Change Cell by write_cell change ln by print_row, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 09/12: HTML doc, Dany De Bontridder, 2016/01/25
- [Noalyss-commit] [noalyss] 08/12: update doc, Dany De Bontridder, 2016/01/25