This commit is contained in:
Juan Pablo Vial
2022-03-07 21:44:17 -03:00
parent a6a1c3d102
commit 726794923d

View File

@ -124,16 +124,16 @@ 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) {
if ($pago->valor > 0) {
$output []= implode($this->separator, [$pago->fecha->format('d/m/Y'), '', $this->formatValue($pago->valor)]);
$output []= implode($this->separator, ['', $pago->fecha->format('d/m/Y'), '', $this->formatValue($pago->valor)]);
$debe += $pago->valor;
}
else {
$output []= implode($this->separator, [$pago->fecha->format('d/m/Y'), $this->formatValue(-$pago->valor), '']);
$output []= implode($this->separator, ['', $pago->fecha->format('d/m/Y'), $this->formatValue(-$pago->valor), '']);
$haber -= $pago->valor;
}
}
@ -145,12 +145,12 @@ class Resumen
{
$ventas = $this->getVentas($id_proyecto);
$output = [];
$output = ["Libro Mayor {$ventas[0]->proyecto()->descripcion}", ''];
foreach ($ventas as $venta) {
$output = array_merge($output, $this->buildLibro($venta, $up_to), []);
$output = array_merge($output, $this->buildLibro($venta, $up_to), [''], ['']);
}
$filename = "Contabilidad - Resumen - {$venta->proyecto()->descripcion} - {$up_to->format('Y-m-d')}.csv";
$filename = "Contabilidad - Resumen - {$ventas[0]->proyecto()->descripcion} - {$up_to->format('Y-m-d')}.csv";
header("Content-Type: text/csv; charset=utf-8");
header('Content-Disposition: attachment; filename="' . $filename . '"');