Change to xlsx file

This commit is contained in:
Juan Pablo Vial
2022-03-07 22:21:42 -03:00
parent 726794923d
commit 3b473bcefa
2 changed files with 38 additions and 2 deletions

View File

@ -4,6 +4,8 @@ namespace App\Service\Informe\Contabilidad;
use DateTimeInterface;
use DateTimeImmutable;
use DateInterval;
use App\Service\Informe\Informe;
use Incoviba\old\Proyecto\Proyecto;
use Incoviba\old\Venta\Venta;
use Incoviba\old\Venta\Pago;
@ -137,7 +139,7 @@ class Resumen
$haber -= $pago->valor;
}
}
$output []= implode($this->separator, ['', $haber, $debe]);
$output []= implode($this->separator, ['', '', $haber, $debe]);
return $output;
}
@ -150,7 +152,12 @@ class Resumen
$output = array_merge($output, $this->buildLibro($venta, $up_to), [''], ['']);
}
$filename = "Contabilidad - Resumen - {$ventas[0]->proyecto()->descripcion} - {$up_to->format('Y-m-d')}.csv";
$filename = "Contabilidad - Resumen - {$ventas[0]->proyecto()->descripcion} - {$up_to->format('Y-m-d')}.xlsx";
$informe = new Informe();
$informe->createSpreadsheet()
->addArray($output)
->send($filename);
return;
header("Content-Type: text/csv; charset=utf-8");
header('Content-Disposition: attachment; filename="' . $filename . '"');