I have to calculate the equivalence surcharge with php and I do not get the correct values.
I have this code:
$dcto0=$DLineasPedido["descuento"] / 100;
$importe=$DLineasPedido["precio"]*$DLineasPedido["cantidad"];
$dcto0=$importe*$dcto0;
$Baselinea=$importe-$dcto0;
$base = $base+$Baselinea;
$iva=$base*$DLineasPedido["iva"] / 100;
$Re=$iva*$Drecargo["Conf2"] / 100;
$Total = $base + $iva + $Re;
looking at this Page , says that if I have 3000 and I add 21% plus 5 , 2% should give me 3786 but it gives me 3662.76 and the equivalence surcharge is 32.76 when it should be 156
What can I be doing wrong?