<?php
namespace App\Entity\Movimientos;
use App\Repository\Movimientos\PrestamoHerramientaRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\RRHH\Empleado;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=PrestamoHerramientaRepository::class)
*/
class PrestamoHerramienta extends MovimientoStock
{
/**
* @ORM\Column(type="date", name="fecha_devolucion", nullable=true)
*/
private $fechaDevolucion;
/**
* @ORM\Column(name="devolucion_procesada", type="boolean", nullable=true)
*/
private $devolucionProcesada = false;
/**
* @ORM\ManyToOne(targetEntity=Empleado::class)
* @ORM\JoinColumn(name="id_empleado", referencedColumnName="id", nullable=true)
* @Assert\NotNull(message="El campo es requerido")
*/
private $responsable;
public function getDescripcion()
{
return "Prestamo Herramientas";
}
public function setIsDevuelta($flag, $fecha)
{
$this->devolucionProcesada = (bool)$flag;
$this->fechaDevolucion = $fecha;
return $this;
}
public function getIsDevuelta()
{
return $this->devolucionProcesada;
}
public function getFinalizable()
{
return true;
}
public function getDetalle()
{
$detalle = array(
"Prestamo Herramientas",
"NÂș: " . str_pad($this->getNumero(), 6, '0', STR_PAD_LEFT),
"Fecha " . $this->getFecha()->format('d/m/Y'),
"Responsable: " . $this->responsable,
"Deposito: " . $this->getDeposito()
);
return $detalle;
}
public static function isToolArticle()
{
return [true];
}
public function getInstance()
{
return "ph";
}
public function getResponsable(): ?Empleado
{
return $this->responsable;
}
public function setResponsable(?Empleado $responsable): self
{
$this->responsable = $responsable;
return $this;
}
public function getFechaDevolucion(): ?\DateTimeInterface
{
return $this->fechaDevolucion;
}
public function setFechaDevolucion(?\DateTimeInterface $fechaDevolucion): self
{
$this->fechaDevolucion = $fechaDevolucion;
return $this;
}
public function isDevolucionProcesada(): ?bool
{
return $this->devolucionProcesada;
}
public function setDevolucionProcesada(?bool $devolucionProcesada): self
{
$this->devolucionProcesada = $devolucionProcesada;
return $this;
}
}