<?php
namespace App\Entity;
use App\Utils\ExtendedEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\OfferRepository")
*/
class Offer
{
use ExtendedEntity;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="offers")
* @ORM\JoinColumn(nullable=false)
*/
private $supplier;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Inquiry", inversedBy="offers")
* @ORM\JoinColumn(nullable=false)
*/
private $inquiry;
/**
* @ORM\Column(type="float")
*/
private $retailPrice = 0;
/**
* @ORM\Column(type="float")
*/
private $discount = 0;
/**
* @ORM\Column(type="float")
*/
private $deliveryPrice = 0;
/**
* @ORM\Column(type="float")
*/
private $totalPrice = 0;
/**
* @ORM\Column(type="string", length=32)
*/
private $status = 'new';
/**
* @ORM\Column(type="boolean")
*/
private $chosen = false;
/**
* @ORM\Column(type="float")
*/
private $priceAfterDiscount = 0;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $notices;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comment;
/**
* @ORM\Column(type="boolean")
*/
private $isRejected = false;
/**
* @ORM\Column(type="string", length=32)
*/
private $state;
/**
* @ORM\Column(type="string", length=32)
*/
private $paymentMethod;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $chooseDate;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PrivateMessage", mappedBy="offer")
*/
private $privateMessages;
/**
* @ORM\OneToMany(targetEntity="App\Entity\OfferFile", mappedBy="offer", cascade={"persist"})
*/
private $offerFiles;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $deliveryTime;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : false})
*/
private $partsOrdered = 0;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $fileUploadId;
/**
* @ORM\Column(name="ordered_date", type="datetime", nullable=true)
*/
private $orderedDate;
/**
* @ORM\OneToOne(targetEntity="App\Entity\OfferFile", cascade={"persist"})
*/
private $invoiceFile;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private $requestInvoice;
/**
* @ORM\Column(name="send_date", type="datetime", nullable=true)
*/
private $sendDate;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : false})
*/
private $partsSended = 0;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $orderMode;
/**
* @ORM\Column(type="boolean")
*/
private $seenByRecipient = false;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ContactPerson")
* @ORM\JoinColumn(nullable=true)
*/
private $contactPerson;
public function __construct()
{
$this->privateMessages = new ArrayCollection();
$this->offerFiles = new ArrayCollection();
$this->fileUploadId = uniqid('offer_');
}
public function getId(): ?int
{
return $this->id;
}
public function getSupplier(): ?Customer
{
return $this->supplier;
}
public function setSupplier(?Customer $supplier): self
{
$this->supplier = $supplier;
return $this;
}
public function getInquiry(): ?Inquiry
{
return $this->inquiry;
}
public function setInquiry(?Inquiry $inquiry): self
{
$this->inquiry = $inquiry;
return $this;
}
public function getRetailPrice(): ?float
{
return $this->retailPrice;
}
public function setRetailPrice(float $retailPrice): self
{
$this->retailPrice = $retailPrice;
return $this;
}
public function getDiscount(): ?float
{
return $this->discount;
}
public function setDiscount(float $discount): self
{
$this->discount = $discount;
return $this;
}
public function getDeliveryPrice(): ?float
{
return $this->deliveryPrice;
}
public function setDeliveryPrice(float $deliveryPrice): self
{
$this->deliveryPrice = $deliveryPrice;
return $this;
}
public function getTotalPrice(): ?float
{
return $this->totalPrice;
}
public function setTotalPrice(float $totalPrice): self
{
$this->totalPrice = $totalPrice;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getChosen(): ?bool
{
return $this->chosen;
}
public function setChosen(bool $chosen): self
{
$this->chosen = $chosen;
return $this;
}
public function getPriceAfterDiscount(): ?float
{
return $this->priceAfterDiscount;
}
public function setPriceAfterDiscount(float $priceAfterDiscount): self
{
$this->priceAfterDiscount = $priceAfterDiscount;
return $this;
}
public function getNotices(): ?string
{
return $this->notices;
}
public function setNotices(?string $notices): self
{
$this->notices = $notices;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getIsRejected(): ?bool
{
return $this->isRejected;
}
public function setIsRejected(bool $isRejected): self
{
$this->isRejected = $isRejected;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(string $state): self
{
$this->state = $state;
return $this;
}
public function getPaymentMethod(): ?string
{
return $this->paymentMethod;
}
public function setPaymentMethod(string $paymentMethod): self
{
$this->paymentMethod = $paymentMethod;
return $this;
}
public function getChooseDate(): ?\DateTimeInterface
{
return $this->chooseDate;
}
public function setChooseDate(?\DateTimeInterface $chooseDate): self
{
$this->chooseDate = $chooseDate;
return $this;
}
/**
* @return Collection|PrivateMessage[]
*/
public function getPrivateMessages(): Collection
{
return $this->privateMessages;
}
public function addPrivateMessage(PrivateMessage $privateMessage): self
{
if (!$this->privateMessages->contains($privateMessage)) {
$this->privateMessages[] = $privateMessage;
$privateMessage->setOffer($this);
}
return $this;
}
public function removePrivateMessage(PrivateMessage $privateMessage): self
{
if ($this->privateMessages->contains($privateMessage)) {
$this->privateMessages->removeElement($privateMessage);
// set the owning side to null (unless already changed)
if ($privateMessage->getOffer() === $this) {
$privateMessage->setOffer(null);
}
}
return $this;
}
public function __toString()
{
return (string)$this->getId();
}
/**
* @return Collection|OfferFile[]
*/
public function getOfferFiles(): Collection
{
return $this->offerFiles;
}
public function setOfferFiles(ArrayCollection $inquiryFiles) : self
{
$this->offerFiles = $inquiryFiles;
return $this;
}
public function addOfferFile($offerFile): self
{
if (!$this->offerFiles->contains($offerFile)) {
$this->offerFiles[] = $offerFile;
if ($offerFile instanceof OfferFile) {
$offerFile->setOffer($this);
}
}
return $this;
}
public function removeOfferFile($offerFile): self
{
/** @var OfferFile $offerFile */
if ($this->offerFiles->contains($offerFile)) {
$this->offerFiles->removeElement($offerFile);
// set the owning side to null (unless already changed)
if ($offerFile->getOffer() === $this) {
$offerFile->setOffer(null);
}
}
return $this;
}
public function getDeliveryTime(): ?\DateTimeInterface
{
return $this->deliveryTime;
}
public function setDeliveryTime(?\DateTimeInterface $deliveryTime): self
{
$this->deliveryTime = $deliveryTime;
return $this;
}
public function getPartsOrdered()
{
return $this->partsOrdered;
}
public function setPartsOrdered($partsOrdered)
{
$this->partsOrdered = $partsOrdered;
}
/**
* @return mixed
*/
public function getFileUploadId()
{
return $this->fileUploadId;
}
/**
* @param mixed $fileUploadId
*/
public function setFileUploadId($fileUploadId)
{
$this->fileUploadId = $fileUploadId;
}
/**
* @return mixed
*/
public function getOrderedDate()
{
return $this->orderedDate;
}
/**
* @param mixed $orderedDate
*/
public function setOrderedDate($orderedDate): void
{
$this->orderedDate = $orderedDate;
}
/**
* @return mixed
*/
public function getInvoiceFile()
{
return $this->invoiceFile;
}
/**
* @param mixed $invoiceFile
*/
public function setInvoiceFile($invoiceFile): void
{
$this->invoiceFile = $invoiceFile;
}
/**
* @return mixed
*/
public function getRequestInvoice()
{
return $this->requestInvoice;
}
/**
* @param mixed $requestInvoice
*/
public function setRequestInvoice($requestInvoice): void
{
$this->requestInvoice = $requestInvoice;
}
/**
* @return mixed
*/
public function getSendDate()
{
return $this->sendDate;
}
/**
* @param mixed $sendDate
*/
public function setSendDate($sendDate)
{
$this->sendDate = $sendDate;
}
/**
* @return int
*/
public function getPartsSended()
{
return $this->partsSended;
}
/**
* @param int $partsSended
*/
public function setPartsSended(int $partsSended)
{
$this->partsSended = $partsSended;
}
/**
* @return mixed
*/
public function getOrderMode()
{
return $this->orderMode;
}
/**
* @param mixed $orderMode
*/
public function setOrderMode($orderMode): void
{
$this->orderMode = $orderMode;
}
/**
* @return mixed
*/
public function getContactPerson()
{
return $this->contactPerson;
}
/**
* @param mixed $contactPerson
*/
public function setContactPerson($contactPerson): void
{
$this->contactPerson = $contactPerson;
}
/**
* @return bool
*/
public function isSeenByRecipient(): bool
{
return $this->seenByRecipient;
}
/**
* @param bool $seenByRecipient
*/
public function setSeenByRecipient(bool $seenByRecipient): void
{
$this->seenByRecipient = $seenByRecipient;
}
}