src/Entity/Reloj.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\CalibreEnum;
  4. use App\Enum\EstadoOperacionEnum;
  5. use App\Enum\EstadoRelojEnum;
  6. use App\Enum\GeneroRelojEnum;
  7. use App\Enum\PiezaRepuestoEnum;
  8. use App\Enum\ServicioMantenimientoEnum;
  9. use App\Enum\TipoCierreEnum;
  10. use App\Enum\TipoCristalEnum;
  11. use App\Enum\TipoEsferaIndiceEnum;
  12. use App\Enum\TipoOperacionEnum;
  13. use DateTime;
  14. use DateTimeInterface;
  15. use Doctrine\Common\Collections\ArrayCollection;
  16. use Doctrine\Common\Collections\Collection;
  17. use Doctrine\Common\Collections\Criteria;
  18. use Doctrine\Common\Collections\Order;
  19. use Doctrine\DBAL\Types\Types;
  20. use Doctrine\ORM\EntityNotFoundException;
  21. use Doctrine\ORM\Mapping as ORM;
  22. use JMS\Serializer\Annotation as JMS;
  23. use Gedmo\Mapping\Annotation as Gedmo;
  24. use Symfony\Component\HttpFoundation\File\File;
  25. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  26. /**
  27.  * @ORM\Entity(repositoryClass="App\Repository\RelojRepository")
  28.  * @ORM\Table(name="reloj")
  29.  * @ORM\EntityListeners({"App\EntityListener\Reloj\CalcularIDPerseoListener", "App\EntityListener\Reloj\CalcularCodigoListener"})
  30.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  31.  * @Vich\Uploadable
  32.  */
  33. class Reloj
  34. {
  35.     /**
  36.      * @ORM\Id
  37.      * @ORM\Column(type="bigint", options={"unsigned":true})
  38.      * @ORM\GeneratedValue(strategy="AUTO")
  39.      * @JMS\Groups({
  40.      *       "api_v1_reloj_serialize",
  41.      *       "api_v1_valoracion_serialize",
  42.      *       "api_v1_operacion_show_serialize"
  43.      *   })
  44.      */
  45.     protected $id;
  46.     /**
  47.      * @ORM\Column(type="string", unique=true, nullable=false)
  48.      * @JMS\Groups({
  49.      *        "api_v1_reloj_serialize",
  50.      *        "api_v1_valoracion_serialize",
  51.      *        "api_v1_operacion_show_serialize"
  52.      *    })
  53.      */
  54.     protected $codigo;
  55.     /**
  56.      * @ORM\Column(
  57.      *     type="string",
  58.      *     unique=true,
  59.      *     nullable=false,
  60.      *     name="id_perseo",
  61.      *     options={"comment":"Identificador de perseo único generado aleatoriamente combinación letras y números"}
  62.      * )
  63.      * @JMS\Groups({
  64.      *        "api_v1_reloj_serialize",
  65.      *        "api_v1_valoracion_serialize",
  66.      *        "api_v1_operacion_show_serialize"
  67.      *    })
  68.      */
  69.     protected $IDperseo;
  70.     /**
  71.      * @ORM\Column(
  72.      *     type="string",
  73.      *     length=4,
  74.      *     nullable=true,
  75.      *     options={"comment":"Valores a tomar REBU ó IVA, por defecto REBU"}
  76.      * )
  77.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  78.      */
  79.     protected $regimen;
  80.     /**
  81.      * @ORM\Column(type="string", nullable=true)
  82.      * @JMS\Groups({
  83.      *     "api_v1_reloj_serialize",
  84.      *     "api_v1_valoracion_serialize",
  85.      *     "api_v1_operacion_show_serialize"
  86.      * })
  87.      */
  88.     protected $foto;
  89.     /**
  90.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto")
  91.      * @var File
  92.      */
  93.     protected $fotoFile;
  94.     /**
  95.      * @ORM\Column(type="string", nullable=true, name="foto_valoracion")
  96.      * @JMS\Groups({
  97.      *     "api_v1_reloj_serialize",
  98.      *     "api_v1_valoracion_serialize"
  99.      * })
  100.      */
  101.     private $fotoValoracion;
  102.     /**
  103.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_valoracion")
  104.      * @var File
  105.      */
  106.     protected $fotoValoracionFile;
  107.     /**
  108.      * @ORM\Column(type="string", nullable=true, name="foto_set")
  109.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  110.      */
  111.     private $fotoSet;
  112.     /**
  113.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_set")
  114.      * @var File
  115.      */
  116.     protected $fotoSetFile;
  117.     /**
  118.      * @ORM\Column(type="string", nullable=true, name="foto_crono", options={"comment":"foto del cronocomparador"})
  119.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  120.      */
  121.     private $fotoCrono;
  122.     /**
  123.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_crono")
  124.      * @var File
  125.      */
  126.     protected $fotoCronoFile;
  127.     /**
  128.      * @ORM\Column(type="string", nullable=true)
  129.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  130.      */
  131.     private $video;
  132.     /**
  133.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="video")
  134.      * @var File
  135.      */
  136.     protected $videoFile;
  137.     /**
  138.      * @ORM\Column(type="string", nullable=true)
  139.      * @JMS\Groups({
  140.      *        "api_v1_reloj_serialize",
  141.      *        "api_v1_valoracion_serialize",
  142.      *        "api_v1_operacion_show_serialize"
  143.      *    })
  144.      */
  145.     protected $modelo1;
  146.     /**
  147.      * @ORM\Column(type="string", nullable=true)
  148.      * @JMS\Groups({
  149.      *        "api_v1_reloj_serialize",
  150.      *        "api_v1_valoracion_serialize",
  151.      *        "api_v1_operacion_show_serialize"
  152.      *    })
  153.      */
  154.     protected $modelo2;
  155.     /**
  156.      * @ORM\Column(type="string", nullable=true)
  157.      * @JMS\Groups({
  158.      *        "api_v1_reloj_serialize",
  159.      *        "api_v1_valoracion_serialize",
  160.      *        "api_v1_operacion_show_serialize"
  161.      *    })
  162.      */
  163.     protected $ref1;
  164.     /**
  165.      * @ORM\Column(type="string", nullable=true)
  166.      * @JMS\Groups({
  167.      *        "api_v1_reloj_serialize",
  168.      *        "api_v1_valoracion_serialize",
  169.      *        "api_v1_operacion_show_serialize"
  170.      *    })
  171.      */
  172.     protected $ref2;
  173.     /**
  174.      * @ORM\Column(type="string", nullable=true)
  175.      * @JMS\Groups({
  176.      *     "api_v1_reloj_serialize",
  177.      *     "api_v1_valoracion_serialize",
  178.      *     "api_v1_operacion_show_serialize"
  179.      * })
  180.      */
  181.     protected $serie;
  182.     /**
  183.      * @ORM\Column(type="float", nullable=true, precision=2)
  184.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  185.      */
  186.     protected $peso;
  187.     /**
  188.      * @ORM\Column(type="datetime", nullable=true, options={"comment":"Fecha comprado por  primera vez"})
  189.      * @JMS\Groups({
  190.      *     "api_v1_reloj_serialize",
  191.      *     "api_v1_valoracion_serialize",
  192.      *     "api_v1_operacion_show_serialize"
  193.      * })
  194.      */
  195.     protected $fecha;
  196.     /**
  197.      * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  198.      * @JMS\Groups({
  199.      *      "api_v1_reloj_serialize",
  200.      *      "api_v1_valoracion_serialize",
  201.      *      "api_v1_operacion_show_serialize"
  202.      *  })
  203.      */
  204.     protected $caja;
  205.     /**
  206.      * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  207.      * @JMS\Groups({
  208.      *      "api_v1_reloj_serialize",
  209.      *      "api_v1_valoracion_serialize",
  210.      *      "api_v1_operacion_show_serialize"
  211.      *  })
  212.      */
  213.     protected $papeles;
  214.     /**
  215.      * @ORM\Column(type="text", nullable=true)
  216.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  217.      */
  218.     protected $otros;
  219.     /**
  220.      * @ORM\Column(type="float", nullable=true, name="itp", precision=2, options={"default":"0.0","comment":"%"})
  221.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  222.      */
  223.     protected $ITP;
  224.     /**
  225.      * @ORM\Column(
  226.      *     type="datetime",
  227.      *     nullable=true,
  228.      *     name="fecha_valoracion",
  229.      *     options={"comment":"Fecha valoracion es la fecha enviada"}
  230.      * )
  231.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  232.      */
  233.     private $fechaValoracion;
  234.     /**
  235.      * @ORM\Column(
  236.      *     type="float",
  237.      *     nullable=true,
  238.      *     options={
  239.      *         "default":"0.0",
  240.      *         "comment":"Comsión CRONO esta en gastos , pero se duplica fuera para tener mejor acceso a ella %"
  241.      *     }
  242.      * )
  243.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  244.      */
  245.     protected $comision;
  246.     /**
  247.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_coste")
  248.      * @JMS\Groups({
  249.      *     "api_v1_reloj_serialize",
  250.      *     "api_v1_valoracion_serialize"
  251.      * })
  252.      */
  253.     protected $precioCoste;
  254.     /**
  255.      * @ORM\Column(
  256.      *     type="float",
  257.      *     nullable=true,
  258.      *     name="precio_coste_total",
  259.      *     precision=2,
  260.      *     options={
  261.      *         "default":"0.0",
  262.      *         "comment":"Autocalculado, cada vez que se añade/modifique un coste ó cambie su coste (Coste del Reloj + Costes Asociados)"
  263.      *     }
  264.      * )
  265.      * @JMS\Groups({
  266.      *     "api_v1_reloj_serialize",
  267.      *     "api_v1_valoracion_serialize",
  268.      *     "api_v1_operacion_show_serialize"
  269.      * })
  270.      */
  271.     protected $precioCosteTotal;
  272.     /**
  273.      * @ORM\Column(
  274.      *     type="string",
  275.      *     nullable=true,
  276.      *     name="genero",
  277.      *     enumType="App\Enum\GeneroRelojEnum",
  278.      *     options={"comment":"Opciones caballero, mujer, unisex"}
  279.      * )
  280.      */
  281.     private $genero;
  282.     /**
  283.      * @ORM\Column(
  284.      *     type="smallint",
  285.      *     length=1,
  286.      *     nullable=true,
  287.      *     name="estado_caja",
  288.      *     options={"comment":"valores a tomar de 1 a 5"}
  289.      * )
  290.      */
  291.     private $estadoCaja;
  292.     /**
  293.      * @ORM\Column(
  294.      *     type="smallint",
  295.      *     length=1,
  296.      *     nullable=true,
  297.      *     name="estado_cristal",
  298.      *     options={"comment":"valores a tomar de 1 a 5"}
  299.      * )
  300.      */
  301.     private $estadoCristal;
  302.     /**
  303.      * @ORM\Column(
  304.      *     type="smallint",
  305.      *     length=1,
  306.      *     nullable=true,
  307.      *     name="estado_dial",
  308.      *     options={"comment":"valores a tomar de 1 a 5"}
  309.      * )
  310.      */
  311.     private $estadoDial;
  312.     /**
  313.      * @ORM\Column(
  314.      *     type="smallint",
  315.      *     length=1,
  316.      *     nullable=true,
  317.      *     name="estado_agujas",
  318.      *     options={"comment":"valores a tomar de 1 a 5"}
  319.      * )
  320.      */
  321.     private $estadoAgujas;
  322.     /**
  323.      * @ORM\Column(
  324.      *     type="smallint",
  325.      *     length=1,
  326.      *     nullable=true,
  327.      *     name="estado_tapa",
  328.      *     options={"comment":"valores a tomar de 1 a 5"}
  329.      * )
  330.      */
  331.     private $estadoTapa;
  332.     /**
  333.      * @ORM\Column(
  334.      *     type="smallint",
  335.      *     length=1,
  336.      *     nullable=true,
  337.      *     name="estado_correa",
  338.      *     options={"comment":"valores a tomar de 1 a 5"}
  339.      * )
  340.      */
  341.     private $estadoCorrea;
  342.     /**
  343.      * @ORM\Column(
  344.      *     type="string",
  345.      *     nullable=true,
  346.      *     enumType="App\Enum\TipoEsferaIndiceEnum",
  347.      *     name="esfera_indice",
  348.      *     options={"comment":"Opciones Arabes, Romanos, Indices, Sin Indices"}
  349.      * )
  350.      */
  351.     private $esferaIndice;
  352.     /**
  353.      * @ORM\Column(type="string", nullable=true, name="esfera_color")
  354.      */
  355.     private $esferaColor;
  356.     /**
  357.      * @ORM\Column(type="boolean", nullable=true, name="esfera_joyas", options={"default":0})
  358.      */
  359.     private $esferaJoyas;
  360.     /**
  361.      * @ORM\Column(type="integer", nullable=true, name="caja_reloj_diametro", options={"comment":"medidas en mm"})
  362.      */
  363.     private $cajaRelojDiametro;
  364.     /**
  365.      * @ORM\Column(type="integer", nullable=true, name="caja_reloj_grosor", options={"comment":"Medidas en mm"})
  366.      */
  367.     private $cajaRelojGrosor;
  368.     /**
  369.      * @ORM\Column(type="integer", nullable=true, name="caja_reloj_resistencia_agua", options={"comment":"Unidad ATM"})
  370.      */
  371.     private $cajaRelojResistenciaAgua;
  372.     /**
  373.      * @ORM\Column(
  374.      *     type="string",
  375.      *     nullable=true,
  376.      *     enumType="App\Enum\TipoCristalEnum",
  377.      *     name="caja_reloj_cristal",
  378.      *     options={"comment":"Opciones Zafiro, Mineral, Plexiglass"}
  379.      * )
  380.      */
  381.     private $cajaRelojCristal;
  382.     /**
  383.      * @ORM\Column(type="string", nullable=true, name="pulsera_color")
  384.      */
  385.     private $pulseraColor;
  386.     /**
  387.      * @ORM\Column(
  388.      *     type="string",
  389.      *     nullable=true,
  390.      *     name="pulsera_cierre",
  391.      *     enumType="App\Enum\TipoCierreEnum",
  392.      *     options={"comment":"Opciones hebilla, deployante"}
  393.      * )
  394.      */
  395.     private $pulseraCierre;
  396.     /**
  397.      * @ORM\Column(type="integer", nullable=true, name="pulsera_ancho_caja")
  398.      */
  399.     private $pulseraAnchoCaja;
  400.     /**
  401.      * @ORM\Column(type="integer", nullable=true, name="pulsera_ancho_cierre")
  402.      */
  403.     private $pulseraAnchoCierre;
  404.     /**
  405.      * @ORM\Column(type="integer", nullable=true, name="pulsera_medida_munieca")
  406.      */
  407.     private $pulseraMedidaMunieca;
  408.     /**
  409.      * @ORM\Column(
  410.      *     type="string",
  411.      *     nullable=true,
  412.      *     enumType="App\Enum\CalibreEnum",
  413.      *     options={"comment":"Opciones automático, manual, cuarzo, solar"}
  414.      * )
  415.      */
  416.     private $calibre;
  417.     /**
  418.      * @ORM\Column(type="string", nullable=true, name="calibre_avanzado")
  419.      */
  420.     private $calibreAvanzado;
  421.     /**
  422.      * @ORM\Column(type="string", nullable=true, name="calibre_basico")
  423.      */
  424.     private $calibreBasico;
  425.     /**
  426.      * @ORM\Column(type="string", nullable=true, name="calibre_reserva_marcha")
  427.      */
  428.     private $calibreReservaMarcha;
  429.     /**
  430.      * @ORM\Column(type="string", nullable=true, name="calibre_numero_joyas")
  431.      */
  432.     private $calibreNumeroJoyas;
  433.     /**
  434.      * @ORM\Column(type="string", nullable=true, name="calibre_oscilacion")
  435.      */
  436.     private $calibreOscilacion;
  437.     /**
  438.      * @ORM\Column(type="string", nullable=true, name="calibre_amplitud")
  439.      */
  440.     private $calibreAmplitud;
  441.     /**
  442.      * @ORM\Column(type="string", nullable=true, name="calibre_marcha")
  443.      */
  444.     private $calibreMarcha;
  445.     /**
  446.      * @ORM\Column(
  447.      *     type="string",
  448.      *     nullable=true,
  449.      *     enumType="App\Enum\PiezaRepuestoEnum",
  450.      *     name="piezas_repuesto",
  451.      *     options={"comment":"Opciones Si, No, No lo sé"}
  452.      * )
  453.      */
  454.     private $piezasRepuesto;
  455.     /**
  456.      * @ORM\Column(type="text", nullable=true, name="piezas_repuesto_observaciones")
  457.      */
  458.     private $piezasRepuestoObservaciones;
  459.     /**
  460.      * @ORM\Column(
  461.      *     type="string",
  462.      *     nullable=true,
  463.      *     enumType="App\Enum\ServicioMantenimientoEnum",
  464.      *     name="servicio_mantenimiento",
  465.      *     options={"comment":"Opciones Si, oficial; Si, relojero propio; No; No lo se"}
  466.      * )
  467.      */
  468.     private $servicioMantenimiento;
  469.     /**
  470.      * @ORM\Column(
  471.      *     type="json",
  472.      *     nullable=true,
  473.      *     name="calibre_caracteristicas",
  474.      *     options={"comment":"Opciones de caracteristicas (selector multiple)"}
  475.      * )
  476.      */
  477.     private $calibreCaracteristicas;
  478.     /**
  479.      * @ORM\Column(
  480.      *     type="json",
  481.      *     nullable=true,
  482.      *     name="calibre_funciones",
  483.      *     options={"comment":"Opciones de caracteristicas (selector multiple)"}
  484.      * )
  485.      */
  486.     private $calibreFunciones;
  487.     /**
  488.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_min_venta")
  489.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  490.      */
  491.     protected $precioMinVenta;
  492.     /**
  493.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_promocion", options={"default":"0.0"})
  494.      * @JMS\Groups({
  495.      *     "api_v1_reloj_serialize",
  496.      *     "api_v1_valoracion_serialize",
  497.      *     "api_v1_operacion_show_serialize"
  498.      * })
  499.      */
  500.     protected $precioPromocion;
  501.     /**
  502.      * @ORM\Column(type="datetime", nullable=true, name="fecha_promocion")
  503.      * @JMS\Groups({
  504.      *     "api_v1_reloj_serialize",
  505.      *     "api_v1_valoracion_serialize"
  506.      * })
  507.      */
  508.     protected $fechaPromocion;
  509.     /**
  510.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_oferta")
  511.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  512.      */
  513.     protected $precioOferta;
  514.     /**
  515.      * @deprecated Por cambios de funcionalidad
  516.      * @ORM\Column(type="boolean", nullable=true, precision=2, name="chrono24")
  517.      */
  518.     protected $chrono24;
  519.     /**
  520.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_pagar")
  521.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  522.      */
  523.     protected $precioPagar;
  524.     /**
  525.      * @ORM\Column(
  526.      *     type="boolean",
  527.      *     nullable=true,
  528.      *     options={
  529.      *         "default":1,
  530.      *         "comment":"Valor por defecto: **true**.
  531.      *         Cuando la operación se origina dentro de un proceso de **gestión**, el valor se establece en **false**.
  532.      *         Este campo permite identificar si una compra ha sido realizada **fuera del circuito de gestión**, independientemente de que el reloj esté o haya estado previamente vinculado a una operación de gestión."
  533.      *     }
  534.      * )
  535.      */
  536.     private $compraDirecta;
  537.     /**
  538.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_compra")
  539.      * @JMS\Groups({
  540.      *     "api_v1_reloj_serialize",
  541.      *     "api_v1_valoracion_serialize"
  542.      * })
  543.      */
  544.     protected $precioCompra;
  545.     /**
  546.      * @ORM\Column(type="datetime", nullable=true, name="fecha_compra")
  547.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  548.      * @JMS\Groups({
  549.      *         "api_v1_reloj_serialize"
  550.      *     })
  551.      */
  552.     protected $fechaCompra;
  553.     /**
  554.      * @ORM\Column(type="float", nullable=true, precision=2)
  555.      * @JMS\Groups({
  556.      *        "api_v1_valoracion_serialize",
  557.      *        "api_v1_reloj_serialize"
  558.      *    })
  559.      */
  560.     protected $precioVenta;
  561.     /**
  562.      * @ORM\Column(type="datetime", nullable=true, name="fecha_venta")
  563.      * @JMS\Groups({
  564.      *        "api_v1_valoracion_serialize",
  565.      *        "api_v1_reloj_serialize"
  566.      *    })
  567.      */
  568.     protected $fechaVenta;
  569.     /**
  570.      * @ORM\Column(type="float", nullable=true, precision=2)
  571.      * @JMS\Groups({
  572.      *     "api_v1_reloj_serialize",
  573.      *     "api_v1_valoracion_serialize",
  574.      *     "api_v1_operacion_show_serialize"
  575.      * })
  576.      */
  577.     protected $precioVentaTotal;
  578.     /**
  579.      * @ORM\Column(type="datetime", nullable=true, name="fecha_baja")
  580.      * @JMS\Groups({
  581.      *        "api_v1_valoracion_serialize",
  582.      *        "api_v1_reloj_serialize"
  583.      *    })
  584.      */
  585.     protected $fechaBaja;
  586.     /**
  587.      * @ORM\Column(type="float", nullable=true, precision=0, name="margen_minimo")
  588.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  589.      */
  590.     protected $margenMinimo;
  591.     /**
  592.      * @ORM\Column(type="float", nullable=true, precision=0, name="margen_deseado")
  593.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  594.      */
  595.     protected $margenDeseado;
  596.     /**
  597.      * @ORM\Column(type="float", nullable=true, precision=2)
  598.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  599.      */
  600.     private $recompra;
  601.     /**
  602.      * @ORM\Column(type="string", nullable=true)
  603.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  604.      */
  605.     private $garantia;
  606.     /**
  607.      * @ORM\Column(type="string", nullable=true)
  608.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  609.      */
  610.     private $descripcion;
  611.     /**
  612.      * @ORM\Column(type="text", nullable=true, name="descripcion_detallada")
  613.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  614.      */
  615.     private $descripcionDetallada;
  616.     /**
  617.      * @ORM\Column(type="text", nullable=true)
  618.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  619.      */
  620.     private $condiciones;
  621.     /**
  622.      * @ORM\Column(type="text", nullable=true, name="anuncio_es")
  623.      */
  624.     private $anuncioES;
  625.     /**
  626.      * @ORM\Column(type="text", nullable=true, name="anuncio_en")
  627.      */
  628.     private $anuncioEN;
  629.     /**
  630.      * @ORM\Column(
  631.      *     type="integer",
  632.      *     nullable=true,
  633.      *     name="tiempo_en_venta",
  634.      *     options={"comment":"Diff entre Fecha Venta y 1º Estado de Anuncio"}
  635.      * )
  636.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  637.      */
  638.     private $tiempoEnVenta;
  639.     /**
  640.      * @ORM\Column(
  641.      *     type="integer",
  642.      *     nullable=true,
  643.      *     name="tiempo_en_stock",
  644.      *     options={"comment":"Diff entre Fecha Venta y Fecha Compra"}
  645.      * )
  646.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  647.      */
  648.     private $tiempoEnStock;
  649.     /**
  650.      * @ORM\Column(type="datetime", nullable=true, name="fecha_recepcion")
  651.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  652.      */
  653.     private $fechaRecepcion;
  654.     /**
  655.      * @ORM\Column(
  656.      *     type="float",
  657.      *     nullable=true,
  658.      *     precision=0,
  659.      *     name="margen_promocion",
  660.      *     options={"default":"0.0","comment":"%"}
  661.      * )
  662.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  663.      */
  664.     protected $margenPromocion;
  665.     /**
  666.      * @ORM\Column(
  667.      *     type="float",
  668.      *     nullable=true,
  669.      *     precision=0,
  670.      *     name="margen_bruto",
  671.      *     options={"default":"0.0","comment":"%"}
  672.      * )
  673.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  674.      */
  675.     protected $margenBruto;
  676.     /**
  677.      * @ORM\Column(type="float", nullable=true, name="margen_neto", precision=2,
  678.      *     options={"default":"0.0","comment":"%"})
  679.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  680.      */
  681.     protected $margenNeto;
  682.     /**
  683.      * @ORM\Column(type="boolean", nullable=false, options={"default":0,"comment":"Relojes comprados"})
  684.      */
  685.     protected $stock;
  686.     /**
  687.      * @ORM\Column(type="boolean", nullable=true, options={"default":0,"comment":"Relojes en Gestión de Venta"})
  688.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  689.      */
  690.     protected $custodia;
  691.     /**
  692.      * @ORM\Column(type="float", nullable=true, name="tiempo_venta", precision=2,
  693.      *     options={"default":"0.0","comment":"%"})
  694.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  695.      */
  696.     protected $tiempoVenta;
  697.     /**
  698.      * @ORM\Column(type="datetime", nullable=true, name="fecha_anuncio", options={"comment":"Fecha primer anuncio"})
  699.      * @JMS\Groups({
  700.      *     "api_v1_reloj_serialize",
  701.      *     "api_v1_valoracion_serialize"
  702.      * })
  703.      */
  704.     private $fechaAnuncio;
  705.     /**
  706.      * @ORM\Column(type="text", nullable=true)
  707.      * @JMS\Groups({
  708.      *     "api_v1_reloj_serialize",
  709.      *     "api_v1_valoracion_serialize"
  710.      * })
  711.      */
  712.     protected $comentario;
  713.     /**
  714.      * @ORM\Column(
  715.      *     type="string",
  716.      *     unique=true,
  717.      *     nullable=true,
  718.      *     name="token_access",
  719.      *     options={"comment":"Token de acceso a la información del reloj"}
  720.      * )
  721.      */
  722.     protected $tokenAccess;
  723.     /**
  724.      * @ORM\Column(
  725.      *     type="boolean",
  726.      *     nullable=true,
  727.      *     name="en_promocion",
  728.      *     options={"default":0,"comment":"Cuando la Estado Operacion es Confirmada"}
  729.      * )
  730.      */
  731.     protected $enPromocion;
  732.     /**
  733.      * @ORM\Column(
  734.      *     type="boolean",
  735.      *     nullable=true,
  736.      *     name="en_servicio",
  737.      *     options={"default":0,"comment":"Relojes Recepcionados y que se encuentren en una Ubicación tipo Proveedor"}
  738.      * )
  739.      */
  740.     protected $enServicio;
  741.     /**
  742.      * @ORM\Column(
  743.      *     type="boolean",
  744.      *     nullable=true,
  745.      *     name="sin_anunciar",
  746.      *     options={"default":0,"comment":"Relojes Estado Listo y no han sido promocionados"}
  747.      * )
  748.      */
  749.     protected $sinAnunciar;
  750.     /**
  751.      * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  752.      */
  753.     protected $enVenta;
  754.     /**
  755.      * @ORM\Column(
  756.      *     type="boolean",
  757.      *     nullable=true,
  758.      *     name="tipo_bloqueo",
  759.      *     options={"comment":"Valores a tomar RM(true) ó RI(false) ó NULL"}
  760.      * )
  761.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  762.      */
  763.     protected $tipoBloqueo;
  764.     /**
  765.      * @ORM\Column(type="boolean", nullable=true)
  766.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  767.      */
  768.     protected $exportacion;
  769.     /**
  770.      * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  771.      * @JMS\Groups({
  772.      *        "api_v1_valoracion_serialize",
  773.      *        "api_v1_reloj_serialize"
  774.      *    })
  775.      */
  776.     protected $deletedAt;
  777.     /**
  778.      * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  779.      * @Gedmo\Timestampable(on="update")
  780.      */
  781.     protected $updatedAt;
  782.     /**
  783.      * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  784.      * @Gedmo\Timestampable(on="create")
  785.      * @JMS\Groups({
  786.      *        "api_v1_reloj_serialize",
  787.      *        "api_v1_valoracion_serialize",
  788.      *        "api_v1_operacion_show_serialize"
  789.      *    })
  790.      */
  791.     protected $createdAt;
  792.     /**
  793.      * @ORM\OneToOne(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, mappedBy="relojInventario")
  794.      */
  795.     private $valoracionReloj;
  796.     /**
  797.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleCompra::class, mappedBy="reloj")
  798.      */
  799.     protected $detalleCompra;
  800.     /**
  801.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleCompra::class, mappedBy="relojBase")
  802.      */
  803.     private $relojesDerivadosDetalleCompra;
  804.     /**
  805.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleVenta::class, mappedBy="reloj")
  806.      */
  807.     protected $detalleVenta;
  808.     /**
  809.      * @ORM\OneToOne(targetEntity=\App\Entity\RegistroPolicial::class, mappedBy="reloj")
  810.      */
  811.     protected $registroPolicial;
  812.     /*
  813.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadAbstract::class, mappedBy="reloj")
  814.      */
  815.     private $actividad;
  816.     /**
  817.      * @ORM\OneToOne(targetEntity=\App\Entity\Promocion::class, mappedBy="reloj")
  818.      */
  819.     protected $promociones;
  820.     /**
  821.      * @ORM\OneToMany(targetEntity="App\Entity\Gasto", mappedBy="reloj")
  822.      */
  823.     protected $gastos;
  824.     /**
  825.      * @ORM\OneToMany(targetEntity="App\Entity\Trazabilidad", mappedBy="reloj")
  826.      */
  827.     protected $trazas;
  828.     /**
  829.      * @ORM\OneToMany(targetEntity="App\Entity\ValoracionesRelojes", mappedBy="reloj", cascade={"persist"})
  830.      */
  831.     protected $valoracionesRelojes;
  832.     /**
  833.      * @ORM\OneToMany(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, mappedBy="relojBase")
  834.      */
  835.     private $relojesDerivadosValoracionSinStock;
  836.     /**
  837.      * @ORM\OneToMany(targetEntity=\App\Entity\Reloj::class, mappedBy="relojBase")
  838.      */
  839.     private $relojesDerivados;
  840.     /**
  841.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoReloj", inversedBy="relojes")
  842.      * @ORM\JoinColumn(name="estado_reloj_id", referencedColumnName="id", nullable=true)
  843.      * @JMS\Type(EstadoReloj::class)
  844.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  845.      */
  846.     protected $estado;
  847.     /**
  848.      * @ORM\ManyToOne(targetEntity="App\Entity\Marca", inversedBy="relojes")
  849.      * @ORM\JoinColumn(name="marca_id", referencedColumnName="id")
  850.      * @JMS\Type(Marca::class)
  851.      * @JMS\Groups({
  852.      *     "api_v1_reloj_serialize",
  853.      *     "api_v1_valoracion_serialize",
  854.      *     "api_v1_operacion_show_serialize"
  855.      * })
  856.      */
  857.     protected $marca;
  858.     /**
  859.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoAspecto", inversedBy="relojes")
  860.      * @ORM\JoinColumn(name="estado_aspecto_id", referencedColumnName="id")
  861.      * @JMS\Type(EstadoAspecto::class)
  862.      * @JMS\Groups({
  863.      *     "api_v1_valoracion_serialize",
  864.      *     "api_v1_operacion_show_serialize"
  865.      * })
  866.      */
  867.     protected $aspecto;
  868.     /**
  869.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoCheck", inversedBy="relojes")
  870.      * @ORM\JoinColumn(name="estado_check_id", referencedColumnName="id")
  871.      */
  872.     protected $check;
  873.     /*
  874.      * @ORM\OneToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojGestion")
  875.      * @ORM\JoinColumn(name="operacion_gestion_id", referencedColumnName="id", unique=true)
  876.      */
  877.     /**
  878.      * @ORM\JoinColumn(name="operacion_gestion_id", referencedColumnName="id")
  879.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesGestion")
  880.      */
  881.     private $operacionGestion;
  882.     /**
  883.      * @ORM\JoinColumn(name="operacion_venta_id", referencedColumnName="id")
  884.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesVenta")
  885.      */
  886.     private $operacionVenta;
  887.     /**
  888.      * @ORM\JoinColumn(name="operacion_compra_id", referencedColumnName="id")
  889.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesCompra")
  890.      */
  891.     private $operacionCompra;
  892.     /**
  893.      * @ORM\ManyToOne(targetEntity=\App\Entity\Valoracion::class, inversedBy="relojes")
  894.      * @ORM\JoinColumn(name="valoracion_id", referencedColumnName="id")
  895.      */
  896.     private $valoracion;
  897.     /**
  898.      * @ORM\ManyToOne(targetEntity=\App\Entity\Empresa::class, inversedBy="relojes")
  899.      * @ORM\JoinColumn(name="empresa_id", referencedColumnName="id", nullable=false)
  900.      */
  901.     private $empresa;
  902.     /**
  903.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesCajaRelojMaterial")
  904.      * @ORM\JoinColumn(name="caja_reloj_material_id", referencedColumnName="id")
  905.      */
  906.     private $cajaRelojMaterial;
  907.     /**
  908.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesCajaRelojMaterialBisel")
  909.      * @ORM\JoinColumn(name="caja_reloj_bisel_material_id", referencedColumnName="id")
  910.      */
  911.     private $cajaRelojMaterialBisel;
  912.     /**
  913.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesPulseraMaterial")
  914.      * @ORM\JoinColumn(name="pulsera_material_id", referencedColumnName="id")
  915.      */
  916.     private $pulseraMaterial;
  917.     /**
  918.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesPulseraMaterialCierre")
  919.      * @ORM\JoinColumn(name="pulsera_material_cierre_id", referencedColumnName="id")
  920.      */
  921.     private $pulseraMaterialCierre;
  922.     /**
  923.      * @ORM\ManyToOne(targetEntity=\App\Entity\Reloj::class, inversedBy="relojesDerivados")
  924.      * @ORM\JoinColumn(name="reloj_base_id", referencedColumnName="id")
  925.      */
  926.     private $relojBase;
  927.     /**
  928.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadCompra::class, mappedBy="reloj")
  929.      */
  930.     private $actividadCompra;
  931.     /**
  932.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadVenta::class, mappedBy="reloj")
  933.      */
  934.     private $actividadVenta;
  935.     private $fechaStr;
  936.     public function __construct()
  937.     {
  938.         $this->reservado false;
  939.         $this->papeles false;
  940.         $this->caja false;
  941.         $this->stock false;
  942.         $this->custodia false;
  943.         $this->gastos = new ArrayCollection();
  944.         $this->trazas = new ArrayCollection();
  945.         $this->valoracionesRelojes = new ArrayCollection();
  946.         $this->detalleVenta = new ArrayCollection();
  947.         $this->detalleCompra = new ArrayCollection();
  948.         $this->relojesDerivadosDetalleCompra = new ArrayCollection();
  949.         $this->relojesDerivadosValoracionSinStock = new ArrayCollection();
  950.         $this->relojesDerivados = new ArrayCollection();
  951.     }
  952.     public function __toString(): string
  953.     {
  954.         return (string)($this->getCodigo() ?? $this->getIDperseo());
  955.     }
  956.     public function getId(): ?int
  957.     {
  958.         return $this->id;
  959.     }
  960.     public function getIDperseo(): ?string
  961.     {
  962.         return $this->IDperseo;
  963.     }
  964.     public function setIDperseo(string $IDperseo): self
  965.     {
  966.         $this->IDperseo $IDperseo;
  967.         return $this;
  968.     }
  969.     public function getRegimen(): ?string
  970.     {
  971.         return $this->regimen;
  972.     }
  973.     public function setRegimen(?string $regimen): self
  974.     {
  975.         $this->regimen $regimen;
  976.         return $this;
  977.     }
  978.     public function getFoto(): ?string
  979.     {
  980.         return $this->foto;
  981.     }
  982.     public function setFoto(?string $foto): self
  983.     {
  984.         $this->foto $foto;
  985.         return $this;
  986.     }
  987.     public function getFotoFile(): ?File
  988.     {
  989.         return $this->fotoFile;
  990.     }
  991.     public function setFotoFile(?File $fotoFile): self
  992.     {
  993.         $this->fotoFile $fotoFile;
  994.         if ($fotoFile) {
  995.             // if 'updatedAt' is not defined in your entity, use another property
  996.             $this->setUpdatedAt(new DateTime('now'));
  997.         }
  998.         return $this;
  999.     }
  1000.     public function getModelo1(): ?string
  1001.     {
  1002.         return $this->modelo1;
  1003.     }
  1004.     public function setModelo1(?string $modelo1): self
  1005.     {
  1006.         $this->modelo1 $modelo1;
  1007.         return $this;
  1008.     }
  1009.     public function getModelo2(): ?string
  1010.     {
  1011.         return $this->modelo2;
  1012.     }
  1013.     public function setModelo2(?string $modelo2): self
  1014.     {
  1015.         $this->modelo2 $modelo2;
  1016.         return $this;
  1017.     }
  1018.     public function getRef1(): ?string
  1019.     {
  1020.         return $this->ref1;
  1021.     }
  1022.     public function setRef1(?string $ref1): self
  1023.     {
  1024.         $this->ref1 $ref1;
  1025.         return $this;
  1026.     }
  1027.     public function getRef2(): ?string
  1028.     {
  1029.         return $this->ref2;
  1030.     }
  1031.     public function setRef2(?string $ref2): self
  1032.     {
  1033.         $this->ref2 $ref2;
  1034.         return $this;
  1035.     }
  1036.     public function getSerie(): ?string
  1037.     {
  1038.         return $this->serie;
  1039.     }
  1040.     public function setSerie(?string $serie): self
  1041.     {
  1042.         $this->serie $serie;
  1043.         return $this;
  1044.     }
  1045.     public function getFecha(): ?DateTimeInterface
  1046.     {
  1047.         return $this->fecha;
  1048.     }
  1049.     public function setFecha(?DateTimeInterface $fecha): self
  1050.     {
  1051.         $this->fecha $fecha;
  1052.         return $this;
  1053.     }
  1054.     public function isCaja(): ?bool
  1055.     {
  1056.         return $this->caja;
  1057.     }
  1058.     public function getCaja(): ?bool
  1059.     {
  1060.         return $this->caja;
  1061.     }
  1062.     public function setCaja(bool $caja): self
  1063.     {
  1064.         $this->caja $caja;
  1065.         return $this;
  1066.     }
  1067.     public function isPapeles(): ?bool
  1068.     {
  1069.         return $this->papeles;
  1070.     }
  1071.     public function getPapeles(): ?bool
  1072.     {
  1073.         return $this->papeles;
  1074.     }
  1075.     public function setPapeles(bool $papeles): self
  1076.     {
  1077.         $this->papeles $papeles;
  1078.         return $this;
  1079.     }
  1080.     public function getOtros(): ?string
  1081.     {
  1082.         return $this->otros;
  1083.     }
  1084.     public function setOtros(?string $otros): self
  1085.     {
  1086.         $this->otros $otros;
  1087.         return $this;
  1088.     }
  1089.     public function getITP(): ?float
  1090.     {
  1091.         return $this->ITP;
  1092.     }
  1093.     public function setITP(?float $ITP): self
  1094.     {
  1095.         $this->ITP $ITP;
  1096.         return $this;
  1097.     }
  1098.     public function getComision(): ?float
  1099.     {
  1100.         return $this->comision;
  1101.     }
  1102.     public function setComision(?float $comision): self
  1103.     {
  1104.         $this->comision $comision;
  1105.         return $this;
  1106.     }
  1107.     public function getPrecioCoste(): ?float
  1108.     {
  1109.         return $this->precioCoste;
  1110.     }
  1111.     public function setPrecioCoste(?float $precioCoste): self
  1112.     {
  1113.         $this->precioCoste $precioCoste;
  1114.         return $this;
  1115.     }
  1116.     public function getPrecioCosteTotal(): ?float
  1117.     {
  1118.         return $this->precioCosteTotal;
  1119.     }
  1120.     public function setPrecioCosteTotal(?float $precioCosteTotal): self
  1121.     {
  1122.         $this->precioCosteTotal $precioCosteTotal;
  1123.         return $this;
  1124.     }
  1125.     public function getPrecioMinVenta(): ?float
  1126.     {
  1127.         return $this->precioMinVenta;
  1128.     }
  1129.     public function setPrecioMinVenta(?float $precioMinVenta): self
  1130.     {
  1131.         $this->precioMinVenta $precioMinVenta;
  1132.         return $this;
  1133.     }
  1134.     public function getPrecioPromocion(): ?float
  1135.     {
  1136.         return $this->precioPromocion;
  1137.     }
  1138.     public function setPrecioPromocion(?float $precioPromocion): self
  1139.     {
  1140.         $this->precioPromocion $precioPromocion;
  1141.         return $this;
  1142.     }
  1143.     public function getPrecioOferta(): ?float
  1144.     {
  1145.         return $this->precioOferta;
  1146.     }
  1147.     public function setPrecioOferta(?float $precioOferta): self
  1148.     {
  1149.         $this->precioOferta $precioOferta;
  1150.         return $this;
  1151.     }
  1152.     public function getPrecioPagar(): ?float
  1153.     {
  1154.         return $this->precioPagar;
  1155.     }
  1156.     public function setPrecioPagar(?float $precioPagar): self
  1157.     {
  1158.         $this->precioPagar $precioPagar;
  1159.         return $this;
  1160.     }
  1161.     public function getPrecioVenta(): ?float
  1162.     {
  1163.         return $this->precioVenta;
  1164.     }
  1165.     public function setPrecioVenta(?float $precioVenta): self
  1166.     {
  1167.         $this->precioVenta $precioVenta;
  1168.         return $this;
  1169.     }
  1170.     public function getPrecioVentaTotal(): ?float
  1171.     {
  1172.         return $this->precioVentaTotal;
  1173.     }
  1174.     public function setPrecioVentaTotal(?float $precioVentaTotal): self
  1175.     {
  1176.         $this->precioVentaTotal $precioVentaTotal;
  1177.         return $this;
  1178.     }
  1179.     public function getMargenMinimo(): ?float
  1180.     {
  1181.         return $this->margenMinimo;
  1182.     }
  1183.     public function setMargenMinimo(?float $margenMinimo): self
  1184.     {
  1185.         $this->margenMinimo $margenMinimo;
  1186.         return $this;
  1187.     }
  1188.     public function getMargenDeseado(): ?float
  1189.     {
  1190.         return $this->margenDeseado;
  1191.     }
  1192.     public function setMargenDeseado(?float $margenDeseado): self
  1193.     {
  1194.         $this->margenDeseado $margenDeseado;
  1195.         return $this;
  1196.     }
  1197.     public function getMargenPromocion(): ?float
  1198.     {
  1199.         return $this->margenPromocion;
  1200.     }
  1201.     public function setMargenPromocion(?float $margenPromocion): self
  1202.     {
  1203.         $this->margenPromocion $margenPromocion;
  1204.         return $this;
  1205.     }
  1206.     public function getMargenBruto(): ?float
  1207.     {
  1208.         return $this->margenBruto;
  1209.     }
  1210.     public function setMargenBruto(?float $margenBruto): self
  1211.     {
  1212.         $this->margenBruto $margenBruto;
  1213.         return $this;
  1214.     }
  1215.     public function getStock(): ?bool
  1216.     {
  1217.         return $this->stock;
  1218.     }
  1219.     public function setStock(bool $stock): self
  1220.     {
  1221.         $this->stock $stock;
  1222.         return $this;
  1223.     }
  1224.     public function getComentario(): ?string
  1225.     {
  1226.         return $this->comentario;
  1227.     }
  1228.     public function setComentario(?string $comentario): self
  1229.     {
  1230.         $this->comentario $comentario;
  1231.         return $this;
  1232.     }
  1233.     public function getReservado(): ?bool
  1234.     {
  1235.         return $this->reservado;
  1236.     }
  1237.     public function setReservado(bool $reservado): self
  1238.     {
  1239.         $this->reservado $reservado;
  1240.         return $this;
  1241.     }
  1242.     public function getTokenAccess(): ?string
  1243.     {
  1244.         return $this->tokenAccess;
  1245.     }
  1246.     public function setTokenAccess(?string $tokenAccess): self
  1247.     {
  1248.         $this->tokenAccess $tokenAccess;
  1249.         return $this;
  1250.     }
  1251.     public function getTipoBloqueo(): ?string
  1252.     {
  1253.         return $this->tipoBloqueo;
  1254.     }
  1255.     public function setTipoBloqueo(?string $tipoBloqueo): self
  1256.     {
  1257.         $this->tipoBloqueo $tipoBloqueo;
  1258.         return $this;
  1259.     }
  1260.     public function getExportacionStr():string
  1261.     {
  1262.         return $this->isExportacion() ? 'Exportacion' 'Europa';
  1263.     }
  1264.     public function getExportacion(): ?bool
  1265.     {
  1266.         return $this->exportacion;
  1267.     }
  1268.     public function setExportacion(?bool $exportacion): self
  1269.     {
  1270.         $this->exportacion $exportacion;
  1271.         return $this;
  1272.     }
  1273.     public function getDeletedAt(): ?DateTimeInterface
  1274.     {
  1275.         return $this->deletedAt;
  1276.     }
  1277.     public function setDeletedAt(?DateTimeInterface $deletedAt): self
  1278.     {
  1279.         $this->deletedAt $deletedAt;
  1280.         return $this;
  1281.     }
  1282.     public function getUpdatedAt(): ?DateTimeInterface
  1283.     {
  1284.         return $this->updatedAt;
  1285.     }
  1286.     public function setUpdatedAt(DateTimeInterface $updatedAt): self
  1287.     {
  1288.         $this->updatedAt $updatedAt;
  1289.         return $this;
  1290.     }
  1291.     public function getCreatedAt(): ?DateTimeInterface
  1292.     {
  1293.         return $this->createdAt;
  1294.     }
  1295.     public function setCreatedAt(DateTimeInterface $createdAt): self
  1296.     {
  1297.         $this->createdAt $createdAt;
  1298.         return $this;
  1299.     }
  1300.     public function getRegistroPolicial(): ?RegistroPolicial
  1301.     {
  1302.         return $this->registroPolicial;
  1303.     }
  1304.     public function setRegistroPolicial(?RegistroPolicial $registroPolicial): self
  1305.     {
  1306.         // unset the owning side of the relation if necessary
  1307.         if ($registroPolicial === null && $this->registroPolicial !== null) {
  1308.             $this->registroPolicial->setReloj(null);
  1309.         }
  1310.         // set the owning side of the relation if necessary
  1311.         if ($registroPolicial !== null && $registroPolicial->getReloj() !== $this) {
  1312.             $registroPolicial->setReloj($this);
  1313.         }
  1314.         $this->registroPolicial $registroPolicial;
  1315.         return $this;
  1316.     }
  1317.     /**
  1318.      * @return Collection|Gasto[]
  1319.      */
  1320.     public function getGastos(): Collection
  1321.     {
  1322.         return $this->gastos;
  1323.     }
  1324.     public function addGasto(Gasto $gasto): self
  1325.     {
  1326.         if (!$this->gastos->contains($gasto)) {
  1327.             $this->gastos[] = $gasto;
  1328.             $gasto->setReloj($this);
  1329.         }
  1330.         return $this;
  1331.     }
  1332.     public function removeGasto(Gasto $gasto): self
  1333.     {
  1334.         if ($this->gastos->removeElement($gasto)) {
  1335.             // set the owning side to null (unless already changed)
  1336.             if ($gasto->getReloj() === $this) {
  1337.                 $gasto->setReloj(null);
  1338.             }
  1339.         }
  1340.         return $this;
  1341.     }
  1342.     /**
  1343.      * @return Collection|Trazabilidad[]
  1344.      */
  1345.     public function getTrazas(): Collection
  1346.     {
  1347.         return $this->trazas;
  1348.     }
  1349.     public function addTraza(Trazabilidad $traza): self
  1350.     {
  1351.         if (!$this->trazas->contains($traza)) {
  1352.             $this->trazas[] = $traza;
  1353.             $traza->setReloj($this);
  1354.         }
  1355.         return $this;
  1356.     }
  1357.     public function removeTraza(Trazabilidad $traza): self
  1358.     {
  1359.         if ($this->trazas->removeElement($traza)) {
  1360.             // set the owning side to null (unless already changed)
  1361.             if ($traza->getReloj() === $this) {
  1362.                 $traza->setReloj(null);
  1363.             }
  1364.         }
  1365.         return $this;
  1366.     }
  1367.     public function getEstado(): ?EstadoReloj
  1368.     {
  1369.         return $this->estado;
  1370.     }
  1371.     public function setEstado(?EstadoReloj $estado): self
  1372.     {
  1373.         $this->estado $estado;
  1374.         return $this;
  1375.     }
  1376.     public function getMarca(): ?Marca
  1377.     {
  1378.         return $this->marca;
  1379.     }
  1380.     public function setMarca(?Marca $marca): self
  1381.     {
  1382.         $this->marca $marca;
  1383.         return $this;
  1384.     }
  1385.     /**
  1386.      * @return Collection|ValoracionesRelojes[]
  1387.      */
  1388.     public function getValoracionesRelojes(): Collection
  1389.     {
  1390.         return $this->valoracionesRelojes;
  1391.     }
  1392.     public function addValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  1393.     {
  1394.         if (!$this->valoracionesRelojes->contains($valoracionesReloje)) {
  1395.             $this->valoracionesRelojes[] = $valoracionesReloje;
  1396.             $valoracionesReloje->setReloj($this);
  1397.         }
  1398.         return $this;
  1399.     }
  1400.     public function removeValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  1401.     {
  1402.         if ($this->valoracionesRelojes->removeElement($valoracionesReloje)) {
  1403.             // set the owning side to null (unless already changed)
  1404.             if ($valoracionesReloje->getReloj() === $this) {
  1405.                 $valoracionesReloje->setReloj(null);
  1406.             }
  1407.         }
  1408.         return $this;
  1409.     }
  1410.     public function isStock(): ?bool
  1411.     {
  1412.         return $this->stock;
  1413.     }
  1414.     public function isReservado(): ?bool
  1415.     {
  1416.         return $this->reservado;
  1417.     }
  1418.     public function isExportacion(): ?bool
  1419.     {
  1420.         return $this->exportacion;
  1421.     }
  1422.     public function getFechaPromocion(): ?DateTimeInterface
  1423.     {
  1424.         return $this->fechaPromocion;
  1425.     }
  1426.     public function setFechaPromocion(?DateTimeInterface $fechaPromocion): self
  1427.     {
  1428.         $this->fechaPromocion $fechaPromocion;
  1429.         return $this;
  1430.     }
  1431.     public function getFechaVenta(): ?DateTimeInterface
  1432.     {
  1433.         return $this->fechaVenta;
  1434.     }
  1435.     public function setFechaVenta(?DateTimeInterface $fechaVenta): self
  1436.     {
  1437.         $this->fechaVenta $fechaVenta;
  1438.         return $this;
  1439.     }
  1440.     public function getFechaBaja(): ?DateTimeInterface
  1441.     {
  1442.         return $this->fechaBaja;
  1443.     }
  1444.     public function setFechaBaja(?DateTimeInterface $fechaBaja): self
  1445.     {
  1446.         $this->fechaBaja $fechaBaja;
  1447.         return $this;
  1448.     }
  1449.     public function getMargenNeto(): ?float
  1450.     {
  1451.         return $this->margenNeto;
  1452.     }
  1453.     public function setMargenNeto(?float $margenNeto): self
  1454.     {
  1455.         $this->margenNeto $margenNeto;
  1456.         return $this;
  1457.     }
  1458.     public function isCustodia(): ?bool
  1459.     {
  1460.         return $this->custodia;
  1461.     }
  1462.     public function setCustodia(bool $custodia): self
  1463.     {
  1464.         $this->custodia $custodia;
  1465.         return $this;
  1466.     }
  1467.     public function getTiempoVenta(): ?float
  1468.     {
  1469.         return $this->tiempoVenta;
  1470.     }
  1471.     public function setTiempoVenta(?float $tiempoVenta): self
  1472.     {
  1473.         $this->tiempoVenta $tiempoVenta;
  1474.         return $this;
  1475.     }
  1476.     public function isEnPromocion(): ?bool
  1477.     {
  1478.         return $this->enPromocion;
  1479.     }
  1480.     public function setEnPromocion(?bool $enPromocion): self
  1481.     {
  1482.         $this->enPromocion $enPromocion;
  1483.         return $this;
  1484.     }
  1485.     public function isEnServicio(): ?bool
  1486.     {
  1487.         return $this->enServicio;
  1488.     }
  1489.     public function setEnServicio(?bool $enServicio): self
  1490.     {
  1491.         $this->enServicio $enServicio;
  1492.         return $this;
  1493.     }
  1494.     public function isTipoBloqueo(): ?bool
  1495.     {
  1496.         return $this->tipoBloqueo;
  1497.     }
  1498.     public function getAspecto(): ?EstadoAspecto
  1499.     {
  1500.         return $this->aspecto;
  1501.     }
  1502.     public function setAspecto(?EstadoAspecto $aspecto): self
  1503.     {
  1504.         $this->aspecto $aspecto;
  1505.         return $this;
  1506.     }
  1507.     public function getCheck(): ?EstadoCheck
  1508.     {
  1509.         return $this->check;
  1510.     }
  1511.     public function setCheck(?EstadoCheck $check): self
  1512.     {
  1513.         $this->check $check;
  1514.         return $this;
  1515.     }
  1516.     public function isSinAnunciar(): ?bool
  1517.     {
  1518.         return $this->sinAnunciar;
  1519.     }
  1520.     public function setSinAnunciar(?bool $sinAnunciar): self
  1521.     {
  1522.         $this->sinAnunciar $sinAnunciar;
  1523.         return $this;
  1524.     }
  1525.     public function isEnVenta(): ?bool
  1526.     {
  1527.         return $this->enVenta;
  1528.     }
  1529.     public function setEnVenta(?bool $enVenta): self
  1530.     {
  1531.         $this->enVenta $enVenta;
  1532.         return $this;
  1533.     }
  1534.     public function getUrlImage():string
  1535.     {
  1536.         /* TODO cogerlo de la configuracion vich */
  1537.         return '/uploads/Reloj/'.$this->getId().'/'.$this->getFoto();
  1538.     }
  1539.     public function getFechaCompra(): ?DateTimeInterface
  1540.     {
  1541.         return $this->fechaCompra;
  1542.     }
  1543.     public function setFechaCompra(?DateTimeInterface $fechaCompra): static
  1544.     {
  1545.         $this->fechaCompra $fechaCompra;
  1546.         return $this;
  1547.     }
  1548.     public function getPromociones(): ?Promocion
  1549.     {
  1550.         return $this->promociones;
  1551.     }
  1552.     public function setPromociones(?Promocion $promociones): static
  1553.     {
  1554.         // unset the owning side of the relation if necessary
  1555.         if ($promociones === null && $this->promociones !== null) {
  1556.             $this->promociones->setReloj(null);
  1557.         }
  1558.         // set the owning side of the relation if necessary
  1559.         if ($promociones !== null && $promociones->getReloj() !== $this) {
  1560.             $promociones->setReloj($this);
  1561.         }
  1562.         $this->promociones $promociones;
  1563.         return $this;
  1564.     }
  1565.     public function getCodigo(): ?string
  1566.     {
  1567.         return $this->codigo;
  1568.     }
  1569.     public function setCodigo(string $codigo): static
  1570.     {
  1571.         $this->codigo $codigo;
  1572.         return $this;
  1573.     }
  1574.     public function getModelos(): ?string
  1575.     {
  1576.         return implode(' 'array_filter([$this->getModelo1(), $this->getModelo2()]));
  1577.     }
  1578.     /*public function setModelos(?string $modelos): static
  1579.     {
  1580.         $modelosArray = explode(',', $modelos);
  1581.         $this->setModelo1(@$modelosArray[0]);
  1582.         $this->setModelo2(@$modelosArray[1]);
  1583.         return $this;
  1584.     }*/
  1585.     public function getRefs(): ?string
  1586.     {
  1587.         return implode(''array_filter([$this->getRef1(), $this->getRef2()]));
  1588.     }
  1589.     /*public function setRefs(?string $refs): static
  1590.     {
  1591.         $refsArray = explode(',', $refs);
  1592.         $this->setRef1(@$refsArray[0]);
  1593.         $this->setRef2(@$refsArray[1]);
  1594.         return $this;
  1595.     }*/
  1596.     public function getActividad(): ?ActividadAbstract
  1597.     {
  1598.         return $this->actividad;
  1599.     }
  1600.     public function setActividad(?ActividadAbstract $actividad): static
  1601.     {
  1602.         // unset the owning side of the relation if necessary
  1603.         if ($actividad === null && $this->actividad !== null) {
  1604.             $this->actividad->setReloj(null);
  1605.         }
  1606.         // set the owning side of the relation if necessary
  1607.         if ($actividad !== null && $actividad->getReloj() !== $this) {
  1608.             $actividad->setReloj($this);
  1609.         }
  1610.         $this->actividad $actividad;
  1611.         return $this;
  1612.     }
  1613.     public function getFotoValoracion(): ?string
  1614.     {
  1615.         return $this->fotoValoracion;
  1616.     }
  1617.     public function setFotoValoracion(?string $fotoValoracion): static
  1618.     {
  1619.         $this->fotoValoracion $fotoValoracion;
  1620.         return $this;
  1621.     }
  1622.     public function getFotoValoracionFile(): ?File
  1623.     {
  1624.         return $this->fotoValoracionFile;
  1625.     }
  1626.     public function setFotoValoracionFile(?File $fotoValoracionFile): self
  1627.     {
  1628.         $this->fotoValoracionFile $fotoValoracionFile;
  1629.         if ($fotoValoracionFile) {
  1630.             // if 'updatedAt' is not defined in your entity, use another property
  1631.             $this->setUpdatedAt(new DateTime('now'));
  1632.         }
  1633.         return $this;
  1634.     }
  1635.     public function getFotoSet(): ?string
  1636.     {
  1637.         return $this->fotoSet;
  1638.     }
  1639.     public function setFotoSet(?string $fotoSet): static
  1640.     {
  1641.         $this->fotoSet $fotoSet;
  1642.         return $this;
  1643.     }
  1644.     public function getFotoSetFile(): ?File
  1645.     {
  1646.         return $this->fotoSetFile;
  1647.     }
  1648.     public function setFotoSetFile(?File $fotoSetFile): self
  1649.     {
  1650.         $this->fotoSetFile $fotoSetFile;
  1651.         if ($fotoSetFile) {
  1652.             // if 'updatedAt' is not defined in your entity, use another property
  1653.             $this->setUpdatedAt(new DateTime('now'));
  1654.         }
  1655.         return $this;
  1656.     }
  1657.     public function getFotoCrono(): ?string
  1658.     {
  1659.         return $this->fotoCrono;
  1660.     }
  1661.     public function setFotoCrono(?string $fotoCrono): static
  1662.     {
  1663.         $this->fotoCrono $fotoCrono;
  1664.         return $this;
  1665.     }
  1666.     public function getFotoCronoFile(): ?File
  1667.     {
  1668.         return $this->fotoCronoFile;
  1669.     }
  1670.     public function setFotoCronoFile(?File $fotoCronoFile): self
  1671.     {
  1672.         $this->fotoCronoFile $fotoCronoFile;
  1673.         if ($fotoCronoFile) {
  1674.             // if 'updatedAt' is not defined in your entity, use another property
  1675.             $this->setUpdatedAt(new DateTime('now'));
  1676.         }
  1677.         return $this;
  1678.     }
  1679.     public function getVideo(): ?string
  1680.     {
  1681.         return $this->video;
  1682.     }
  1683.     public function setVideo(?string $video): static
  1684.     {
  1685.         $this->video $video;
  1686.         return $this;
  1687.     }
  1688.     public function getVideoFile(): ?File
  1689.     {
  1690.         return $this->videoFile;
  1691.     }
  1692.     public function setVideoFile(?File $videoFile): self
  1693.     {
  1694.         $this->videoFile $videoFile;
  1695.         if ($videoFile) {
  1696.             // if 'updatedAt' is not defined in your entity, use another property
  1697.             $this->setUpdatedAt(new DateTime('now'));
  1698.         }
  1699.         return $this;
  1700.     }
  1701.     /**
  1702.      * @return bool|null
  1703.      * @deprecated Por cambios de funcionalidad
  1704.      */
  1705.     public function isChrono24(): ?bool
  1706.     {
  1707.         return $this->chrono24;
  1708.     }
  1709.     /**
  1710.      * @deprecated Por cambios de funcionalidad
  1711.      * @param bool|null $chrono24
  1712.      * @return $this
  1713.      */
  1714.     public function setChrono24(?bool $chrono24): static
  1715.     {
  1716.         $this->chrono24 $chrono24;
  1717.         return $this;
  1718.     }
  1719.     /**
  1720.      * @return Collection<int, DetalleVenta>
  1721.      */
  1722.     public function getDetalleVenta(): Collection
  1723.     {
  1724.         return $this->detalleVenta;
  1725.     }
  1726.     public function getDetalleVentaAsentada(): ?DetalleVenta
  1727.     {
  1728.         return ($this->getDetalleVenta()->filter(fn($dc) => $dc->getVenta()->getOperacion()->getEstado()->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA))->first();
  1729.     }
  1730.     public function addDetalleVentum(DetalleVenta $detalleVentum): static
  1731.     {
  1732.         if (!$this->detalleVenta->contains($detalleVentum)) {
  1733.             $this->detalleVenta->add($detalleVentum);
  1734.             $detalleVentum->setReloj($this);
  1735.         }
  1736.         return $this;
  1737.     }
  1738.     public function removeDetalleVentum(DetalleVenta $detalleVentum): static
  1739.     {
  1740.         if ($this->detalleVenta->removeElement($detalleVentum)) {
  1741.             // set the owning side to null (unless already changed)
  1742.             if ($detalleVentum->getReloj() === $this) {
  1743.                 $detalleVentum->setReloj(null);
  1744.             }
  1745.         }
  1746.         return $this;
  1747.     }
  1748.     public function getPrecioCompra(): ?float
  1749.     {
  1750.         return $this->precioCompra;
  1751.     }
  1752.     public function setPrecioCompra(?float $precioCompra): static
  1753.     {
  1754.         $this->precioCompra $precioCompra;
  1755.         return $this;
  1756.     }
  1757.     /**
  1758.      * @deprecated A partir del 04/06/2024 cuando se realiza el ciclo completo sustituir por "getOperacionCompra"
  1759.      * @return Operacion|null
  1760.      */
  1761.     public function getOperacion():?Operacion
  1762.     {
  1763.         return $this->getDetalleCompra()?->getCompra()?->getOperacion();
  1764.     }
  1765.     public function getOperacionCompra():?Operacion
  1766.     {
  1767.         //return $this->getDetalleCompra()?->getCompra()?->getOperacion()->filter(fn($operacion) => $operacion->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_CONFIRMADA || $operacion->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA);
  1768.         return $this->operacionCompra;
  1769.     }
  1770.     public function getOperacionGestionCompra():?Operacion
  1771.     {
  1772.         return $this->getOperacionCompra()??$this->getOperacionGestion();
  1773.     }
  1774.     public function getOperacionVenta():?Operacion
  1775.     {
  1776.         /*$detalle = $this->getDetalleVenta();
  1777.         if($detalle->count() !== 1 && $detalle->count() !== 0) throw new Exception('ERROR, PENDIENTE de resolver / controlar');
  1778.         return $detalle->count() === 0 ? null : $this->getDetalleVenta()->first()->getVenta()?->getOperacion();*/
  1779.         try {
  1780.             if ($this->operacionVenta?->getDeletedAt() === null) return $this->operacionVenta;
  1781.         }
  1782.         catch(EntityNotFoundException $e)
  1783.         {
  1784.             return null;
  1785.         }
  1786.         return $this->operacionVenta;
  1787.     }
  1788.     public function getRecompra(): ?float
  1789.     {
  1790.         return $this->recompra;
  1791.     }
  1792.     public function setRecompra(?float $recompra): static
  1793.     {
  1794.         $this->recompra $recompra;
  1795.         return $this;
  1796.     }
  1797.     public function getGarantia(): ?string
  1798.     {
  1799.         return $this->garantia;
  1800.     }
  1801.     public function setGarantia(?string $garantia): static
  1802.     {
  1803.         $this->garantia $garantia;
  1804.         return $this;
  1805.     }
  1806.     public function getOperacionGestion(): ?Operacion
  1807.     {
  1808.         return $this->operacionGestion;
  1809.     }
  1810.     public function setOperacionGestion(?Operacion $operacionGestion): static
  1811.     {
  1812.         $this->operacionGestion $operacionGestion;
  1813.         return $this;
  1814.     }
  1815.     public function setOperacionVenta(?Operacion $operacionVenta): static
  1816.     {
  1817.         $this->operacionVenta $operacionVenta;
  1818.         return $this;
  1819.     }
  1820.     public function setOperacionCompra(?Operacion $operacionCompra): static
  1821.     {
  1822.         $this->operacionCompra $operacionCompra;
  1823.         return $this;
  1824.     }
  1825.     public function getActividadCompra(): ?ActividadCompra
  1826.     {
  1827.         return $this->actividadCompra;
  1828.     }
  1829.     public function setActividadCompra(?ActividadCompra $actividadCompra): static
  1830.     {
  1831.         // unset the owning side of the relation if necessary
  1832.         if ($actividadCompra === null && $this->actividadCompra !== null) {
  1833.             $this->actividadCompra->setReloj(null);
  1834.         }
  1835.         // set the owning side of the relation if necessary
  1836.         if ($actividadCompra !== null && $actividadCompra->getReloj() !== $this) {
  1837.             $actividadCompra->setReloj($this);
  1838.         }
  1839.         $this->actividadCompra $actividadCompra;
  1840.         return $this;
  1841.     }
  1842.     public function getActividadVenta(): ?ActividadVenta
  1843.     {
  1844.         return $this->actividadVenta;
  1845.     }
  1846.     public function setActividadVenta(?ActividadVenta $actividadVenta): static
  1847.     {
  1848.         // unset the owning side of the relation if necessary
  1849.         if ($actividadVenta === null && $this->actividadVenta !== null) {
  1850.             $this->actividadVenta->setReloj(null);
  1851.         }
  1852.         // set the owning side of the relation if necessary
  1853.         if ($actividadVenta !== null && $actividadVenta->getReloj() !== $this) {
  1854.             $actividadVenta->setReloj($this);
  1855.         }
  1856.         $this->actividadVenta $actividadVenta;
  1857.         return $this;
  1858.     }
  1859.     public function getPeso(): ?float
  1860.     {
  1861.         return $this->peso;
  1862.     }
  1863.     public function setPeso(?float $peso): static
  1864.     {
  1865.         $this->peso $peso;
  1866.         return $this;
  1867.     }
  1868.     public function getDescripcion(): ?string
  1869.     {
  1870.         return $this->descripcion;
  1871.     }
  1872.     public function setDescripcion(?string $descripcion): static
  1873.     {
  1874.         $this->descripcion $descripcion;
  1875.         return $this;
  1876.     }
  1877.     public function getFechaStr(): ?string
  1878.     {
  1879.         return $this->fecha?->format("d/m/Y");
  1880.     }
  1881.     public function getExportPeso():?string
  1882.     {
  1883.         return number_format($this->peso2',''.') . ' g.';
  1884.     }
  1885.     public function getExportPrecioCompra():?string
  1886.     {
  1887.         return number_format($this->precioCompra2',''.') . ' €';
  1888.     }
  1889.     /**
  1890.      * @return Collection<int, DetalleCompra>
  1891.      */
  1892.     public function getDetalleCompra(): Collection
  1893.     {
  1894.         return $this->detalleCompra;
  1895.     }
  1896.     public function getDetalleCompraAsentada(): ?DetalleCompra
  1897.     {
  1898.         return ($this->getDetalleCompra()->filter(fn($dc) => $dc->getCompra()->getOperacion()->getTipo() === TipoOperacionEnum::OPERACION_COMPRA || $dc->getCompra()->getOperacion()->getTipo() === TipoOperacionEnum::OPERACION_PERMUTA))->first();
  1899.     }
  1900.     public function addDetalleCompra(DetalleCompra $detalleCompra): static
  1901.     {
  1902.         if (!$this->detalleCompra->contains($detalleCompra)) {
  1903.             $this->detalleCompra->add($detalleCompra);
  1904.             $detalleCompra->setReloj($this);
  1905.         }
  1906.         return $this;
  1907.     }
  1908.     public function removeDetalleCompra(DetalleCompra $detalleCompra): static
  1909.     {
  1910.         if ($this->detalleCompra->removeElement($detalleCompra)) {
  1911.             // set the owning side to null (unless already changed)
  1912.             if ($detalleCompra->getReloj() === $this) {
  1913.                 $detalleCompra->setReloj(null);
  1914.             }
  1915.         }
  1916.         return $this;
  1917.     }
  1918.     public function getTiempoEnVenta(): ?int
  1919.     {
  1920.         $this->updateDerivedTimes();
  1921.         return $this->tiempoEnVenta;
  1922.     }
  1923.     public function setTiempoEnVenta(?int $tiempoEnVenta): static
  1924.     {
  1925.         $this->tiempoEnVenta $tiempoEnVenta;
  1926.         return $this;
  1927.     }
  1928.     public function getTiempoEnStock(): ?int
  1929.     {
  1930.         return $this->tiempoEnStock;
  1931.     }
  1932.     public function setTiempoEnStock(?int $tiempoEnStock): static
  1933.     {
  1934.         $this->tiempoEnStock $tiempoEnStock;
  1935.         return $this;
  1936.     }
  1937.     public function getFechaRecepcion(): ?DateTimeInterface
  1938.     {
  1939.         return $this->fechaRecepcion;
  1940.     }
  1941.     public function getFechaRecepcionStr(): ?string
  1942.     {
  1943.         return $this->fechaRecepcion?->format("d/m/Y");
  1944.     }
  1945.     public function setFechaRecepcion(?DateTimeInterface $fechaRecepcion): static
  1946.     {
  1947.         $this->fechaRecepcion $fechaRecepcion;
  1948.         return $this;
  1949.     }
  1950.     public function getFechaValoracion(): ?DateTimeInterface
  1951.     {
  1952.         return $this->fechaValoracion;
  1953.     }
  1954.     public function setFechaValoracion(?DateTimeInterface $fechaValoracion): static
  1955.     {
  1956.         $this->fechaValoracion $fechaValoracion;
  1957.         return $this;
  1958.     }
  1959.     public function getFechaAnuncio(): ?DateTimeInterface
  1960.     {
  1961.         return $this->fechaAnuncio;
  1962.     }
  1963.     public function setFechaAnuncio(?DateTimeInterface $fechaAnuncio): static
  1964.     {
  1965.         $this->fechaAnuncio $fechaAnuncio;
  1966.         return $this;
  1967.     }
  1968.     public function getValoracion(): ?Valoracion
  1969.     {
  1970.         return $this->valoracion;
  1971.     }
  1972.     public function setValoracion(?Valoracion $valoracion): static
  1973.     {
  1974.         $this->valoracion $valoracion;
  1975.         return $this;
  1976.     }
  1977.     public function getValoracionReloj(): ?ValoracionesRelojesSinStock
  1978.     {
  1979.         return $this->valoracionReloj;
  1980.     }
  1981.     public function setValoracionReloj(?ValoracionesRelojesSinStock $valoracionReloj): static
  1982.     {
  1983.         // unset the owning side of the relation if necessary
  1984.         if ($valoracionReloj === null && $this->valoracionReloj !== null) {
  1985.             $this->valoracionReloj->setRelojInventario(null);
  1986.         }
  1987.         // set the owning side of the relation if necessary
  1988.         if ($valoracionReloj !== null && $valoracionReloj->getRelojInventario() !== $this) {
  1989.             $valoracionReloj->setRelojInventario($this);
  1990.         }
  1991.         $this->valoracionReloj $valoracionReloj;
  1992.         return $this;
  1993.     }
  1994.     public function hasBeenSold():bool
  1995.     {
  1996.         if($this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO) return true;
  1997.         if($this->getFechaVenta()) return true;
  1998.         $criteria Criteria::create()
  1999.             ->orderBy(['fecha' => Criteria::DESC])
  2000.             ->setMaxResults(1);
  2001.         $ultimaAccion $this->getPromociones()?->getAcciones()
  2002.             ?->filter(fn($accion) => $accion instanceof AccionEstado)
  2003.             ?->matching($criteria)
  2004.             ?->first();
  2005.         return $ultimaAccion?->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO;
  2006.     }
  2007.     public function hasBeenBought():bool
  2008.     {
  2009.         if($this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_COMPRA) return true;
  2010.         if($this->getFechaCompra()) return true;
  2011.         $criteria Criteria::create()
  2012.             ->orderBy(['fecha' => Criteria::DESC])
  2013.             ->setMaxResults(1);
  2014.         $ultimaAccion $this->getPromociones()?->getAcciones()
  2015.             ?->filter(fn($accion) => $accion instanceof AccionEstado)
  2016.             ?->matching($criteria)
  2017.             ?->first();
  2018.         return $ultimaAccion?->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_COMPRA;
  2019.     }
  2020.     public function getGenero(): ?GeneroRelojEnum
  2021.     {
  2022.         return $this->genero;
  2023.     }
  2024.     public function setGenero(?GeneroRelojEnum $genero): static
  2025.     {
  2026.         $this->genero $genero;
  2027.         return $this;
  2028.     }
  2029.     public function getEstadoCaja(): ?int
  2030.     {
  2031.         return $this->estadoCaja;
  2032.     }
  2033.     public function setEstadoCaja(?int $estadoCaja): static
  2034.     {
  2035.         $this->estadoCaja $estadoCaja;
  2036.         return $this;
  2037.     }
  2038.     public function getEstadoCristal(): ?int
  2039.     {
  2040.         return $this->estadoCristal;
  2041.     }
  2042.     public function setEstadoCristal(?int $estadoCristal): static
  2043.     {
  2044.         $this->estadoCristal $estadoCristal;
  2045.         return $this;
  2046.     }
  2047.     public function getEstadoDial(): ?int
  2048.     {
  2049.         return $this->estadoDial;
  2050.     }
  2051.     public function setEstadoDial(?int $estadoDial): static
  2052.     {
  2053.         $this->estadoDial $estadoDial;
  2054.         return $this;
  2055.     }
  2056.     public function getEstadoAgujas(): ?int
  2057.     {
  2058.         return $this->estadoAgujas;
  2059.     }
  2060.     public function setEstadoAgujas(?int $estadoAgujas): static
  2061.     {
  2062.         $this->estadoAgujas $estadoAgujas;
  2063.         return $this;
  2064.     }
  2065.     public function getEstadoTapa(): ?int
  2066.     {
  2067.         return $this->estadoTapa;
  2068.     }
  2069.     public function setEstadoTapa(?int $estadoTapa): static
  2070.     {
  2071.         $this->estadoTapa $estadoTapa;
  2072.         return $this;
  2073.     }
  2074.     public function getEstadoCorrea(): ?int
  2075.     {
  2076.         return $this->estadoCorrea;
  2077.     }
  2078.     public function setEstadoCorrea(?int $estadoCorrea): static
  2079.     {
  2080.         $this->estadoCorrea $estadoCorrea;
  2081.         return $this;
  2082.     }
  2083.     public function getEsferaIndice(): ?TipoEsferaIndiceEnum
  2084.     {
  2085.         return $this->esferaIndice;
  2086.     }
  2087.     public function setEsferaIndice(?TipoEsferaIndiceEnum $esferaIndice): static
  2088.     {
  2089.         $this->esferaIndice $esferaIndice;
  2090.         return $this;
  2091.     }
  2092.     public function getEsferaColor(): ?string
  2093.     {
  2094.         return $this->esferaColor;
  2095.     }
  2096.     public function setEsferaColor(?string $esferaColor): static
  2097.     {
  2098.         $this->esferaColor $esferaColor;
  2099.         return $this;
  2100.     }
  2101.     public function isEsferaJoyas(): ?bool
  2102.     {
  2103.         return $this->esferaJoyas;
  2104.     }
  2105.     public function setEsferaJoyas(?bool $esferaJoyas): static
  2106.     {
  2107.         $this->esferaJoyas $esferaJoyas;
  2108.         return $this;
  2109.     }
  2110.     public function getCajaRelojDiametro(): ?int
  2111.     {
  2112.         return $this->cajaRelojDiametro;
  2113.     }
  2114.     public function setCajaRelojDiametro(?int $cajaRelojDiametro): static
  2115.     {
  2116.         $this->cajaRelojDiametro $cajaRelojDiametro;
  2117.         return $this;
  2118.     }
  2119.     public function getCajaRelojGrosor(): ?int
  2120.     {
  2121.         return $this->cajaRelojGrosor;
  2122.     }
  2123.     public function setCajaRelojGrosor(?int $cajaRelojGrosor): static
  2124.     {
  2125.         $this->cajaRelojGrosor $cajaRelojGrosor;
  2126.         return $this;
  2127.     }
  2128.     public function getCajaRelojResistenciaAgua(): ?int
  2129.     {
  2130.         return $this->cajaRelojResistenciaAgua;
  2131.     }
  2132.     public function setCajaRelojResistenciaAgua(?int $cajaRelojResistenciaAgua): static
  2133.     {
  2134.         $this->cajaRelojResistenciaAgua $cajaRelojResistenciaAgua;
  2135.         return $this;
  2136.     }
  2137.     public function getCajaRelojCristal(): ?TipoCristalEnum
  2138.     {
  2139.         return $this->cajaRelojCristal;
  2140.     }
  2141.     public function setCajaRelojCristal(?TipoCristalEnum $cajaRelojCristal): static
  2142.     {
  2143.         $this->cajaRelojCristal $cajaRelojCristal;
  2144.         return $this;
  2145.     }
  2146.     public function getPulseraColor(): ?string
  2147.     {
  2148.         return $this->pulseraColor;
  2149.     }
  2150.     public function setPulseraColor(?string $pulseraColor): static
  2151.     {
  2152.         $this->pulseraColor $pulseraColor;
  2153.         return $this;
  2154.     }
  2155.     public function getPulseraCierre(): ?TipoCierreEnum
  2156.     {
  2157.         return $this->pulseraCierre;
  2158.     }
  2159.     public function setPulseraCierre(?TipoCierreEnum $pulseraCierre): static
  2160.     {
  2161.         $this->pulseraCierre $pulseraCierre;
  2162.         return $this;
  2163.     }
  2164.     public function getPulseraAnchoCaja(): ?int
  2165.     {
  2166.         return $this->pulseraAnchoCaja;
  2167.     }
  2168.     public function setPulseraAnchoCaja(?int $pulseraAnchoCaja): static
  2169.     {
  2170.         $this->pulseraAnchoCaja $pulseraAnchoCaja;
  2171.         return $this;
  2172.     }
  2173.     public function getPulseraAnchoCierre(): ?int
  2174.     {
  2175.         return $this->pulseraAnchoCierre;
  2176.     }
  2177.     public function setPulseraAnchoCierre(?int $pulseraAnchoCierre): static
  2178.     {
  2179.         $this->pulseraAnchoCierre $pulseraAnchoCierre;
  2180.         return $this;
  2181.     }
  2182.     public function getPulseraMedidaMunieca(): ?int
  2183.     {
  2184.         return $this->pulseraMedidaMunieca;
  2185.     }
  2186.     public function setPulseraMedidaMunieca(?int $pulseraMedidaMunieca): static
  2187.     {
  2188.         $this->pulseraMedidaMunieca $pulseraMedidaMunieca;
  2189.         return $this;
  2190.     }
  2191.     public function getCalibre(): ?CalibreEnum
  2192.     {
  2193.         return $this->calibre;
  2194.     }
  2195.     public function setCalibre(?CalibreEnum $calibre): static
  2196.     {
  2197.         $this->calibre $calibre;
  2198.         return $this;
  2199.     }
  2200.     public function getCalibreAvanzado(): ?string
  2201.     {
  2202.         return $this->calibreAvanzado;
  2203.     }
  2204.     public function setCalibreAvanzado(?string $calibreAvanzado): static
  2205.     {
  2206.         $this->calibreAvanzado $calibreAvanzado;
  2207.         return $this;
  2208.     }
  2209.     public function getCalibreBasico(): ?string
  2210.     {
  2211.         return $this->calibreBasico;
  2212.     }
  2213.     public function setCalibreBasico(?string $calibreBasico): static
  2214.     {
  2215.         $this->calibreBasico $calibreBasico;
  2216.         return $this;
  2217.     }
  2218.     public function getCalibreReservaMarcha(): ?string
  2219.     {
  2220.         return $this->calibreReservaMarcha;
  2221.     }
  2222.     public function setCalibreReservaMarcha(?string $calibreReservaMarcha): static
  2223.     {
  2224.         $this->calibreReservaMarcha $calibreReservaMarcha;
  2225.         return $this;
  2226.     }
  2227.     public function getCalibreNumeroJoyas(): ?string
  2228.     {
  2229.         return $this->calibreNumeroJoyas;
  2230.     }
  2231.     public function setCalibreNumeroJoyas(?string $calibreNumeroJoyas): static
  2232.     {
  2233.         $this->calibreNumeroJoyas $calibreNumeroJoyas;
  2234.         return $this;
  2235.     }
  2236.     public function getCalibreOscilacion(): ?string
  2237.     {
  2238.         return $this->calibreOscilacion;
  2239.     }
  2240.     public function setCalibreOscilacion(?string $calibreOscilacion): static
  2241.     {
  2242.         $this->calibreOscilacion $calibreOscilacion;
  2243.         return $this;
  2244.     }
  2245.     public function getCalibreAmplitud(): ?string
  2246.     {
  2247.         return $this->calibreAmplitud;
  2248.     }
  2249.     public function setCalibreAmplitud(?string $calibreAmplitud): static
  2250.     {
  2251.         $this->calibreAmplitud $calibreAmplitud;
  2252.         return $this;
  2253.     }
  2254.     public function getCalibreMarcha(): ?string
  2255.     {
  2256.         return $this->calibreMarcha;
  2257.     }
  2258.     public function setCalibreMarcha(?string $calibreMarcha): static
  2259.     {
  2260.         $this->calibreMarcha $calibreMarcha;
  2261.         return $this;
  2262.     }
  2263.     public function getPiezasRepuesto(): ?PiezaRepuestoEnum
  2264.     {
  2265.         return $this->piezasRepuesto;
  2266.     }
  2267.     public function setPiezasRepuesto(?PiezaRepuestoEnum $piezasRepuesto): static
  2268.     {
  2269.         $this->piezasRepuesto $piezasRepuesto;
  2270.         return $this;
  2271.     }
  2272.     public function getPiezasRepuestoObservaciones(): ?string
  2273.     {
  2274.         return $this->piezasRepuestoObservaciones;
  2275.     }
  2276.     public function setPiezasRepuestoObservaciones(?string $piezasRepuestoObservaciones): static
  2277.     {
  2278.         $this->piezasRepuestoObservaciones $piezasRepuestoObservaciones;
  2279.         return $this;
  2280.     }
  2281.     public function getServicioMantenimiento(): ?ServicioMantenimientoEnum
  2282.     {
  2283.         return $this->servicioMantenimiento;
  2284.     }
  2285.     public function setServicioMantenimiento(?ServicioMantenimientoEnum $servicioMantenimiento): static
  2286.     {
  2287.         $this->servicioMantenimiento $servicioMantenimiento;
  2288.         return $this;
  2289.     }
  2290.     public function getCondiciones(): ?string
  2291.     {
  2292.         return $this->condiciones;
  2293.     }
  2294.     public function setCondiciones(?string $condiciones): static
  2295.     {
  2296.         $this->condiciones $condiciones;
  2297.         return $this;
  2298.     }
  2299.     public function getAnuncioES(): ?string
  2300.     {
  2301.         return $this->anuncioES;
  2302.     }
  2303.     public function setAnuncioES(?string $anuncioES): static
  2304.     {
  2305.         $this->anuncioES $anuncioES;
  2306.         return $this;
  2307.     }
  2308.     public function getAnuncioEN(): ?string
  2309.     {
  2310.         return $this->anuncioEN;
  2311.     }
  2312.     public function setAnuncioEN(?string $anuncioEN): static
  2313.     {
  2314.         $this->anuncioEN $anuncioEN;
  2315.         return $this;
  2316.     }
  2317.     public function getEmpresa(): ?Empresa
  2318.     {
  2319.         return $this->empresa;
  2320.     }
  2321.     public function setEmpresa(?Empresa $empresa): static
  2322.     {
  2323.         $this->empresa $empresa;
  2324.         return $this;
  2325.     }
  2326.     public function getCajaRelojMaterial(): ?Material
  2327.     {
  2328.         return $this->cajaRelojMaterial;
  2329.     }
  2330.     public function setCajaRelojMaterial(?Material $cajaRelojMaterial): static
  2331.     {
  2332.         $this->cajaRelojMaterial $cajaRelojMaterial;
  2333.         return $this;
  2334.     }
  2335.     public function getCajaRelojMaterialBisel(): ?Material
  2336.     {
  2337.         return $this->cajaRelojMaterialBisel;
  2338.     }
  2339.     public function setCajaRelojMaterialBisel(?Material $cajaRelojMaterialBisel): static
  2340.     {
  2341.         $this->cajaRelojMaterialBisel $cajaRelojMaterialBisel;
  2342.         return $this;
  2343.     }
  2344.     public function getPulseraMaterial(): ?Material
  2345.     {
  2346.         return $this->pulseraMaterial;
  2347.     }
  2348.     public function setPulseraMaterial(?Material $pulseraMaterial): static
  2349.     {
  2350.         $this->pulseraMaterial $pulseraMaterial;
  2351.         return $this;
  2352.     }
  2353.     public function getPulseraMaterialCierre(): ?Material
  2354.     {
  2355.         return $this->pulseraMaterialCierre;
  2356.     }
  2357.     public function setPulseraMaterialCierre(?Material $pulseraMaterialCierre): static
  2358.     {
  2359.         $this->pulseraMaterialCierre $pulseraMaterialCierre;
  2360.         return $this;
  2361.     }
  2362.     public function getCalibreCaracteristicas(): ?array
  2363.     {
  2364.         return $this->calibreCaracteristicas;
  2365.     }
  2366.     public function setCalibreCaracteristicas(?array $calibreCaracteristicas): static
  2367.     {
  2368.         $this->calibreCaracteristicas $calibreCaracteristicas;
  2369.         return $this;
  2370.     }
  2371.     public function getCalibreFunciones(): ?array
  2372.     {
  2373.         return $this->calibreFunciones;
  2374.     }
  2375.     public function setCalibreFunciones(?array $calibreFunciones): static
  2376.     {
  2377.         $this->calibreFunciones $calibreFunciones;
  2378.         return $this;
  2379.     }
  2380.     public function getDescripcionDetallada(): ?string
  2381.     {
  2382.         return $this->descripcionDetallada;
  2383.     }
  2384.     public function setDescripcionDetallada(?string $descripcionDetallada): static
  2385.     {
  2386.         $this->descripcionDetallada $descripcionDetallada;
  2387.         return $this;
  2388.     }
  2389.     public function getPapelesStr():string
  2390.     {
  2391.         return $this->getPapeles() ? 'reloj.con_papeles' 'reloj.sin_papeles';
  2392.     }
  2393.     public function getCajaStr():string
  2394.     {
  2395.         return $this->getCaja() ? 'reloj.con_caja' 'reloj.sin_caja';
  2396.     }
  2397.     /**
  2398.      * @return Collection<int, DetalleCompra>
  2399.      */
  2400.     public function getRelojesDerivadosDetalleCompra(): Collection
  2401.     {
  2402.         return $this->relojesDerivadosDetalleCompra;
  2403.     }
  2404.     public function addRelojesDerivadosDetalleCompra(DetalleCompra $relojesDerivadosDetalleCompra): static
  2405.     {
  2406.         if (!$this->relojesDerivadosDetalleCompra->contains($relojesDerivadosDetalleCompra)) {
  2407.             $this->relojesDerivadosDetalleCompra->add($relojesDerivadosDetalleCompra);
  2408.             $relojesDerivadosDetalleCompra->setRelojBaseCompra($this);
  2409.         }
  2410.         return $this;
  2411.     }
  2412.     public function removeRelojesDerivadosDetalleCompra(DetalleCompra $relojesDerivadosDetalleCompra): static
  2413.     {
  2414.         if ($this->relojesDerivadosDetalleCompra->removeElement($relojesDerivadosDetalleCompra)) {
  2415.             // set the owning side to null (unless already changed)
  2416.             if ($relojesDerivadosDetalleCompra->getRelojBaseCompra() === $this) {
  2417.                 $relojesDerivadosDetalleCompra->setRelojBaseCompra(null);
  2418.             }
  2419.         }
  2420.         return $this;
  2421.     }
  2422.     /**
  2423.      * @return Collection<int, ValoracionesRelojesSinStock>
  2424.      */
  2425.     public function getRelojesDerivadosValoracionSinStock(): Collection
  2426.     {
  2427.         return $this->relojesDerivadosValoracionSinStock;
  2428.     }
  2429.     public function addRelojesDerivadosValoracionSinStock(ValoracionesRelojesSinStock $relojesDerivadosValoracionSinStock): static
  2430.     {
  2431.         if (!$this->relojesDerivadosValoracionSinStock->contains($relojesDerivadosValoracionSinStock)) {
  2432.             $this->relojesDerivadosValoracionSinStock->add($relojesDerivadosValoracionSinStock);
  2433.             $relojesDerivadosValoracionSinStock->setRelojBaseSinStock($this);
  2434.         }
  2435.         return $this;
  2436.     }
  2437.     public function removeRelojesDerivadosValoracionSinStock(ValoracionesRelojesSinStock $relojesDerivadosValoracionSinStock): static
  2438.     {
  2439.         if ($this->relojesDerivadosValoracionSinStock->removeElement($relojesDerivadosValoracionSinStock)) {
  2440.             // set the owning side to null (unless already changed)
  2441.             if ($relojesDerivadosValoracionSinStock->getRelojBaseSinStock() === $this) {
  2442.                 $relojesDerivadosValoracionSinStock->setRelojBaseSinStock(null);
  2443.             }
  2444.         }
  2445.         return $this;
  2446.     }
  2447.     /**
  2448.      * @return Collection<int, Reloj>
  2449.      */
  2450.     public function getRelojesDerivados(): Collection
  2451.     {
  2452.         return $this->relojesDerivados;
  2453.     }
  2454.     public function addRelojesDerivado(Reloj $relojesDerivado): static
  2455.     {
  2456.         if (!$this->relojesDerivados->contains($relojesDerivado)) {
  2457.             $this->relojesDerivados->add($relojesDerivado);
  2458.             $relojesDerivado->setRelojBase($this);
  2459.         }
  2460.         return $this;
  2461.     }
  2462.     public function removeRelojesDerivado(Reloj $relojesDerivado): static
  2463.     {
  2464.         if ($this->relojesDerivados->removeElement($relojesDerivado)) {
  2465.             // set the owning side to null (unless already changed)
  2466.             if ($relojesDerivado->getRelojBase() === $this) {
  2467.                 $relojesDerivado->setRelojBase(null);
  2468.             }
  2469.         }
  2470.         return $this;
  2471.     }
  2472.     public function getRelojBase(): ?self
  2473.     {
  2474.         return $this->relojBase;
  2475.     }
  2476.     public function setRelojBase(?self $relojBase): static
  2477.     {
  2478.         $this->relojBase $relojBase;
  2479.         return $this;
  2480.     }
  2481.     public function isCompraDirecta(): ?bool
  2482.     {
  2483.         return $this->compraDirecta;
  2484.     }
  2485.     public function setCompraDirecta(?bool $compraDirecta): static
  2486.     {
  2487.         $this->compraDirecta $compraDirecta;
  2488.         return $this;
  2489.     }
  2490.     public function isSold():bool
  2491.     {
  2492.         return $this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO;
  2493.     }
  2494.     public function isSend():bool
  2495.     {
  2496.         return $this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_ENVIADO;
  2497.     }
  2498.     public function getDiasDesdeRecepcion():?int
  2499.     {
  2500.         $promocion $this->getPromociones();
  2501.         $fechaRecepcion $this->getFechaRecepcion() ? clone $this->getFechaRecepcion() : new DateTime();
  2502.         $fechaRecepcion->setTime(0,0,0);
  2503.         $fechaListo $promocion?->getFechaListo() ? clone $promocion->getFechaListo() : new DateTime();
  2504.         $fechaListo->setTime(0,0,0);
  2505.         $diasDesdeRecepcion = ($fechaRecepcion && $fechaListo) ? $fechaListo->diff($fechaRecepcion)->days null;
  2506.         return $diasDesdeRecepcion;
  2507.     }
  2508.     public function getDiasDesdeListo():?int
  2509.     {
  2510.         $promocion $this->getPromociones();
  2511.         $fechaListo $promocion?->getFechaListo() ? clone $promocion->getFechaListo() : new DateTime();
  2512.         $fechaListo->setTime(0,0,0);
  2513.         $fechaAnuncio $this->getFechaAnuncio() ? clone $this->getFechaAnuncio() : new DateTime();
  2514.         if($fechaAnuncio$fechaAnuncio->setTime(0,0,0);
  2515.         $diasDesdeListo = ($fechaListo && $fechaAnuncio) ? $fechaAnuncio->diff($fechaListo)->days null;
  2516.         return $diasDesdeListo;
  2517.     }
  2518.     public function getDiasDesdeAnuncio():?int
  2519.     {
  2520.         return $this->getTiempoEnVenta();
  2521.     }
  2522.     public function updateDerivedTimes()
  2523.     {
  2524.         $fechaAnuncio $this->getFechaAnuncio() ? clone $this->getFechaAnuncio() : null;
  2525.         if($fechaAnuncio$fechaAnuncio->setTime(0,0,0);
  2526.         $fechaVenta $this->getFechaVenta() ? clone $this->getFechaVenta() : ( $this->getFechaBaja() ? clone $this->getFechaBaja() : new DateTime());
  2527.         $fechaVenta->setTime(0,0,0);
  2528.         $fechaRecepcion $this->getFechaRecepcion() ? clone $this->getFechaRecepcion() : new DateTime();
  2529.         $fechaRecepcion->setTime(0,0,0);
  2530.         $this->tiempoEnVenta = ($fechaVenta && $fechaAnuncio) ? $fechaVenta->diff($fechaAnuncio)->days null;
  2531.         $this->tiempoEnStock = ($fechaVenta && $fechaRecepcion) ? $fechaVenta->diff($fechaRecepcion)->days null;
  2532.     }
  2533.     public function calculateCostesCompra(): float
  2534.     {
  2535.         $accionesCostes $this->getPromociones()?->getAcciones()?->filter(fn($accion) => $accion instanceof AccionMejora || $accion instanceof AccionServicio) ?? [];
  2536.         return array_sum$accionesCostes->map(fn($accion) => $accion->getCoste())->toArray() );
  2537.     }
  2538.     public function calculateCostesVenta(): float
  2539.     {
  2540.         $accionesCostes $this->getPromociones()?->getAcciones()?->filter(fn($accion) => $accion instanceof AccionVenta) ?? [];
  2541.         return array_sum$accionesCostes->map(fn($accion) => $accion->getCoste())->toArray() );
  2542.     }
  2543.     public function updatePrecioCosteTotal():void
  2544.     {
  2545.         $this->setPrecioCosteTotal($this->getPrecioCompra() + $this->calculateCostesCompra());
  2546.     }
  2547.     public function getIvaImportacion():float
  2548.     {
  2549.         $accionImport $this->getPromociones()?->getAcciones()?->filter(fn($accion) => $accion instanceof AccionEstado && $accion->isImport()) ?? [];
  2550.         return $accionImport->getCoste();
  2551.     }
  2552.     public function isAvailable(): bool
  2553.     {
  2554.         return !$this->getDetalleVenta()->exists(
  2555.             fn(int $keyDetalleVenta $detalle) => !$detalle->getOperacion()?->isCancelled()
  2556.         );
  2557.     }
  2558.     public function hasOperacionGestion():bool
  2559.     {
  2560.         return $this->getOperacionGestion() !== null;
  2561.     }
  2562.     public function hasOperacionCompra():bool
  2563.     {
  2564.         return $this->getOperacionCompra() !== null;
  2565.     }
  2566.     public function hasOperacionVenta():bool
  2567.     {
  2568.         return $this->getOperacionVenta() !== null;
  2569.     }
  2570.     /**
  2571.      * Campo virtual exclusivo para la API que indica si el reloj es de gestión.
  2572.      * @JMS\VirtualProperty()
  2573.      * @JMS\SerializedName("isGestion")
  2574.      * @JMS\Groups({
  2575.      *     "api_v1_reloj_serialize"
  2576.      * })
  2577.      * @return bool
  2578.      */
  2579.     public function getIsGestion():bool
  2580.     {
  2581.         return $this->hasOperacionGestion();
  2582.     }
  2583.     /**
  2584.      * Campo virtual exclusivo para la API que obtiene el precio CHRONO24.
  2585.      * @JMS\VirtualProperty()
  2586.      * @JMS\SerializedName("precio_chrono")
  2587.      * @JMS\Groups({
  2588.      *     "api_v1_reloj_serialize",
  2589.      *     "api_v1_valoracion_serialize"
  2590.      * })
  2591.      * @return null|float
  2592.      */
  2593.     public function getPrecioChrono24():?float
  2594.     {
  2595.         $criteria Criteria::create()
  2596.             ->orderBy(['fecha' => Order::Descending]);
  2597.         $anuncioCHRONO24 $this->getPromociones()
  2598.             ?->getAcciones()
  2599.             ->filter(
  2600.                 fn (AccionAbstract $accion) =>
  2601.                     $accion instanceof AccionAnuncio &&
  2602.                     $accion->getCanal()?->getNombre() === 'CHRONO24'
  2603.             )
  2604.             ->matching($criteria)
  2605.             ->first();
  2606.         return $anuncioCHRONO24 $anuncioCHRONO24->getPrecio() : null;
  2607.     }
  2608. }