<?php
namespace App\Entity;
use App\Repository\SaleItemsRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SaleItemsRepository::class)
*/
class SaleItems
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Sales::class, inversedBy="saleItems")
* @ORM\JoinColumn(nullable=false)
*/
private $sale;
/**
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="saleItems")
* @ORM\JoinColumn(nullable=false)
*/
private $product;
/**
* @ORM\Column(type="integer")
*/
private $count;
/**
* @ORM\Column(type="integer")
*/
private $amount;
/**
* @ORM\Column(type="integer")
*/
private $unitAmount;
/**
* @ORM\Column(type="integer")
*/
private $promotionRate;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $pmp;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $costs;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $benef;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $package;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $packageCount;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $packagePrice;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $packageBarcode;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $packageName;
public function getId(): ?int
{
return $this->id;
}
public function getSale(): ?Sales
{
return $this->sale;
}
public function setSale(?Sales $sale): self
{
$this->sale = $sale;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getCount(): ?int
{
return $this->count;
}
public function setCount(int $count): self
{
$this->count = $count;
return $this;
}
public function getAmount(): ?int
{
return $this->amount;
}
public function setAmount(int $amount): self
{
$this->amount = $amount;
return $this;
}
/**
* @return mixed
*/
public function getUnitAmount()
{
return $this->unitAmount;
}
/**
* @param mixed $unitAmount
*/
public function setUnitAmount($unitAmount): void
{
$this->unitAmount = $unitAmount;
}
/**
* @return mixed
*/
public function getPromotionRate()
{
return $this->promotionRate;
}
/**
* @param mixed $promotionRate
*/
public function setPromotionRate($promotionRate): void
{
$this->promotionRate = $promotionRate;
}
public function getPmp(): ?float
{
return $this->pmp;
}
public function setPmp(?float $pmp): self
{
$this->pmp = $pmp;
return $this;
}
public function getCosts(): ?int
{
return $this->costs;
}
public function setCosts(Product $product, $pmp, $count): self
{
if($product->getUnit() == 'WEIGHT'){
$count = $count/1000;
}
$this->costs = round($pmp * $count);
return $this;
}
public function getBenef(): ?int
{
return $this->benef;
}
public function setBenef(?int $benef): self
{
$this->benef = $benef;
return $this;
}
public function isPackage(): ?bool
{
return $this->package;
}
public function setPackage(?bool $package): self
{
$this->package = $package;
return $this;
}
/**
* @return mixed
*/
public function getPackageCount()
{
return $this->packageCount;
}
/**
* @param mixed $packageCount
*/
public function setPackageCount($packageCount): void
{
$this->packageCount = $packageCount;
}
/**
* @return mixed
*/
public function getPackagePrice()
{
return $this->packagePrice;
}
/**
* @param mixed $packagePrice
*/
public function setPackagePrice($packagePrice): void
{
$this->packagePrice = $packagePrice;
}
/**
* @return mixed
*/
public function getPackageBarcode()
{
return $this->packageBarcode;
}
/**
* @param mixed $packageBarcode
*/
public function setPackageBarcode($packageBarcode): void
{
$this->packageBarcode = $packageBarcode;
}
/**
* @return mixed
*/
public function getPackageName()
{
return $this->packageName;
}
/**
* @param mixed $packageName
*/
public function setPackageName($packageName): void
{
$this->packageName = $packageName;
}
}