Tras buscar mucho por la red hemos realizado lo siguiente para facturar suplidos.
La idea ha sido segmentar por cada impuesto un total de base y un total de impuestos, nosotros usamos el 0%, 4%, 10% y el 21%
Para poder realizar los cambios en la facturas hay que acceder a la routa:
htdocs/core/modules/facture/ y modificar el archivo pdf_crabe.modules.php
En la versión 17 de dolibar la línea a modificar es desde la 624 a 655

El código usado es:
Código: Seleccionar todo
//Bases desglosadas por cada tipo de iva ** Realizado por JESUSJG
$totalHT_IVA0 = 0;
$totalHT_IVA4 = 0;
$totalHT_IVA10 = 0;
$totalHT_IVA21 = 0;
$nblignes = count($object->lines);
for ($i = 0; $i < $nblignes; $i++)
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$total_excl_taxNumber = floatval(str_replace(',', '.', str_replace('.', '', $total_excl_tax)));
if ($vat_rate == "0%" || $vat_rate == "0.00")
{
$totalHT_IVA0 += $total_excl_taxNumber;
}
else if ($vat_rate == "4%")
{
$totalHT_IVA4 += $total_excl_taxNumber;
}
else if ($vat_rate == "10%")
{
$totalHT_IVA10 += $total_excl_taxNumber;
}
else if ($vat_rate == "21%")
{
$totalHT_IVA21 += $total_excl_taxNumber;
}
}
foreach($this->tva as $tvakey => $totalvat)
{
if ($tvakey == 0 || $tvakey != 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").")";
}
// Si el IVA es 0%, mostramos "0% y Suplidos"
if ($tvakey == "0" || $tvakey == 0) {
$totalvat = $outputlangs->transnoentities("TotalHT").' 0% y Suplidos';
} else {
$totalvat = $outputlangs->transnoentities("TotalHT").' '.vatrate($tvakey,1).$tvacompl;
}
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalHT_portivoIVA = 0;
if ($tvakey == "0" || $tvakey == 0)
{
$totalHT_portivoIVA = $totalHT_IVA0;
}
else if ($tvakey == 4)
{
$totalHT_portivoIVA = $totalHT_IVA4;
}
else if ($tvakey == 10)
{
$totalHT_portivoIVA = $totalHT_IVA10;
}
else if ($tvakey == 21)
{
$totalHT_portivoIVA = $totalHT_IVA21;
}
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($totalHT_portivoIVA + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
}
}
// FIN CÓDIGO - Bases desglosadas por cada tipo de iva ** Realizado por JESUSJG