src/Entity/ActividadAbstract.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\EstadoActividadEnum;
  4. use App\Validator as PerseoAssert;
  5. use DateTime;
  6. use DateTimeInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use Symfony\Component\HttpFoundation\File\File;
  10. use Symfony\Component\Uid\Uuid;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  13. /**
  14. * @ORM\Entity(repositoryClass="App\Repository\ActividadAbstractRepository")
  15. * @ORM\Table(name="actividad", schema="perseo")
  16. * @ORM\EntityListeners({
  17. * "App\EntityListener\Actividad\CalcularIDPerseoListener",
  18. * "App\EntityListener\Actividad\UpdateDatesListener"
  19. * })
  20. * @ORM\InheritanceType("SINGLE_TABLE")
  21. * @ORM\DiscriminatorColumn(name="type", type="string")
  22. * @ORM\DiscriminatorMap({"compra":"App\Entity\ActividadCompra","venta":"App\Entity\ActividadVenta"})
  23. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  24. * @Vich\Uploadable
  25. * @PerseoAssert\ContraintsValidarEntidadCp()
  26. */
  27. Abstract class ActividadAbstract
  28. {
  29. /**
  30. * @ORM\Id
  31. * @ORM\Column(type="uuid", unique=true)
  32. * @ORM\GeneratedValue(strategy="CUSTOM")
  33. * @ORM\CustomIdGenerator(class="doctrine.uuid_generator")
  34. */
  35. private $id;
  36. /**
  37. * @ORM\Column(type="string", nullable=true)
  38. */
  39. private $tipo;
  40. /**
  41. * @ORM\Column(type="string", length=2, nullable=true, options={"default":"es"})
  42. */
  43. private $idioma;
  44. /**
  45. * @ORM\Column(type="string", unique=true, nullable=false, name="id_perseo",)
  46. */
  47. private $IDperseo;
  48. /**
  49. * @ORM\Column(type="datetime", nullable=true, name="fecha")
  50. */
  51. private $fecha;
  52. /**
  53. * @ORM\Column(type="boolean", nullable=true)
  54. */
  55. private $exportacion;
  56. /**
  57. * @ORM\Column(type="string", length=4, nullable=true)
  58. */
  59. private $regimen;
  60. /**
  61. * @ORM\Column(type="boolean", nullable=true, options={"comment":"0 => particular, 1 => empresa"})
  62. */
  63. private $tipoCliente;
  64. /**
  65. * @ORM\Column(type="string", length=2, nullable=true, name="cliente_idioma")
  66. */
  67. private $clienteIdioma;
  68. /**
  69. * @ORM\Column(type="string", nullable=true, name="cliente_razon_social")
  70. */
  71. private $clienteRazonSocial;
  72. /**
  73. * @ORM\Column(
  74. * type="string",
  75. * nullable=true,
  76. * name="cliente_identificacion_tipo",
  77. * options={"comment":"DNI, Pasaporte, Licencia de Condución"}
  78. * )
  79. */
  80. private $clienteIdentificacionTipo;
  81. /**
  82. * @ORM\Column(type="string", nullable=true, name="cliente_identificacion")
  83. */
  84. private $clienteIdentificacion;
  85. /**
  86. * @ORM\Column(type="string", nullable=true, name="cliente_direccion")
  87. */
  88. private $clienteDireccion;
  89. /**
  90. * @ORM\Column(type="string", length=12, nullable=true, name="cliente_cp")
  91. * @Assert\Length(min = 5, max = 12)
  92. */
  93. private $clienteCp;
  94. /**
  95. * @ORM\Column(type="string", nullable=true, name="cliente_region")
  96. */
  97. protected $clienteRegion;
  98. /**
  99. * @ORM\Column(type="string", nullable=true, name="cliente_ciudad")
  100. */
  101. private $clienteCiudad;
  102. /**
  103. * @ORM\Column(type="string", nullable=true, name="cliente_provincia")
  104. */
  105. private $clienteProvincia;
  106. /**
  107. * @ORM\Column(type="string", nullable=true, name="cliente_ccaa")
  108. */
  109. private $clienteCcaa;
  110. /**
  111. * @ORM\Column(type="string", nullable=true, name="cliente_pais")
  112. */
  113. private $clientePais;
  114. /**
  115. * @ORM\Column(type="string", nullable=true, name="cliente_identificacion_frontal")
  116. */
  117. private $clienteIdentificacionFrontal;
  118. /**
  119. * @Vich\UploadableField(mapping="cliente", fileNameProperty="clienteIdentificacionFrontal")
  120. * @var File
  121. */
  122. private $clienteIdentificacionFrontalFile;
  123. /**
  124. * @ORM\Column(type="string", nullable=true, name="cliente_identificacion_trasera")
  125. */
  126. private $clienteIdentificacionTrasera;
  127. /**
  128. * @Vich\UploadableField(mapping="cliente", fileNameProperty="clienteIdentificacionTrasera")
  129. * @var File
  130. */
  131. private $clienteIdentificacionTraseraFile;
  132. /**
  133. * @ORM\Column(type="string", nullable=true, name="cliente_entidad_bancaria")
  134. */
  135. private $clienteEntidadBancaria;
  136. /**
  137. * @ORM\Column(type="string", nullable=true, name="cliente_iban")
  138. */
  139. private $clienteIban;
  140. /**
  141. * @ORM\Column(type="text", nullable=true, name="cliente_observaciones")
  142. */
  143. private $clienteObservaciones;
  144. /**
  145. * @ORM\Column(type="string", nullable=true, name="reloj_foto")
  146. */
  147. private $relojFoto;
  148. /**
  149. * @Vich\UploadableField(mapping="reloj", fileNameProperty="relojFoto")
  150. * @var File
  151. */
  152. protected $relojFotoFile;
  153. /**
  154. * @ORM\Column(type="string", nullable=true, name="reloj_modelo")
  155. */
  156. private $relojModelo1;
  157. /**
  158. * @ORM\Column(type="string", nullable=true)
  159. */
  160. private $relojModelo2;
  161. /**
  162. * @ORM\Column(type="string", nullable=true, name="reloj_ref")
  163. */
  164. private $relojRef1;
  165. /**
  166. * @ORM\Column(type="string", nullable=true)
  167. */
  168. private $relojRef2;
  169. /**
  170. * @ORM\Column(type="string", nullable=true, name="reloj_serie")
  171. */
  172. private $relojSerie;
  173. /**
  174. * @ORM\Column(
  175. * type="datetime",
  176. * nullable=true,
  177. * name="reloj_fecha",
  178. * options={"comment":"Fecha comprado por primera vez"}
  179. * )
  180. */
  181. private $relojFecha;
  182. /**
  183. * @ORM\Column(type="boolean", nullable=false, name="reloj_caja", options={"default":0})
  184. */
  185. private $relojCaja;
  186. /**
  187. * @ORM\Column(type="boolean", nullable=false, name="reloj_papeles", options={"default":0})
  188. */
  189. private $relojPapeles;
  190. /**
  191. * @ORM\Column(type="datetime", nullable=true, name="fecha_asentada")
  192. */
  193. private $fechaAsentada;
  194. /**
  195. * @ORM\Column(type="datetime", nullable=true)
  196. */
  197. private $fechaConfirmada;
  198. /**
  199. * @ORM\Column(type="datetime", nullable=true, name="fecha_facturada")
  200. */
  201. private $fechaFacturada;
  202. /**
  203. * @ORM\Column(type="datetime", nullable=true, name="fecha_cancelada")
  204. */
  205. private $fechaCancelada;
  206. /**
  207. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  208. */
  209. private $deletedAt;
  210. /**
  211. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  212. * @Gedmo\Timestampable(on="update")
  213. */
  214. private $updatedAt;
  215. /**
  216. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  217. * @Gedmo\Timestampable(on="create")
  218. */
  219. private $createdAt;
  220. /**
  221. * @ORM\OneToOne(targetEntity=\App\Entity\DetalleOperacion::class, inversedBy="actividad")
  222. * @ORM\JoinColumn(name="detalle_operacion_id", referencedColumnName="id", unique=true)
  223. */
  224. private $detalleOperacion;
  225. /**
  226. * @ORM\ManyToOne(targetEntity=\App\Entity\Cliente::class, inversedBy="actividades")
  227. * @ORM\JoinColumn(name="cliente_id", referencedColumnName="id")
  228. */
  229. private $cliente;
  230. /**
  231. * @ORM\ManyToOne(targetEntity=\App\Entity\Marca::class, inversedBy="actividades")
  232. * @ORM\JoinColumn(name="reloj_marca_id", referencedColumnName="id")
  233. */
  234. private $relojMarca;
  235. /**
  236. * @ORM\ManyToOne(targetEntity=\App\Entity\EstadoAspecto::class, inversedBy="actividades")
  237. * @ORM\JoinColumn(name="reloj_estado_id", referencedColumnName="id")
  238. */
  239. private $relojAspecto;
  240. /**
  241. * @ORM\ManyToOne(targetEntity=\App\Entity\UnidadNegocio::class, inversedBy="actividades")
  242. * @ORM\JoinColumn(name="unidad_negocio_id", referencedColumnName="id")
  243. */
  244. private $unidadNegocio;
  245. /**
  246. * @ORM\ManyToOne(targetEntity=\App\Entity\Usuario::class, inversedBy="actividades")
  247. * @ORM\JoinColumn(name="usuario_id", referencedColumnName="id")
  248. */
  249. private $usuario;
  250. /**
  251. * @ORM\ManyToOne(targetEntity=\App\Entity\Canal::class, inversedBy="actividades")
  252. * @ORM\JoinColumn(name="canal_id", referencedColumnName="id")
  253. */
  254. private $canal;
  255. /**
  256. * @ORM\ManyToOne(targetEntity=\App\Entity\EstadoActividad::class, inversedBy="actividades")
  257. * @ORM\JoinColumn(name="estado_id", referencedColumnName="id")
  258. */
  259. private $estado;
  260. public function __toString(): string
  261. {
  262. return $this->IDperseo??'---';
  263. }
  264. public function getId(): ?Uuid
  265. {
  266. return $this->id;
  267. }
  268. public function getIDperseo(): ?string
  269. {
  270. return $this->IDperseo;
  271. }
  272. public function setIDperseo(?string $IDperseo): static
  273. {
  274. $this->IDperseo = $IDperseo;
  275. return $this;
  276. }
  277. public function getFecha(): ?DateTimeInterface
  278. {
  279. return $this->fecha;
  280. }
  281. public function setFecha(?DateTimeInterface $fecha): static
  282. {
  283. $this->fecha = $fecha;
  284. return $this;
  285. }
  286. public function isExportacion(): ?bool
  287. {
  288. return $this->exportacion;
  289. }
  290. public function setExportacion(?bool $exportacion): static
  291. {
  292. $this->exportacion = $exportacion;
  293. return $this;
  294. }
  295. public function getRegimen(): ?string
  296. {
  297. return $this->regimen;
  298. }
  299. public function setRegimen(?string $regimen): static
  300. {
  301. $this->regimen = $regimen;
  302. return $this;
  303. }
  304. public function getClienteIdioma(): ?string
  305. {
  306. return $this->clienteIdioma;
  307. }
  308. public function setClienteIdioma(?string $clienteIdioma): static
  309. {
  310. $this->clienteIdioma = $clienteIdioma;
  311. return $this;
  312. }
  313. public function getClienteRazonSocial(): ?string
  314. {
  315. return $this->clienteRazonSocial;
  316. }
  317. public function setClienteRazonSocial(?string $clienteRazonSocial): static
  318. {
  319. $this->clienteRazonSocial = $clienteRazonSocial;
  320. return $this;
  321. }
  322. public function getClienteIdentificacionTipo(): ?string
  323. {
  324. return $this->clienteIdentificacionTipo;
  325. }
  326. public function setClienteIdentificacionTipo(?string $clienteIdentificacionTipo): static
  327. {
  328. $this->clienteIdentificacionTipo = $clienteIdentificacionTipo;
  329. return $this;
  330. }
  331. public function getClienteIdentificacion(): ?string
  332. {
  333. return $this->clienteIdentificacion;
  334. }
  335. public function setClienteIdentificacion(?string $clienteIdentificacion): static
  336. {
  337. $this->clienteIdentificacion = $clienteIdentificacion;
  338. return $this;
  339. }
  340. public function getClienteDireccion(): ?string
  341. {
  342. return $this->clienteDireccion;
  343. }
  344. public function setClienteDireccion(?string $clienteDireccion): static
  345. {
  346. $this->clienteDireccion = $clienteDireccion;
  347. return $this;
  348. }
  349. public function getClienteCp(): ?string
  350. {
  351. return $this->clienteCp;
  352. }
  353. public function setClienteCp(?string $clienteCp): static
  354. {
  355. $this->clienteCp = $clienteCp;
  356. return $this;
  357. }
  358. public function getClienteCiudad(): ?string
  359. {
  360. return $this->clienteCiudad;
  361. }
  362. public function setClienteCiudad(?string $clienteCiudad): static
  363. {
  364. $this->clienteCiudad = $clienteCiudad;
  365. return $this;
  366. }
  367. public function getClienteProvincia(): ?string
  368. {
  369. return $this->clienteProvincia;
  370. }
  371. public function setClienteProvincia(?string $clienteProvincia): static
  372. {
  373. $this->clienteProvincia = $clienteProvincia;
  374. return $this;
  375. }
  376. public function getClienteCcaa(): ?string
  377. {
  378. return $this->clienteCcaa;
  379. }
  380. public function setClienteCcaa(?string $clienteCcaa): static
  381. {
  382. $this->clienteCcaa = $clienteCcaa;
  383. return $this;
  384. }
  385. public function getClientePais(): ?string
  386. {
  387. return $this->clientePais;
  388. }
  389. public function setClientePais(?string $clientePais): static
  390. {
  391. $this->clientePais = $clientePais;
  392. return $this;
  393. }
  394. public function getClienteIdentificacionFrontal(): ?string
  395. {
  396. return $this->clienteIdentificacionFrontal;
  397. }
  398. public function setClienteIdentificacionFrontal(?string $clienteIdentificacionFrontal): static
  399. {
  400. $this->clienteIdentificacionFrontal = $clienteIdentificacionFrontal;
  401. return $this;
  402. }
  403. public function getClienteIdentificacionFrontalFile(): ?File
  404. {
  405. return $this->clienteIdentificacionFrontalFile;
  406. }
  407. public function setClienteIdentificacionFrontalFile(?File $clienteIdentificacionFrontalFile): static
  408. {
  409. $this->clienteIdentificacionFrontalFile = $clienteIdentificacionFrontalFile;
  410. if ($clienteIdentificacionFrontalFile) {
  411. // if 'updatedAt' is not defined in your entity, use another property
  412. $this->setUpdatedAt(new DateTime('now'));
  413. }
  414. return $this;
  415. }
  416. public function getClienteIdentificacionTrasera(): ?string
  417. {
  418. return $this->clienteIdentificacionTrasera;
  419. }
  420. public function setClienteIdentificacionTrasera(?string $clienteIdentificacionTrasera): static
  421. {
  422. $this->clienteIdentificacionTrasera = $clienteIdentificacionTrasera;
  423. return $this;
  424. }
  425. public function getClienteIdentificacionTraseraFile(): ?File
  426. {
  427. return $this->clienteIdentificacionTraseraFile;
  428. }
  429. public function setClienteIdentificacionTraseraFile(?File $clienteIdentificacionTraseraFile): static
  430. {
  431. $this->clienteIdentificacionTraseraFile = $clienteIdentificacionTraseraFile;
  432. if ($clienteIdentificacionTraseraFile) {
  433. // if 'updatedAt' is not defined in your entity, use another property
  434. $this->setUpdatedAt(new DateTime('now'));
  435. }
  436. return $this;
  437. }
  438. public function getClienteEntidadBancaria(): ?string
  439. {
  440. return $this->clienteEntidadBancaria;
  441. }
  442. public function setClienteEntidadBancaria(?string $clienteEntidadBancaria): static
  443. {
  444. $this->clienteEntidadBancaria = $clienteEntidadBancaria;
  445. return $this;
  446. }
  447. public function getClienteIban(): ?string
  448. {
  449. return $this->clienteIban;
  450. }
  451. public function setClienteIban(?string $clienteIban): static
  452. {
  453. $this->clienteIban = $clienteIban;
  454. return $this;
  455. }
  456. public function getClienteObservaciones(): ?string
  457. {
  458. return $this->clienteObservaciones;
  459. }
  460. public function setClienteObservaciones(?string $clienteObservaciones): static
  461. {
  462. $this->clienteObservaciones = $clienteObservaciones;
  463. return $this;
  464. }
  465. public function getDeletedAt(): ?DateTimeInterface
  466. {
  467. return $this->deletedAt;
  468. }
  469. public function setDeletedAt(?DateTimeInterface $deletedAt): static
  470. {
  471. $this->deletedAt = $deletedAt;
  472. return $this;
  473. }
  474. public function getUpdatedAt(): ?DateTimeInterface
  475. {
  476. return $this->updatedAt;
  477. }
  478. public function setUpdatedAt(DateTimeInterface $updatedAt): static
  479. {
  480. $this->updatedAt = $updatedAt;
  481. return $this;
  482. }
  483. public function getCreatedAt(): ?DateTimeInterface
  484. {
  485. return $this->createdAt;
  486. }
  487. public function setCreatedAt(DateTimeInterface $createdAt): static
  488. {
  489. $this->createdAt = $createdAt;
  490. return $this;
  491. }
  492. public function getDetalleOperacion(): ?DetalleOperacion
  493. {
  494. return $this->detalleOperacion;
  495. }
  496. public function setDetalleOperacion(?DetalleOperacion $detalleOperacion): static
  497. {
  498. $this->detalleOperacion = $detalleOperacion;
  499. return $this;
  500. }
  501. public function getCliente(): ?Cliente
  502. {
  503. return $this->cliente;
  504. }
  505. public function setCliente(?Cliente $cliente): static
  506. {
  507. $this->cliente = $cliente;
  508. return $this;
  509. }
  510. public function getExportacionStr():string
  511. {
  512. return $this->isExportacion() ? 'Exportacion' : 'Europa';
  513. }
  514. public function getRelojFoto(): ?string
  515. {
  516. return $this->relojFoto;
  517. }
  518. public function setRelojFoto(?string $relojFoto): static
  519. {
  520. $this->relojFoto = $relojFoto;
  521. return $this;
  522. }
  523. public function getRelojFotoFile(): ?File
  524. {
  525. return $this->relojFotoFile;
  526. }
  527. public function setRelojFotoFile(?File $relojFotoFile): self
  528. {
  529. $this->relojFotoFile = $relojFotoFile;
  530. if ($relojFotoFile) {
  531. // if 'updatedAt' is not defined in your entity, use another property
  532. $this->setUpdatedAt(new DateTime('now'));
  533. }
  534. return $this;
  535. }
  536. public function getRelojModelo1(): ?string
  537. {
  538. return $this->relojModelo1;
  539. }
  540. public function setRelojModelo1(?string $relojModelo1): static
  541. {
  542. $this->relojModelo1 = $relojModelo1;
  543. return $this;
  544. }
  545. public function getRelojModelo2(): ?string
  546. {
  547. return $this->relojModelo2;
  548. }
  549. public function setRelojModelo2(?string $relojModelo2): static
  550. {
  551. $this->relojModelo2 = $relojModelo2;
  552. return $this;
  553. }
  554. public function getRelojRef1(): ?string
  555. {
  556. return $this->relojRef1;
  557. }
  558. public function setRelojRef1(?string $relojRef1): static
  559. {
  560. $this->relojRef1 = $relojRef1;
  561. return $this;
  562. }
  563. public function getRelojRef2(): ?string
  564. {
  565. return $this->relojRef2;
  566. }
  567. public function setRelojRef2(?string $relojRef2): static
  568. {
  569. $this->relojRef2 = $relojRef2;
  570. return $this;
  571. }
  572. public function getRelojSerie(): ?string
  573. {
  574. return $this->relojSerie;
  575. }
  576. public function setRelojSerie(?string $relojSerie): static
  577. {
  578. $this->relojSerie = $relojSerie;
  579. return $this;
  580. }
  581. public function getRelojFecha(): ?DateTimeInterface
  582. {
  583. return $this->relojFecha;
  584. }
  585. public function setRelojFecha(?DateTimeInterface $relojFecha): static
  586. {
  587. $this->relojFecha = $relojFecha;
  588. return $this;
  589. }
  590. public function isRelojCaja(): ?bool
  591. {
  592. return $this->relojCaja;
  593. }
  594. public function setRelojCaja(bool $relojCaja): static
  595. {
  596. $this->relojCaja = $relojCaja;
  597. return $this;
  598. }
  599. public function isRelojPapeles(): ?bool
  600. {
  601. return $this->relojPapeles;
  602. }
  603. public function setRelojPapeles(bool $relojPapeles): static
  604. {
  605. $this->relojPapeles = $relojPapeles;
  606. return $this;
  607. }
  608. public function getRelojAspecto(): ?EstadoAspecto
  609. {
  610. return $this->relojAspecto;
  611. }
  612. public function setRelojAspecto(?EstadoAspecto $relojAspecto): static
  613. {
  614. $this->relojAspecto = $relojAspecto;
  615. return $this;
  616. }
  617. public function getRelojMarca(): ?Marca
  618. {
  619. return $this->relojMarca;
  620. }
  621. public function setRelojMarca(?Marca $relojMarca): static
  622. {
  623. $this->relojMarca = $relojMarca;
  624. return $this;
  625. }
  626. public function getUnidadNegocio(): ?UnidadNegocio
  627. {
  628. return $this->unidadNegocio;
  629. }
  630. public function setUnidadNegocio(?UnidadNegocio $unidadNegocio): static
  631. {
  632. $this->unidadNegocio = $unidadNegocio;
  633. return $this;
  634. }
  635. public function getUsuario(): ?Usuario
  636. {
  637. return $this->usuario;
  638. }
  639. public function setUsuario(?Usuario $usuario): static
  640. {
  641. $this->usuario = $usuario;
  642. return $this;
  643. }
  644. public function getCanal(): ?Canal
  645. {
  646. return $this->canal;
  647. }
  648. public function setCanal(?Canal $canal): static
  649. {
  650. $this->canal = $canal;
  651. return $this;
  652. }
  653. public function isTipoCliente(): ?bool
  654. {
  655. return $this->tipoCliente;
  656. }
  657. public function setTipoCliente(?bool $tipoCliente): static
  658. {
  659. $this->tipoCliente = $tipoCliente;
  660. return $this;
  661. }
  662. public function getIdioma(): ?string
  663. {
  664. return $this->idioma;
  665. }
  666. public function setIdioma(?string $idioma): static
  667. {
  668. $this->idioma = $idioma;
  669. return $this;
  670. }
  671. public function getTipo(): ?string
  672. {
  673. return $this->tipo;
  674. }
  675. public function setTipo(?string $tipo): static
  676. {
  677. $this->tipo = $tipo;
  678. return $this;
  679. }
  680. public function getImporte():?float
  681. {
  682. return $this instanceof ActividadCompra ? $this->getPrecioCoste() : $this->getPrecio();
  683. }
  684. public function getRelojStr():string
  685. {
  686. return implode(', ', [$this->getRelojMarca(), $this->getRelojModelo1()]);
  687. }
  688. public function getFechaVenta():?DateTimeInterface
  689. {
  690. return $this instanceof ActividadVenta ? $this->getFecha() : null;
  691. }
  692. public function getPrecioCoste():?float
  693. {
  694. return $this instanceof ActividadCompra ? $this->getPrecioCoste() : null;
  695. }
  696. public function getPrecioVenta():?float
  697. {
  698. return $this instanceof ActividadVenta ? $this->getPrecioVenta() : null;
  699. }
  700. public function getClienteRegion(): ?string
  701. {
  702. return $this->clienteRegion;
  703. }
  704. public function setClienteRegion(?string $clienteRegion): static
  705. {
  706. $this->clienteRegion = $clienteRegion;
  707. return $this;
  708. }
  709. public function getEstado(): ?EstadoActividad
  710. {
  711. return $this->estado;
  712. }
  713. public function setEstado(?EstadoActividad $estado): static
  714. {
  715. $this->estado = $estado;
  716. return $this;
  717. }
  718. public function getFechaAsentada(): ?\DateTimeInterface
  719. {
  720. return $this->fechaAsentada;
  721. }
  722. public function setFechaAsentada(?\DateTimeInterface $fechaAsentada): static
  723. {
  724. $this->fechaAsentada = $fechaAsentada;
  725. return $this;
  726. }
  727. public function getFechaConfirmada(): ?\DateTimeInterface
  728. {
  729. return $this->fechaConfirmada;
  730. }
  731. public function setFechaConfirmada(?\DateTimeInterface $fechaConfirmada): static
  732. {
  733. $this->fechaConfirmada = $fechaConfirmada;
  734. return $this;
  735. }
  736. public function getFechaFacturada(): ?\DateTimeInterface
  737. {
  738. return $this->fechaFacturada;
  739. }
  740. public function setFechaFacturada(?\DateTimeInterface $fechaFacturada): static
  741. {
  742. $this->fechaFacturada = $fechaFacturada;
  743. return $this;
  744. }
  745. public function getFechaCancelada(): ?\DateTimeInterface
  746. {
  747. return $this->fechaCancelada;
  748. }
  749. public function setFechaCancelada(?\DateTimeInterface $fechaCancelada): static
  750. {
  751. $this->fechaCancelada = $fechaCancelada;
  752. return $this;
  753. }
  754. public function getEstadoFecha(): ?DateTimeInterface
  755. {
  756. switch($this->getEstado()?->getKey())
  757. {
  758. case EstadoActividadEnum::ESTADO_ASENTADA:
  759. $fecha = $this->getFechaAsentada();
  760. break;
  761. case EstadoActividadEnum::ESTADO_CONFIRMADA:
  762. $fecha = $this->getFechaConfirmada();
  763. break;
  764. case EstadoActividadEnum::ESTADO_FACTURADA:
  765. $fecha = $this->getFechaFacturada();
  766. break;
  767. case EstadoActividadEnum::ESTADO_CANCELADA:
  768. $fecha = $this->getFechaCancelada();
  769. break;
  770. default:
  771. $fecha = null;
  772. break;
  773. }
  774. return $fecha;
  775. }
  776. }