<?php
namespace App\Entity;
use App\Repository\VendorQuotationRepository;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VendorQuotationRepository::class)]
class VendorQuotation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[Groups(['LogService'])]
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'vendorQuotations')]
#[ORM\JoinColumn(nullable: false)]
private $createdBy;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[Groups(['LogService'])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $filepath;
#[Groups(['LogService'])]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $filename;
#[Groups(['LogService'])]
#[ORM\ManyToOne(targetEntity: VendorQuotationPlanning::class, inversedBy: 'vendorQuotations')]
#[ORM\JoinColumn(nullable: false)]
private $vendorQuotationPlanning;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
#[ORM\ManyToOne(targetEntity: User::class)]
private $updatedBy;
#[ORM\Column(type: 'string', length: 64, nullable: true)]
private $filetype;
#[ORM\Column(type: 'float')]
private $amount;
#[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'vendorQuotations')]
#[ORM\JoinColumn(nullable: false)]
private $currency;
public function __construct(){
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getFilepath(): ?string
{
return $this->filepath;
}
public function setFilepath(string $filepath): self
{
$this->filepath = $filepath;
return $this;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(string $filename): self
{
$this->filename = $filename;
return $this;
}
public function getVendorQuotationPlanning(): ?VendorQuotationPlanning
{
return $this->vendorQuotationPlanning;
}
public function setVendorQuotationPlanning(?VendorQuotationPlanning $vendorQuotationPlanning): self
{
$this->vendorQuotationPlanning = $vendorQuotationPlanning;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getFiletype(): ?string
{
return $this->filetype;
}
public function setFiletype(?string $filetype): self
{
$this->filetype = $filetype;
return $this;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function setAmount(float $amount): self
{
$this->amount = $amount;
return $this;
}
public function getAmountUsd(): ?float
{
global $kernel;
$currencyService = $kernel->getContainer()->get('CurrencyService');
$dateStr = $this->createdAt->format('Y-m-d');
return $currencyService->convertAtDate($dateStr, $this->currency->getIso(), 'USD', $this->amount);
}
public function getCurrency(): ?Currency
{
return $this->currency;
}
public function setCurrency(?Currency $currency): self
{
$this->currency = $currency;
return $this;
}
}