FIX The vat code was not correctly managed on PDF templates
This commit is contained in:
parent
3a6b5199ec
commit
c3a42162d9
@ -201,6 +201,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -567,10 +568,14 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
@ -882,16 +887,16 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @return int Position pour suite
|
||||
*/
|
||||
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
@ -994,8 +999,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// VAT
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
@ -1009,11 +1015,17 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
$totalvat .= vatrate($tvakey, 1).$tvacompl;
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= $tvaval['vatcode'].$tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$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, $outputlangs), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -185,6 +185,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Use new system for position of columns, view $this->defineColumnField()
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -792,10 +793,14 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
@ -1098,15 +1103,15 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @return int Position pour suite
|
||||
*/
|
||||
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis = null)
|
||||
{
|
||||
global $conf, $mysoc, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
@ -1207,8 +1212,9 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// VAT
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
@ -1222,11 +1228,46 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
$totalvat .= vatrate($tvakey, 1).$tvacompl;
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= $tvaval['vatcode'].$tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$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, $outputlangs), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl = '';
|
||||
if (preg_match('/\*/', $tvakey)) {
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= ($tvaval['vatcode'] ? $tvaval['vatcode'] : vatrate($tvaval['vatrate'], 1)).$tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$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(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -156,6 +156,9 @@ class pdf_storm extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
$this->atleastonediscount = 0;
|
||||
}
|
||||
|
||||
@ -173,6 +173,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
$this->atleastonediscount = 0;
|
||||
}
|
||||
|
||||
@ -197,9 +197,11 @@ class pdf_standard extends ModeleExpenseReport
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
$this->atleastonediscount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -210,6 +210,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -743,10 +744,14 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
@ -1349,8 +1354,6 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
@ -1373,7 +1376,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
//}
|
||||
|
||||
// VAT
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
@ -1385,12 +1388,19 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
|
||||
$totalvat .= vatrate($tvakey, 1).$tvacompl;
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= $tvaval['vatcode'].$tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$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(price2num($tvaval, 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -187,6 +187,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Use new system for position of columns, view $this->defineColumnField()
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -881,10 +882,14 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
||||
@ -1593,9 +1598,8 @@ class pdf_sponge extends ModelePDFFactures
|
||||
}
|
||||
//}
|
||||
|
||||
// VAT
|
||||
// Situations totals migth be wrong on huge amounts
|
||||
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
|
||||
// Situations totals migth be wrong on huge amounts with old mode 1
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1 && $object->situation_cycle_ref && $object->situation_counter > 1) {
|
||||
$sum_pdf_tva = 0;
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
$sum_pdf_tva += $tvaval; // sum VAT amounts to compare to object
|
||||
@ -1612,10 +1616,14 @@ class pdf_sponge extends ModelePDFFactures
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
$this->tva[$tvakey] = $tvaval * $coef_fix_tva;
|
||||
}
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
$this->tva_array[$tvakey]['amount'] = $tvaval['amount'] * $coef_fix_tva;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
// VAT
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
@ -1629,11 +1637,17 @@ class pdf_sponge extends ModelePDFFactures
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
$totalvat .= vatrate($tvakey, 1).$tvacompl;
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= ($tvaval['vatcode'] ? $tvaval['vatcode'] : vatrate($tvaval['vatrate'], 1)).$tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$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, $outputlangs), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,10 +42,14 @@ abstract class ModelePDFFactures extends CommonDocGenerator
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
public $tva;
|
||||
public $tva_array;
|
||||
public $localtax1;
|
||||
public $localtax2;
|
||||
|
||||
public $atleastonediscount = 0;
|
||||
public $atleastoneratenotnull = 0;
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
|
||||
@ -197,6 +197,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -677,10 +678,14 @@ class pdf_azur extends ModelePDFPropales
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
@ -1059,9 +1064,10 @@ class pdf_azur extends ModelePDFPropales
|
||||
* @param int $deja_regle Amount already paid
|
||||
* @param int $posy Start position
|
||||
* @param Translate $outputlangs Objet langs
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @return int Position for continuation
|
||||
*/
|
||||
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc;
|
||||
@ -1164,8 +1170,9 @@ class pdf_azur extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// VAT
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
foreach ($this->tva_array as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
@ -1177,12 +1184,19 @@ class pdf_azur extends ModelePDFPropales
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
|
||||
$totalvat .= vatrate($tvakey, 1).$tvacompl;
|
||||
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
|
||||
$totalvat .= ' ';
|
||||
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
|
||||
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
|
||||
$totalvat .= ($tvaval['vatcode'] ? $tvaval['vatcode'] : vatrate($tvaval['vatrate'], 1)).$tvacompl;
|
||||
} else {
|
||||
$totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$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, $outputlangs), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// Use new system for position of columns, view $this->defineColumnField()
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -802,10 +803,14 @@ class pdf_cyan extends ModelePDFPropales
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
@ -1178,15 +1183,15 @@ class pdf_cyan extends ModelePDFPropales
|
||||
* @param int $deja_regle Amount already paid (in the currency of invoice)
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @return int Position pour suite
|
||||
*/
|
||||
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
|
||||
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis = null)
|
||||
{
|
||||
global $conf, $mysoc, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
@ -1293,6 +1298,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// VAT
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
|
||||
@ -174,6 +174,7 @@ class pdf_standard extends ModelePDFStock
|
||||
$this->postotalht -= 20;
|
||||
}
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
|
||||
@ -181,6 +181,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
|
||||
@ -169,6 +169,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
$this->posxdesc = $this->marge_gauche + 1; // For module retrocompatibility support durring PDF transition: TODO remove this at the end
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -738,10 +739,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@ -197,6 +197,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -617,10 +618,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
@ -168,6 +168,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
|
||||
@ -194,6 +194,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
}
|
||||
|
||||
$this->tva = array();
|
||||
$this->tva_array = array();
|
||||
$this->localtax1 = array();
|
||||
$this->localtax2 = array();
|
||||
$this->atleastoneratenotnull = 0;
|
||||
@ -611,10 +612,14 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
|
||||
// Fill $this->tva and $this->tva_array
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user