<?php
namespace App\Entity;
use App\Repository\StockTransferRepository;
use App\Utils\CurrencyHelper;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StockTransferRepository::class)]
class StockTransfer extends BaseEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Warehouse::class, inversedBy: 'outgoingTransfers')]
#[ORM\JoinColumn(nullable: false)]
private $outWarehouse;
#[ORM\ManyToOne(targetEntity: Warehouse::class, inversedBy: 'incomingTransfers')]
#[ORM\JoinColumn(nullable: false)]
private $arrivalWarehouse;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\Column(name: 'out_date', type: 'date_immutable', nullable: true)]
private $warehouseOutDate;
#[ORM\Column(name: 'warehouse_arrival_date', type: 'date_immutable', nullable: true)]
private $warehouseArrivalDate;
#[ORM\Column(name: 'total_amount', type: 'decimal', precision: 19, scale: 4, nullable: true)]
private $totalAmount;
#[ORM\Column(name: 'invoice_number', type: 'string', nullable: true)]
private $invoiceNumber;
#[ORM\Column(name: 'container_number', type: 'string', nullable: true)]
private $containerNumber;
#[ORM\Column(name: 'konsimento', type: 'string', nullable: true)]
private $konsimento;
#[ORM\ManyToOne(targetEntity: StockTransaction::class, inversedBy: 'stockTransfers')]
#[ORM\JoinColumn(nullable: true)]
private $transaction;
#[ORM\OneToMany(mappedBy: 'stockTransfer', targetEntity: Stock::class)]
private $stock;
#[ORM\OneToMany(mappedBy: 'stockTransfer', targetEntity: StockTransferProducts::class)]
private $products;
#[ORM\OneToMany(mappedBy: 'stockTransfer', targetEntity: StockTransferContainer::class)]
private $stockTransferContainers;
#[ORM\Column(name: 'transferCost', type: 'decimal', precision: 19, scale: 4, nullable: true)]
private $transferCosts;
#[ORM\Column(name: 'transferType', type: 'string', nullable: true)]
private $transferType;
private $quantity;
private $priceFob;
private $priceNavlun;
private $totalUnitPrice;
private $purchaseTotalAmount;
private $buyingCompany;
private $buyingDate;
public function __construct()
{
$this->stock = new ArrayCollection();
$this->products = new ArrayCollection();
$this->stockTransferContainers = new ArrayCollection();
}
public function __toString(): string
{
return $this->id;
}
public function getId(): ?int
{
return $this->id;
}
public function getOutWarehouse(): ?Warehouse
{
return $this->outWarehouse;
}
public function setOutWarehouse(?Warehouse $outWarehouse): self
{
$this->outWarehouse = $outWarehouse;
return $this;
}
public function getArrivalWarehouse(): ?Warehouse
{
return $this->arrivalWarehouse;
}
public function setArrivalWarehouse(?Warehouse $arrivalWarehouse): self
{
$this->arrivalWarehouse = $arrivalWarehouse;
return $this;
}
public function getQuantity()
{
return $this->quantity;
}
public function setQuantity($quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getDescription()
{
return $this->description;
}
public function setDescription($description): self
{
$this->description = $description;
return $this;
}
public function getTransaction(): ?StockTransaction
{
return $this->transaction;
}
public function setTransaction(?StockTransaction $transaction): self
{
$this->transaction = $transaction;
return $this;
}
public function getInvoiceNumber(): ?string
{
return $this->invoiceNumber;
}
public function setInvoiceNumber(?string $invoiceNumber): self
{
$this->invoiceNumber = $invoiceNumber;
return $this;
}
public function getContainerNumber(): ?string
{
return $this->containerNumber;
}
public function setContainerNumber(?string $containerNumber): self
{
$this->containerNumber = $containerNumber;
return $this;
}
public function getKonsimento(): ?string
{
return $this->konsimento;
}
public function setKonsimento(?string $konsimento): self
{
$this->konsimento = $konsimento;
return $this;
}
public function getPriceFob()
{
return $this->priceFob;
}
public function setPriceFob($priceFob): self
{
$this->priceFob = $priceFob;
return $this;
}
public function getPriceNavlun()
{
return $this->priceNavlun;
}
public function setPriceNavlun($priceNavlun): self
{
$this->priceNavlun = $priceNavlun;
return $this;
}
public function getTotalUnitPrice()
{
return $this->totalUnitPrice;
}
public function setTotalUnitPrice($totalUnitPrice): self
{
$this->totalUnitPrice = $totalUnitPrice;
return $this;
}
public function getPurchaseTotalAmount()
{
return $this->purchaseTotalAmount;
}
public function setPurchaseTotalAmount($purchaseTotalAmount): self
{
$this->purchaseTotalAmount = $purchaseTotalAmount;
return $this;
}
public function getBuyingCompany(): ?string
{
return $this->buyingCompany;
}
public function setBuyingCompany(string $buyingCompany): self
{
$this->buyingCompany = $buyingCompany;
return $this;
}
public function getBuyingDate(): ?\DateTimeImmutable
{
return $this->buyingDate;
}
public function setBuyingDate(\DateTimeImmutable $buyingDate): self
{
$this->buyingDate = $buyingDate;
return $this;
}
public function getWarehouseArrivalDate(): ?\DateTimeImmutable
{
return $this->warehouseArrivalDate;
}
public function setWarehouseArrivalDate(?\DateTimeImmutable $warehouseArrivalDate): self
{
$this->warehouseArrivalDate = $warehouseArrivalDate;
return $this;
}
public function getStock()
{
return $this->stock;
}
public function addStock(Stock $stock): self
{
$this->stock[] = $stock;
$stock->setStockTransfer($this);
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stock->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getStockTransfer() === $this) {
$stock->setStockTransfer(null);
}
}
return $this;
}
/**
* @return Collection<int, StockTransferProducts>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(StockTransferProducts $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setStockTransfer($this);
}
return $this;
}
public function removeProduct(StockTransferProducts $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getStockTransfer() === $this) {
$product->setStockTransfer(null);
}
}
return $this;
}
public function getWarehouseOutDate(): ?\DateTimeImmutable
{
return $this->warehouseOutDate;
}
public function setWarehouseOutDate(\DateTimeImmutable $warehouseOutDate): self
{
$this->warehouseOutDate = $warehouseOutDate;
return $this;
}
public function getTotalAmount()
{
return $this->totalAmount;
}
public function setTotalAmount($totalAmount): self
{
$this->totalAmount = CurrencyHelper::convertToFloat($totalAmount);
return $this;
}
public function setStock(Collection $stock): self
{
$this->stock = $stock;
return $this;
}
/**
* @return Collection<int, StockTransferContainer>
*/
public function getStockTransferContainers(): Collection
{
return $this->stockTransferContainers;
}
public function addStockTransferContainer(StockTransferContainer $stockTransferContainer): self
{
if (!$this->stockTransferContainers->contains($stockTransferContainer)) {
$this->stockTransferContainers[] = $stockTransferContainer;
$stockTransferContainer->setStockTransfer($this);
}
return $this;
}
public function removeStockTransferContainer(StockTransferContainer $stockTransferContainer): self
{
if ($this->stockTransferContainers->removeElement($stockTransferContainer)) {
// set the owning side to null (unless already changed)
if ($stockTransferContainer->getStockTransfer() === $this) {
$stockTransferContainer->setStockTransfer(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getTransferCosts()
{
return $this->transferCosts;
}
/**
* @param mixed $transferCosts
*/
public function setTransferCosts($transferCosts): void
{
$this->transferCosts = $transferCosts;
}
/**
* @return mixed
*/
public function getTransferType()
{
return $this->transferType;
}
/**
* @param mixed $transferType
*/
public function setTransferType($transferType): void
{
$this->transferType = $transferType;
}
}