New: Uniformize pdf generation code. We also keep space to repeat pdf

head info.
This commit is contained in:
Laurent Destailleur 2012-09-17 00:43:23 +02:00
parent 832a472325
commit 2170801fd2
11 changed files with 145 additions and 143 deletions

View File

@ -143,7 +143,7 @@ class pdf_einstein extends ModelePDFCommandes
$outputlangs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->commande->dir_output)
{
$object->fetch_thirdparty();
@ -261,25 +261,27 @@ class pdf_einstein extends ModelePDFCommandes
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// VAT Rate
@ -597,7 +599,7 @@ if ($pageposafter > $pageposbefore) {
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab2_top = $posy;
@ -802,7 +804,7 @@ if ($pageposafter > $pageposbefore) {
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
@ -813,10 +815,10 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
}
$pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','', $default_font_size - 1);
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
@ -827,7 +829,7 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
@ -844,14 +846,14 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if (empty($hidetop))
{
@ -861,7 +863,7 @@ if ($pageposafter > $pageposbefore) {
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
}
}
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);

View File

@ -163,7 +163,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetDrawColor(128,128,128);
$pdf->AliasNbPages();
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
@ -182,14 +182,14 @@ class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetTextColor(0,0,0);
$tab_top = 52;
$tab_top_newpage = 10;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
$tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;
$pdf->SetFillColor(240,240,240);
$pdf->SetTextColor(0,0,0);
$pdf->SetXY(10, $tab_top + 5);
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
@ -198,18 +198,19 @@ class pdf_expedition_merou extends ModelePdfExpedition
for ($i = 0; $i < $num; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 3);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description de la ligne produit
$libelleproduitservice = pdf_writelinedesc($pdf,$object,$i,$outputlangs,90,3,50,$curY,0,1);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
@ -226,7 +227,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY(30, $curY);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0);
$pdf->SetXY(140, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_asked, 0, 'C', 0);
@ -234,7 +235,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{

View File

@ -170,7 +170,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 10;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
@ -226,9 +226,9 @@ class pdf_expedition_rouget extends ModelePdfExpedition
for ($i = 0; $i < $num; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
@ -238,13 +238,14 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$pdf->SetXY($this->posxqtyordered+5, $curY);

View File

@ -98,7 +98,7 @@ class pdf_crabe extends ModelePDFFactures
// Get source company
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1;
@ -178,7 +178,7 @@ class pdf_crabe extends ModelePDFFactures
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
$heightforinfotot = 80; // Height reserved to output the info and total part
$heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
@ -221,13 +221,14 @@ class pdf_crabe extends ModelePDFFactures
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 10;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
@ -260,27 +261,29 @@ class pdf_crabe extends ModelePDFFactures
$nexY = $tab_top + 7;
// Loop on each lines
for ($i = 0 ; $i < $nblignes ; $i++)
for ($i = 0; $i < $nblignes; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
@ -376,12 +379,12 @@ if ($pageposafter > $pageposbefore) {
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}

View File

@ -84,10 +84,9 @@ class pdf_soleil extends ModelePDFFicheinter
$this->option_multilang = 0; // Dispo en plusieurs langues
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
// Recupere emmetteur
// Get source company
$this->emetteur=$mysoc;
if (empty($this->emetteur->country_code))
$this->emetteur->country_code = substr($langs->defaultlang,-2); // By default, if not defined
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined
// Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1;
@ -96,14 +95,18 @@ class pdf_soleil extends ModelePDFFicheinter
/**
* Function to build pdf onto disk
*
* @param object $object Object to generate
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @return int 1=ok, 0=ko
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs)
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$langs,$conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -114,6 +117,8 @@ class pdf_soleil extends ModelePDFFicheinter
$outputlangs->load("companies");
$outputlangs->load("interventions");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->ficheinter->dir_output)
{
$object->fetch_thirdparty();
@ -135,7 +140,7 @@ class pdf_soleil extends ModelePDFFicheinter
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
@ -169,16 +174,14 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetTextColor(0,0,0);
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_middlepage = 10;
$tab_top_newpage = 10;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_middlepage = 200;
$tab_height_newpage = 150;
// Affiche notes
@ -186,7 +189,7 @@ class pdf_soleil extends ModelePDFFicheinter
{
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
@ -242,48 +245,31 @@ class pdf_soleil extends ModelePDFFicheinter
if ($valide > 0 || $object->specimen)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
$pdf->SetFont('','B', $default_font_size - 1);
$pdf->SetXY($this->marge_gauche, $curY);
$txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output);
$curYold=$nexYold=$nexY;
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $txt, 0, 1, 0);
$curY = $pdf->GetY();
$nexY+=3;
// Description of product line
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).'</strong>';
$desc=dol_htmlentitiesbr($objectligne->desc,1);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->marge_gauche, $nexY);
$desc = dol_htmlentitiesbr($objectligne->desc,1);
$curYold = $pdf->GetY();
$nexYold = $curYold;
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $desc, 0, 1, 0);
$stringheight=$pdf->getStringHeight('A', $txt);
$curY = $pdf->GetY();
$nexY+=(dol_nboflines_bis($objectligne->desc,0,$outputlangs->charset_output)*$stringheight);
//print $curYold."-".$nexYold." +".dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)."*".$stringheight."= ".$curY."-".$nexY."<br>";
$nexY+=2; // Passe espace entre les lignes
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
@ -323,17 +309,15 @@ class pdf_soleil extends ModelePDFFicheinter
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter + 1;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
@ -401,21 +385,24 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
*/
$pdf->Rect($this->marge_gauche, $tab_top, ($this->page_largeur-$this->marge_gauche-$this->marge_droite), $tab_height+3);
$pdf->SetXY($this->marge_gauche, $pdf->GetY() + 20);
$pdf->MultiCell(60, 5, '', 0, 'J', 0);
$pdf->SetXY(20,230);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
// Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
$pdf->SetXY(20,235);
$pdf->MultiCell(80,25, '', 1);
if (empty($hidebottom))
{
$pdf->SetXY(20,230);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
$pdf->SetXY(110,230);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
$pdf->SetXY(20,235);
$pdf->MultiCell(80,25, '', 1);
$pdf->SetXY(110,235);
$pdf->MultiCell(80,25, '', 1);
$pdf->SetXY(110,230);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
$pdf->SetXY(110,235);
$pdf->MultiCell(80,25, '', 1);
}
}
/**

View File

@ -171,10 +171,10 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 100;
$tab_top_newpage = 50;
$tab_height = 140;
$tab_height_newpage = 190;
$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
@ -183,25 +183,26 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
for ($i = 0 ; $i < $nblines ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1);
//$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetXY(10, $curY);

View File

@ -206,8 +206,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 5;
$tab_height = 150;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
// Affiche notes
@ -240,18 +240,20 @@ class pdf_typhon extends ModelePDFDeliveryOrder
for ($i = 0 ; $i < $nblines ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$curX,$curY);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page

View File

@ -226,8 +226,8 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_middlepage = 10;
$tab_top_newpage = 10;
$tab_top_middlepage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_middlepage = 200;
$tab_height_newpage = 150;
@ -262,18 +262,20 @@ class pdf_azur extends ModelePDFPropales
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page

View File

@ -225,7 +225,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 10;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
@ -259,25 +259,27 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1,$hookmanager);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// VAT Rate
@ -437,7 +439,7 @@ if ($pageposafter > $pageposbefore) {
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab2_top = $posy;
@ -455,7 +457,7 @@ if ($pageposafter > $pageposbefore) {
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$index=0;
// Total HT
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + 0);
@ -642,10 +644,10 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
}
$pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','', $default_font_size - 1);
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
@ -656,7 +658,7 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
@ -673,14 +675,14 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if (empty($hidetop))
{
@ -690,7 +692,7 @@ if ($pageposafter > $pageposbefore) {
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
}
}
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
@ -853,7 +855,7 @@ if ($pageposafter > $pageposbefore) {
$posy+=1;
$pdf->SetFont('','', $default_font_size - 1);
$posy+=5;
$pdf->SetXY($posx,$posy);
if ($object->date)

View File

@ -237,7 +237,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 10;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
@ -271,25 +271,27 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1,$hookmanager);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// VAT Rate
@ -811,17 +813,17 @@ if ($pageposafter > $pageposbefore) {
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
if (empty($hidetop))
{
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
}
$pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','', $default_font_size - 1);
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
@ -832,7 +834,7 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
@ -849,14 +851,14 @@ if ($pageposafter > $pageposbefore) {
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if (empty($hidetop))
{
@ -864,9 +866,9 @@ if ($pageposafter > $pageposbefore) {
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
}
}
}
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);

View File

@ -27,8 +27,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* \class Fichinter
* \brief Classe des gestion des fiches interventions
* Classe des gestion des fiches interventions
*/
class Fichinter extends CommonObject
{
@ -818,10 +817,11 @@ class Fichinter extends CommonObject
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->socid = 1;
$this->date = $now;
$this->datec = $now;
$this->note_private='Private note';
$this->note_public='SPECIMEN';
$this->duree = 0;
$nbp = 5;
$nbp = 20;
$xnbp = 0;
while ($xnbp < $nbp)
{
@ -884,8 +884,7 @@ class Fichinter extends CommonObject
}
/**
* \class FichinterLigne
* \brief Classe permettant la gestion des lignes d'intervention
* Classe permettant la gestion des lignes d'intervention
*/
class FichinterLigne
{