<?php
namespace App\Entity;
use App\Entity\Base\AbstractTimestampableEntity;
use App\Repository\ContractRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ContractRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class Contract extends AbstractTimestampableEntity
{
/**
* @ORM\ManyToOne(targetEntity=ProjectType::class, inversedBy="contracts")
* @ORM\JoinColumn(nullable=false)
*/
private ProjectType $projectType;
/**
* @ORM\Column(type="string", length=20 )
*/
private string $seria;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $nr;
/**
* @ORM\Column(type="date", nullable=true)
*/
private ?\DateTime $dataDin;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="contracts")
* @ORM\JoinColumn(nullable=false)
*/
private Company $company;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $contracTxt;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $anexa;
/**
* @ORM\Column(type="date", nullable=true)
*/
private ?\DateTime $startDate;
/**
* @ORM\Column(type="date", nullable=true)
*/
private ?\DateTime $endDate;
/**
* @ORM\Column(type="decimal", precision=20, scale=2, nullable=true)
*/
private ?float $totalPaid;
/**
* @ORM\Column(type="decimal", precision=20, scale=2, nullable=true)
*/
private ?float $unitPrice;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?float $intervalOfUnitPrice;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $durationMounth;
/**
* @ORM\OneToMany(targetEntity=Tranche::class, mappedBy="contract")
*/
private $tranches;
/**
* @ORM\ManyToOne(targetEntity=ContractStatus::class)
* @ORM\JoinColumn(nullable=false)
*/
private $contractStatus;
/**
* @ORM\ManyToOne(targetEntity=Project::class, inversedBy="contracts")
* @ORM\JoinColumn(nullable=false)
*/
private $project;
/**
* @ORM\Column(type="boolean")
*/
private $indefinite;
/**
* @ORM\ManyToOne(targetEntity=Currency::class)
* @ORM\JoinColumn(nullable=false)
*/
private $currency;
/**
* @ORM\Column(type="decimal", precision=10, scale=6)
*/
private $exchangeRate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private ?float $hourlyRate;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $contractedHour;
/**
* @ORM\ManyToOne(targetEntity=Contract::class, inversedBy="contracts")
*/
private ?Contract $contractParent;
/**
* @ORM\OneToMany(targetEntity=Contract::class, mappedBy="contractParent")
*/
private $contracts;
/**
* @ORM\ManyToOne(targetEntity=Language::class)
* @ORM\JoinColumn(nullable=true)
*/
private ?Language $language;
/**
* @ORM\Column(type="decimal", precision=21, scale=2, nullable=true)
*/
private $contractParentValue;
public function __construct()
{
$this->receptionHeaders = new ArrayCollection();
$this->contractPaymentTranches = new ArrayCollection();
$this->tranches = new ArrayCollection();
$this->contracts = new ArrayCollection();
}
public function getProjectType(): ProjectType
{
return $this->projectType;
}
public function setProjectType(ProjectType $projectType): void
{
$this->projectType = $projectType;
}
public function getSeria(): string
{
return $this->seria;
}
public function setSeria(string $seria): void
{
$this->seria = $seria;
}
public function getNr(): ?string
{
return $this->nr;
}
public function setNr(?string $nr): void
{
$this->nr = $nr;
}
public function getDataDin(): ?\DateTime
{
return $this->dataDin;
}
public function setDataDin(?\DateTime $dataDin): void
{
$this->dataDin = $dataDin;
}
public function getCompany(): Company
{
return $this->company;
}
public function setCompany(Company $company): void
{
$this->company = $company;
}
public function getContracTxt(): ?string
{
return $this->contracTxt;
}
public function setContracTxt(?string $contracTxt): void
{
$this->contracTxt = $contracTxt;
}
public function getAnexa(): ?string
{
return $this->anexa;
}
public function setAnexa(?string $anexa): void
{
$this->anexa = $anexa;
}
public function getStartDate(): ?\DateTime
{
return $this->startDate;
}
public function setStartDate(?\DateTime $startDate): void
{
$this->startDate = $startDate;
}
public function getEndDate(): ?\DateTime
{
return $this->endDate;
}
public function setEndDate(?\DateTime $endDate): void
{
$this->endDate = $endDate;
}
public function getTotalPaid(): ?float
{
return $this->totalPaid;
}
public function setTotalPaid(?float $totalPaid): void
{
$this->totalPaid = $totalPaid;
}
public function getUnitPrice(): ?float
{
return $this->unitPrice;
}
public function setUnitPrice(?float $unitPrice): void
{
$this->unitPrice = $unitPrice;
}
public function getIntervalOfUnitPrice(): ?float
{
return $this->intervalOfUnitPrice;
}
public function setIntervalOfUnitPrice(?float $intervalOfUnitPrice): void
{
$this->intervalOfUnitPrice = $intervalOfUnitPrice;
}
public function getDurationMounth()
{
return $this->durationMounth;
}
public function setDurationMounth($durationMounth): void
{
$this->durationMounth = $durationMounth;
}
/**
* @return Collection<int, Tranche>
*/
public function getTranches(): Collection
{
return $this->tranches;
}
public function addTranch(Tranche $tranch): self
{
if (!$this->tranches->contains($tranch)) {
$this->tranches[] = $tranch;
$tranch->setContract($this);
}
return $this;
}
public function removeTranch(Tranche $tranch): self
{
if ($this->tranches->removeElement($tranch)) {
// set the owning side to null (unless already changed)
if ($tranch->getContract() === $this) {
$tranch->setContract(null);
}
}
return $this;
}
public function getContractStatus(): ?ContractStatus
{
return $this->contractStatus;
}
public function setContractStatus(?ContractStatus $contractStatus): self
{
$this->contractStatus = $contractStatus;
return $this;
}
public function getProject(): ?Project
{
return $this->project;
}
public function setProject(?Project $project): self
{
$this->project = $project;
return $this;
}
public function isIndefinite(): ?bool
{
return $this->indefinite;
}
public function setIndefinite(bool $indefinite): self
{
$this->indefinite = $indefinite;
return $this;
}
public function getCurrency()
{
return $this->currency;
}
public function setCurrency($currency): self
{
$this->currency = $currency;
return $this;
}
public function getExchangeRate()
{
return $this->exchangeRate;
}
public function setExchangeRate($exchangeRate): self
{
$this->exchangeRate = $exchangeRate;
return $this;
}
public function getHourlyRate():?float
{
return $this->hourlyRate;
}
public function setHourlyRate(?float $hourlyRate): self
{
$this->hourlyRate = $hourlyRate;
return $this;
}
public function getContractedHour(): ?int
{
return $this->contractedHour;
}
public function setContractedHour(?int $contractedHour): self
{
$this->contractedHour = $contractedHour;
return $this;
}
public function getContractParent(): ?self
{
return $this->contractParent;
}
public function setContractParent(?self $contractParent): self
{
$this->contractParent = $contractParent;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getContracts(): Collection
{
return $this->contracts;
}
public function addContract(self $contract): self
{
if (!$this->contracts->contains($contract)) {
$this->contracts[] = $contract;
$contract->setContractParent($this);
}
return $this;
}
public function removeContract(self $contract): self
{
if ($this->contracts->removeElement($contract)) {
// set the owning side to null (unless already changed)
if ($contract->getContractParent() === $this) {
$contract->setContractParent(null);
}
}
return $this;
}
public function getLanguage(): ?Language
{
return $this->language;
}
public function setLanguage(?Language $language): Contract
{
$this->language = $language;
return $this;
}
public function getContractParentValue(): ?string
{
return $this->contractParentValue;
}
public function setContractParentValue(?string $contractParentValue): self
{
$this->contractParentValue = $contractParentValue;
return $this;
}
}