<?php
namespace App\Entity;
use App\Entity\Partner;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Zamowienia
*
*
* @ORM\Entity
* @ORM\Entity(repositoryClass="App\Repository\ZamowieniaRepository")
*/
class Zamowienia
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="numer", type="string", length=255, nullable=true)
*/
private $numer;
/**
* @var \DateTime
*
* @ORM\Column(name="data_zamowienia", type="datetime", nullable=false)
*/
private $dataZamowienia;
/**
* @var \DateTime|null
*
* @ORM\Column(name="data_montaz", type="datetime", nullable=true)
*/
private $dataMontaz;
/**
* @var \DateTime|null
*
* @ORM\Column(name="data_pomiar", type="datetime", nullable=true)
*/
private $dataPomiar;
/**
* @var float
*
* @ORM\Column(name="wartosc", type="float", precision=10, scale=0, nullable=false)
*/
private $wartosc;
/**
* @var string
*
* @ORM\Column(name="nazwa_dostawa", type="string", length=150, nullable=false)
*/
private $nazwaDostawa;
/**
* @var string
*
* @ORM\Column(name="adres_dostawa", type="string", length=255, nullable=false)
*/
private $adresDostawa;
/**
* @var string
*
* @ORM\Column(name="kod_dostawa", type="string", length=30, nullable=false)
*/
private $kodDostawa;
/**
* @var string
*
* @ORM\Column(name="miasto_dostawa", type="string", length=150, nullable=false)
*/
private $miastoDostawa;
/**
* @var string|null
*
* @ORM\Column(name="nazwa_montaz", type="string", length=150, nullable=true)
*/
private $nazwaMontaz;
/**
* @var string|null
*
* @ORM\Column(name="adres_montaz", type="string", length=255, nullable=true)
*/
private $adresMontaz;
/**
* @var string|null
*
* @ORM\Column(name="kod_montaz", type="string", length=6, nullable=true)
*/
private $kodMontaz;
/**
* @var string|null
*
* @ORM\Column(name="miasto_montaz", type="string", length=150, nullable=true)
*/
private $miastoMontaz;
/**
* @var string|null
*
* @ORM\Column(name="telefon_dostawa", type="string", length=50, nullable=true)
*/
private $telefonDostawa;
/**
* @var string|null
*
* @ORM\Column(name="telefon_montaz", type="string", length=50, nullable=true)
*/
private $telefonMontaz;
/**
* @var int
*
* @ORM\Column(name="id_produkt", type="integer", nullable=false)
*/
private $idProdukt;
/**
* @var float
*
* @ORM\Column(name="vat", type="float", precision=10, scale=0, nullable=false)
*/
private $vat;
/**
* @var int
*
* @ORM\Column(name="margin", type="integer", nullable=false)
*/
private $margin;
/**
* @var int
*
* @ORM\Column(name="discount", type="integer", nullable=false)
*/
private $discount;
/**
* @var int
*
* @ORM\Column(name="square", type="integer", nullable=false)
*/
private $square;
/**
* @var string|null
*
* @ORM\Column(name="mail", type="string", length=255, nullable=true)
*/
private $mail;
/**
* @var array
*
* @ORM\Column(name="produkt", type="json", nullable=false)
*/
private $produkt;
/**
* Set idProdukt
*
* @param integer $idProdukt
*
* @return Zamowienie
*/
public function setIdProdukt($idProdukt)
{
$this->idProdukt = $idProdukt;
return $this;
}
/**
* Get idProdukt
*
* @return integer
*/
public function getIdProdukt()
{
return $this->idProdukt;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set numer
*
* @param string $numer
*
* @return Zamowienia
*/
public function setNumer($numer)
{
$this->numer = $numer;
return $this;
}
/**
* Get numer
*
* @return string
*/
public function getNumer()
{
return $this->numer;
}
/**
* Set dataZamowienia
*
* @param \DateTime $dataZamowienia
*
* @return Zamowienia
*/
public function setDataZamowienia($dataZamowienia)
{
$this->dataZamowienia = $dataZamowienia;
return $this;
}
/**
* Get dataZamowienia
*
* @return \DateTime
*/
public function getDataZamowienia()
{
return $this->dataZamowienia;
}
/**
* Set wartosc
*
* @param string $wartosc
*
* @return Zamowienia
*/
public function setWartosc($wartosc)
{
$this->wartosc = $wartosc;
return $this;
}
/**
* Get wartosc
*
* @return string
*/
public function getWartosc()
{
return $this->wartosc;
}
/**
* Set nazwaDostawa
*
* @param string $nazwaDostawa
*
* @return Zamowienia
*/
public function setNazwaDostawa($nazwaDostawa)
{
$this->nazwaDostawa = $nazwaDostawa;
return $this;
}
/**
* Get nazwaDostawa
*
* @return string
*/
public function getNazwaDostawa()
{
return $this->nazwaDostawa;
}
/**
* Set adresDostawa
*
* @param string $adresDostawa
*
* @return Zamowienia
*/
public function setAdresDostawa($adresDostawa)
{
$this->adresDostawa = $adresDostawa;
return $this;
}
/**
* Get adresDostawa
*
* @return string
*/
public function getAdresDostawa()
{
return $this->adresDostawa;
}
/**
* Set kodDostawa
*
* @param string $kodDostawa
*
* @return Zamowienia
*/
public function setKodDostawa($kodDostawa)
{
$this->kodDostawa = $kodDostawa;
return $this;
}
/**
* Get kodDostawa
*
* @return string
*/
public function getKodDostawa()
{
return $this->kodDostawa;
}
/**
* Set miastoDostawa
*
* @param string $miastoDostawa
*
* @return Zamowienia
*/
public function setMiastoDostawa($miastoDostawa)
{
$this->miastoDostawa = $miastoDostawa;
return $this;
}
/**
* Get miastoDostawa
*
* @return string
*/
public function getMiastoDostawa()
{
return $this->miastoDostawa;
}
/**
* Set nazwaMontaz
*
* @param string $nazwaMontaz
*
* @return Zamowienia
*/
public function setNazwaMontaz($nazwaMontaz)
{
$this->nazwaMontaz = $nazwaMontaz;
return $this;
}
/**
* Get nazwaMontaz
*
* @return string
*/
public function getNazwaMontaz()
{
return $this->nazwaMontaz;
}
/**
* @var string
*
* @ORM\Column(name="mail", type="string", length=255,nullable=true)
*/
//private $mail;
/**
* Set adresMontaz
*
* @param string $adresMontaz
*
* @return Zamowienia
*/
public function setAdresMontaz($adresMontaz)
{
$this->adresMontaz = $adresMontaz;
return $this;
}
/**
* Get adresMontaz
*
* @return string
*/
public function getAdresMontaz()
{
return $this->adresMontaz;
}
/**
* Set kodMontaz
*
* @param string $kodMontaz
*
* @return Zamowienia
*/
public function setKodMontaz($kodMontaz)
{
$this->kodMontaz = $kodMontaz;
return $this;
}
/**
* Get kodMontaz
*
* @return string
*/
public function getKodMontaz()
{
return $this->kodMontaz;
}
/**
* Set miastoMontaz
*
* @param string $miastoMontaz
*
* @return Zamowienia
*/
public function setMiastoMontaz($miastoMontaz)
{
$this->miastoMontaz = $miastoMontaz;
return $this;
}
/**
* Get miastoMontaz
*
* @return string
*/
public function getMiastoMontaz()
{
return $this->miastoMontaz;
}
/**
* Set telefonDostawa
*
* @param string $telefonDostawa
*
* @return Zamowienia
*/
public function setTelefonDostawa($telefonDostawa)
{
$this->telefonDostawa = $telefonDostawa;
return $this;
}
/**
* Get telefonDostawa
*
* @return string
*/
public function getTelefonDostawa()
{
return $this->telefonDostawa;
}
/**
* Set telefonMontaz
*
* @param string $telefonMontaz
*
* @return Zamowienia
*/
public function setTelefonMontaz($telefonMontaz)
{
$this->telefonMontaz = $telefonMontaz;
return $this;
}
/**
* Get telefonMontaz
*
* @return string
*/
public function getTelefonMontaz()
{
return $this->telefonMontaz;
}
/**
* @var array
*
* @ORM\Column(name="produkt", type="json_array")
*/
// private $produkt;
/**
* Set produkt
*
* @param array $produkt
*
* @return Zamowienia
*/
public function setProdukt($produkt)
{
$this->produkt = $produkt;
return $this;
}
/**
* Get produkt
*
* @return array
*/
public function getProdukt()
{
return $this->produkt;
}
/**
* Set mail
*
* @param string $mail
*
* @return Zamowienia
*/
public function setMail($mail)
{
$this->mail = $mail;
return $this;
}
/**
* Get mail
*
* @return string
*/
public function getMail()
{
return $this->mail;
}
/**
* Set dataMontaz
*
* @param \DateTime $dataMontaz
*
* @return Zamowienia
*/
public function setDataMontaz($dataMontaz)
{
$this->dataMontaz = $dataMontaz;
return $this;
}
/**
* Get dataMontaz
*
* @return \DateTime
*/
public function getDataMontaz()
{
return $this->dataMontaz;
}
/**
* Set dataPomiar
*
* @param \DateTime $dataPomiar
*
* @return Zamowienia
*/
public function setDataPomiar($dataPomiar)
{
$this->dataPomiar = $dataPomiar;
return $this;
}
/**
* Get dataPomiar
*
* @return \DateTime
*/
public function getDataPomiar()
{
return $this->dataPomiar;
}
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
public $path;
public function getAbsolutePath()
{
return null === $this->path
? null
: $this->getUploadRootDir().'/'.$this->path;
}
public function getWebPath()
{
return null === $this->path
? null
: $this->getUploadDir().'/'.$this->path;
}
protected function getUploadRootDir()
{
// the absolute directory path where uploaded
// documents should be saved
return __DIR__.'/../../public/'.$this->getUploadDir();
}
protected function getUploadDir()
{
// get rid of the __DIR__ so it doesn't screw up
// when displaying uploaded doc/image in the view.
return 'uploads/faktury';
}
/**
* @Assert\File(maxSize="6000000")
*/
private $file;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="zamowienias")
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=Partner::class, inversedBy="zamowienias")
* @ORM\JoinColumn(nullable=false)
*/
private $partner;
/**
* @ORM\ManyToOne(targetEntity=Purchaser::class, inversedBy="zamowienias")
* @ORM\JoinColumn(nullable=false)
*/
private $purchaser;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $cenaBezRabat;
/**
* @ORM\Column(type="decimal", precision=12, scale=2, nullable=true)
*/
private $cenaBezMarza;
/**
* @ORM\Column(type="decimal", precision=12, scale=2, nullable=true)
*/
private $profit;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $wojewodztwo;
/**
* Sets file.
*
* @param UploadedFile $file
*/
public function setFile(UploadedFile $file = null)
{
$this->file = $file;
}
/**
* Get file.
*
* @return UploadedFile
*/
public function getFile()
{
return $this->file;
}
public function upload()
{
// the file property can be empty if the field is not required
if (null === $this->getFile()) {
return;
}
// use the original file name here but you should
// sanitize it at least to avoid any security issues
$name = 'faktura_' . date('Y-m-d-H-i-s') . '_' . uniqid() .'.'.$this->getFile()->guessExtension();
// move takes the target directory and then the
// target filename to move to
$this->getFile()->move(
$this->getUploadRootDir(),
$name
);
// set the path property to the filename where you've saved the file
$this->path = $name;
// clean up the file property as you won't need it anymore
$this->file = null;
}
/**
* Set path
*
* @param string $path
*
* @return Zamowienia
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* Get path
*
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* Set vat
*
* @param float $vat
*
* @return Zamowienia
*/
public function setVat($vat)
{
$this->vat = $vat;
return $this;
}
/**
* Get vat
*
* @return float
*/
public function getVat()
{
return $this->vat;
}
/**
* Set margin
*
* @param integer $margin
*
* @return Zamowienia
*/
public function setMargin($margin)
{
$this->margin = $margin;
return $this;
}
/**
* Get margin
*
* @return integer
*/
public function getMargin()
{
return $this->margin;
}
/**
* Set square
*
* @param integer $square
*
* @return Zamowienia
*/
public function setSquare($square)
{
$this->square = $square;
return $this;
}
/**
* Get square
*
* @return integer
*/
public function getSquare()
{
return $this->square;
}
/**
* Set discount
*
* @param integer $discount
*
* @return Zamowienia
*/
public function setDiscount($discount)
{
$this->discount = $discount;
return $this;
}
/**
* Get discount
*
* @return integer
*/
public function getDiscount()
{
return $this->discount;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getPartner(): ?Partner
{
return $this->partner;
}
public function setPartner(?Partner $partner): self
{
$this->partner = $partner;
return $this;
}
public function getPurchaser(): ?Purchaser
{
return $this->purchaser;
}
public function setPurchaser(?Purchaser $purchaser): self
{
$this->purchaser = $purchaser;
return $this;
}
public function getCenaBezRabat(): ?string
{
return $this->cenaBezRabat;
}
public function setCenaBezRabat(?string $cenaBezRabat): self
{
$this->cenaBezRabat = $cenaBezRabat;
return $this;
}
public function getCenaBezMarza(): ?string
{
return $this->cenaBezMarza;
}
public function setCenaBezMarza(?string $cenaBezMarza): self
{
$this->cenaBezMarza = $cenaBezMarza;
return $this;
}
public function getProfit(): ?string
{
return $this->profit;
}
public function setProfit(?string $profit): self
{
$this->profit = $profit;
return $this;
}
public function getWojewodztwo(): ?string
{
return $this->wojewodztwo;
}
public function setWojewodztwo(?string $wojewodztwo): self
{
$this->wojewodztwo = $wojewodztwo;
return $this;
}
}