<?php
namespace App\Entity;
use App\Repository\ContractsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ContractsRepository::class)
*/
class Contracts
{
public static $statuses = [0=>'Létrehozva',1=>'Elfogadva',2=>'Kiküldve',3=>'Aláírva'];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Customers::class, inversedBy="contracts")
*/
private $customer;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $price_net;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $price_brt;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text")
*/
private $contract;
/**
* @ORM\Column(type="date")
*/
private $created;
/**
* @ORM\Column(type="integer")
*/
private $status;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $work_address;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $production_days;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $production_deadline;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $deposit_price_br;
/**
* @ORM\OneToMany(targetEntity=PdfFiles::class, mappedBy="contracts")
*/
private $files;
public function __construct()
{
$this->files = new ArrayCollection();
$this->created = new \DateTime();
$this->status = 0;
}
public function getId(): ?int
{
return $this->id;
}
public function getCustomer(): ?Customers
{
return $this->customer;
}
public function setCustomer(?Customers $customer): self
{
$this->customer = $customer;
return $this;
}
public function getPriceNet(): ?int
{
return $this->price_net;
}
public function setPriceNet(?int $price_net): self
{
$this->price_net = $price_net;
$this->setPriceBrt($price_net*1.27);
return $this;
}
public function getPriceBrt(): ?int
{
return $this->price_brt;
}
public function setPriceBrt(?int $price_brt): self
{
$this->price_brt = $price_brt;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getContract(): ?string
{
if($this->contract === null){
$this->contract = file_get_contents(dirname(__FILE__).'/../../gortech_contract.md');
}
return $this->contract;
}
public function setContract(string $contract): self
{
$this->contract = $contract;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getWorkAddress(): ?string
{
return $this->work_address;
}
public function setWorkAddress(?string $work_address): self
{
$this->work_address = $work_address;
return $this;
}
public function getProductionDays(): ?int
{
return $this->production_days;
}
public function setProductionDays(?int $production_days): self
{
$this->production_days = $production_days;
return $this;
}
public function getProductionDeadline(): ?\DateTimeInterface
{
return $this->production_deadline;
}
public function setProductionDeadline(?\DateTimeInterface $production_deadline): self
{
$this->production_deadline = $production_deadline;
return $this;
}
public function getDepositPriceBr(): ?int
{
return $this->deposit_price_br;
}
public function setDepositPriceBr(?int $deposit_price_br): self
{
$this->deposit_price_br = $deposit_price_br;
return $this;
}
/**
* @return Collection|PdfFiles[]
*/
public function getFiles(): Collection
{
return $this->files;
}
public function addFile(PdfFiles $file): self
{
if (!$this->files->contains($file)) {
$this->files[] = $file;
$file->setContracts($this);
}
return $this;
}
public function removeFile(PdfFiles $file): self
{
if ($this->files->removeElement($file)) {
// set the owning side to null (unless already changed)
if ($file->getContracts() === $this) {
$file->setContracts(null);
}
}
return $this;
}
}