src/Entity/Reloj.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\EstadoOperacionEnum;
  4. use App\Enum\EstadoRelojEnum;
  5. use App\Enum\TipoOperacionEnum;
  6. use DateTime;
  7. use DateTimeInterface;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\Common\Collections\Criteria;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Gedmo\Mapping\Annotation as Gedmo;
  14. use Symfony\Component\HttpFoundation\File\File;
  15. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  16. /**
  17.  * @ORM\Entity(repositoryClass="App\Repository\RelojRepository")
  18.  * @ORM\Table(name="reloj", schema="perseo")
  19.  * @ORM\EntityListeners({"App\EntityListener\Reloj\CalcularIDPerseoListener", "App\EntityListener\Reloj\CalcularCodigoListener"})
  20.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  21.  * @Vich\Uploadable
  22.  */
  23. class Reloj
  24. {
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\Column(type="bigint", options={"unsigned":true})
  28.      * @ORM\GeneratedValue(strategy="AUTO")
  29.      */
  30.     protected $id;
  31.     /**
  32.      * @ORM\Column(type="string", unique=true, nullable=false)
  33.      */
  34.     protected $codigo;
  35.     /**
  36.      * @ORM\Column(
  37.      *     type="string",
  38.      *     unique=true,
  39.      *     nullable=false,
  40.      *     name="id_perseo",
  41.      *     options={"comment":"Identificador de perseo único generado aleatoriamente combinación letras y números"}
  42.      * )
  43.      */
  44.     protected $IDperseo;
  45.     /**
  46.      * @ORM\Column(
  47.      *     type="string",
  48.      *     length=4,
  49.      *     nullable=true,
  50.      *     options={"comment":"Valores a tomar REBU ó IVA, por defecto REBU"}
  51.      * )
  52.      */
  53.     protected $regimen;
  54.     /**
  55.      * @ORM\Column(type="string", nullable=true)
  56.      */
  57.     protected $foto;
  58.     /**
  59.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto")
  60.      * @var File
  61.      */
  62.     protected $fotoFile;
  63.     /**
  64.      * @ORM\Column(type="string", nullable=true, name="foto_valoracion")
  65.      */
  66.     private $fotoValoracion;
  67.     /**
  68.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_valoracion")
  69.      * @var File
  70.      */
  71.     protected $fotoValoracionFile;
  72.     /**
  73.      * @ORM\Column(type="string", nullable=true, name="foto_set")
  74.      */
  75.     private $fotoSet;
  76.     /**
  77.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_set")
  78.      * @var File
  79.      */
  80.     protected $fotoSetFile;
  81.     /**
  82.      * @ORM\Column(type="string", nullable=true, name="foto_crono", options={"comment":"foto del cronocomparador"})
  83.      */
  84.     private $fotoCrono;
  85.     /**
  86.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_crono")
  87.      * @var File
  88.      */
  89.     protected $fotoCronoFile;
  90.     /**
  91.      * @ORM\Column(type="string", nullable=true)
  92.      */
  93.     private $video;
  94.     /**
  95.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="video")
  96.      * @var File
  97.      */
  98.     protected $videoFile;
  99.     /**
  100.      * @ORM\Column(type="string", nullable=true)
  101.      */
  102.     protected $modelo1;
  103.     /**
  104.      * @ORM\Column(type="string", nullable=true)
  105.      */
  106.     protected $modelo2;
  107.     /**
  108.      * @ORM\Column(type="string", nullable=true)
  109.      */
  110.     protected $ref1;
  111.     /**
  112.      * @ORM\Column(type="string", nullable=true)
  113.      */
  114.     protected $ref2;
  115.     /**
  116.      * @ORM\Column(type="string", nullable=true)
  117.      */
  118.     protected $serie;
  119.     /**
  120.      * @ORM\Column(type="float", nullable=true, precision=2)
  121.      */
  122.     protected $peso;
  123.     /**
  124.      * @ORM\Column(type="datetime", nullable=true, options={"comment":"Fecha comprado por  primera vez"})
  125.      */
  126.     protected $fecha;
  127.     /**
  128.      * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  129.      */
  130.     protected $caja;
  131.     /**
  132.      * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  133.      */
  134.     protected $papeles;
  135.     /**
  136.      * @ORM\Column(type="text", nullable=true)
  137.      */
  138.     protected $otros;
  139.     /**
  140.      * @ORM\Column(type="float", nullable=true, name="itp", precision=2, options={"default":"0.0","comment":"%"})
  141.      */
  142.     protected $ITP;
  143.     /**
  144.      * @ORM\Column(
  145.      *     type="datetime",
  146.      *     nullable=true,
  147.      *     name="fecha_valoracion",
  148.      *     options={"comment":"Fecha valoracion es la fecha enviada"}
  149.      * )
  150.      */
  151.     private $fechaValoracion;
  152.     /**
  153.      * @ORM\Column(
  154.      *     type="float",
  155.      *     nullable=true,
  156.      *     options={
  157.      *         "default":"0.0",
  158.      *         "comment":"Comsión CRONO esta en gastos , pero se duplica fuera para tener mejor acceso a ella %"
  159.      *     }
  160.      * )
  161.      */
  162.     protected $comision;
  163.     /**
  164.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_coste")
  165.      */
  166.     protected $precioCoste;
  167.     /**
  168.      * @ORM\Column(
  169.      *     type="float",
  170.      *     nullable=true,
  171.      *     name="precio_coste_total",
  172.      *     precision=2,
  173.      *     options={
  174.      *         "default":"0.0",
  175.      *         "comment":"Autocalculado, cada vez que se añade/modifique un coste ó cambie su coste (Coste del Reloj + Costes Asociados)"
  176.      *     }
  177.      * )
  178.      */
  179.     protected $precioCosteTotal;
  180.     /**
  181.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_min_venta")
  182.      */
  183.     protected $precioMinVenta;
  184.     /**
  185.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_promocion", options={"default":"0.0"})
  186.      */
  187.     protected $precioPromocion;
  188.     /**
  189.      * @ORM\Column(type="datetime", nullable=true, name="fecha_promocion")
  190.      */
  191.     protected $fechaPromocion;
  192.     /**
  193.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_oferta")
  194.      */
  195.     protected $precioOferta;
  196.     /**
  197.      * @deprecated Por cambios de funcionalidad
  198.      * @ORM\Column(type="boolean", nullable=true, precision=2, name="chrono24")
  199.      */
  200.     protected $chrono24;
  201.     /**
  202.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_pagar")
  203.      */
  204.     protected $precioPagar;
  205.     /**
  206.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_compra")
  207.      */
  208.     protected $precioCompra;
  209.     /**
  210.      * @ORM\Column(type="datetime", nullable=true, name="fecha_compra")
  211.      */
  212.     protected $fechaCompra;
  213.     /**
  214.      * @ORM\Column(type="float", nullable=true, precision=2)
  215.      */
  216.     protected $precioVenta;
  217.     /**
  218.      * @ORM\Column(type="datetime", nullable=true, name="fecha_venta")
  219.      */
  220.     protected $fechaVenta;
  221.     /**
  222.      * @ORM\Column(type="float", nullable=true, precision=2)
  223.      */
  224.     protected $precioVentaTotal;
  225.     /**
  226.      * @ORM\Column(type="float", nullable=true, precision=0, name="margen_minimo")
  227.      */
  228.     protected $margenMinimo;
  229.     /**
  230.      * @ORM\Column(type="float", nullable=true, precision=0, name="margen_deseado")
  231.      */
  232.     protected $margenDeseado;
  233.     /**
  234.      * @ORM\Column(type="float", nullable=true, precision=2)
  235.      */
  236.     private $recompra;
  237.     /**
  238.      * @ORM\Column(type="string", nullable=true)
  239.      */
  240.     private $garantia;
  241.     /**
  242.      * @ORM\Column(
  243.      *     type="integer",
  244.      *     nullable=true,
  245.      *     name="tiempo_en_venta",
  246.      *     options={"comment":"Diff entre Fecha Venta y 1º Estado de Anuncio"}
  247.      * )
  248.      */
  249.     private $tiempoEnVenta;
  250.     /**
  251.      * @ORM\Column(
  252.      *     type="integer",
  253.      *     nullable=true,
  254.      *     name="tiempo_en_stock",
  255.      *     options={"comment":"Diff entre Fecha Venta y Fecha Compra"}
  256.      * )
  257.      */
  258.     private $tiempoEnStock;
  259.     /**
  260.      * @ORM\Column(type="datetime", nullable=true, name="fecha_recepcion")
  261.      */
  262.     private $fechaRecepcion;
  263.     /**
  264.      * @ORM\Column(
  265.      *     type="float",
  266.      *     nullable=true,
  267.      *     precision=0,
  268.      *     name="margen_promocion",
  269.      *     options={"default":"0.0","comment":"%"}
  270.      * )
  271.      */
  272.     protected $margenPromocion;
  273.     /**
  274.      * @ORM\Column(
  275.      *     type="float",
  276.      *     nullable=true,
  277.      *     precision=0,
  278.      *     name="margen_bruto",
  279.      *     options={"default":"0.0","comment":"%"}
  280.      * )
  281.      */
  282.     protected $margenBruto;
  283.     /**
  284.      * @ORM\Column(type="float", nullable=true, name="margen_neto", precision=2,
  285.      *     options={"default":"0.0","comment":"%"})
  286.      */
  287.     protected $margenNeto;
  288.     /**
  289.      * @ORM\Column(type="boolean", nullable=false, options={"default":0,"comment":"Relojes comprados"})
  290.      */
  291.     protected $stock;
  292.     /**
  293.      * @ORM\Column(type="boolean", nullable=true, options={"default":0,"comment":"Relojes en Gestión de Venta"})
  294.      */
  295.     protected $custodia;
  296.     /**
  297.      * @ORM\Column(type="float", nullable=true, name="tiempo_venta", precision=2,
  298.      *     options={"default":"0.0","comment":"%"})
  299.      */
  300.     protected $tiempoVenta;
  301.     /**
  302.      * @ORM\Column(type="datetime", nullable=true, name="fecha_anuncio", options={"comment":"Fecha primer anuncio"})
  303.      */
  304.     private $fechaAnuncio;
  305.     /**
  306.      * @ORM\Column(type="string", nullable=true)
  307.      */
  308.     protected $descripcion;
  309.     /**
  310.      * @ORM\Column(type="text", nullable=true)
  311.      */
  312.     protected $comentario;
  313.     /**
  314.      * @ORM\Column(
  315.      *     type="string",
  316.      *     unique=true,
  317.      *     nullable=true,
  318.      *     name="token_access",
  319.      *     options={"comment":"Token de acceso a la información del reloj"}
  320.      * )
  321.      */
  322.     protected $tokenAccess;
  323.     /**
  324.      * @ORM\Column(
  325.      *     type="boolean",
  326.      *     nullable=true,
  327.      *     name="en_promocion",
  328.      *     options={"default":0,"comment":"Cuando la Estado Operacion es Confirmada"}
  329.      * )
  330.      */
  331.     protected $enPromocion;
  332.     /**
  333.      * @ORM\Column(
  334.      *     type="boolean",
  335.      *     nullable=true,
  336.      *     name="en_servicio",
  337.      *     options={"default":0,"comment":"Relojes Recepcionados y que se encuentren en una Ubicación tipo Proveedor"}
  338.      * )
  339.      */
  340.     protected $enServicio;
  341.     /**
  342.      * @ORM\Column(
  343.      *     type="boolean",
  344.      *     nullable=true,
  345.      *     name="sin_anunciar",
  346.      *     options={"default":0,"comment":"Relojes Estado Listo y no han sido promocionados"}
  347.      * )
  348.      */
  349.     protected $sinAnunciar;
  350.     /**
  351.      * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  352.      */
  353.     protected $enVenta;
  354.     /**
  355.      * @ORM\Column(
  356.      *     type="boolean",
  357.      *     nullable=true,
  358.      *     name="tipo_bloqueo",
  359.      *     options={"comment":"Valores a tomar RM(true) ó RI(false) ó NULL"}
  360.      * )
  361.      */
  362.     protected $tipoBloqueo;
  363.     /**
  364.      * @ORM\Column(type="boolean", nullable=true)
  365.      */
  366.     protected $exportacion;
  367.     /**
  368.      * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  369.      */
  370.     protected $deletedAt;
  371.     /**
  372.      * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  373.      * @Gedmo\Timestampable(on="update")
  374.      */
  375.     protected $updatedAt;
  376.     /**
  377.      * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  378.      * @Gedmo\Timestampable(on="create")
  379.      */
  380.     protected $createdAt;
  381.     /**
  382.      * @ORM\OneToOne(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, mappedBy="relojInventario")
  383.      */
  384.     private $valoracionReloj;
  385.     /**
  386.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleCompra::class, mappedBy="reloj")
  387.      */
  388.     protected $detalleCompra;
  389.     /**
  390.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleVenta::class, mappedBy="reloj")
  391.      */
  392.     protected $detalleVenta;
  393.     /**
  394.      * @ORM\OneToOne(targetEntity=\App\Entity\RegistroPolicial::class, mappedBy="reloj")
  395.      */
  396.     protected $registroPolicial;
  397.     /*
  398.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadAbstract::class, mappedBy="reloj")
  399.      */
  400.     private $actividad;
  401.     /**
  402.      * @ORM\OneToOne(targetEntity=\App\Entity\Promocion::class, mappedBy="reloj")
  403.      */
  404.     protected $promociones;
  405.     /**
  406.      * @ORM\OneToMany(targetEntity="App\Entity\Gasto", mappedBy="reloj")
  407.      */
  408.     protected $gastos;
  409.     /**
  410.      * @ORM\OneToMany(targetEntity="App\Entity\Trazabilidad", mappedBy="reloj")
  411.      */
  412.     protected $trazas;
  413.     /**
  414.      * @ORM\OneToMany(targetEntity="App\Entity\ValoracionesRelojes", mappedBy="reloj", cascade={"persist"})
  415.      */
  416.     protected $valoracionesRelojes;
  417.     /**
  418.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoReloj", inversedBy="relojes")
  419.      * @ORM\JoinColumn(name="estado_reloj_id", referencedColumnName="id", nullable=true)
  420.      */
  421.     protected $estado;
  422.     /**
  423.      * @ORM\ManyToOne(targetEntity="App\Entity\Marca", inversedBy="relojes")
  424.      * @ORM\JoinColumn(name="marca_id", referencedColumnName="id")
  425.      */
  426.     protected $marca;
  427.     /**
  428.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoAspecto", inversedBy="relojes")
  429.      * @ORM\JoinColumn(name="estado_aspecto_id", referencedColumnName="id")
  430.      */
  431.     protected $aspecto;
  432.     /**
  433.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoCheck", inversedBy="relojes")
  434.      * @ORM\JoinColumn(name="estado_check_id", referencedColumnName="id")
  435.      */
  436.     protected $check;
  437.     /*
  438.      * @ORM\OneToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojGestion")
  439.      * @ORM\JoinColumn(name="operacion_gestion_id", referencedColumnName="id", unique=true)
  440.      */
  441.     /**
  442.      * @ORM\JoinColumn(name="operacion_gestion_id", referencedColumnName="id")
  443.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesGestion")
  444.      */
  445.     private $operacionGestion;
  446.     /**
  447.      * @ORM\JoinColumn(name="operacion_venta_id", referencedColumnName="id")
  448.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesVenta")
  449.      */
  450.     private $operacionVenta;
  451.     /**
  452.      * @ORM\JoinColumn(name="operacion_compra_id", referencedColumnName="id")
  453.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesCompra")
  454.      */
  455.     private $operacionCompra;
  456.     /**
  457.      * @ORM\ManyToOne(targetEntity=\App\Entity\Valoracion::class, inversedBy="relojes")
  458.      * @ORM\JoinColumn(name="valoracion_id", referencedColumnName="id")
  459.      */
  460.     private $valoracion;
  461.     /**
  462.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadCompra::class, mappedBy="reloj")
  463.      */
  464.     private $actividadCompra;
  465.     /**
  466.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadVenta::class, mappedBy="reloj")
  467.      */
  468.     private $actividadVenta;
  469.     private $fechaStr;
  470.     public function __construct()
  471.     {
  472.         $this->reservado false;
  473.         $this->papeles false;
  474.         $this->caja false;
  475.         $this->stock false;
  476.         $this->custodia false;
  477.         $this->gastos = new ArrayCollection();
  478.         $this->trazas = new ArrayCollection();
  479.         $this->valoracionesRelojes = new ArrayCollection();
  480.         $this->detalleVenta = new ArrayCollection();
  481.         $this->detalleCompra = new ArrayCollection();
  482.     }
  483.     public function __toString(): string
  484.     {
  485.         return (string)($this->getCodigo() ?? $this->getIDperseo());
  486.     }
  487.     public function getId(): ?string
  488.     {
  489.         return $this->id;
  490.     }
  491.     public function getIDperseo(): ?string
  492.     {
  493.         return $this->IDperseo;
  494.     }
  495.     public function setIDperseo(string $IDperseo): self
  496.     {
  497.         $this->IDperseo $IDperseo;
  498.         return $this;
  499.     }
  500.     public function getRegimen(): ?string
  501.     {
  502.         return $this->regimen;
  503.     }
  504.     public function setRegimen(?string $regimen): self
  505.     {
  506.         $this->regimen $regimen;
  507.         return $this;
  508.     }
  509.     public function getFoto(): ?string
  510.     {
  511.         return $this->foto;
  512.     }
  513.     public function setFoto(?string $foto): self
  514.     {
  515.         $this->foto $foto;
  516.         return $this;
  517.     }
  518.     public function getFotoFile(): ?File
  519.     {
  520.         return $this->fotoFile;
  521.     }
  522.     public function setFotoFile(?File $fotoFile): self
  523.     {
  524.         $this->fotoFile $fotoFile;
  525.         if ($fotoFile) {
  526.             // if 'updatedAt' is not defined in your entity, use another property
  527.             $this->setUpdatedAt(new DateTime('now'));
  528.         }
  529.         return $this;
  530.     }
  531.     public function getModelo1(): ?string
  532.     {
  533.         return $this->modelo1;
  534.     }
  535.     public function setModelo1(?string $modelo1): self
  536.     {
  537.         $this->modelo1 $modelo1;
  538.         return $this;
  539.     }
  540.     public function getModelo2(): ?string
  541.     {
  542.         return $this->modelo2;
  543.     }
  544.     public function setModelo2(?string $modelo2): self
  545.     {
  546.         $this->modelo2 $modelo2;
  547.         return $this;
  548.     }
  549.     public function getRef1(): ?string
  550.     {
  551.         return $this->ref1;
  552.     }
  553.     public function setRef1(?string $ref1): self
  554.     {
  555.         $this->ref1 $ref1;
  556.         return $this;
  557.     }
  558.     public function getRef2(): ?string
  559.     {
  560.         return $this->ref2;
  561.     }
  562.     public function setRef2(?string $ref2): self
  563.     {
  564.         $this->ref2 $ref2;
  565.         return $this;
  566.     }
  567.     public function getSerie(): ?string
  568.     {
  569.         return $this->serie;
  570.     }
  571.     public function setSerie(?string $serie): self
  572.     {
  573.         $this->serie $serie;
  574.         return $this;
  575.     }
  576.     public function getFecha(): ?DateTimeInterface
  577.     {
  578.         return $this->fecha;
  579.     }
  580.     public function setFecha(?DateTimeInterface $fecha): self
  581.     {
  582.         $this->fecha $fecha;
  583.         return $this;
  584.     }
  585.     public function isCaja(): ?bool
  586.     {
  587.         return $this->caja;
  588.     }
  589.     public function getCaja(): ?bool
  590.     {
  591.         return $this->caja;
  592.     }
  593.     public function setCaja(bool $caja): self
  594.     {
  595.         $this->caja $caja;
  596.         return $this;
  597.     }
  598.     public function isPapeles(): ?bool
  599.     {
  600.         return $this->papeles;
  601.     }
  602.     public function getPapeles(): ?bool
  603.     {
  604.         return $this->papeles;
  605.     }
  606.     public function setPapeles(bool $papeles): self
  607.     {
  608.         $this->papeles $papeles;
  609.         return $this;
  610.     }
  611.     public function getOtros(): ?string
  612.     {
  613.         return $this->otros;
  614.     }
  615.     public function setOtros(?string $otros): self
  616.     {
  617.         $this->otros $otros;
  618.         return $this;
  619.     }
  620.     public function getITP(): ?float
  621.     {
  622.         return $this->ITP;
  623.     }
  624.     public function setITP(?float $ITP): self
  625.     {
  626.         $this->ITP $ITP;
  627.         return $this;
  628.     }
  629.     public function getComision(): ?float
  630.     {
  631.         return $this->comision;
  632.     }
  633.     public function setComision(?float $comision): self
  634.     {
  635.         $this->comision $comision;
  636.         return $this;
  637.     }
  638.     public function getPrecioCoste(): ?float
  639.     {
  640.         return $this->precioCoste;
  641.     }
  642.     public function setPrecioCoste(?float $precioCoste): self
  643.     {
  644.         $this->precioCoste $precioCoste;
  645.         return $this;
  646.     }
  647.     public function getPrecioCosteTotal(): ?float
  648.     {
  649.         return $this->precioCosteTotal;
  650.     }
  651.     public function setPrecioCosteTotal(?float $precioCosteTotal): self
  652.     {
  653.         $this->precioCosteTotal $precioCosteTotal;
  654.         return $this;
  655.     }
  656.     public function getPrecioMinVenta(): ?float
  657.     {
  658.         return $this->precioMinVenta;
  659.     }
  660.     public function setPrecioMinVenta(?float $precioMinVenta): self
  661.     {
  662.         $this->precioMinVenta $precioMinVenta;
  663.         return $this;
  664.     }
  665.     public function getPrecioPromocion(): ?float
  666.     {
  667.         return $this->precioPromocion;
  668.     }
  669.     public function setPrecioPromocion(?float $precioPromocion): self
  670.     {
  671.         $this->precioPromocion $precioPromocion;
  672.         return $this;
  673.     }
  674.     public function getPrecioOferta(): ?float
  675.     {
  676.         return $this->precioOferta;
  677.     }
  678.     public function setPrecioOferta(?float $precioOferta): self
  679.     {
  680.         $this->precioOferta $precioOferta;
  681.         return $this;
  682.     }
  683.     public function getPrecioPagar(): ?float
  684.     {
  685.         return $this->precioPagar;
  686.     }
  687.     public function setPrecioPagar(?float $precioPagar): self
  688.     {
  689.         $this->precioPagar $precioPagar;
  690.         return $this;
  691.     }
  692.     public function getPrecioVenta(): ?float
  693.     {
  694.         return $this->precioVenta;
  695.     }
  696.     public function setPrecioVenta(?float $precioVenta): self
  697.     {
  698.         $this->precioVenta $precioVenta;
  699.         return $this;
  700.     }
  701.     public function getPrecioVentaTotal(): ?float
  702.     {
  703.         return $this->precioVentaTotal;
  704.     }
  705.     public function setPrecioVentaTotal(?float $precioVentaTotal): self
  706.     {
  707.         $this->precioVentaTotal $precioVentaTotal;
  708.         return $this;
  709.     }
  710.     public function getMargenMinimo(): ?float
  711.     {
  712.         return $this->margenMinimo;
  713.     }
  714.     public function setMargenMinimo(?float $margenMinimo): self
  715.     {
  716.         $this->margenMinimo $margenMinimo;
  717.         return $this;
  718.     }
  719.     public function getMargenDeseado(): ?float
  720.     {
  721.         return $this->margenDeseado;
  722.     }
  723.     public function setMargenDeseado(?float $margenDeseado): self
  724.     {
  725.         $this->margenDeseado $margenDeseado;
  726.         return $this;
  727.     }
  728.     public function getMargenPromocion(): ?float
  729.     {
  730.         return $this->margenPromocion;
  731.     }
  732.     public function setMargenPromocion(?float $margenPromocion): self
  733.     {
  734.         $this->margenPromocion $margenPromocion;
  735.         return $this;
  736.     }
  737.     public function getMargenBruto(): ?float
  738.     {
  739.         return $this->margenBruto;
  740.     }
  741.     public function setMargenBruto(?float $margenBruto): self
  742.     {
  743.         $this->margenBruto $margenBruto;
  744.         return $this;
  745.     }
  746.     public function getStock(): ?bool
  747.     {
  748.         return $this->stock;
  749.     }
  750.     public function setStock(bool $stock): self
  751.     {
  752.         $this->stock $stock;
  753.         return $this;
  754.     }
  755.     public function getComentario(): ?string
  756.     {
  757.         return $this->comentario;
  758.     }
  759.     public function setComentario(?string $comentario): self
  760.     {
  761.         $this->comentario $comentario;
  762.         return $this;
  763.     }
  764.     public function getReservado(): ?bool
  765.     {
  766.         return $this->reservado;
  767.     }
  768.     public function setReservado(bool $reservado): self
  769.     {
  770.         $this->reservado $reservado;
  771.         return $this;
  772.     }
  773.     public function getTokenAccess(): ?string
  774.     {
  775.         return $this->tokenAccess;
  776.     }
  777.     public function setTokenAccess(?string $tokenAccess): self
  778.     {
  779.         $this->tokenAccess $tokenAccess;
  780.         return $this;
  781.     }
  782.     public function getTipoBloqueo(): ?string
  783.     {
  784.         return $this->tipoBloqueo;
  785.     }
  786.     public function setTipoBloqueo(?string $tipoBloqueo): self
  787.     {
  788.         $this->tipoBloqueo $tipoBloqueo;
  789.         return $this;
  790.     }
  791.     public function getExportacionStr():string
  792.     {
  793.         return $this->isExportacion() ? 'Exportacion' 'Europa';
  794.     }
  795.     public function getExportacion(): ?bool
  796.     {
  797.         return $this->exportacion;
  798.     }
  799.     public function setExportacion(?bool $exportacion): self
  800.     {
  801.         $this->exportacion $exportacion;
  802.         return $this;
  803.     }
  804.     public function getDeletedAt(): ?DateTimeInterface
  805.     {
  806.         return $this->deletedAt;
  807.     }
  808.     public function setDeletedAt(?DateTimeInterface $deletedAt): self
  809.     {
  810.         $this->deletedAt $deletedAt;
  811.         return $this;
  812.     }
  813.     public function getUpdatedAt(): ?DateTimeInterface
  814.     {
  815.         return $this->updatedAt;
  816.     }
  817.     public function setUpdatedAt(DateTimeInterface $updatedAt): self
  818.     {
  819.         $this->updatedAt $updatedAt;
  820.         return $this;
  821.     }
  822.     public function getCreatedAt(): ?DateTimeInterface
  823.     {
  824.         return $this->createdAt;
  825.     }
  826.     public function setCreatedAt(DateTimeInterface $createdAt): self
  827.     {
  828.         $this->createdAt $createdAt;
  829.         return $this;
  830.     }
  831.     public function getRegistroPolicial(): ?RegistroPolicial
  832.     {
  833.         return $this->registroPolicial;
  834.     }
  835.     public function setRegistroPolicial(?RegistroPolicial $registroPolicial): self
  836.     {
  837.         // unset the owning side of the relation if necessary
  838.         if ($registroPolicial === null && $this->registroPolicial !== null) {
  839.             $this->registroPolicial->setReloj(null);
  840.         }
  841.         // set the owning side of the relation if necessary
  842.         if ($registroPolicial !== null && $registroPolicial->getReloj() !== $this) {
  843.             $registroPolicial->setReloj($this);
  844.         }
  845.         $this->registroPolicial $registroPolicial;
  846.         return $this;
  847.     }
  848.     /**
  849.      * @return Collection|Gasto[]
  850.      */
  851.     public function getGastos(): Collection
  852.     {
  853.         return $this->gastos;
  854.     }
  855.     public function addGasto(Gasto $gasto): self
  856.     {
  857.         if (!$this->gastos->contains($gasto)) {
  858.             $this->gastos[] = $gasto;
  859.             $gasto->setReloj($this);
  860.         }
  861.         return $this;
  862.     }
  863.     public function removeGasto(Gasto $gasto): self
  864.     {
  865.         if ($this->gastos->removeElement($gasto)) {
  866.             // set the owning side to null (unless already changed)
  867.             if ($gasto->getReloj() === $this) {
  868.                 $gasto->setReloj(null);
  869.             }
  870.         }
  871.         return $this;
  872.     }
  873.     /**
  874.      * @return Collection|Trazabilidad[]
  875.      */
  876.     public function getTrazas(): Collection
  877.     {
  878.         return $this->trazas;
  879.     }
  880.     public function addTraza(Trazabilidad $traza): self
  881.     {
  882.         if (!$this->trazas->contains($traza)) {
  883.             $this->trazas[] = $traza;
  884.             $traza->setReloj($this);
  885.         }
  886.         return $this;
  887.     }
  888.     public function removeTraza(Trazabilidad $traza): self
  889.     {
  890.         if ($this->trazas->removeElement($traza)) {
  891.             // set the owning side to null (unless already changed)
  892.             if ($traza->getReloj() === $this) {
  893.                 $traza->setReloj(null);
  894.             }
  895.         }
  896.         return $this;
  897.     }
  898.     public function getEstado(): ?EstadoReloj
  899.     {
  900.         return $this->estado;
  901.     }
  902.     public function setEstado(?EstadoReloj $estado): self
  903.     {
  904.         $this->estado $estado;
  905.         return $this;
  906.     }
  907.     public function getMarca(): ?Marca
  908.     {
  909.         return $this->marca;
  910.     }
  911.     public function setMarca(?Marca $marca): self
  912.     {
  913.         $this->marca $marca;
  914.         return $this;
  915.     }
  916.     /**
  917.      * @return Collection|ValoracionesRelojes[]
  918.      */
  919.     public function getValoracionesRelojes(): Collection
  920.     {
  921.         return $this->valoracionesRelojes;
  922.     }
  923.     public function addValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  924.     {
  925.         if (!$this->valoracionesRelojes->contains($valoracionesReloje)) {
  926.             $this->valoracionesRelojes[] = $valoracionesReloje;
  927.             $valoracionesReloje->setReloj($this);
  928.         }
  929.         return $this;
  930.     }
  931.     public function removeValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  932.     {
  933.         if ($this->valoracionesRelojes->removeElement($valoracionesReloje)) {
  934.             // set the owning side to null (unless already changed)
  935.             if ($valoracionesReloje->getReloj() === $this) {
  936.                 $valoracionesReloje->setReloj(null);
  937.             }
  938.         }
  939.         return $this;
  940.     }
  941.     public function isStock(): ?bool
  942.     {
  943.         return $this->stock;
  944.     }
  945.     public function isReservado(): ?bool
  946.     {
  947.         return $this->reservado;
  948.     }
  949.     public function isExportacion(): ?bool
  950.     {
  951.         return $this->exportacion;
  952.     }
  953.     public function getFechaPromocion(): ?DateTimeInterface
  954.     {
  955.         return $this->fechaPromocion;
  956.     }
  957.     public function setFechaPromocion(?DateTimeInterface $fechaPromocion): self
  958.     {
  959.         $this->fechaPromocion $fechaPromocion;
  960.         return $this;
  961.     }
  962.     public function getFechaVenta(): ?DateTimeInterface
  963.     {
  964.         return $this->fechaVenta;
  965.     }
  966.     public function setFechaVenta(?DateTimeInterface $fechaVenta): self
  967.     {
  968.         $this->fechaVenta $fechaVenta;
  969.         return $this;
  970.     }
  971.     public function getMargenNeto(): ?float
  972.     {
  973.         return $this->margenNeto;
  974.     }
  975.     public function setMargenNeto(?float $margenNeto): self
  976.     {
  977.         $this->margenNeto $margenNeto;
  978.         return $this;
  979.     }
  980.     public function isCustodia(): ?bool
  981.     {
  982.         return $this->custodia;
  983.     }
  984.     public function setCustodia(bool $custodia): self
  985.     {
  986.         $this->custodia $custodia;
  987.         return $this;
  988.     }
  989.     public function getTiempoVenta(): ?float
  990.     {
  991.         return $this->tiempoVenta;
  992.     }
  993.     public function setTiempoVenta(?float $tiempoVenta): self
  994.     {
  995.         $this->tiempoVenta $tiempoVenta;
  996.         return $this;
  997.     }
  998.     public function isEnPromocion(): ?bool
  999.     {
  1000.         return $this->enPromocion;
  1001.     }
  1002.     public function setEnPromocion(?bool $enPromocion): self
  1003.     {
  1004.         $this->enPromocion $enPromocion;
  1005.         return $this;
  1006.     }
  1007.     public function isEnServicio(): ?bool
  1008.     {
  1009.         return $this->enServicio;
  1010.     }
  1011.     public function setEnServicio(?bool $enServicio): self
  1012.     {
  1013.         $this->enServicio $enServicio;
  1014.         return $this;
  1015.     }
  1016.     public function isTipoBloqueo(): ?bool
  1017.     {
  1018.         return $this->tipoBloqueo;
  1019.     }
  1020.     public function getAspecto(): ?EstadoAspecto
  1021.     {
  1022.         return $this->aspecto;
  1023.     }
  1024.     public function setAspecto(?EstadoAspecto $aspecto): self
  1025.     {
  1026.         $this->aspecto $aspecto;
  1027.         return $this;
  1028.     }
  1029.     public function getCheck(): ?EstadoCheck
  1030.     {
  1031.         return $this->check;
  1032.     }
  1033.     public function setCheck(?EstadoCheck $check): self
  1034.     {
  1035.         $this->check $check;
  1036.         return $this;
  1037.     }
  1038.     public function isSinAnunciar(): ?bool
  1039.     {
  1040.         return $this->sinAnunciar;
  1041.     }
  1042.     public function setSinAnunciar(?bool $sinAnunciar): self
  1043.     {
  1044.         $this->sinAnunciar $sinAnunciar;
  1045.         return $this;
  1046.     }
  1047.     public function isEnVenta(): ?bool
  1048.     {
  1049.         return $this->enVenta;
  1050.     }
  1051.     public function setEnVenta(?bool $enVenta): self
  1052.     {
  1053.         $this->enVenta $enVenta;
  1054.         return $this;
  1055.     }
  1056.     public function getUrlImage():string
  1057.     {
  1058.         /* TODO cogerlo de la configuracion vich */
  1059.         return '/uploads/reloj/'.$this->getId().'/'.$this->getFoto();
  1060.     }
  1061.     public function getFechaCompra(): ?DateTimeInterface
  1062.     {
  1063.         return $this->fechaCompra;
  1064.     }
  1065.     public function setFechaCompra(?DateTimeInterface $fechaCompra): static
  1066.     {
  1067.         $this->fechaCompra $fechaCompra;
  1068.         return $this;
  1069.     }
  1070.     public function getPromociones(): ?Promocion
  1071.     {
  1072.         return $this->promociones;
  1073.     }
  1074.     public function setPromociones(?Promocion $promociones): static
  1075.     {
  1076.         // unset the owning side of the relation if necessary
  1077.         if ($promociones === null && $this->promociones !== null) {
  1078.             $this->promociones->setReloj(null);
  1079.         }
  1080.         // set the owning side of the relation if necessary
  1081.         if ($promociones !== null && $promociones->getReloj() !== $this) {
  1082.             $promociones->setReloj($this);
  1083.         }
  1084.         $this->promociones $promociones;
  1085.         return $this;
  1086.     }
  1087.     public function getCodigo(): ?string
  1088.     {
  1089.         return $this->codigo;
  1090.     }
  1091.     public function setCodigo(string $codigo): static
  1092.     {
  1093.         $this->codigo $codigo;
  1094.         return $this;
  1095.     }
  1096.     public function getModelos(): ?string
  1097.     {
  1098.         return implode(' ', [$this->getModelo1(), $this->getModelo2()]);
  1099.     }
  1100.     /*public function setModelos(?string $modelos): static
  1101.     {
  1102.         $modelosArray = explode(',', $modelos);
  1103.         $this->setModelo1(@$modelosArray[0]);
  1104.         $this->setModelo2(@$modelosArray[1]);
  1105.         return $this;
  1106.     }*/
  1107.     public function getRefs(): ?string
  1108.     {
  1109.         return implode('', [$this->getRef1(), $this->getRef2()]);
  1110.     }
  1111.     /*public function setRefs(?string $refs): static
  1112.     {
  1113.         $refsArray = explode(',', $refs);
  1114.         $this->setRef1(@$refsArray[0]);
  1115.         $this->setRef2(@$refsArray[1]);
  1116.         return $this;
  1117.     }*/
  1118.     public function getActividad(): ?ActividadAbstract
  1119.     {
  1120.         return $this->actividad;
  1121.     }
  1122.     public function setActividad(?ActividadAbstract $actividad): static
  1123.     {
  1124.         // unset the owning side of the relation if necessary
  1125.         if ($actividad === null && $this->actividad !== null) {
  1126.             $this->actividad->setReloj(null);
  1127.         }
  1128.         // set the owning side of the relation if necessary
  1129.         if ($actividad !== null && $actividad->getReloj() !== $this) {
  1130.             $actividad->setReloj($this);
  1131.         }
  1132.         $this->actividad $actividad;
  1133.         return $this;
  1134.     }
  1135.     public function getFotoValoracion(): ?string
  1136.     {
  1137.         return $this->fotoValoracion;
  1138.     }
  1139.     public function setFotoValoracion(?string $fotoValoracion): static
  1140.     {
  1141.         $this->fotoValoracion $fotoValoracion;
  1142.         return $this;
  1143.     }
  1144.     public function getFotoValoracionFile(): ?File
  1145.     {
  1146.         return $this->fotoValoracionFile;
  1147.     }
  1148.     public function setFotoValoracionFile(?File $fotoValoracionFile): self
  1149.     {
  1150.         $this->fotoValoracionFile $fotoValoracionFile;
  1151.         if ($fotoValoracionFile) {
  1152.             // if 'updatedAt' is not defined in your entity, use another property
  1153.             $this->setUpdatedAt(new DateTime('now'));
  1154.         }
  1155.         return $this;
  1156.     }
  1157.     public function getFotoSet(): ?string
  1158.     {
  1159.         return $this->fotoSet;
  1160.     }
  1161.     public function setFotoSet(?string $fotoSet): static
  1162.     {
  1163.         $this->fotoSet $fotoSet;
  1164.         return $this;
  1165.     }
  1166.     public function getFotoSetFile(): ?File
  1167.     {
  1168.         return $this->fotoSetFile;
  1169.     }
  1170.     public function setFotoSetFile(?File $fotoSetFile): self
  1171.     {
  1172.         $this->fotoSetFile $fotoSetFile;
  1173.         if ($fotoSetFile) {
  1174.             // if 'updatedAt' is not defined in your entity, use another property
  1175.             $this->setUpdatedAt(new DateTime('now'));
  1176.         }
  1177.         return $this;
  1178.     }
  1179.     public function getFotoCrono(): ?string
  1180.     {
  1181.         return $this->fotoCrono;
  1182.     }
  1183.     public function setFotoCrono(?string $fotoCrono): static
  1184.     {
  1185.         $this->fotoCrono $fotoCrono;
  1186.         return $this;
  1187.     }
  1188.     public function getFotoCronoFile(): ?File
  1189.     {
  1190.         return $this->fotoCronoFile;
  1191.     }
  1192.     public function setFotoCronoFile(?File $fotoCronoFile): self
  1193.     {
  1194.         $this->fotoCronoFile $fotoCronoFile;
  1195.         if ($fotoCronoFile) {
  1196.             // if 'updatedAt' is not defined in your entity, use another property
  1197.             $this->setUpdatedAt(new DateTime('now'));
  1198.         }
  1199.         return $this;
  1200.     }
  1201.     public function getVideo(): ?string
  1202.     {
  1203.         return $this->video;
  1204.     }
  1205.     public function setVideo(?string $video): static
  1206.     {
  1207.         $this->video $video;
  1208.         return $this;
  1209.     }
  1210.     public function getVideoFile(): ?File
  1211.     {
  1212.         return $this->videoFile;
  1213.     }
  1214.     public function setVideoFile(?File $videoFile): self
  1215.     {
  1216.         $this->videoFile $videoFile;
  1217.         if ($videoFile) {
  1218.             // if 'updatedAt' is not defined in your entity, use another property
  1219.             $this->setUpdatedAt(new DateTime('now'));
  1220.         }
  1221.         return $this;
  1222.     }
  1223.     /**
  1224.      * @return bool|null
  1225.      * @deprecated Por cambios de funcionalidad
  1226.      */
  1227.     public function isChrono24(): ?bool
  1228.     {
  1229.         return $this->chrono24;
  1230.     }
  1231.     /**
  1232.      * @deprecated Por cambios de funcionalidad
  1233.      * @param bool|null $chrono24
  1234.      * @return $this
  1235.      */
  1236.     public function setChrono24(?bool $chrono24): static
  1237.     {
  1238.         $this->chrono24 $chrono24;
  1239.         return $this;
  1240.     }
  1241.     /**
  1242.      * @return Collection<int, DetalleVenta>
  1243.      */
  1244.     public function getDetalleVenta(): Collection
  1245.     {
  1246.         return $this->detalleVenta;
  1247.     }
  1248.     public function getDetalleVentaAsentada(): ?DetalleVenta
  1249.     {
  1250.         return ($this->getDetalleVenta()->filter(fn($dc) => $dc->getVenta()->getOperacion()->getEstado()->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA))->first();
  1251.     }
  1252.     public function addDetalleVentum(DetalleVenta $detalleVentum): static
  1253.     {
  1254.         if (!$this->detalleVenta->contains($detalleVentum)) {
  1255.             $this->detalleVenta->add($detalleVentum);
  1256.             $detalleVentum->setReloj($this);
  1257.         }
  1258.         return $this;
  1259.     }
  1260.     public function removeDetalleVentum(DetalleVenta $detalleVentum): static
  1261.     {
  1262.         if ($this->detalleVenta->removeElement($detalleVentum)) {
  1263.             // set the owning side to null (unless already changed)
  1264.             if ($detalleVentum->getReloj() === $this) {
  1265.                 $detalleVentum->setReloj(null);
  1266.             }
  1267.         }
  1268.         return $this;
  1269.     }
  1270.     public function getPrecioCompra(): ?float
  1271.     {
  1272.         return $this->precioCompra;
  1273.     }
  1274.     public function setPrecioCompra(?float $precioCompra): static
  1275.     {
  1276.         $this->precioCompra $precioCompra;
  1277.         return $this;
  1278.     }
  1279.     /**
  1280.      * @deprecated A partir del 04/06/2024 cuando se realiza el ciclo completo sustituir por "getOperacionCompra"
  1281.      * @return Operacion|null
  1282.      */
  1283.     public function getOperacion():?Operacion
  1284.     {
  1285.         return $this->getDetalleCompra()?->getCompra()?->getOperacion();
  1286.     }
  1287.     public function getOperacionCompra():?Operacion
  1288.     {
  1289.         //return $this->getDetalleCompra()?->getCompra()?->getOperacion()->filter(fn($operacion) => $operacion->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_CONFIRMADA || $operacion->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA);
  1290.         return $this->operacionCompra;
  1291.     }
  1292.     public function getOperacionGestionCompra():?Operacion
  1293.     {
  1294.         return $this->getOperacionCompra()??$this->getOperacionGestion();
  1295.     }
  1296.     public function getOperacionVenta():?Operacion
  1297.     {
  1298.         /*$detalle = $this->getDetalleVenta();
  1299.         if($detalle->count() !== 1 && $detalle->count() !== 0) throw new Exception('ERROR, PENDIENTE de resolver / controlar');
  1300.         return $detalle->count() === 0 ? null : $this->getDetalleVenta()->first()->getVenta()?->getOperacion();*/
  1301.         return $this->operacionVenta;
  1302.     }
  1303.     public function getRecompra(): ?float
  1304.     {
  1305.         return $this->recompra;
  1306.     }
  1307.     public function setRecompra(?float $recompra): static
  1308.     {
  1309.         $this->recompra $recompra;
  1310.         return $this;
  1311.     }
  1312.     public function getGarantia(): ?string
  1313.     {
  1314.         return $this->garantia;
  1315.     }
  1316.     public function setGarantia(?string $garantia): static
  1317.     {
  1318.         $this->garantia $garantia;
  1319.         return $this;
  1320.     }
  1321.     public function getOperacionGestion(): ?Operacion
  1322.     {
  1323.         return $this->operacionGestion;
  1324.     }
  1325.     public function setOperacionGestion(?Operacion $operacionGestion): static
  1326.     {
  1327.         $this->operacionGestion $operacionGestion;
  1328.         return $this;
  1329.     }
  1330.     public function setOperacionVenta(?Operacion $operacionVenta): static
  1331.     {
  1332.         $this->operacionVenta $operacionVenta;
  1333.         return $this;
  1334.     }
  1335.     public function setOperacionCompra(?Operacion $operacionCompra): static
  1336.     {
  1337.         $this->operacionCompra $operacionCompra;
  1338.         return $this;
  1339.     }
  1340.     public function getActividadCompra(): ?ActividadCompra
  1341.     {
  1342.         return $this->actividadCompra;
  1343.     }
  1344.     public function setActividadCompra(?ActividadCompra $actividadCompra): static
  1345.     {
  1346.         // unset the owning side of the relation if necessary
  1347.         if ($actividadCompra === null && $this->actividadCompra !== null) {
  1348.             $this->actividadCompra->setReloj(null);
  1349.         }
  1350.         // set the owning side of the relation if necessary
  1351.         if ($actividadCompra !== null && $actividadCompra->getReloj() !== $this) {
  1352.             $actividadCompra->setReloj($this);
  1353.         }
  1354.         $this->actividadCompra $actividadCompra;
  1355.         return $this;
  1356.     }
  1357.     public function getActividadVenta(): ?ActividadVenta
  1358.     {
  1359.         return $this->actividadVenta;
  1360.     }
  1361.     public function setActividadVenta(?ActividadVenta $actividadVenta): static
  1362.     {
  1363.         // unset the owning side of the relation if necessary
  1364.         if ($actividadVenta === null && $this->actividadVenta !== null) {
  1365.             $this->actividadVenta->setReloj(null);
  1366.         }
  1367.         // set the owning side of the relation if necessary
  1368.         if ($actividadVenta !== null && $actividadVenta->getReloj() !== $this) {
  1369.             $actividadVenta->setReloj($this);
  1370.         }
  1371.         $this->actividadVenta $actividadVenta;
  1372.         return $this;
  1373.     }
  1374.     public function getPeso(): ?float
  1375.     {
  1376.         return $this->peso;
  1377.     }
  1378.     public function setPeso(?float $peso): static
  1379.     {
  1380.         $this->peso $peso;
  1381.         return $this;
  1382.     }
  1383.     public function getDescripcion(): ?string
  1384.     {
  1385.         return $this->descripcion;
  1386.     }
  1387.     public function setDescripcion(?string $descripcion): static
  1388.     {
  1389.         $this->descripcion $descripcion;
  1390.         return $this;
  1391.     }
  1392.     public function getFechaStr(): ?string
  1393.     {
  1394.         return $this->fecha?->format("d/m/Y");
  1395.     }
  1396.     public function getExportPeso():?string
  1397.     {
  1398.         return number_format($this->peso2',''.') . ' g.';
  1399.     }
  1400.     public function getExportPrecioCompra():?string
  1401.     {
  1402.         return number_format($this->precioCompra2',''.') . ' €';
  1403.     }
  1404.     /**
  1405.      * @return Collection<int, DetalleCompra>
  1406.      */
  1407.     public function getDetalleCompra(): Collection
  1408.     {
  1409.         return $this->detalleCompra;
  1410.     }
  1411.     public function getDetalleCompraAsentada(): ?DetalleCompra
  1412.     {
  1413.         return ($this->getDetalleCompra()->filter(fn($dc) => $dc->getCompra()->getOperacion()->getTipo() === TipoOperacionEnum::OPERACION_COMPRA || $dc->getCompra()->getOperacion()->getTipo() === TipoOperacionEnum::OPERACION_PERMUTA))->first();
  1414.     }
  1415.     public function addDetalleCompra(DetalleCompra $detalleCompra): static
  1416.     {
  1417.         if (!$this->detalleCompra->contains($detalleCompra)) {
  1418.             $this->detalleCompra->add($detalleCompra);
  1419.             $detalleCompra->setReloj($this);
  1420.         }
  1421.         return $this;
  1422.     }
  1423.     public function removeDetalleCompra(DetalleCompra $detalleCompra): static
  1424.     {
  1425.         if ($this->detalleCompra->removeElement($detalleCompra)) {
  1426.             // set the owning side to null (unless already changed)
  1427.             if ($detalleCompra->getReloj() === $this) {
  1428.                 $detalleCompra->setReloj(null);
  1429.             }
  1430.         }
  1431.         return $this;
  1432.     }
  1433.     public function getTiempoEnVenta(): ?int
  1434.     {
  1435.         return $this->tiempoEnVenta;
  1436.     }
  1437.     public function setTiempoEnVenta(?int $tiempoEnVenta): static
  1438.     {
  1439.         $this->tiempoEnVenta $tiempoEnVenta;
  1440.         return $this;
  1441.     }
  1442.     public function getTiempoEnStock(): ?int
  1443.     {
  1444.         return $this->tiempoEnStock;
  1445.     }
  1446.     public function setTiempoEnStock(?int $tiempoEnStock): static
  1447.     {
  1448.         $this->tiempoEnStock $tiempoEnStock;
  1449.         return $this;
  1450.     }
  1451.     public function getFechaRecepcion(): ?DateTimeInterface
  1452.     {
  1453.         return $this->fechaRecepcion;
  1454.     }
  1455.     public function getFechaRecepcionStr(): ?string
  1456.     {
  1457.         return $this->fechaRecepcion?->format("d/m/Y");
  1458.     }
  1459.     public function setFechaRecepcion(?DateTimeInterface $fechaRecepcion): static
  1460.     {
  1461.         $this->fechaRecepcion $fechaRecepcion;
  1462.         return $this;
  1463.     }
  1464.     public function getFechaValoracion(): ?DateTimeInterface
  1465.     {
  1466.         return $this->fechaValoracion;
  1467.     }
  1468.     public function setFechaValoracion(?DateTimeInterface $fechaValoracion): static
  1469.     {
  1470.         $this->fechaValoracion $fechaValoracion;
  1471.         return $this;
  1472.     }
  1473.     public function getFechaAnuncio(): ?DateTimeInterface
  1474.     {
  1475.         return $this->fechaAnuncio;
  1476.     }
  1477.     public function setFechaAnuncio(?DateTimeInterface $fechaAnuncio): static
  1478.     {
  1479.         $this->fechaAnuncio $fechaAnuncio;
  1480.         return $this;
  1481.     }
  1482.     public function getValoracion(): ?Valoracion
  1483.     {
  1484.         return $this->valoracion;
  1485.     }
  1486.     public function setValoracion(?Valoracion $valoracion): static
  1487.     {
  1488.         $this->valoracion $valoracion;
  1489.         return $this;
  1490.     }
  1491.     public function getValoracionReloj(): ?ValoracionesRelojesSinStock
  1492.     {
  1493.         return $this->valoracionReloj;
  1494.     }
  1495.     public function setValoracionReloj(?ValoracionesRelojesSinStock $valoracionReloj): static
  1496.     {
  1497.         // unset the owning side of the relation if necessary
  1498.         if ($valoracionReloj === null && $this->valoracionReloj !== null) {
  1499.             $this->valoracionReloj->setRelojInventario(null);
  1500.         }
  1501.         // set the owning side of the relation if necessary
  1502.         if ($valoracionReloj !== null && $valoracionReloj->getRelojInventario() !== $this) {
  1503.             $valoracionReloj->setRelojInventario($this);
  1504.         }
  1505.         $this->valoracionReloj $valoracionReloj;
  1506.         return $this;
  1507.     }
  1508.     public function hasBeenSold():bool
  1509.     {
  1510.         if($this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO) return true;
  1511.         $criteria Criteria::create()
  1512.             ->orderBy(['fecha' => Criteria::DESC])
  1513.             ->setMaxResults(1);
  1514.         $ultimaAccion $this->getPromociones()?->getAcciones()
  1515.             ?->filter(fn($accion) => $accion instanceof AccionEstado)
  1516.             ?->matching($criteria)
  1517.             ?->first();
  1518.         return $ultimaAccion?->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO;
  1519.     }
  1520. }