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"> <table class="ui collapsing simple table">
<tr> <tr>
<td>Informe anterior</td> <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>
<tr> <tr>
<td>Informe actual</td> <td>Informe actual</td>
@ -48,6 +52,17 @@
</tr> </tr>
</table> </table>
</div> </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> </div>
<table class="ui striped table"> <table class="ui striped table">
<thead> <thead>

View File

@ -69,9 +69,17 @@ class Contabilidad extends Controller
{ {
$fecha = new DateTimeImmutable($fecha); $fecha = new DateTimeImmutable($fecha);
$anterior = $contabilidadService->getAnterior($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); $informes = $contabilidadService->build($fecha);
$filename = "Informe de Tesorería {$fecha->format('d.m.Y')}"; $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, public function cuadratura(ServerRequestInterface $request, ResponseInterface $response, View $view,
Repository\Inmobiliaria $inmobiliariaRepository): ResponseInterface Repository\Inmobiliaria $inmobiliariaRepository): ResponseInterface

View File

@ -345,7 +345,12 @@ class Excel extends Ideal\Service
$rowIndex ++; $rowIndex ++;
} }
$end = $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() $sheet->getStyle("C{$start}:D{$end}")->getNumberFormat()
->setFormatCode(self::CURRENCY_CODE); ->setFormatCode(self::CURRENCY_CODE);
} }