Fix vat visiblity on pdf

This commit is contained in:
Laurent Destailleur
2017-09-27 21:58:42 +02:00
parent c5f30f0d80
commit 537a551bb5
5 changed files with 16 additions and 14 deletions

View File

@@ -3684,7 +3684,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
* @param string $rate Rate value to format ('19.6', '19,6', '19.6%', '19,6%', '19.6 (CODEX)', ...)
* @param boolean $addpercent Add a percent % sign in output
* @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat)
* @param int $usestarfornpr 1=Use '*' for NPR vat rate intead of MAIN_LABEL_MENTION_NPR
* @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates
* @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)')
*/
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
@@ -3714,7 +3714,7 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
// TODO Split on / and output with a price2num to have clean numbers without ton of 000.
$ret=$rate.($addpercent?'%':'');
}
if ($info_bits & 1) $ret.=' *';
if (($info_bits & 1) && $usestarfornpr >= 0) $ret.=' *';
$ret.=$morelabel;
return $ret;
}

View File

@@ -1491,14 +1491,14 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
$tmpresult='';
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1);
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 0, $object->lines[$i]->info_bits, -1);
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX))
{
if ($object->lines[$i]->total_localtax1 != 0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1);
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx), 0);
}
}
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX))
@@ -1507,9 +1507,10 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx),1);
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx), 0);
}
}
$tmpresult.= '%';
$result.=$tmpresult;
}

View File

@@ -140,7 +140,7 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
$this->posxtva=112;
$this->posxtva=110;
$this->posxup=126;
$this->posxqty=145;
}
@@ -431,8 +431,8 @@ class pdf_einstein extends ModelePDFCommandes
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
$pdf->SetXY($this->posxtva-5, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R');
}
// Unit price before discount

View File

@@ -125,7 +125,7 @@ class pdf_crabe extends ModelePDFFactures
}
else
{
$this->posxtva=112;
$this->posxtva=110;
$this->posxup=126;
$this->posxqty=145;
}
@@ -496,8 +496,8 @@ class pdf_crabe extends ModelePDFFactures
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
$pdf->SetXY($this->posxtva-5, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R');
}
// Unit price before discount

View File

@@ -114,7 +114,7 @@ class pdf_azur extends ModelePDFPropales
}
else
{
$this->posxtva=112;
$this->posxtva=110;
$this->posxup=126;
$this->posxqty=145;
}
@@ -505,8 +505,8 @@ class pdf_azur extends ModelePDFPropales
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R');
$pdf->SetXY($this->posxtva-5, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva+4, 3, $vat_rate, 0, 'R');
}
// Unit price before discount
@@ -1310,6 +1310,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
if (empty($hidetop))
{
// Not do -3 and +3 instead of -1 -1 to have more space for text 'Sales tax'
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
}