<?php
namespace App\Entity;
use App\Repository\InterestPaidoffReportRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=InterestPaidoffReportRepository::class)
*/
class InterestPaidoffReport
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="interestPaidoffReports")
* @ORM\JoinColumn(nullable=false)
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="interestPaidoffReports")
* @ORM\JoinColumn(nullable=false)
*/
private $product;
/**
* @ORM\Column(type="date")
*/
private $dateFrom;
/**
* @ORM\Column(type="date")
*/
private $dateTo;
/**
* @ORM\Column(type="float")
*/
private $totalRevenues;
/**
* @ORM\Column(type="float")
*/
private $totalTax;
/**
* @ORM\Column(type="datetime")
*/
private $created;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="interestPaidoffReports")
* @ORM\JoinColumn(nullable=false)
*/
private $createdBy;
/**
* @ORM\OneToMany(targetEntity=InterestPaidoff::class, mappedBy="interestPaidoffReport", orphanRemoval=true, cascade={"persist"})
*/
private $interestPaidoffs;
/**
* @ORM\Column(type="boolean")
*/
private $deleted = false;
public function __construct()
{
$this->interestPaidoffs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getDateFrom(): ?\DateTimeInterface
{
return $this->dateFrom;
}
public function setDateFrom(\DateTimeInterface $dateFrom): self
{
$this->dateFrom = $dateFrom;
return $this;
}
public function getDateTo(): ?\DateTimeInterface
{
return $this->dateTo;
}
public function setDateTo(\DateTimeInterface $dateTo): self
{
$this->dateTo = $dateTo;
return $this;
}
public function getTotalRevenues(): ?float
{
return $this->totalRevenues;
}
public function setTotalRevenues(float $totalRevenues): self
{
$this->totalRevenues = $totalRevenues;
return $this;
}
public function getTotalTax(): ?float
{
return $this->totalTax;
}
public function setTotalTax(float $totalTax): self
{
$this->totalTax = $totalTax;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
/**
* @return Collection<int, InterestPaidoff>
*/
public function getInterestPaidoffs(): Collection
{
return $this->interestPaidoffs;
}
public function addInterestPaidoff(InterestPaidoff $interestPaidoff): self
{
if (!$this->interestPaidoffs->contains($interestPaidoff)) {
$this->interestPaidoffs[] = $interestPaidoff;
$interestPaidoff->setInterestPaidoffReport($this);
}
return $this;
}
public function removeInterestPaidoff(InterestPaidoff $interestPaidoff): self
{
if ($this->interestPaidoffs->removeElement($interestPaidoff)) {
// set the owning side to null (unless already changed)
if ($interestPaidoff->getInterestPaidoffReport() === $this) {
$interestPaidoff->setInterestPaidoffReport(null);
}
}
return $this;
}
/**
* @return int
*/
public function getDays(\DateTimeInterface $fromDateTime, \DateTimeInterface $toDateTime)
{
if ($fromDateTime->format("U") <= $toDateTime->format("U")) {
$diff = $fromDateTime->diff($toDateTime);
return (int)$diff->format('%a');
} else {
return -1;
}
}
public function isDeleted(): ?bool
{
return $this->deleted;
}
public function setDeleted(bool $deleted): self
{
$this->deleted = $deleted;
return $this;
}
}