Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Controller/EditRegularizacionImpuesto.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ protected function createViews(): void

$this->createViewsTaxSummary();
$this->createViewsTaxDetail();
$this->createViewsTaxLine('ListPartidaImpuesto-1', 'purchases', 'fas fa-sign-in-alt');
$this->createViewsTaxLine('ListPartidaImpuesto-2', 'sales', 'fas fa-sign-out-alt');
$this->createViewsTaxLine('ListPartidaImpuesto-1', 'deductible-vat', 'fas fa-sign-in-alt');
$this->createViewsTaxLine('ListPartidaImpuesto-2', 'vat-accrued', 'fas fa-sign-out-alt');
$this->createViewsEntryLine();
$this->createViewsPresentacion();
}
Expand Down
2 changes: 1 addition & 1 deletion Lib/Modelo303.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private function addMovimiento(string $tipo, string $operacion, string $tipodoc,

// Determine the correct group based on the tax rate.
$tax = ($tipo === 'IVARRE') ? $recargo : $iva;
$key = rtrim(rtrim(number_format($tax, 1, '.', ''), '0'), '.');
$key = rtrim(rtrim(number_format($tax, 2, '.', ''), '0'), '.');
$grupo = $this->casillaMap[$tipo][$key]
?? $this->casillaMap[$tipo][(string)(int)$tax]
?? $this->casillaMap[$tipo]['*']
Expand Down
20 changes: 20 additions & 0 deletions Test/main/Modelo303SquaresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,26 @@ public function testRecargoEquivalencia(): void
$this->assertEqualsWithDelta(52.0, $modelo->casilla('24'), 0.001);
}

public function testRecargoEquivalenciaConDosDecimales(): void
{
// los tipos de recargo 0.26% y 1.75% tienen 2 decimales; number_format() con solo
// 1 decimal los redondeaba (0.26 -> "0.3", 1.75 -> "1.8") y no encajaban en el mapa
// de casillas, generando un aviso de importe sin casilla.
$modelo = new Modelo303();
$modelo->loadFromResumen([
$this->row('IVARRE', 0, 400.0, 1.04, '', 'venta', 0.26),
$this->row('IVARRE', 0, 400.0, 7.0, '', 'venta', 1.75),
]);

// recargo 0.26 -> base 168 / cuota 170
$this->assertEqualsWithDelta(400.0, $modelo->casilla('168'), 0.001);
$this->assertEqualsWithDelta(1.04, $modelo->casilla('170'), 0.001);
// recargo 1.75 -> base 156 / cuota 158
$this->assertEqualsWithDelta(400.0, $modelo->casilla('156'), 0.001);
$this->assertEqualsWithDelta(7.0, $modelo->casilla('158'), 0.001);
$this->assertEmpty($modelo->getAvisos());
}

public function testRecargoEquivalenciaEnCuentaIVAREP(): void
{
// Cuando no hay subcuenta IVARRE configurada, el núcleo contabiliza el recargo en la
Expand Down