2
0
forked from Wavyzz/dolibarr

Fix: Several problem with localtax into PDF generation

This commit is contained in:
Laurent Destailleur
2013-03-07 12:04:12 +01:00
parent 3defd294cb
commit c762c93eb1
5 changed files with 101 additions and 106 deletions

View File

@@ -719,12 +719,11 @@ class pdf_einstein extends ModelePDFCommandes
else
{
//Local tax 1 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
foreach( $this->localtax1 as $localtax_type => $localtax_rate )
{
// TODO: Place into a function to control showing by country or study better option
if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
if (in_array((string) $localtax_type, array('1','3','5','7'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
@@ -740,8 +739,8 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@@ -749,14 +748,13 @@ class pdf_einstein extends ModelePDFCommandes
}
}
}
}
//}
//Local tax 2 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
foreach( $this->localtax2 as $localtax_type => $localtax_rate )
{
// TODO: Place into a function to control showing by country or study better option
if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
if (in_array((string) $localtax_type, array('1','3','5','7'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
@@ -774,8 +772,8 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@@ -784,7 +782,7 @@ class pdf_einstein extends ModelePDFCommandes
}
}
}
}
//}
// VAT
foreach($this->tva as $tvakey => $tvaval)
{
@@ -811,15 +809,15 @@ class pdf_einstein extends ModelePDFCommandes
}
//Local tax 1 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
foreach( $this->localtax1 as $localtax_type => $localtax_rate )
{
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
if ($tvakey != 0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
@@ -832,7 +830,7 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' ';
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@@ -841,7 +839,7 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
@@ -849,17 +847,17 @@ class pdf_einstein extends ModelePDFCommandes
}
}
}
}
//}
//Local tax 2 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
//{
foreach( $this->localtax2 as $localtax_type => $localtax_rate )
{
if (in_array((string) $localtax_type, array('2','4','6'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
if ($tvakey != 0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
@@ -872,7 +870,7 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' ';
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@@ -881,7 +879,7 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
@@ -890,7 +888,7 @@ class pdf_einstein extends ModelePDFCommandes
}
}
}
}
//}
// Total TTC
$index++;