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