From 33417a6acd48f9fe94693df2e5faf0cece564364 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Mon, 7 Mar 2022 22:50:17 -0300 Subject: [PATCH] FIX: filter --- app/Service/Informe/Contabilidad/Resumen.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Service/Informe/Contabilidad/Resumen.php b/app/Service/Informe/Contabilidad/Resumen.php index 729bdc5..0562a30 100644 --- a/app/Service/Informe/Contabilidad/Resumen.php +++ b/app/Service/Informe/Contabilidad/Resumen.php @@ -35,7 +35,14 @@ class Resumen $ventas = $proyecto->ventas(); $output = []; foreach ($ventas as $venta) { - if (!in_array($venta, $output)) { + $found = false; + foreach ($output as $v) { + if ($v->unidad()->descripcion == $venta->unidad()->descripcion) { + $found = true; + break; + } + } + if (!$found) { $output []= $venta; } } @@ -129,7 +136,7 @@ class Resumen protected function buildLibro(Venta $venta, DateTimeInterface $up_to) { $pagos = $this->getPagos($venta, $up_to); - $output = [' ', "Cuenta: Anticipos Dpto {$venta->unidad()->descripcion}"]; + $output = ['', "Cuenta: Anticipos Dpto {$venta->unidad()->descripcion}"]; $debe = 0; $haber = 0; foreach ($pagos as $pago) {