src/Entity/Zamowienia.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Partner;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Symfony\Component\HttpFoundation\File\UploadedFile;
  8. /**
  9.  * Zamowienia
  10.  *
  11.  * 
  12.  * @ORM\Entity
  13.  * @ORM\Entity(repositoryClass="App\Repository\ZamowieniaRepository")
  14.  */
  15. class Zamowienia
  16. {
  17.     /**
  18.      * @var int
  19.      *
  20.      * @ORM\Column(name="id", type="integer", nullable=false)
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="IDENTITY")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @var string|null
  27.      *
  28.      * @ORM\Column(name="numer", type="string", length=255, nullable=true)
  29.      */
  30.     private $numer;
  31.     /**
  32.      * @var \DateTime
  33.      *
  34.      * @ORM\Column(name="data_zamowienia", type="datetime", nullable=false)
  35.      */
  36.     private $dataZamowienia;
  37.     /**
  38.      * @var \DateTime|null
  39.      *
  40.      * @ORM\Column(name="data_montaz", type="datetime", nullable=true)
  41.      */
  42.     private $dataMontaz;
  43.     /**
  44.      * @var \DateTime|null
  45.      *
  46.      * @ORM\Column(name="data_pomiar", type="datetime", nullable=true)
  47.      */
  48.     private $dataPomiar;
  49.     /**
  50.      * @var float
  51.      *
  52.      * @ORM\Column(name="wartosc", type="float", precision=10, scale=0, nullable=false)
  53.      */
  54.     private $wartosc;
  55.     /**
  56.      * @var string
  57.      *
  58.      * @ORM\Column(name="nazwa_dostawa", type="string", length=150, nullable=false)
  59.      */
  60.     private $nazwaDostawa;
  61.     /**
  62.      * @var string
  63.      *
  64.      * @ORM\Column(name="adres_dostawa", type="string", length=255, nullable=false)
  65.      */
  66.     private $adresDostawa;
  67.     /**
  68.      * @var string
  69.      *
  70.      * @ORM\Column(name="kod_dostawa", type="string", length=30, nullable=false)
  71.      */
  72.     private $kodDostawa;
  73.     /**
  74.      * @var string
  75.      *
  76.      * @ORM\Column(name="miasto_dostawa", type="string", length=150, nullable=false)
  77.      */
  78.     private $miastoDostawa;
  79.     /**
  80.      * @var string|null
  81.      *
  82.      * @ORM\Column(name="nazwa_montaz", type="string", length=150, nullable=true)
  83.      */
  84.     private $nazwaMontaz;
  85.     /**
  86.      * @var string|null
  87.      *
  88.      * @ORM\Column(name="adres_montaz", type="string", length=255, nullable=true)
  89.      */
  90.     private $adresMontaz;
  91.     /**
  92.      * @var string|null
  93.      *
  94.      * @ORM\Column(name="kod_montaz", type="string", length=6, nullable=true)
  95.      */
  96.     private $kodMontaz;
  97.     /**
  98.      * @var string|null
  99.      *
  100.      * @ORM\Column(name="miasto_montaz", type="string", length=150, nullable=true)
  101.      */
  102.     private $miastoMontaz;
  103.     /**
  104.      * @var string|null
  105.      *
  106.      * @ORM\Column(name="telefon_dostawa", type="string", length=50, nullable=true)
  107.      */
  108.     private $telefonDostawa;
  109.     /**
  110.      * @var string|null
  111.      *
  112.      * @ORM\Column(name="telefon_montaz", type="string", length=50, nullable=true)
  113.      */
  114.     private $telefonMontaz;
  115.     /**
  116.      * @var int
  117.      *
  118.      * @ORM\Column(name="id_produkt", type="integer", nullable=false)
  119.      */
  120.     private $idProdukt;
  121.     /**
  122.      * @var float
  123.      *
  124.      * @ORM\Column(name="vat", type="float", precision=10, scale=0, nullable=false)
  125.      */
  126.     private $vat;
  127.     /**
  128.      * @var int
  129.      *
  130.      * @ORM\Column(name="margin", type="integer", nullable=false)
  131.      */
  132.     private $margin;
  133.     /**
  134.      * @var int
  135.      *
  136.      * @ORM\Column(name="discount", type="integer", nullable=false)
  137.      */
  138.     private $discount;
  139.     /**
  140.      * @var int
  141.      *
  142.      * @ORM\Column(name="square", type="integer", nullable=false)
  143.      */
  144.     private $square;
  145.     /**
  146.      * @var string|null
  147.      *
  148.      * @ORM\Column(name="mail", type="string", length=255, nullable=true)
  149.      */
  150.     private $mail;
  151.     /**
  152.      * @var array
  153.      *
  154.      * @ORM\Column(name="produkt", type="json", nullable=false)
  155.      */
  156.     private $produkt;
  157.     
  158.      /**
  159.      * Set idProdukt
  160.      *
  161.      * @param integer $idProdukt
  162.      *
  163.      * @return Zamowienie
  164.      */
  165.     public function setIdProdukt($idProdukt)
  166.     {
  167.         $this->idProdukt $idProdukt;
  168.         return $this;
  169.     }
  170.     /**
  171.      * Get idProdukt
  172.      *
  173.      * @return integer
  174.      */
  175.     public function getIdProdukt()
  176.     {
  177.         return $this->idProdukt;
  178.     }
  179.     /**
  180.      * Get id
  181.      *
  182.      * @return integer
  183.      */
  184.     public function getId()
  185.     {
  186.         return $this->id;
  187.     }
  188.     /**
  189.      * Set numer
  190.      *
  191.      * @param string $numer
  192.      *
  193.      * @return Zamowienia
  194.      */
  195.     public function setNumer($numer)
  196.     {
  197.         $this->numer $numer;
  198.         return $this;
  199.     }
  200.     /**
  201.      * Get numer
  202.      *
  203.      * @return string
  204.      */
  205.     public function getNumer()
  206.     {
  207.         return $this->numer;
  208.     }
  209.     /**
  210.      * Set dataZamowienia
  211.      *
  212.      * @param \DateTime $dataZamowienia
  213.      *
  214.      * @return Zamowienia
  215.      */
  216.     public function setDataZamowienia($dataZamowienia)
  217.     {
  218.         $this->dataZamowienia $dataZamowienia;
  219.         return $this;
  220.     }
  221.     /**
  222.      * Get dataZamowienia
  223.      *
  224.      * @return \DateTime
  225.      */
  226.     public function getDataZamowienia()
  227.     {
  228.         return $this->dataZamowienia;
  229.     }
  230.     /**
  231.      * Set wartosc
  232.      *
  233.      * @param string $wartosc
  234.      *
  235.      * @return Zamowienia
  236.      */
  237.     public function setWartosc($wartosc)
  238.     {
  239.         $this->wartosc $wartosc;
  240.         return $this;
  241.     }
  242.     /**
  243.      * Get wartosc
  244.      *
  245.      * @return string
  246.      */
  247.     public function getWartosc()
  248.     {
  249.         return $this->wartosc;
  250.     }
  251.     /**
  252.      * Set nazwaDostawa
  253.      *
  254.      * @param string $nazwaDostawa
  255.      *
  256.      * @return Zamowienia
  257.      */
  258.     public function setNazwaDostawa($nazwaDostawa)
  259.     {
  260.         $this->nazwaDostawa $nazwaDostawa;
  261.         return $this;
  262.     }
  263.     /**
  264.      * Get nazwaDostawa
  265.      *
  266.      * @return string
  267.      */
  268.     public function getNazwaDostawa()
  269.     {
  270.         return $this->nazwaDostawa;
  271.     }
  272.     /**
  273.      * Set adresDostawa
  274.      *
  275.      * @param string $adresDostawa
  276.      *
  277.      * @return Zamowienia
  278.      */
  279.     public function setAdresDostawa($adresDostawa)
  280.     {
  281.         $this->adresDostawa $adresDostawa;
  282.         return $this;
  283.     }
  284.     /**
  285.      * Get adresDostawa
  286.      *
  287.      * @return string
  288.      */
  289.     public function getAdresDostawa()
  290.     {
  291.         return $this->adresDostawa;
  292.     }
  293.     /**
  294.      * Set kodDostawa
  295.      *
  296.      * @param string $kodDostawa
  297.      *
  298.      * @return Zamowienia
  299.      */
  300.     public function setKodDostawa($kodDostawa)
  301.     {
  302.         $this->kodDostawa $kodDostawa;
  303.         return $this;
  304.     }
  305.     /**
  306.      * Get kodDostawa
  307.      *
  308.      * @return string
  309.      */
  310.     public function getKodDostawa()
  311.     {
  312.         return $this->kodDostawa;
  313.     }
  314.     /**
  315.      * Set miastoDostawa
  316.      *
  317.      * @param string $miastoDostawa
  318.      *
  319.      * @return Zamowienia
  320.      */
  321.     public function setMiastoDostawa($miastoDostawa)
  322.     {
  323.         $this->miastoDostawa $miastoDostawa;
  324.         return $this;
  325.     }
  326.     /**
  327.      * Get miastoDostawa
  328.      *
  329.      * @return string
  330.      */
  331.     public function getMiastoDostawa()
  332.     {
  333.         return $this->miastoDostawa;
  334.     }
  335.     /**
  336.      * Set nazwaMontaz
  337.      *
  338.      * @param string $nazwaMontaz
  339.      *
  340.      * @return Zamowienia
  341.      */
  342.     public function setNazwaMontaz($nazwaMontaz)
  343.     {
  344.         $this->nazwaMontaz $nazwaMontaz;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Get nazwaMontaz
  349.      *
  350.      * @return string
  351.      */
  352.     public function getNazwaMontaz()
  353.     {
  354.         return $this->nazwaMontaz;
  355.     }
  356.      /**
  357.      * @var string
  358.      *
  359.      * @ORM\Column(name="mail", type="string", length=255,nullable=true)
  360.      */
  361.    //private $mail;
  362.     /**
  363.      * Set adresMontaz
  364.      *
  365.      * @param string $adresMontaz
  366.      *
  367.      * @return Zamowienia
  368.      */
  369.     public function setAdresMontaz($adresMontaz)
  370.     {
  371.         $this->adresMontaz $adresMontaz;
  372.         return $this;
  373.     }
  374.     /**
  375.      * Get adresMontaz
  376.      *
  377.      * @return string
  378.      */
  379.     public function getAdresMontaz()
  380.     {
  381.         return $this->adresMontaz;
  382.     }
  383.     /**
  384.      * Set kodMontaz
  385.      *
  386.      * @param string $kodMontaz
  387.      *
  388.      * @return Zamowienia
  389.      */
  390.     public function setKodMontaz($kodMontaz)
  391.     {
  392.         $this->kodMontaz $kodMontaz;
  393.         return $this;
  394.     }
  395.     /**
  396.      * Get kodMontaz
  397.      *
  398.      * @return string
  399.      */
  400.     public function getKodMontaz()
  401.     {
  402.         return $this->kodMontaz;
  403.     }
  404.     /**
  405.      * Set miastoMontaz
  406.      *
  407.      * @param string $miastoMontaz
  408.      *
  409.      * @return Zamowienia
  410.      */
  411.     public function setMiastoMontaz($miastoMontaz)
  412.     {
  413.         $this->miastoMontaz $miastoMontaz;
  414.         return $this;
  415.     }
  416.     /**
  417.      * Get miastoMontaz
  418.      *
  419.      * @return string
  420.      */
  421.     public function getMiastoMontaz()
  422.     {
  423.         return $this->miastoMontaz;
  424.     }
  425.     /**
  426.      * Set telefonDostawa
  427.      *
  428.      * @param string $telefonDostawa
  429.      *
  430.      * @return Zamowienia
  431.      */
  432.     public function setTelefonDostawa($telefonDostawa)
  433.     {
  434.         $this->telefonDostawa $telefonDostawa;
  435.         return $this;
  436.     }
  437.     /**
  438.      * Get telefonDostawa
  439.      *
  440.      * @return string
  441.      */
  442.     public function getTelefonDostawa()
  443.     {
  444.         return $this->telefonDostawa;
  445.     }
  446.     /**
  447.      * Set telefonMontaz
  448.      *
  449.      * @param string $telefonMontaz
  450.      *
  451.      * @return Zamowienia
  452.      */
  453.     public function setTelefonMontaz($telefonMontaz)
  454.     {
  455.         $this->telefonMontaz $telefonMontaz;
  456.         return $this;
  457.     }
  458.     /**
  459.      * Get telefonMontaz
  460.      *
  461.      * @return string
  462.      */
  463.     public function getTelefonMontaz()
  464.     {
  465.         return $this->telefonMontaz;
  466.     }
  467.      /**
  468.      * @var array
  469.      *
  470.      * @ORM\Column(name="produkt", type="json_array")
  471.      */
  472.     // private $produkt;
  473.     /**
  474.      * Set produkt
  475.      *
  476.      * @param array $produkt
  477.      *
  478.      * @return Zamowienia
  479.      */
  480.     public function setProdukt($produkt)
  481.     {
  482.         $this->produkt $produkt;
  483.         return $this;
  484.     }
  485.     /**
  486.      * Get produkt
  487.      *
  488.      * @return array
  489.      */
  490.     public function getProdukt()
  491.     {
  492.         return $this->produkt;
  493.     }
  494.     /**
  495.      * Set mail
  496.      *
  497.      * @param string $mail
  498.      *
  499.      * @return Zamowienia
  500.      */
  501.     public function setMail($mail)
  502.     {
  503.         $this->mail $mail;
  504.         return $this;
  505.     }
  506.     /**
  507.      * Get mail
  508.      *
  509.      * @return string
  510.      */
  511.     public function getMail()
  512.     {
  513.         return $this->mail;
  514.     }
  515.     /**
  516.      * Set dataMontaz
  517.      *
  518.      * @param \DateTime $dataMontaz
  519.      *
  520.      * @return Zamowienia
  521.      */
  522.     public function setDataMontaz($dataMontaz)
  523.     {
  524.         $this->dataMontaz $dataMontaz;
  525.         return $this;
  526.     }
  527.     /**
  528.      * Get dataMontaz
  529.      *
  530.      * @return \DateTime
  531.      */
  532.     public function getDataMontaz()
  533.     {
  534.         return $this->dataMontaz;
  535.     }
  536.     /**
  537.      * Set dataPomiar
  538.      *
  539.      * @param \DateTime $dataPomiar
  540.      *
  541.      * @return Zamowienia
  542.      */
  543.     public function setDataPomiar($dataPomiar)
  544.     {
  545.         $this->dataPomiar $dataPomiar;
  546.         return $this;
  547.     }
  548.     /**
  549.      * Get dataPomiar
  550.      *
  551.      * @return \DateTime
  552.      */
  553.     public function getDataPomiar()
  554.     {
  555.         return $this->dataPomiar;
  556.     }
  557.      /**
  558.      * @ORM\Column(type="string", length=255, nullable=true)
  559.      */
  560.     public $path;
  561.     public function getAbsolutePath()
  562.     {
  563.         return null === $this->path
  564.             null
  565.             $this->getUploadRootDir().'/'.$this->path;
  566.     }
  567.     public function getWebPath()
  568.     {
  569.         return null === $this->path
  570.             null
  571.             $this->getUploadDir().'/'.$this->path;
  572.     }
  573.     protected function getUploadRootDir()
  574.     {
  575.         // the absolute directory path where uploaded
  576.         // documents should be saved
  577.         return __DIR__.'/../../public/'.$this->getUploadDir();
  578.     }
  579.     protected function getUploadDir()
  580.     {
  581.         // get rid of the __DIR__ so it doesn't screw up
  582.         // when displaying uploaded doc/image in the view.
  583.         return 'uploads/faktury';
  584.     }
  585.     /**
  586.      * @Assert\File(maxSize="6000000")
  587.      */
  588.     private $file;
  589.     /**
  590.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="zamowienias")
  591.      */
  592.     private $user;
  593.     /**
  594.      * @ORM\ManyToOne(targetEntity=Partner::class, inversedBy="zamowienias")
  595.      * @ORM\JoinColumn(nullable=false)
  596.      */
  597.     private $partner;
  598.     /**
  599.      * @ORM\ManyToOne(targetEntity=Purchaser::class, inversedBy="zamowienias")
  600.      * @ORM\JoinColumn(nullable=false)
  601.      */
  602.     private $purchaser;
  603.     /**
  604.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  605.      */
  606.     private $cenaBezRabat;
  607.     /**
  608.      * @ORM\Column(type="decimal", precision=12, scale=2, nullable=true)
  609.      */
  610.     private $cenaBezMarza;
  611.     /**
  612.      * @ORM\Column(type="decimal", precision=12, scale=2, nullable=true)
  613.      */
  614.     private $profit;
  615.     /**
  616.      * @ORM\Column(type="string", length=255, nullable=true)
  617.      */
  618.     private $wojewodztwo;
  619.     /**
  620.      * Sets file.
  621.      *
  622.      * @param UploadedFile $file
  623.      */
  624.     public function setFile(UploadedFile $file null)
  625.     {
  626.         $this->file $file;
  627.     }
  628.     /**
  629.      * Get file.
  630.      *
  631.      * @return UploadedFile
  632.      */
  633.     public function getFile()
  634.     {
  635.         return $this->file;
  636.     }
  637.     public function upload()
  638. {
  639.     // the file property can be empty if the field is not required
  640.     if (null === $this->getFile()) {
  641.         return;
  642.     }
  643.     // use the original file name here but you should
  644.     // sanitize it at least to avoid any security issues
  645.     $name 'faktura_' date('Y-m-d-H-i-s') . '_' uniqid() .'.'.$this->getFile()->guessExtension();
  646.     // move takes the target directory and then the
  647.     // target filename to move to
  648.     $this->getFile()->move(
  649.         $this->getUploadRootDir(),
  650.         $name
  651.     );
  652.     // set the path property to the filename where you've saved the file
  653.     $this->path $name;
  654.     // clean up the file property as you won't need it anymore
  655.     $this->file null;
  656. }
  657.     /**
  658.      * Set path
  659.      *
  660.      * @param string $path
  661.      *
  662.      * @return Zamowienia
  663.      */
  664.     public function setPath($path)
  665.     {
  666.         $this->path $path;
  667.         return $this;
  668.     }
  669.     /**
  670.      * Get path
  671.      *
  672.      * @return string
  673.      */
  674.     public function getPath()
  675.     {
  676.         return $this->path;
  677.     }
  678.   
  679.    
  680.     
  681.     /**
  682.      * Set vat
  683.      *
  684.      * @param float $vat
  685.      *
  686.      * @return Zamowienia
  687.      */
  688.     public function setVat($vat)
  689.     {
  690.         $this->vat $vat;
  691.         return $this;
  692.     }
  693.     /**
  694.      * Get vat
  695.      *
  696.      * @return float
  697.      */
  698.     public function getVat()
  699.     {
  700.         return $this->vat;
  701.     }
  702.     /**
  703.      * Set margin
  704.      *
  705.      * @param integer $margin
  706.      *
  707.      * @return Zamowienia
  708.      */
  709.     public function setMargin($margin)
  710.     {
  711.         $this->margin $margin;
  712.         return $this;
  713.     }
  714.     /**
  715.      * Get margin
  716.      *
  717.      * @return integer
  718.      */
  719.     public function getMargin()
  720.     {
  721.         return $this->margin;
  722.     }
  723.     /**
  724.      * Set square
  725.      *
  726.      * @param integer $square
  727.      *
  728.      * @return Zamowienia
  729.      */
  730.     public function setSquare($square)
  731.     {
  732.         $this->square $square;
  733.         return $this;
  734.     }
  735.     /**
  736.      * Get square
  737.      *
  738.      * @return integer
  739.      */
  740.     public function getSquare()
  741.     {
  742.         return $this->square;
  743.     }
  744.     /**
  745.      * Set discount
  746.      *
  747.      * @param integer $discount
  748.      *
  749.      * @return Zamowienia
  750.      */
  751.     public function setDiscount($discount)
  752.     {
  753.         $this->discount $discount;
  754.         return $this;
  755.     }
  756.     /**
  757.      * Get discount
  758.      *
  759.      * @return integer
  760.      */
  761.     public function getDiscount()
  762.     {
  763.         return $this->discount;
  764.     }
  765.     public function getUser(): ?User
  766.     {
  767.         return $this->user;
  768.     }
  769.     public function setUser(?User $user): self
  770.     {
  771.         $this->user $user;
  772.         return $this;
  773.     }
  774.     public function getPartner(): ?Partner
  775.     {
  776.         return $this->partner;
  777.     }
  778.     public function setPartner(?Partner $partner): self
  779.     {
  780.         $this->partner $partner;
  781.         return $this;
  782.     }
  783.     public function getPurchaser(): ?Purchaser
  784.     {
  785.         return $this->purchaser;
  786.     }
  787.     public function setPurchaser(?Purchaser $purchaser): self
  788.     {
  789.         $this->purchaser $purchaser;
  790.         return $this;
  791.     }
  792.     public function getCenaBezRabat(): ?string
  793.     {
  794.         return $this->cenaBezRabat;
  795.     }
  796.     public function setCenaBezRabat(?string $cenaBezRabat): self
  797.     {
  798.         $this->cenaBezRabat $cenaBezRabat;
  799.         return $this;
  800.     }
  801.     public function getCenaBezMarza(): ?string
  802.     {
  803.         return $this->cenaBezMarza;
  804.     }
  805.     public function setCenaBezMarza(?string $cenaBezMarza): self
  806.     {
  807.         $this->cenaBezMarza $cenaBezMarza;
  808.         return $this;
  809.     }
  810.     public function getProfit(): ?string
  811.     {
  812.         return $this->profit;
  813.     }
  814.     public function setProfit(?string $profit): self
  815.     {
  816.         $this->profit $profit;
  817.         return $this;
  818.     }
  819.     public function getWojewodztwo(): ?string
  820.     {
  821.         return $this->wojewodztwo;
  822.     }
  823.     public function setWojewodztwo(?string $wojewodztwo): self
  824.     {
  825.         $this->wojewodztwo $wojewodztwo;
  826.         return $this;
  827.     }
  828. }