Merge branch 'develop'

This commit is contained in:
2020-01-02 16:54:15 -03:00
2 changed files with 19 additions and 2 deletions

View File

@ -305,10 +305,27 @@ class Cierre extends Model
$estado->save();
}
}
public function abandonar(\DateTime $fecha) {
$tipo = model(TipoEstadoCierre::class)->where('descripcion', 'abandonado')->findOne();
$data = [
'cierre' => $this->id,
'tipo' => $tipo->id
];
$estado = (new Factory(EstadoCierre::class))->where($data)->find();
if (!$estado) {
$data['fecha'] = $fecha->format('Y-m-d');
$estado = model(EstadoCierre::class)->create($data);
$estado->setContainer($this->container);
$estado->save();
}
}
protected $promesa;
public function promesa()
{
if ($this->promesa == null) {
if (!$this->unidadPrincipal()) {
$this->promesa = false;
}
if ($this->promesa === null) {
$propiedad = model(Propiedad::class)->where('unidad_principal', $this->unidadPrincipal()->unidad)->findOne();
if (!$propiedad) {
$this->promesa = false;

View File

@ -75,7 +75,7 @@ class Venta extends Model
}
public function fecha()
{
return Carbon::parse($this->fecha, new \DateTimeZone(config('app.timezone')));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
public function proyecto()
{