Merge branch 'develop'
This commit is contained in:
@ -68,7 +68,7 @@ class Resumen
|
||||
$cuotas = $venta->pie()->cuotas('fecha', $up_to);
|
||||
$ly = $this->startOfYear($up_to);
|
||||
$older = array_reduce($cuotas, function($sum, $item) use ($ly) {
|
||||
if ($item->pago()->estado()->tipo()->active != 1 || strtolower($item->pago()->estado()->tipo()->descripcion) != 'no pagado') {
|
||||
if ($item->pago()->estado()->tipo()->active != 1 or strtolower($item->pago()->estado()->tipo()->descripcion) == 'no pagado') {
|
||||
return $sum;
|
||||
}
|
||||
if ($item->pago()->fecha() >= $ly) {
|
||||
@ -119,6 +119,13 @@ class Resumen
|
||||
}
|
||||
return [$this->extractValueDate($venta->subsidio()->pago(), 'Ahorro'), $this->extractValueDate($venta->subsidio()->subsidio(), 'Subsidio')];
|
||||
}
|
||||
protected function getResciliacion(Venta $venta, DateTimeInterface $up_to)
|
||||
{
|
||||
if ($venta->resciliacion == null) {
|
||||
return $this->defaultValueDate($up_to, 'Resciliacion');
|
||||
}
|
||||
return $this->extractValueDate($venta->resciliacion()->pago(), 'Resciliacion');
|
||||
}
|
||||
protected function getPagos(Venta $venta, DateTimeInterface $up_to)
|
||||
{
|
||||
$pagos = [];
|
||||
@ -133,6 +140,13 @@ class Resumen
|
||||
});
|
||||
}
|
||||
|
||||
protected function buildLine(Venta $venta, $pago)
|
||||
{
|
||||
if ($pago->valor > 0) {
|
||||
return ['', $venta->unidad()->descripcion, $pago->fecha->format('d/m/Y'), $pago->glosa, '', $pago->valor, $pago->estado];
|
||||
}
|
||||
return ['', $venta->unidad()->descripcion, $pago->fecha->format('d/m/Y'), $pago->glosa, -$pago->valor, '', $pago->estado];
|
||||
}
|
||||
protected function buildLibro(Venta $venta, DateTimeInterface $up_to)
|
||||
{
|
||||
$pagos = $this->getPagos($venta, $up_to);
|
||||
@ -143,16 +157,15 @@ class Resumen
|
||||
$debe = 0;
|
||||
$haber = 0;
|
||||
foreach ($pagos as $pago) {
|
||||
$output []= $this->buildLine($venta, $pago);
|
||||
if ($pago->valor > 0) {
|
||||
$output []= ['', $pago->fecha->format('d/m/Y'), $pago->glosa, '', $pago->valor, $pago->estado];
|
||||
$debe += $pago->valor;
|
||||
}
|
||||
else {
|
||||
$output []= ['', $pago->fecha->format('d/m/Y'), $pago->glosa, -$pago->valor, '', $pago->estado];
|
||||
$haber -= $pago->valor;
|
||||
}
|
||||
}
|
||||
$output []= ['', '', 'Total', $haber, $debe];
|
||||
$output []= ['', '', '', 'Total', $haber, $debe];
|
||||
return $output;
|
||||
}
|
||||
|
||||
@ -163,15 +176,15 @@ class Resumen
|
||||
|
||||
$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 - {$ventas[0]->proyecto()->descripcion} - {$up_to->format('Y-m-d')}.xlsx";
|
||||
$informe = new Informe();
|
||||
$informe->createSpreadsheet()
|
||||
->addArray($output)
|
||||
->formatColumn('C')
|
||||
->formatColumn('D')
|
||||
->formatColumn('E')
|
||||
->formatColumn('F')
|
||||
->send($filename);
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,9 @@ class Pago extends Model
|
||||
if ($uf == 1 and method_exists($this->fuente()[0]->obj, 'uf')) {
|
||||
$uf = $this->fuente()[0]->obj->uf();
|
||||
}
|
||||
if ($uf == 0) {
|
||||
$uf = 1;
|
||||
}
|
||||
$valor /= $uf;
|
||||
if ($this->asociado() and $this->asociado == 0) {
|
||||
$valor += $this->asociado()->valor('ufs');
|
||||
|
@ -20,6 +20,7 @@ server {
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_read_timeout 3600;
|
||||
fastcgi_pass php:9000;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user