<?php
namespace App\Entity;
use App\Repository\FacturaGenericaRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FacturaGenericaRepository::class)
*/
class FacturaGenerica
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Contrato::class, inversedBy="facturasGenericas")
*/
private $contrato;
/**
* @ORM\Column(type="decimal", precision=13, scale=10, nullable=true)
*/
private $iva;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $iban;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ccc;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nombreCliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nifCliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $direccionCliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cpCliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $poblacionCliente;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $provinciaCliente;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $fechaEmision;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $numeroFactura;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nombreNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $direccionNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cpNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $poblacionNotificaciones;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $provinciaNotificaciones;
/**
* @ORM\Column(type="boolean")
*/
private $notificaciones;
/**
* @ORM\OneToMany(targetEntity=Concepto::class, mappedBy="facturaGenerica", cascade={"persist", "remove"})
*/
private $conceptos;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $totalFactura;
/**
* @ORM\ManyToOne(targetEntity=Tarifa::class, inversedBy="facturasGenericas")
*/
private $tarifa;
/**
* @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
*/
private $potenciaP1;
/**
* @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
*/
private $potenciaP2;
/**
* @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
*/
private $potenciaP3;
/**
* @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
*/
private $potenciaP4;
/**
* @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
*/
private $potenciaP5;
/**
* @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
*/
private $potenciaP6;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $devuelta;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $fechaDevolucion;
/**
* @ORM\ManyToMany(targetEntity=Fraccionamiento::class, mappedBy="facturasGenericas")
*/
private $fraccionamientos;
/**
* @ORM\ManyToOne(targetEntity=EstadoFactura::class, inversedBy="facturasGenericas")
*/
private $estado;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $logoHosteleria;
public function __construct()
{
$this->conceptos = new ArrayCollection();
$this->fraccionamientos = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getContrato(): ?Contrato
{
return $this->contrato;
}
public function setContrato(?Contrato $contrato): self
{
$this->contrato = $contrato;
return $this;
}
public function getIva(): ?string
{
return $this->iva;
}
public function setIva(?string $iva): self
{
$this->iva = $iva;
return $this;
}
public function getIban(): ?string
{
return $this->iban;
}
public function setIban(?string $iban): self
{
$this->iban = $iban;
return $this;
}
public function getCcc(): ?string
{
return $this->ccc;
}
public function setCcc(?string $ccc): self
{
$this->ccc = $ccc;
return $this;
}
public function getNombreCliente(): ?string
{
return $this->nombreCliente;
}
public function setNombreCliente(?string $nombreCliente): self
{
$this->nombreCliente = $nombreCliente;
return $this;
}
public function getNifCliente(): ?string
{
return $this->nifCliente;
}
public function setNifCliente(?string $nifCliente): self
{
$this->nifCliente = $nifCliente;
return $this;
}
public function getDireccionCliente(): ?string
{
return $this->direccionCliente;
}
public function setDireccionCliente(?string $direccionCliente): self
{
$this->direccionCliente = $direccionCliente;
return $this;
}
public function getCpCliente(): ?string
{
return $this->cpCliente;
}
public function setCpCliente(?string $cpCliente): self
{
$this->cpCliente = $cpCliente;
return $this;
}
public function getPoblacionCliente(): ?string
{
return $this->poblacionCliente;
}
public function setPoblacionCliente(?string $poblacionCliente): self
{
$this->poblacionCliente = $poblacionCliente;
return $this;
}
public function getProvinciaCliente(): ?string
{
return $this->provinciaCliente;
}
public function setProvinciaCliente(?string $provinciaCliente): self
{
$this->provinciaCliente = $provinciaCliente;
return $this;
}
public function getFechaEmision(): ?\DateTimeInterface
{
return $this->fechaEmision;
}
public function setFechaEmision(?\DateTimeInterface $fechaEmision): self
{
$this->fechaEmision = $fechaEmision;
return $this;
}
public function getNumeroFactura(): ?string
{
return $this->numeroFactura;
}
public function setNumeroFactura(?string $numeroFactura): self
{
$this->numeroFactura = $numeroFactura;
return $this;
}
public function getNombreNotificaciones(): ?string
{
return $this->nombreNotificaciones;
}
public function setNombreNotificaciones(?string $nombreNotificaciones): self
{
$this->nombreNotificaciones = $nombreNotificaciones;
return $this;
}
public function getDireccionNotificaciones(): ?string
{
return $this->direccionNotificaciones;
}
public function setDireccionNotificaciones(?string $direccionNotificaciones): self
{
$this->direccionNotificaciones = $direccionNotificaciones;
return $this;
}
public function getCpNotificaciones(): ?string
{
return $this->cpNotificaciones;
}
public function setCpNotificaciones(?string $cpNotificaciones): self
{
$this->cpNotificaciones = $cpNotificaciones;
return $this;
}
public function getPoblacionNotificaciones(): ?string
{
return $this->poblacionNotificaciones;
}
public function setPoblacionNotificaciones(?string $poblacionNotificaciones): self
{
$this->poblacionNotificaciones = $poblacionNotificaciones;
return $this;
}
public function getProvinciaNotificaciones(): ?string
{
return $this->provinciaNotificaciones;
}
public function setProvinciaNotificaciones(?string $provinciaNotificaciones): self
{
$this->provinciaNotificaciones = $provinciaNotificaciones;
return $this;
}
public function getNotificaciones(): ?bool
{
return $this->notificaciones;
}
public function setNotificaciones(bool $notificaciones): self
{
$this->notificaciones = $notificaciones;
return $this;
}
public function getTotalFactura(): ?string
{
return $this->totalFactura;
}
public function setTotalFactura(?string $totalFactura): self
{
$this->totalFactura = $totalFactura;
return $this;
}
/**
* @return Collection|Concepto[]
*/
public function getConceptos(): Collection
{
return $this->conceptos;
}
public function addConcepto(Concepto $concepto): self
{
if (!$this->conceptos->contains($concepto)) {
$this->conceptos[] = $concepto;
$concepto->setFacturaGenerica($this);
}
return $this;
}
public function removeConcepto(Concepto $concepto): self
{
if ($this->conceptos->contains($concepto)) {
$this->conceptos->removeElement($concepto);
// set the owning side to null (unless already changed)
if ($concepto->getFacturaGenerica() === $this) {
$concepto->setFacturaGenerica(null);
}
}
return $this;
}
public function getTarifa(): ?Tarifa
{
return $this->tarifa;
}
public function setTarifa(?Tarifa $tarifa): self
{
$this->tarifa = $tarifa;
return $this;
}
public function getNumeroCuenta(): ?string
{
return $this->iban.' '.implode(' ', str_split($this->ccc, 4)) ;
}
public function calcularTotal(): ?string
{
$total=0;
foreach ($this->conceptos as $concepto){
$total+=$concepto->getImporte();
}
$total+=$total*0.21;
$this->totalFactura=$total;
return $this->totalFactura;
}
public function getBaseImponible(): ?float
{
$total=0;
foreach ($this->conceptos as $concepto){
$total+=$concepto->getImporte();
}
return $total;
}
public function getPotenciaP1(): ?string
{
return $this->potenciaP1;
}
public function setPotenciaP1(?string $potenciaP1): self
{
$this->potenciaP1 = $potenciaP1;
return $this;
}
public function getPotenciaP2(): ?string
{
return $this->potenciaP2;
}
public function setPotenciaP2(?string $potenciaP2): self
{
$this->potenciaP2 = $potenciaP2;
return $this;
}
public function getPotenciaP3(): ?string
{
return $this->potenciaP3;
}
public function setPotenciaP3(?string $potenciaP3): self
{
$this->potenciaP3 = $potenciaP3;
return $this;
}
public function getPotenciaP4(): ?string
{
return $this->potenciaP4;
}
public function setPotenciaP4(?string $potenciaP4): self
{
$this->potenciaP4 = $potenciaP4;
return $this;
}
public function getPotenciaP5(): ?string
{
return $this->potenciaP5;
}
public function setPotenciaP5(?string $potenciaP5): self
{
$this->potenciaP5 = $potenciaP5;
return $this;
}
public function getPotenciaP6(): ?string
{
return $this->potenciaP6;
}
public function setPotenciaP6(?string $potenciaP6): self
{
$this->potenciaP6 = $potenciaP6;
return $this;
}
public function getClassName(){
return 'FacturaGenerica';
}
public function __toString()
{
return $this->numeroFactura??'-';
}
public function getDevuelta(): ?bool
{
return $this->devuelta;
}
public function setDevuelta(?bool $devuelta): self
{
$this->devuelta = $devuelta;
return $this;
}
public function getFechaDevolucion(): ?\DateTimeInterface
{
return $this->fechaDevolucion;
}
public function setFechaDevolucion(?\DateTimeInterface $fechaDevolucion): self
{
$this->fechaDevolucion = $fechaDevolucion;
return $this;
}
/**
* @return Collection<int, Fraccionamiento>
*/
public function getFraccionamientos(): Collection
{
return $this->fraccionamientos;
}
public function addFraccionamiento(Fraccionamiento $fraccionamiento): self
{
if (!$this->fraccionamientos->contains($fraccionamiento)) {
$this->fraccionamientos[] = $fraccionamiento;
$fraccionamiento->addFacturasGenerica($this);
}
return $this;
}
public function removeFraccionamiento(Fraccionamiento $fraccionamiento): self
{
if ($this->fraccionamientos->removeElement($fraccionamiento)) {
$fraccionamiento->removeFacturasGenerica($this);
}
return $this;
}
public function getEstado(): ?EstadoFactura
{
return $this->estado;
}
public function setEstado(?EstadoFactura $estado): self
{
$this->estado = $estado;
return $this;
}
public function isLogoHosteleria(): ?bool
{
return $this->logoHosteleria;
}
public function setLogoHosteleria(?bool $logoHosteleria): self
{
$this->logoHosteleria = $logoHosteleria;
return $this;
}
}