src/Entity/FacturaGenerica.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FacturaGenericaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=FacturaGenericaRepository::class)
  9.  */
  10. class FacturaGenerica
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=Contrato::class, inversedBy="facturasGenericas")
  20.      */
  21.     private $contrato;
  22.     /**
  23.      * @ORM\Column(type="decimal", precision=13, scale=10, nullable=true)
  24.      */
  25.     private $iva;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $iban;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $ccc;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $nombreCliente;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $nifCliente;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $direccionCliente;
  46.     /**
  47.      * @ORM\Column(type="string", length=255, nullable=true)
  48.      */
  49.     private $cpCliente;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private $poblacionCliente;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, nullable=true)
  56.      */
  57.     private $provinciaCliente;
  58.     /**
  59.      * @ORM\Column(type="date", nullable=true)
  60.      */
  61.     private $fechaEmision;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $numeroFactura;
  66.     /**
  67.      * @ORM\Column(type="string", length=255, nullable=true)
  68.      */
  69.     private $nombreNotificaciones;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      */
  73.     private $direccionNotificaciones;
  74.     /**
  75.      * @ORM\Column(type="string", length=255, nullable=true)
  76.      */
  77.     private $cpNotificaciones;
  78.     /**
  79.      * @ORM\Column(type="string", length=255, nullable=true)
  80.      */
  81.     private $poblacionNotificaciones;
  82.     /**
  83.      * @ORM\Column(type="string", length=255, nullable=true)
  84.      */
  85.     private $provinciaNotificaciones;
  86.     /**
  87.      * @ORM\Column(type="boolean")
  88.      */
  89.     private $notificaciones;
  90.     /**
  91.      * @ORM\OneToMany(targetEntity=Concepto::class, mappedBy="facturaGenerica", cascade={"persist", "remove"})
  92.      */
  93.     private $conceptos;
  94.     /**
  95.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  96.      */
  97.     private $totalFactura;
  98.     /**
  99.      * @ORM\ManyToOne(targetEntity=Tarifa::class, inversedBy="facturasGenericas")
  100.      */
  101.     private $tarifa;
  102.     /**
  103.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  104.      */
  105.     private $potenciaP1;
  106.     /**
  107.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  108.      */
  109.     private $potenciaP2;
  110.     /**
  111.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  112.      */
  113.     private $potenciaP3;
  114.     /**
  115.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  116.      */
  117.     private $potenciaP4;
  118.     /**
  119.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  120.      */
  121.     private $potenciaP5;
  122.     /**
  123.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  124.      */
  125.     private $potenciaP6;
  126.     /**
  127.      * @ORM\Column(type="boolean", nullable=true)
  128.      */
  129.     private $devuelta;
  130.     /**
  131.      * @ORM\Column(type="date", nullable=true)
  132.      */
  133.     private $fechaDevolucion;
  134.     /**
  135.      * @ORM\ManyToMany(targetEntity=Fraccionamiento::class, mappedBy="facturasGenericas")
  136.      */
  137.     private $fraccionamientos;
  138.     /**
  139.      * @ORM\ManyToOne(targetEntity=EstadoFactura::class, inversedBy="facturasGenericas")
  140.      */
  141.     private $estado;
  142.     /**
  143.      * @ORM\Column(type="boolean", nullable=true)
  144.      */
  145.     private $logoHosteleria;
  146.     public function __construct()
  147.     {
  148.         $this->conceptos = new ArrayCollection();
  149.         $this->fraccionamientos = new ArrayCollection();
  150.     }
  151.     public function getId(): ?int
  152.     {
  153.         return $this->id;
  154.     }
  155.     public function getContrato(): ?Contrato
  156.     {
  157.         return $this->contrato;
  158.     }
  159.     public function setContrato(?Contrato $contrato): self
  160.     {
  161.         $this->contrato $contrato;
  162.         return $this;
  163.     }
  164.     public function getIva(): ?string
  165.     {
  166.         return $this->iva;
  167.     }
  168.     public function setIva(?string $iva): self
  169.     {
  170.         $this->iva $iva;
  171.         return $this;
  172.     }
  173.     public function getIban(): ?string
  174.     {
  175.         return $this->iban;
  176.     }
  177.     public function setIban(?string $iban): self
  178.     {
  179.         $this->iban $iban;
  180.         return $this;
  181.     }
  182.     public function getCcc(): ?string
  183.     {
  184.         return $this->ccc;
  185.     }
  186.     public function setCcc(?string $ccc): self
  187.     {
  188.         $this->ccc $ccc;
  189.         return $this;
  190.     }
  191.     public function getNombreCliente(): ?string
  192.     {
  193.         return $this->nombreCliente;
  194.     }
  195.     public function setNombreCliente(?string $nombreCliente): self
  196.     {
  197.         $this->nombreCliente $nombreCliente;
  198.         return $this;
  199.     }
  200.     public function getNifCliente(): ?string
  201.     {
  202.         return $this->nifCliente;
  203.     }
  204.     public function setNifCliente(?string $nifCliente): self
  205.     {
  206.         $this->nifCliente $nifCliente;
  207.         return $this;
  208.     }
  209.     public function getDireccionCliente(): ?string
  210.     {
  211.         return $this->direccionCliente;
  212.     }
  213.     public function setDireccionCliente(?string $direccionCliente): self
  214.     {
  215.         $this->direccionCliente $direccionCliente;
  216.         return $this;
  217.     }
  218.     public function getCpCliente(): ?string
  219.     {
  220.         return $this->cpCliente;
  221.     }
  222.     public function setCpCliente(?string $cpCliente): self
  223.     {
  224.         $this->cpCliente $cpCliente;
  225.         return $this;
  226.     }
  227.     public function getPoblacionCliente(): ?string
  228.     {
  229.         return $this->poblacionCliente;
  230.     }
  231.     public function setPoblacionCliente(?string $poblacionCliente): self
  232.     {
  233.         $this->poblacionCliente $poblacionCliente;
  234.         return $this;
  235.     }
  236.     public function getProvinciaCliente(): ?string
  237.     {
  238.         return $this->provinciaCliente;
  239.     }
  240.     public function setProvinciaCliente(?string $provinciaCliente): self
  241.     {
  242.         $this->provinciaCliente $provinciaCliente;
  243.         return $this;
  244.     }
  245.     public function getFechaEmision(): ?\DateTimeInterface
  246.     {
  247.         return $this->fechaEmision;
  248.     }
  249.     public function setFechaEmision(?\DateTimeInterface $fechaEmision): self
  250.     {
  251.         $this->fechaEmision $fechaEmision;
  252.         return $this;
  253.     }
  254.     public function getNumeroFactura(): ?string
  255.     {
  256.         return $this->numeroFactura;
  257.     }
  258.     public function setNumeroFactura(?string $numeroFactura): self
  259.     {
  260.         $this->numeroFactura $numeroFactura;
  261.         return $this;
  262.     }
  263.     public function getNombreNotificaciones(): ?string
  264.     {
  265.         return $this->nombreNotificaciones;
  266.     }
  267.     public function setNombreNotificaciones(?string $nombreNotificaciones): self
  268.     {
  269.         $this->nombreNotificaciones $nombreNotificaciones;
  270.         return $this;
  271.     }
  272.     public function getDireccionNotificaciones(): ?string
  273.     {
  274.         return $this->direccionNotificaciones;
  275.     }
  276.     public function setDireccionNotificaciones(?string $direccionNotificaciones): self
  277.     {
  278.         $this->direccionNotificaciones $direccionNotificaciones;
  279.         return $this;
  280.     }
  281.     public function getCpNotificaciones(): ?string
  282.     {
  283.         return $this->cpNotificaciones;
  284.     }
  285.     public function setCpNotificaciones(?string $cpNotificaciones): self
  286.     {
  287.         $this->cpNotificaciones $cpNotificaciones;
  288.         return $this;
  289.     }
  290.     public function getPoblacionNotificaciones(): ?string
  291.     {
  292.         return $this->poblacionNotificaciones;
  293.     }
  294.     public function setPoblacionNotificaciones(?string $poblacionNotificaciones): self
  295.     {
  296.         $this->poblacionNotificaciones $poblacionNotificaciones;
  297.         return $this;
  298.     }
  299.     public function getProvinciaNotificaciones(): ?string
  300.     {
  301.         return $this->provinciaNotificaciones;
  302.     }
  303.     public function setProvinciaNotificaciones(?string $provinciaNotificaciones): self
  304.     {
  305.         $this->provinciaNotificaciones $provinciaNotificaciones;
  306.         return $this;
  307.     }
  308.     public function getNotificaciones(): ?bool
  309.     {
  310.         return $this->notificaciones;
  311.     }
  312.     public function setNotificaciones(bool $notificaciones): self
  313.     {
  314.         $this->notificaciones $notificaciones;
  315.         return $this;
  316.     }
  317.     public function getTotalFactura(): ?string
  318.     {
  319.         return $this->totalFactura;
  320.     }
  321.     public function setTotalFactura(?string $totalFactura): self
  322.     {
  323.         $this->totalFactura $totalFactura;
  324.         return $this;
  325.     }
  326.     /**
  327.      * @return Collection|Concepto[]
  328.      */
  329.     public function getConceptos(): Collection
  330.     {
  331.         return $this->conceptos;
  332.     }
  333.     public function addConcepto(Concepto $concepto): self
  334.     {
  335.         if (!$this->conceptos->contains($concepto)) {
  336.             $this->conceptos[] = $concepto;
  337.             $concepto->setFacturaGenerica($this);
  338.         }
  339.         return $this;
  340.     }
  341.     public function removeConcepto(Concepto $concepto): self
  342.     {
  343.         if ($this->conceptos->contains($concepto)) {
  344.             $this->conceptos->removeElement($concepto);
  345.             // set the owning side to null (unless already changed)
  346.             if ($concepto->getFacturaGenerica() === $this) {
  347.                 $concepto->setFacturaGenerica(null);
  348.             }
  349.         }
  350.         return $this;
  351.     }
  352.     public function getTarifa(): ?Tarifa
  353.     {
  354.         return $this->tarifa;
  355.     }
  356.     public function setTarifa(?Tarifa $tarifa): self
  357.     {
  358.         $this->tarifa $tarifa;
  359.         return $this;
  360.     }
  361.     public function getNumeroCuenta(): ?string
  362.     {
  363.         return $this->iban.' '.implode(' 'str_split($this->ccc4)) ;
  364.     }
  365.     public function calcularTotal(): ?string
  366.     {
  367.         $total=0;
  368.         foreach ($this->conceptos as $concepto){
  369.             $total+=$concepto->getImporte();
  370.         }
  371.         $total+=$total*0.21;
  372.         $this->totalFactura=$total;
  373.         return $this->totalFactura;
  374.     }
  375.     public function getBaseImponible(): ?float
  376.     {
  377.         $total=0;
  378.         foreach ($this->conceptos as $concepto){
  379.             $total+=$concepto->getImporte();
  380.         }
  381.         return $total;
  382.     }
  383.     public function getPotenciaP1(): ?string
  384.     {
  385.         return $this->potenciaP1;
  386.     }
  387.     public function setPotenciaP1(?string $potenciaP1): self
  388.     {
  389.         $this->potenciaP1 $potenciaP1;
  390.         return $this;
  391.     }
  392.     public function getPotenciaP2(): ?string
  393.     {
  394.         return $this->potenciaP2;
  395.     }
  396.     public function setPotenciaP2(?string $potenciaP2): self
  397.     {
  398.         $this->potenciaP2 $potenciaP2;
  399.         return $this;
  400.     }
  401.     public function getPotenciaP3(): ?string
  402.     {
  403.         return $this->potenciaP3;
  404.     }
  405.     public function setPotenciaP3(?string $potenciaP3): self
  406.     {
  407.         $this->potenciaP3 $potenciaP3;
  408.         return $this;
  409.     }
  410.     public function getPotenciaP4(): ?string
  411.     {
  412.         return $this->potenciaP4;
  413.     }
  414.     public function setPotenciaP4(?string $potenciaP4): self
  415.     {
  416.         $this->potenciaP4 $potenciaP4;
  417.         return $this;
  418.     }
  419.     public function getPotenciaP5(): ?string
  420.     {
  421.         return $this->potenciaP5;
  422.     }
  423.     public function setPotenciaP5(?string $potenciaP5): self
  424.     {
  425.         $this->potenciaP5 $potenciaP5;
  426.         return $this;
  427.     }
  428.     public function getPotenciaP6(): ?string
  429.     {
  430.         return $this->potenciaP6;
  431.     }
  432.     public function setPotenciaP6(?string $potenciaP6): self
  433.     {
  434.         $this->potenciaP6 $potenciaP6;
  435.         return $this;
  436.     }
  437.     public function getClassName(){
  438.         return 'FacturaGenerica';
  439.     }
  440.     public function __toString()
  441.     {
  442.         return $this->numeroFactura??'-';
  443.     }
  444.     public function getDevuelta(): ?bool
  445.     {
  446.         return $this->devuelta;
  447.     }
  448.     public function setDevuelta(?bool $devuelta): self
  449.     {
  450.         $this->devuelta $devuelta;
  451.         return $this;
  452.     }
  453.     public function getFechaDevolucion(): ?\DateTimeInterface
  454.     {
  455.         return $this->fechaDevolucion;
  456.     }
  457.     public function setFechaDevolucion(?\DateTimeInterface $fechaDevolucion): self
  458.     {
  459.         $this->fechaDevolucion $fechaDevolucion;
  460.         return $this;
  461.     }
  462.     /**
  463.      * @return Collection<int, Fraccionamiento>
  464.      */
  465.     public function getFraccionamientos(): Collection
  466.     {
  467.         return $this->fraccionamientos;
  468.     }
  469.     public function addFraccionamiento(Fraccionamiento $fraccionamiento): self
  470.     {
  471.         if (!$this->fraccionamientos->contains($fraccionamiento)) {
  472.             $this->fraccionamientos[] = $fraccionamiento;
  473.             $fraccionamiento->addFacturasGenerica($this);
  474.         }
  475.         return $this;
  476.     }
  477.     public function removeFraccionamiento(Fraccionamiento $fraccionamiento): self
  478.     {
  479.         if ($this->fraccionamientos->removeElement($fraccionamiento)) {
  480.             $fraccionamiento->removeFacturasGenerica($this);
  481.         }
  482.         return $this;
  483.     }
  484.     public function getEstado(): ?EstadoFactura
  485.     {
  486.         return $this->estado;
  487.     }
  488.     public function setEstado(?EstadoFactura $estado): self
  489.     {
  490.         $this->estado $estado;
  491.         return $this;
  492.     }
  493.     public function isLogoHosteleria(): ?bool
  494.     {
  495.         return $this->logoHosteleria;
  496.     }
  497.     public function setLogoHosteleria(?bool $logoHosteleria): self
  498.     {
  499.         $this->logoHosteleria $logoHosteleria;
  500.         return $this;
  501.     }
  502. }