src/Entity/Reloj.php line 27

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