Fix pic position when VAT column hidden

This commit is contained in:
fappels 2017-07-19 17:19:08 +02:00
parent 3ef4b0fd2b
commit 7fc359df5d
2 changed files with 15 additions and 11 deletions

View File

@ -110,9 +110,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($conf->global->PRODUCT_USE_UNITS) if ($conf->global->PRODUCT_USE_UNITS)
{ {
$this->posxtva=99; $this->posxtva=97;
$this->posxup=114; $this->posxup=114;
$this->posxqty=130; $this->posxqty=132;
$this->posxunit=147; $this->posxunit=147;
} else { } else {
$this->posxtva=112; $this->posxtva=112;
@ -120,7 +120,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->posxqty=145; $this->posxqty=145;
} }
//if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxup = $this->posxtva; // posxtva is picture position reference
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
@ -372,12 +372,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->startTransaction(); $pdf->startTransaction();
if ($posYAfterImage > 0) if ($posYAfterImage > 0)
{ {
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc,1); $descWidth = $this->posxpicture-$curX;
} }
else else
{ {
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1); $descWidth = $this->posxtva-$curX;
} }
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc,1);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak if ($pageposafter > $pageposbefore) // There is a pagebreak
{ {
@ -385,7 +387,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,1); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc,1);
$posyafter=$pdf->GetY(); $posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{ {
@ -963,7 +965,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
} }
} }
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup, $tab_top, $this->posxup, $tab_top + $tab_height);
if (empty($hidetop)) if (empty($hidetop))
{ {
$pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->SetXY($this->posxup-1, $tab_top+1);

View File

@ -108,7 +108,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->posxqty=145; $this->posxqty=145;
$this->posxdiscount=162; $this->posxdiscount=162;
$this->postotalht=174; $this->postotalht=174;
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup=$this->posxtva;
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
@ -382,12 +382,14 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->startTransaction(); $pdf->startTransaction();
if ($posYAfterImage > 0) if ($posYAfterImage > 0)
{ {
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc,1); $descWidth = $this->posxpicture-$curX;
} }
else else
{ {
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1); $descWidth = $this->posxtva-$curX;
} }
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc,1);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak if ($pageposafter > $pageposbefore) // There is a pagebreak
{ {
@ -395,7 +397,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY(); $posyafter=$pdf->GetY();