Informes anteriores y siguientes

This commit is contained in:
Juan Pablo Vial
2024-04-05 14:48:17 -03:00
parent 0502b8e735
commit 47d43f504d
3 changed files with 31 additions and 3 deletions

View File

@ -27,7 +27,11 @@
<table class="ui collapsing simple table">
<tr>
<td>Informe anterior</td>
<td>{{$anterior->format('d/m/Y')}}</td>
<td>
<a href="{{$urls->base}}/contabilidad/informes/tesoreria/{{$anterior->format('Y-m-d')}}">
{{$anterior->format('d/m/Y')}}
</a>
</td>
</tr>
<tr>
<td>Informe actual</td>
@ -48,6 +52,17 @@
</tr>
</table>
</div>
@if ($siguiente !== null)
<div class="five wide column"></div>
<div class="right aligned two wide column">
<div class="ui segment">
Siguiente
<a href="{{$urls->base}}/contabilidad/informes/tesoreria/{{$siguiente->format('Y-m-d')}}">
{{$siguiente->format('d/m/Y')}} >>
</a>
</div>
</div>
@endif
</div>
<table class="ui striped table">
<thead>

View File

@ -69,9 +69,17 @@ class Contabilidad extends Controller
{
$fecha = new DateTimeImmutable($fecha);
$anterior = $contabilidadService->getAnterior($fecha);
$yesterday = new DateTimeImmutable('yesterday');
$siguiente = null;
if ($yesterday >= $fecha) {
$siguiente = $fecha->add(new DateInterval('P1D'));
if ($siguiente->format('N') === '6') {
$siguiente = $fecha->add(new DateInterval('P3D'));
}
}
$informes = $contabilidadService->build($fecha);
$filename = "Informe de Tesorería {$fecha->format('d.m.Y')}";
return $view->render($response, 'contabilidad.informes.tesoreria', compact('fecha', 'anterior', 'informes', 'filename'));
return $view->render($response, 'contabilidad.informes.tesoreria', compact('fecha', 'anterior', 'siguiente', 'informes', 'filename'));
}
public function cuadratura(ServerRequestInterface $request, ResponseInterface $response, View $view,
Repository\Inmobiliaria $inmobiliariaRepository): ResponseInterface

View File

@ -345,7 +345,12 @@ class Excel extends Ideal\Service
$rowIndex ++;
}
$end = $rowIndex;
$sheet->getCell("V{$totalRow}")->setValue("=SUM(C{$start}:D{$end})");
$sumFormula = match($tipo) {
'ingresos' => "=SUM(C{$start}:C{$end})",
'egresos' => "=SUM(D{$start}:D{$end})",
default => ''
};
$sheet->getCell("V{$totalRow}")->setValue($sumFormula);
$sheet->getStyle("C{$start}:D{$end}")->getNumberFormat()
->setFormatCode(self::CURRENCY_CODE);
}