<?php
namespace App\Entity;
use App\MDS\VenuesBundle\Entity\ReservationInvoice;
use App\MDS\VenuesBundle\Entity\ReservationInvoiceRec;
use App\Repository\DeliveryNoteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DeliveryNoteRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class DeliveryNote
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Client::class, inversedBy="deliveryNotes")
* @ORM\JoinColumn(nullable=false)
*/
private $client;
/**
* @ORM\Column(type="string", length=30, nullable=true)
*/
private $sageDeliveryNumber; // Número de albarán
/**
* @ORM\Column(type="string", length=40, nullable=true)
*/
private $sageInvoiceNumber; //Número de factura
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $sageAlmacen;
/**
* @ORM\Column(type="boolean")
*/
private $factured;
/**
* @ORM\Column(type="boolean")
*/
private $isRectificative;
/**
* @ORM\ManyToOne(targetEntity=DeliveryNote::class, inversedBy="rectificativas")
*/
private $rectifies;
/**
* @ORM\OneToMany(targetEntity=DeliveryNote::class, mappedBy="rectifies")
*/
private $rectificativas;
/**
* @ORM\Column(type="boolean")
*/
private $sentToSage;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $syncDate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $facturedAt;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $updatedAt;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $lastError;
/**
* @ORM\ManyToOne(targetEntity=SettingsCompany::class, inversedBy="deliveryNotes")
* @ORM\JoinColumn(nullable=false)
*/
private $sageCompany;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*/
private $letter;
/**
* @ORM\OneToOne(targetEntity=ReservationInvoice::class, inversedBy="deliveryNote", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
private $reservationInvoice;
/**
* @ORM\OneToOne(targetEntity=ReservationInvoiceRec::class, inversedBy="deliveryNote", cascade={"persist", "remove"})
*/
private $reservationInvoiceRec;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $pdf; // Letra de la Factura. Indica la serie de la factura
public function __construct()
{
$this->rectificativas = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getClient(): ?Client
{
return $this->client;
}
public function setClient(?Client $client): self
{
$this->client = $client;
return $this;
}
public function getSageDeliveryNumber(): ?string
{
return $this->sageDeliveryNumber;
}
public function setSageDeliveryNumber(?string $sageDeliveryNumber): self
{
$this->sageDeliveryNumber = $sageDeliveryNumber;
return $this;
}
public function getSageInvoiceNumber(): ?string
{
return $this->sageInvoiceNumber;
}
public function setSageInvoiceNumber(?string $sageInvoiceNumber): self
{
$this->sageInvoiceNumber = $sageInvoiceNumber;
return $this;
}
public function getSageAlmacen(): ?string
{
return $this->sageAlmacen;
}
public function setSageAlmacen(?string $sageAlmacen): self
{
$this->sageAlmacen = $sageAlmacen;
return $this;
}
public function isFactured(): ?bool
{
return $this->factured;
}
public function setFactured(bool $factured): self
{
$this->factured = $factured;
return $this;
}
public function isIsRectificative(): ?bool
{
return $this->isRectificative;
}
public function setIsRectificative(bool $isRectificative): self
{
$this->isRectificative = $isRectificative;
return $this;
}
public function getRectifies(): ?self
{
return $this->rectifies;
}
public function setRectifies(?self $rectifies): self
{
$this->rectifies = $rectifies;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getRectivicativas(): Collection
{
return $this->rectificativas;
}
public function addRectivicativa(self $rectificativas): self
{
if (!$this->rectificativas->contains($rectificativas)) {
$this->rectificativas[] = $rectificativas;
$rectificativas->setRectifies($this);
}
return $this;
}
public function removeRectivicativa(self $rectificativas): self
{
if ($this->rectificativas->removeElement($rectificativas)) {
// set the owning side to null (unless already changed)
if ($rectificativas->getRectifies() === $this) {
$rectificativas->setRectifies(null);
}
}
return $this;
}
public function isSentToSage(): ?bool
{
return $this->sentToSage;
}
public function setSentToSage(bool $sentToSage): self
{
$this->sentToSage = $sentToSage;
return $this;
}
public function getSyncDate(): ?\DateTimeInterface
{
return $this->syncDate;
}
public function setSyncDate(?\DateTimeInterface $syncDate): self
{
$this->syncDate = $syncDate;
return $this;
}
public function getFacturedAt(): ?\DateTimeInterface
{
return $this->facturedAt;
}
public function setFacturedAt(?\DateTimeInterface $facturedAt): self
{
$this->facturedAt = $facturedAt;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getLastError(): ?string
{
return $this->lastError;
}
public function setLastError(?string $lastError): self
{
$this->lastError = $lastError;
return $this;
}
/**
* @ORM\PrePersist
*/
public function prePersist(): void
{
$this->createdAt = new \DateTimeImmutable();
$this->updatedAt = new \DateTimeImmutable();
}
/**
* @ORM\PreUpdate
*/
public function preUpdate(): void
{
$this->updatedAt = new \DateTimeImmutable();
}
public function getSageCompany(): ?SettingsCompany
{
return $this->sageCompany;
}
public function setSageCompany(?SettingsCompany $sageCompany): self
{
$this->sageCompany = $sageCompany;
return $this;
}
public function getLetter(): ?string
{
return $this->letter;
}
public function setLetter(?string $letter): self
{
$this->letter = $letter;
return $this;
}
public function getReservationInvoice(): ?ReservationInvoice
{
return $this->reservationInvoice;
}
public function setReservationInvoice(ReservationInvoice $reservationInvoice): self
{
$this->reservationInvoice = $reservationInvoice;
return $this;
}
public function getReservationInvoiceRec(): ?ReservationInvoiceRec
{
return $this->reservationInvoiceRec;
}
public function setReservationInvoiceRec(?ReservationInvoiceRec $reservationInvoiceRec): self
{
$this->reservationInvoiceRec = $reservationInvoiceRec;
return $this;
}
public function getPdf(): ?string
{
return $this->pdf;
}
public function setPdf(?string $pdf): self
{
$this->pdf = $pdf;
return $this;
}
}