Formateo
This commit is contained in:
@ -124,16 +124,16 @@ class Resumen
|
|||||||
protected function buildLibro(Venta $venta, DateTimeInterface $up_to)
|
protected function buildLibro(Venta $venta, DateTimeInterface $up_to)
|
||||||
{
|
{
|
||||||
$pagos = $this->getPagos($venta, $up_to);
|
$pagos = $this->getPagos($venta, $up_to);
|
||||||
$output = ["Cuenta: Anticipos Dpto {$venta->unidad()->descripcion}"];
|
$output = [";Cuenta: Anticipos Dpto {$venta->unidad()->descripcion}"];
|
||||||
$debe = 0;
|
$debe = 0;
|
||||||
$haber = 0;
|
$haber = 0;
|
||||||
foreach ($pagos as $pago) {
|
foreach ($pagos as $pago) {
|
||||||
if ($pago->valor > 0) {
|
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;
|
$debe += $pago->valor;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
$haber -= $pago->valor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,12 +145,12 @@ class Resumen
|
|||||||
{
|
{
|
||||||
$ventas = $this->getVentas($id_proyecto);
|
$ventas = $this->getVentas($id_proyecto);
|
||||||
|
|
||||||
$output = [];
|
$output = ["Libro Mayor {$ventas[0]->proyecto()->descripcion}", ''];
|
||||||
foreach ($ventas as $venta) {
|
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-Type: text/csv; charset=utf-8");
|
||||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||||
|
Reference in New Issue
Block a user