<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Criteria;
/**
* Quotes
*
* @ORM\Table(name="quotes")
* @ORM\Entity
*/
class Quotes
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var int|null
*
* @ORM\Column(name="price_sum", type="integer", nullable=true)
*/
private $priceSum;
/**
* @var int|null
*
* @ORM\Column(name="price_sum_br", type="integer", nullable=true)
*/
private $priceSumBr;
/**
* @var string|null
*
* @ORM\Column(name="note", type="text", length=65535, nullable=true)
*/
private $note;
/**
* @var \DateTime
*
* @ORM\Column(name="created", type="datetime", nullable=false)
*/
private $created;
/**
* @var int|null
*
* @ORM\Column(name="price_bodyguard", type="integer", nullable=true)
*/
private $priceBodyguard;
/**
* @var int|null
*
* @ORM\Column(name="price_paint", type="integer", nullable=true)
*/
private $pricePaint;
/**
* @var int|null
*
* @ORM\Column(name="price_assembly", type="integer", nullable=true)
*/
private $priceAssembly;
/**
* @var int
*
* @ORM\Column(name="tax", type="string", nullable=false)
*/
private $tax;
/**
* @ORM\OneToMany(targetEntity=QuoteItems::class, mappedBy="quote", cascade={"persist"},orphanRemoval=true)
*/
public $quoteItems;
/**
* @ORM\OneToMany(targetEntity=Attachment::class, mappedBy="quote", cascade={"persist"},orphanRemoval=true)
*/
public $attachments;
/**
* @var \DateTime
*
* @ORM\Column(name="modified", type="datetime", nullable=true, options={"comment"="Módosítva"})
*/
private $modified;
public function __construct()
{
$this->created = new \DateTime();
$this->quoteItems = new ArrayCollection();
$this->attachments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTax(): ?string
{
return $this->tax;
}
public function setTax(?string $tax): self
{
$this->tax = $tax;
return $this;
}
public function getPriceSum(): ?int
{
return $this->priceSum;
}
public function setPriceSum(?int $priceSum): self
{
$this->priceSum = $priceSum;
return $this;
}
public function getPriceSumBr(): ?int
{
return $this->priceSumBr;
}
public function setPriceSumBr(?int $priceSumBr): self
{
$this->priceSumBr = $priceSumBr;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteItems(): Collection
{
return $this->quoteItems;
}
/* public function addQuoteItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
*/
/**
* @return Collection|QuoteItems[]
*/
public function getQuotePaintItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::PAINT));
return $this->quoteItems->matching($criteria);
}
public function addQuotePaintItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::PAINT);
if($this->getPricePaint() !== null){
$quoteItem->setPriceQty($this->pricePaint);
}
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuotePaintItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
/*if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}*/
}
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteAssemblyItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::ASSEMBLY));
return $this->quoteItems->matching($criteria);
}
public function addQuoteAssemblyItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::ASSEMBLY);
if($this->getPriceAssembly() !== null){
$quoteItem->setPriceQty($this->priceAssembly);
}
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteAssemblyItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteBodyguardItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::BODYGUARD));
return $this->quoteItems->matching($criteria);
}
public function addQuoteBodyguardItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::BODYGUARD);
if($this->getPriceBodyguard() !== null){
$quoteItem->setPriceQty($this->priceBodyguard);
}
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteBodyguardItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteOtherItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::OTHER));
return $this->quoteItems->matching($criteria);
}
public function addQuoteOtherItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::OTHER);
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteOtherItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
/**
* @return Collection|Attachment[]
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttachment(Attachment $photo): self
{
if (!$this->attachments->contains($photo)) {
$photo->setQuote($this);
$this->attachments[] = $photo;
}
return $this;
}
public function removeAttachment(Attachment $photo): self
{
if ($this->attachments->removeElement($photo)) {
// set the owning side to null (unless already changed)
if ($photo->getQuote() === $this) {
$photo->setQuote(null);
}
}
return $this;
}
public function getPriceBodyguard(): ?int
{
return $this->priceBodyguard;
}
public function setPriceBodyguard(?int $priceBodyguard): self
{
$this->priceBodyguard = $priceBodyguard;
return $this;
}
public function getPricePaint(): ?int
{
return $this->pricePaint;
}
public function setPricePaint(?int $pricePaint): self
{
$this->pricePaint = $pricePaint;
return $this;
}
public function getPriceAssembly(): ?int
{
return $this->priceAssembly;
}
public function setPriceAssembly(?int $priceAssembly): self
{
$this->priceAssembly = $priceAssembly;
return $this;
}
public function __toString()
{
return 'Ajánlat - '. $this->getCar()->getPlateNumber() . " - " . $this->getCreated()->format('Ymd');
}
public function rowCss(){
return "";
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
}