src/Entity/Contrato.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContratoRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ContratoRepository::class)
  10.  */
  11. class Contrato
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $referenciaContrato;
  23.     /**
  24.      * @ORM\ManyToOne(targetEntity=Canal::class, inversedBy="contratos")
  25.      * @ORM\JoinColumn(nullable=false)
  26.      */
  27.     private $canal;
  28.     /**
  29.      * @ORM\Column(type="date")
  30.      */
  31.     private $fecha;
  32.     /**
  33.      * @ORM\Column(type="integer")
  34.      */
  35.     private $consumoGrabado;
  36.     /**
  37.      * @ORM\Column(type="integer")
  38.      */
  39.     private $consumoFirmado;
  40.     /**
  41.      * @ORM\Column(type="boolean")
  42.      */
  43.     private $visita;
  44.     /**
  45.      * @ORM\Column(type="boolean")
  46.      */
  47.     private $referido;
  48.     /**
  49.      * @ORM\Column(type="string", length=255)
  50.      */
  51.     private $formaPago;
  52.     /**
  53.      * @ORM\Column(type="string", length=255, nullable=true)
  54.      */
  55.     private $iban;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $ccc;
  60.     /**
  61.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  62.      */
  63.     private $lecturaInicialP1;
  64.     /**
  65.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  66.      */
  67.     private $lecturaInicialP2;
  68.     /**
  69.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  70.      */
  71.     private $lecturaInicialP3;
  72.     /**
  73.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  74.      */
  75.     private $lecturaInicialP4;
  76.     /**
  77.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  78.      */
  79.     private $lecturaInicialP5;
  80.     /**
  81.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  82.      */
  83.     private $lecturaInicialP6;
  84.     /**
  85.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  86.      */
  87.     private $lecturaReactivaP1;
  88.     /**
  89.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  90.      */
  91.     private $lecturaReactivaP2;
  92.     /**
  93.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  94.      */
  95.     private $lecturaReactivaP3;
  96.     /**
  97.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  98.      */
  99.     private $lecturaReactivaP4;
  100.     /**
  101.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  102.      */
  103.     private $lecturaReactivaP5;
  104.     /**
  105.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  106.      */
  107.     private $lecturaReactivaP6;
  108.     /**
  109.      * @ORM\Column(type="date", nullable=true)
  110.      */
  111.     private $fechaLectura;
  112.     /**
  113.      * @ORM\ManyToOne(targetEntity=TipoLectura::class, inversedBy="contratos")
  114.      * @ORM\JoinColumn(nullable=true)
  115.      */
  116.     private $tipoLectura;
  117.     /**
  118.      * @ORM\Column(type="date", nullable=true)
  119.      */
  120.     private $fechaCobro;
  121.     /**
  122.      * @ORM\ManyToOne(targetEntity=Cliente::class, inversedBy="contratos")
  123.      */
  124.     private $cliente;
  125.     /**
  126.      * @ORM\ManyToOne(targetEntity=Suministro::class, inversedBy="contratos")
  127.      */
  128.     private $suministro;
  129.     /**
  130.      * @ORM\ManyToOne(targetEntity=Producto::class, inversedBy="contratos")
  131.      */
  132.     private $producto;
  133.     /**
  134.      * @ORM\OneToMany(targetEntity=Factura::class, mappedBy="contrato")
  135.      */
  136.     private $facturas;
  137.     /**
  138.      * @ORM\ManyToOne(targetEntity=ProductoProveedor::class, inversedBy="contratos")
  139.      */
  140.     private $productoProveedor;
  141.     /**
  142.      * @ORM\ManyToOne(targetEntity=Proveedor::class, inversedBy="contratos")
  143.      */
  144.     private $proveedor;
  145.     /**
  146.      * @ORM\Column(type="date", nullable=true)
  147.      */
  148.     private $fechaFin;
  149.     /**
  150.      * @ORM\ManyToOne(targetEntity=TipoImpuesto::class, inversedBy="contratos")
  151.      * @ORM\JoinColumn(nullable=false)
  152.      */
  153.     private $tipoImpuesto;
  154.     /**
  155.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="contratosCreados")
  156.      */
  157.     private $createdBy;
  158.     /**
  159.      * @ORM\ManyToOne(targetEntity=Estado::class, inversedBy="contratos")
  160.      */
  161.     private $estado;
  162.     /**
  163.      * @ORM\Column(type="string", length=255, nullable=true)
  164.      */
  165.     private $observaciones;
  166.     /**
  167.      * @ORM\Column(type="string", length=255, nullable=true)
  168.      */
  169.     private $comercial;
  170.     /**
  171.      * @ORM\Column(type="boolean")
  172.      */
  173.     private $oculto=false;
  174.     /**
  175.      * @ORM\Column(type="boolean")
  176.      */
  177.     private $cambioTarifa=false;
  178.     /**
  179.      * @ORM\Column(type="decimal", precision=10, scale=5, nullable=true)
  180.      */
  181.     private $factorConversion;
  182.     /**
  183.      * @ORM\Column(type="date", nullable=true)
  184.      */
  185.     private $ultimaLectura;
  186.     /**
  187.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  188.      */
  189.     private $ahorroAnual;
  190.     /**
  191.      * @ORM\Column(type="date", nullable=true)
  192.      */
  193.     private $fechaCaducidad;
  194.     /**
  195.      * @ORM\OneToMany(targetEntity=FacturaGenerica::class, mappedBy="contrato")
  196.      */
  197.     private $facturasGenericas;
  198.     /**
  199.      * @ORM\ManyToOne(targetEntity=Comercial::class, inversedBy="contratos")
  200.      */
  201.     private $seller;
  202.     /**
  203.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  204.      */
  205.     private $comision1;
  206.     /**
  207.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  208.      */
  209.     private $comision2;
  210.     /**
  211.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  212.      */
  213.     private $otrosGastos;
  214.     /**
  215.      * @ORM\Column(type="string", length=255, nullable=true)
  216.      */
  217.     private $optimizacion;
  218.     /**
  219.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  220.      */
  221.     private $comisionComercial;
  222.     /**
  223.      * @ORM\Column(type="boolean", nullable=true)
  224.      */
  225.     private $facturaDevuelta;
  226.     /**
  227.      * @ORM\Column(type="string", length=255, nullable=true)
  228.      */
  229.     private $cambios;
  230.     /**
  231.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  232.      */
  233.     private $consumoRealP1;
  234.     /**
  235.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  236.      */
  237.     private $consumoRealP2;
  238.     /**
  239.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  240.      */
  241.     private $consumoRealP3;
  242.     /**
  243.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  244.      */
  245.     private $consumoRealP4;
  246.     /**
  247.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  248.      */
  249.     private $consumoRealP5;
  250.     /**
  251.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  252.      */
  253.     private $consumoRealP6;
  254.     /**
  255.      * @ORM\ManyToOne(targetEntity=EstadoComision::class, inversedBy="contratosCobrados")
  256.      */
  257.     private $comisionCobrada;
  258.     /**
  259.      * @ORM\ManyToOne(targetEntity=EstadoComision::class, inversedBy="contratosPagados")
  260.      */
  261.     private $comisionPagada;
  262.     /**
  263.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  264.      */
  265.     private $comisionCobradaValor;
  266.     /**
  267.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  268.      */
  269.     private $comisionPagadaValor;
  270.     /**
  271.      * @ORM\Column(type="date", nullable=true)
  272.      */
  273.     private $comisionCobradaFecha;
  274.     /**
  275.      * @ORM\Column(type="date", nullable=true)
  276.      */
  277.     private $comisionPagadaFecha;
  278.     /**
  279.      * @ORM\ManyToOne(targetEntity=EstadoFinanciero::class, inversedBy="contratos")
  280.      */
  281.     private $estadoFinanciero;
  282.     /**
  283.      * @ORM\Column(type="date", nullable=true)
  284.      */
  285.     private $fechaRentabilidad;
  286.     /**
  287.      * @ORM\Column(type="string", length=255, nullable=true)
  288.      */
  289.     private $observacionesRentabilidad;
  290.     /**
  291.      * @ORM\ManyToOne(targetEntity=TipoIva::class, inversedBy="contratos")
  292.      */
  293.     private $tipoIva;
  294.     /**
  295.      * @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
  296.      */
  297.     private $consumoAcumulado;
  298.     /**
  299.      * @ORM\ManyToMany(targetEntity=Comercial::class, inversedBy="subContratos")
  300.      */
  301.     private $subseller;
  302.     /**
  303.      * @ORM\Column(type="boolean", nullable=true)
  304.      */
  305.     private $logoHosteleria;
  306.     /**
  307.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  308.      */
  309.     private $importeBateriaVirtual;
  310.     /**
  311.      * @ORM\Column(type="boolean", nullable=true)
  312.      */
  313.     private $bateriaVirtual;
  314.     public function __construct()
  315.     {
  316.         $this->facturas = new ArrayCollection();
  317.         $this->facturasGenericas = new ArrayCollection();
  318.         $this->subseller = new ArrayCollection();
  319.     }
  320.     public function getId(): ?int
  321.     {
  322.         return $this->id;
  323.     }
  324.     public function getUltimaLectura(): ?\DateTimeInterface
  325.     {
  326.         return $this->ultimaLectura;
  327.     }
  328.     public function setUltimaLectura($ultimaLectura): self
  329.     {
  330.         $this->ultimaLectura $ultimaLectura;
  331.         return $this;
  332.     }
  333.     public function getReferenciaContrato(): ?string
  334.     {
  335.         return $this->referenciaContrato;
  336.     }
  337.     public function setReferenciaContrato(string $referenciaContrato): self
  338.     {
  339.         $this->referenciaContrato $referenciaContrato;
  340.         return $this;
  341.     }
  342.     public function getCanal(): ?Canal
  343.     {
  344.         return $this->canal;
  345.     }
  346.     public function setCanal(Canal $canal): self
  347.     {
  348.         $this->canal $canal;
  349.         return $this;
  350.     }
  351.     public function getFecha(): ?\DateTimeInterface
  352.     {
  353.         return $this->fecha;
  354.     }
  355.     public function setFecha(\DateTimeInterface $fecha): self
  356.     {
  357.         $this->fecha $fecha;
  358.         return $this;
  359.     }
  360.     public function getConsumoGrabado(): ?int
  361.     {
  362.         return $this->consumoGrabado;
  363.     }
  364.     public function setConsumoGrabado(int $consumoGrabado): self
  365.     {
  366.         $this->consumoGrabado $consumoGrabado;
  367.         return $this;
  368.     }
  369.     public function getConsumoFirmado(): ?int
  370.     {
  371.         return $this->consumoFirmado;
  372.     }
  373.     public function setConsumoFirmado(int $consumoFirmado): self
  374.     {
  375.         $this->consumoFirmado $consumoFirmado;
  376.         return $this;
  377.     }
  378.     public function getVisita(): ?bool
  379.     {
  380.         return $this->visita;
  381.     }
  382.     public function setVisita(bool $visita): self
  383.     {
  384.         $this->visita $visita;
  385.         return $this;
  386.     }
  387.     public function getReferido(): ?bool
  388.     {
  389.         return $this->referido;
  390.     }
  391.     public function setReferido(bool $referido): self
  392.     {
  393.         $this->referido $referido;
  394.         return $this;
  395.     }
  396.     public function getFormaPago(): ?string
  397.     {
  398.         return $this->formaPago;
  399.     }
  400.     public function setFormaPago(string $formaPago): self
  401.     {
  402.         $this->formaPago $formaPago;
  403.         return $this;
  404.     }
  405.     public function getIban(): ?string
  406.     {
  407.         return $this->iban;
  408.     }
  409.     public function setIban(string $iban): self
  410.     {
  411.         $this->iban $iban;
  412.         return $this;
  413.     }
  414.     public function getCcc(): ?string
  415.     {
  416.         return $this->ccc;
  417.     }
  418.     public function setCcc(string $ccc): self
  419.     {
  420.         $this->ccc $ccc;
  421.         return $this;
  422.     }
  423.     public function getLecturaInicialP1(): ?string
  424.     {
  425.         return $this->lecturaInicialP1;
  426.     }
  427.     public function setLecturaInicialP1(string $lecturaInicialP1): self
  428.     {
  429.         $this->lecturaInicialP1 $lecturaInicialP1;
  430.         return $this;
  431.     }
  432.     public function getLecturaInicialP2(): ?string
  433.     {
  434.         return $this->lecturaInicialP2;
  435.     }
  436.     public function setLecturaInicialP2(?string $lecturaInicialP2): self
  437.     {
  438.         $this->lecturaInicialP2 $lecturaInicialP2;
  439.         return $this;
  440.     }
  441.     public function getLecturaInicialP3(): ?string
  442.     {
  443.         return $this->lecturaInicialP3;
  444.     }
  445.     public function setLecturaInicialP3(string $lecturaInicialP3): self
  446.     {
  447.         $this->lecturaInicialP3 $lecturaInicialP3;
  448.         return $this;
  449.     }
  450.     public function getLecturaInicialP4(): ?string
  451.     {
  452.         return $this->lecturaInicialP4;
  453.     }
  454.     public function setLecturaInicialP4(?string $lecturaInicialP4): self
  455.     {
  456.         $this->lecturaInicialP4 $lecturaInicialP4;
  457.         return $this;
  458.     }
  459.     public function getLecturaInicialP5(): ?string
  460.     {
  461.         return $this->lecturaInicialP5;
  462.     }
  463.     public function setLecturaInicialP5(?string $lecturaInicialP5): self
  464.     {
  465.         $this->lecturaInicialP5 $lecturaInicialP5;
  466.         return $this;
  467.     }
  468.     public function getLecturaInicialP6(): ?string
  469.     {
  470.         return $this->lecturaInicialP6;
  471.     }
  472.     public function setLecturaInicialP6(?string $lecturaInicialP6): self
  473.     {
  474.         $this->lecturaInicialP6 $lecturaInicialP6;
  475.         return $this;
  476.     }
  477.     public function getLecturaReactivaP1(): ?string
  478.     {
  479.         return $this->lecturaReactivaP1;
  480.     }
  481.     public function setLecturaReactivaP1(string $lecturaReactivaP1): self
  482.     {
  483.         $this->lecturaReactivaP1 $lecturaReactivaP1;
  484.         return $this;
  485.     }
  486.     public function getLecturaReactivaP2(): ?string
  487.     {
  488.         return $this->lecturaReactivaP2;
  489.     }
  490.     public function setLecturaReactivaP2(?string $lecturaReactivaP2): self
  491.     {
  492.         $this->lecturaReactivaP2 $lecturaReactivaP2;
  493.         return $this;
  494.     }
  495.     public function getLecturaReactivaP3(): ?string
  496.     {
  497.         return $this->lecturaReactivaP3;
  498.     }
  499.     public function setLecturaReactivaP3(?string $lecturaReactivaP3): self
  500.     {
  501.         $this->lecturaReactivaP3 $lecturaReactivaP3;
  502.         return $this;
  503.     }
  504.     public function getLecturaReactivaP4(): ?string
  505.     {
  506.         return $this->lecturaReactivaP4;
  507.     }
  508.     public function setLecturaReactivaP4(?string $lecturaReactivaP4): self
  509.     {
  510.         $this->lecturaReactivaP4 $lecturaReactivaP4;
  511.         return $this;
  512.     }
  513.     public function getLecturaReactivaP5(): ?string
  514.     {
  515.         return $this->lecturaReactivaP5;
  516.     }
  517.     public function setLecturaReactivaP5(?string $lecturaReactivaP5): self
  518.     {
  519.         $this->lecturaReactivaP5 $lecturaReactivaP5;
  520.         return $this;
  521.     }
  522.     public function getLecturaReactivaP6(): ?string
  523.     {
  524.         return $this->lecturaReactivaP6;
  525.     }
  526.     public function setLecturaReactivaP6(?string $lecturaReactivaP6): self
  527.     {
  528.         $this->lecturaReactivaP6 $lecturaReactivaP6;
  529.         return $this;
  530.     }
  531.     public function getFechaLectura(): ?\DateTimeInterface
  532.     {
  533.         return $this->fechaLectura;
  534.     }
  535.     public function setFechaLectura(?\DateTimeInterface $fechaLectura): self
  536.     {
  537.         $this->fechaLectura $fechaLectura;
  538.         return $this;
  539.     }
  540.     public function getTipoLectura(): ?TipoLectura
  541.     {
  542.         return $this->tipoLectura;
  543.     }
  544.     public function setTipoLectura(?TipoLectura $tipoLectura): self
  545.     {
  546.         $this->tipoLectura $tipoLectura;
  547.         return $this;
  548.     }
  549.     public function getFechaCobro(): ?\DateTimeInterface
  550.     {
  551.         return $this->fechaCobro;
  552.     }
  553.     public function setFechaCobro(?\DateTimeInterface $fechaCobro): self
  554.     {
  555.         $this->fechaCobro $fechaCobro;
  556.         return $this;
  557.     }
  558.     public function getCliente(): ?Cliente
  559.     {
  560.         return $this->cliente;
  561.     }
  562.     public function setCliente(?Cliente $cliente): self
  563.     {
  564.         $this->cliente $cliente;
  565.         return $this;
  566.     }
  567.     public function getSuministro(): ?Suministro
  568.     {
  569.         return $this->suministro;
  570.     }
  571.     public function setSuministro(?Suministro $suministro): self
  572.     {
  573.         $this->suministro $suministro;
  574.         return $this;
  575.     }
  576.     public function getProducto(): ?Producto
  577.     {
  578.         return $this->producto;
  579.     }
  580.     public function setProducto(?Producto $producto): self
  581.     {
  582.         $this->producto $producto;
  583.         return $this;
  584.     }
  585.     /**
  586.      * @return Collection|Factura[]
  587.      */
  588.     public function getFacturas(): Collection
  589.     {
  590.         return $this->facturas;
  591.     }
  592.     public function addFactura(Factura $factura): self
  593.     {
  594.         if (!$this->facturas->contains($factura)) {
  595.             $this->facturas[] = $factura;
  596.             $factura->setContrato($this);
  597.         }
  598.         return $this;
  599.     }
  600.     public function removeFactura(Factura $factura): self
  601.     {
  602.         if ($this->facturas->contains($factura)) {
  603.             $this->facturas->removeElement($factura);
  604.             // set the owning side to null (unless already changed)
  605.             if ($factura->getContrato() === $this) {
  606.                 $factura->setContrato(null);
  607.             }
  608.         }
  609.         return $this;
  610.     }
  611.     public function getProductoProveedor(): ?ProductoProveedor
  612.     {
  613.         return $this->productoProveedor;
  614.     }
  615.     public function setProductoProveedor(?ProductoProveedor $productoProveedor): self
  616.     {
  617.         $this->productoProveedor $productoProveedor;
  618.         return $this;
  619.     }
  620.     public function getProveedor(): ?Proveedor
  621.     {
  622.         return $this->proveedor;
  623.     }
  624.     public function setProveedor(?Proveedor $proveedor): self
  625.     {
  626.         $this->proveedor $proveedor;
  627.         return $this;
  628.     }
  629.     public function getTipoImpuesto(): ?TipoImpuesto
  630.     {
  631.         return $this->tipoImpuesto;
  632.     }
  633.     public function setTipoImpuesto(?TipoImpuesto $impuesto): self
  634.     {
  635.         $this->tipoImpuesto $impuesto;
  636.         return $this;
  637.     }
  638.     public function __toString(): string
  639.     {
  640.         return $this->referenciaContrato;
  641.     }
  642.     public function getNumeroCuenta(): ?string
  643.     {
  644.         return $this->iban.' '.implode(' 'str_split($this->ccc4)) ;
  645.     }
  646.     public function setNumeroCuenta(string $numeroCuenta): self
  647.     {
  648.         $numeroCuenta=str_replace(' ','',$numeroCuenta);
  649.         $this->iban=substr($numeroCuenta0,4);
  650.         $this->ccc=substr($numeroCuenta4);
  651.         return $this;
  652.     }
  653.     public function getFechaFin(): ?\DateTimeInterface
  654.     {
  655.         return $this->fechaFin;
  656.     }
  657.     public function setFechaFin(?\DateTimeInterface $fechaFin): self
  658.     {
  659.         $this->fechaFin $fechaFin;
  660.         return $this;
  661.     }
  662.     public function getCreatedBy(): ?User
  663.     {
  664.         return $this->createdBy;
  665.     }
  666.     public function setCreatedBy(?User $createdBy): self
  667.     {
  668.         $this->createdBy $createdBy;
  669.         return $this;
  670.     }
  671.     public function getEstado(): ?Estado
  672.     {
  673.         return $this->estado;
  674.     }
  675.     public function setEstado(?Estado $estado): self
  676.     {
  677.         $this->estado $estado;
  678.         return $this;
  679.     }
  680.     public function getObservaciones(): ?string
  681.     {
  682.         return $this->observaciones;
  683.     }
  684.     public function setObservaciones(?string $observaciones): self
  685.     {
  686.         $this->observaciones $observaciones;
  687.         return $this;
  688.     }
  689.     public function getComercial(): ?string
  690.     {
  691.         return $this->comercial;
  692.     }
  693.     public function setComercial(?string $comercial): self
  694.     {
  695.         $this->comercial $comercial;
  696.         return $this;
  697.     }
  698.     public function getOculto(): ?bool
  699.     {
  700.         return $this->oculto;
  701.     }
  702.     public function setOculto(?bool $oculto): self
  703.     {
  704.         $this->oculto $oculto;
  705.         return $this;
  706.     }
  707.     public function getCambioTarifa(): ?bool
  708.     {
  709.         return $this->cambioTarifa;
  710.     }
  711.     public function setCambioTarifa(?bool $cambioTarifa): self
  712.     {
  713.         $this->cambioTarifa $cambioTarifa;
  714.         return $this;
  715.     }
  716.     public function getFactorConversion(): ?string
  717.     {
  718.         return $this->factorConversion;
  719.     }
  720.     public function setFactorConversion(?string $factorConversion): self
  721.     {
  722.         $this->factorConversion $factorConversion;
  723.         return $this;
  724.     }
  725.     public function getAhorroAnual(): ?string
  726.     {
  727.         return $this->ahorroAnual;
  728.     }
  729.     public function setAhorroAnual(?string $ahorroAnual): self
  730.     {
  731.         $this->ahorroAnual $ahorroAnual;
  732.         return $this;
  733.     }
  734.     public function getFechaCaducidad(): ?\DateTimeInterface
  735.     {
  736.         return $this->fechaCaducidad;
  737.     }
  738.     public function setFechaCaducidad(?\DateTimeInterface $fechaCaducidad): self
  739.     {
  740.         $this->fechaCaducidad $fechaCaducidad;
  741.         return $this;
  742.     }
  743.     /**
  744.      * @return Collection|FacturaGenerica[]
  745.      */
  746.     public function getFacturasGenericas(): Collection
  747.     {
  748.         return $this->facturasGenericas;
  749.     }
  750.     public function addFacturaGenerica(FacturaGenerica $facturaGenerica): self
  751.     {
  752.         if (!$this->facturasGenericas->contains($facturaGenerica)) {
  753.             $this->facturasGenericas[] = $facturaGenerica;
  754.             $facturaGenerica->setContrato($this);
  755.         }
  756.         return $this;
  757.     }
  758.     public function removeFacturaGenerica(FacturaGenerica $facturaGenerica): self
  759.     {
  760.         if ($this->facturasGenericas->contains($facturaGenerica)) {
  761.             $this->facturasGenericas->removeElement($facturaGenerica);
  762.             // set the owning side to null (unless already changed)
  763.             if ($facturaGenerica->getContrato() === $this) {
  764.                 $facturaGenerica->setContrato(null);
  765.             }
  766.         }
  767.         return $this;
  768.     }
  769.     public function getSeller(): ?Comercial
  770.     {
  771.         return $this->seller;
  772.     }
  773.     public function setSeller(?Comercial $seller): self
  774.     {
  775.         $this->seller $seller;
  776.         return $this;
  777.     }
  778.     public function getComision1(): ?string
  779.     {
  780.         return $this->comision1;
  781.     }
  782.     public function setComision1(?string $comision1): self
  783.     {
  784.         $this->comision1 $comision1;
  785.         return $this;
  786.     }
  787.     public function getComision2(): ?string
  788.     {
  789.         return $this->comision2;
  790.     }
  791.     public function setComision2(?string $comision2): self
  792.     {
  793.         $this->comision2 $comision2;
  794.         return $this;
  795.     }
  796.     public function getOtrosGastos(): ?string
  797.     {
  798.         return $this->otrosGastos;
  799.     }
  800.     public function setOtrosGastos(?string $otrosGastos): self
  801.     {
  802.         $this->otrosGastos $otrosGastos;
  803.         return $this;
  804.     }
  805.     public function getOptimizacion(): ?string
  806.     {
  807.         return $this->optimizacion;
  808.     }
  809.     public function setOptimizacion(?string $optimizacion): self
  810.     {
  811.         $this->optimizacion $optimizacion;
  812.         return $this;
  813.     }
  814.     public function getComisionComercial(): ?string
  815.     {
  816.         return $this->comisionComercial;
  817.     }
  818.     public function setComisionComercial(?string $comisionComercial): self
  819.     {
  820.         $this->comisionComercial $comisionComercial;
  821.         return $this;
  822.     }
  823.     public function getFacturaDevuelta(): ?bool
  824.     {
  825.         return $this->facturaDevuelta;
  826.     }
  827.     public function setFacturaDevuelta(?bool $facturaDevuelta): self
  828.     {
  829.         $this->facturaDevuelta $facturaDevuelta;
  830.         return $this;
  831.     }
  832.     public function getCambios(): ?string
  833.     {
  834.         return $this->cambios;
  835.     }
  836.     public function setCambios(?string $cambios): self
  837.     {
  838.         $this->cambios $cambios;
  839.         return $this;
  840.     }
  841.     public function getConsumoRealP1(): ?string
  842.     {
  843.         return $this->consumoRealP1;
  844.     }
  845.     public function setConsumoRealP1(?string $consumoRealP1): self
  846.     {
  847.         $this->consumoRealP1 $consumoRealP1;
  848.         return $this;
  849.     }
  850.     public function getConsumoRealP2(): ?string
  851.     {
  852.         return $this->consumoRealP2;
  853.     }
  854.     public function setConsumoRealP2(?string $consumoRealP2): self
  855.     {
  856.         $this->consumoRealP2 $consumoRealP2;
  857.         return $this;
  858.     }
  859.     public function getConsumoRealP3(): ?string
  860.     {
  861.         return $this->consumoRealP3;
  862.     }
  863.     public function setConsumoRealP3(?string $consumoRealP3): self
  864.     {
  865.         $this->consumoRealP3 $consumoRealP3;
  866.         return $this;
  867.     }
  868.     public function getConsumoRealP4(): ?string
  869.     {
  870.         return $this->consumoRealP4;
  871.     }
  872.     public function setConsumoRealP4(?string $consumoRealP4): self
  873.     {
  874.         $this->consumoRealP4 $consumoRealP4;
  875.         return $this;
  876.     }
  877.     public function getConsumoRealP5(): ?string
  878.     {
  879.         return $this->consumoRealP5;
  880.     }
  881.     public function setConsumoRealP5(?string $consumoRealP5): self
  882.     {
  883.         $this->consumoRealP5 $consumoRealP5;
  884.         return $this;
  885.     }
  886.     public function getConsumoRealP6(): ?string
  887.     {
  888.         return $this->consumoRealP6;
  889.     }
  890.     public function setConsumoRealP6(?string $consumoRealP6): self
  891.     {
  892.         $this->consumoRealP6 $consumoRealP6;
  893.         return $this;
  894.     }
  895.     public function getComisionCobrada(): ?EstadoComision
  896.     {
  897.         return $this->comisionCobrada;
  898.     }
  899.     public function setComisionCobrada(?EstadoComision $comisionCobrada): self
  900.     {
  901.         $this->comisionCobrada $comisionCobrada;
  902.         return $this;
  903.     }
  904.     public function getComisionPagada(): ?EstadoComision
  905.     {
  906.         return $this->comisionPagada;
  907.     }
  908.     public function setComisionPagada(?EstadoComision $comisionPagada): self
  909.     {
  910.         $this->comisionPagada $comisionPagada;
  911.         return $this;
  912.     }
  913.     public function getComisionCobradaValor(): ?string
  914.     {
  915.         return $this->comisionCobradaValor;
  916.     }
  917.     public function setComisionCobradaValor(?string $comisionCobradaValor): self
  918.     {
  919.         $this->comisionCobradaValor $comisionCobradaValor;
  920.         return $this;
  921.     }
  922.     public function getComisionPagadaValor(): ?string
  923.     {
  924.         return $this->comisionPagadaValor;
  925.     }
  926.     public function setComisionPagadaValor(?string $comisionPagadaValor): self
  927.     {
  928.         $this->comisionPagadaValor $comisionPagadaValor;
  929.         return $this;
  930.     }
  931.     public function getComisionCobradaFecha(): ?\DateTimeInterface
  932.     {
  933.         return $this->comisionCobradaFecha;
  934.     }
  935.     public function setComisionCobradaFecha(?\DateTimeInterface $comisionCobradaFecha): self
  936.     {
  937.         $this->comisionCobradaFecha $comisionCobradaFecha;
  938.         return $this;
  939.     }
  940.     public function getComisionPagadaFecha(): ?\DateTimeInterface
  941.     {
  942.         return $this->comisionPagadaFecha;
  943.     }
  944.     public function setComisionPagadaFecha(?\DateTimeInterface $comisionPagadaFecha): self
  945.     {
  946.         $this->comisionPagadaFecha $comisionPagadaFecha;
  947.         return $this;
  948.     }
  949.     public function getEstadoFinanciero(): ?EstadoFinanciero
  950.     {
  951.         return $this->estadoFinanciero;
  952.     }
  953.     public function setEstadoFinanciero(?EstadoFinanciero $estadoFinanciero): self
  954.     {
  955.         $this->estadoFinanciero $estadoFinanciero;
  956.         return $this;
  957.     }
  958.     public function getFechaRentabilidad(): ?\DateTimeInterface
  959.     {
  960.         return $this->fechaRentabilidad;
  961.     }
  962.     public function setFechaRentabilidad(?\DateTimeInterface $fechaRentabilidad): self
  963.     {
  964.         $this->fechaRentabilidad $fechaRentabilidad;
  965.         return $this;
  966.     }
  967.     public function getObservacionesRentabilidad(): ?string
  968.     {
  969.         return $this->observacionesRentabilidad;
  970.     }
  971.     public function setObservacionesRentabilidad(?string $observacionesRentabilidad): self
  972.     {
  973.         $this->observacionesRentabilidad $observacionesRentabilidad;
  974.         return $this;
  975.     }
  976.     public function getTipoIva(): ?TipoIva
  977.     {
  978.         return $this->tipoIva;
  979.     }
  980.     public function setTipoIva(?TipoIva $tipoIva): self
  981.     {
  982.         $this->tipoIva $tipoIva;
  983.         return $this;
  984.     }
  985.     public function getConsumoAcumulado(): ?string
  986.     {
  987.         return $this->consumoAcumulado;
  988.     }
  989.     public function setConsumoAcumulado(?string $consumoAcumulado): self
  990.     {
  991.         $this->consumoAcumulado $consumoAcumulado;
  992.         return $this;
  993.     }
  994.     public function updateConsumoAcumulado(): self
  995.     {
  996.         $oneYearAgo=new DateTime("2017-05-18");
  997.         $oneYearAgo->modify("-1 year");
  998.         $facturas=$this->getFacturas();
  999.         if( empty($facturas) ){
  1000.             $this->consumoAcumulado=0;
  1001.         }else{
  1002.             $facturas=usort($facturas, function($a$b) {
  1003.                 return strtotime$a->getFechaLectura() ) <=> strtotime$b->getFechaLectura() );
  1004.             });
  1005.             if($this->fechaLectura>$oneYearAgo){
  1006.                 $oldestLecturaP1=$this->getLecturaInicialP1();
  1007.             }
  1008.         }
  1009.         return $this;
  1010.     }
  1011.     /**
  1012.      * @return Collection<int, Comercial>
  1013.      */
  1014.     public function getSubseller(): Collection
  1015.     {
  1016.         return $this->subseller;
  1017.     }
  1018.     public function addSubseller(Comercial $subseller): self
  1019.     {
  1020.         if (!$this->subseller->contains($subseller)) {
  1021.             $this->subseller[] = $subseller;
  1022.         }
  1023.         return $this;
  1024.     }
  1025.     public function removeSubseller(Comercial $subseller): self
  1026.     {
  1027.         $this->subseller->removeElement($subseller);
  1028.         return $this;
  1029.     }
  1030.     public function isLogoHosteleria(): ?bool
  1031.     {
  1032.         return $this->logoHosteleria;
  1033.     }
  1034.     public function setLogoHosteleria(?bool $logoHosteleria): self
  1035.     {
  1036.         $this->logoHosteleria $logoHosteleria;
  1037.         return $this;
  1038.     }
  1039.     public function getImporteBateriaVirtual(): ?string
  1040.     {
  1041.         return $this->importeBateriaVirtual;
  1042.     }
  1043.     public function setImporteBateriaVirtual(?string $importeBateriaVirtual): self
  1044.     {
  1045.         $this->importeBateriaVirtual $importeBateriaVirtual;
  1046.         return $this;
  1047.     }
  1048.     public function isBateriaVirtual(): ?bool
  1049.     {
  1050.         return $this->bateriaVirtual;
  1051.     }
  1052.     public function setBateriaVirtual(?bool $bateriaVirtual): self
  1053.     {
  1054.         $this->bateriaVirtual $bateriaVirtual;
  1055.         return $this;
  1056.     }
  1057. }