src/Entity/TblMouvement.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimestampableTrait;
  4. use App\Repository\TblMouvementRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. /**
  10.  * @ORM\Entity(repositoryClass=TblMouvementRepository::class)
  11.  * @Gedmo\Loggable
  12.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  13.  */
  14. class TblMouvement
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="date")
  24.      * @Gedmo\Versioned
  25.      */
  26.     private $dateMouvement;
  27.     
  28.     /**
  29.      * @ORM\Column(type="float")
  30.      * @Gedmo\Versioned
  31.      */
  32.     private $quantite;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      * @Gedmo\Versioned
  36.      */
  37.     private $NumFacture;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=User::class)
  40.      * @ORM\JoinColumns({
  41.      *   @ORM\JoinColumn(name="acheter_par", referencedColumnName="user_id")
  42.      * })
  43.      * @Gedmo\Blameable(on="create")
  44.      * @Gedmo\Versioned
  45.      */
  46.     private $acheterPar;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=RefEtatMouvement::class)
  49.      * @ORM\JoinColumn(nullable=false)
  50.      * @Gedmo\Versioned
  51.      */
  52.     private $etatMouvement;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity=RefTypeMouvement::class)
  55.      * @ORM\JoinColumn(nullable=false)
  56.      * @Gedmo\Versioned
  57.      */
  58.     private $typeMouvement;
  59.     /**
  60.      * @ORM\Column(type="float", nullable=true)
  61.      * @Gedmo\Versioned
  62.      */
  63.     private $prixAchatUnitaire;
  64.     /**
  65.      * @ORM\Column(type="text", nullable=true)
  66.      * @Gedmo\Versioned
  67.      */
  68.     private $description;
  69.     /**
  70.      * @ORM\ManyToMany(targetEntity=TblFile::class,cascade={"persist"})
  71.      * @ORM\JoinTable(name="lnk_tbl_mouvement_tbl_file",
  72.      *   joinColumns={
  73.      *     @ORM\JoinColumn(name="tbl_mouvement_id", referencedColumnName="id")
  74.      *   },
  75.      *   inverseJoinColumns={
  76.      *     @ORM\JoinColumn(name="tbl_file_id", referencedColumnName="id", nullable=false)
  77.      *   }
  78.      * )
  79.      */
  80.     private $files;
  81.     /**
  82.      * @ORM\ManyToOne(targetEntity=RefTypeStock::class, inversedBy="mouvements")
  83.      * @ORM\JoinColumn(nullable=true)
  84.      */
  85.     private $entrepot;
  86.     /**
  87.      * @ORM\ManyToOne(targetEntity=RefTypeProduit::class, inversedBy="mouvements")
  88.      * @ORM\JoinColumn(nullable=false)
  89.      * @Gedmo\Versioned
  90.      */
  91.     private $typeProduit;
  92.     /**
  93.      * @ORM\ManyToMany(targetEntity=TblParcelle::class, inversedBy="mouvements"  ,cascade={"persist"})
  94.      * @ORM\JoinTable(name="lnk_tbl_mouvement_parcelle",
  95.      *   joinColumns={
  96.      *     @ORM\JoinColumn(name="mouvement_id", referencedColumnName="id")
  97.      *   },
  98.      *   inverseJoinColumns={
  99.      *     @ORM\JoinColumn(name="parcelle_id", referencedColumnName="id", nullable=false )
  100.      *   }
  101.      * )
  102.      */
  103.     private $parcelle;
  104.     /**
  105.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="mouvements")
  106.      * @ORM\JoinColumns({
  107.      *   @ORM\JoinColumn(name="consommateur", referencedColumnName="user_id")
  108.      * })
  109.      */
  110.     private $consommateur;
  111.     /**
  112.      * @ORM\ManyToOne(targetEntity=TblOperations::class, inversedBy="tblMouvements")
  113.      */
  114.     private $operations;
  115.     /**
  116.      * @ORM\OneToOne(targetEntity=TblDetailProduitOperation::class, mappedBy="mouvement", cascade={"persist", "remove"})
  117.      */
  118.     private $detailProduitOperation;
  119.     /**
  120.      * @ORM\OneToOne(targetEntity=TblDetailQuantiteParcelle::class, mappedBy="mouvement", cascade={"persist", "remove"})
  121.      */
  122.     private $tblDetailQuantiteParcelle;
  123.     /**
  124.      * @ORM\ManyToOne(targetEntity=TblPersonnel::class, inversedBy="tblMouvements")
  125.      */
  126.     private $personnel;
  127.     
  128.     use Workflowable;
  129.     public function __construct()
  130.     {
  131.         $this->files = new ArrayCollection();
  132.         $this->parcelle = new ArrayCollection();
  133.     }
  134.     use TimestampableTrait;
  135.     public function toArrayDatatable($urlEdit)
  136.     {
  137.         return [
  138.             $this->getDateMouvement()->format('d/m/Y'),
  139.             $this->getTypeMouvementIcon(),
  140.             $this->getTypeProduit()->__toString(),
  141.             $this->getQuantite().' '.$this->getTypeProduit()->getUnite(),
  142.             number_format($this->getPrixAchatUnitaire() * $this->getQuantite(), 2","" "),
  143.             $this->getPersonnel()?$this->getPersonnel()->__toString():"--",
  144.             $this->getDescription(),
  145.             $this->getEtatMouvementIcon(),
  146.             $this->getIconsMouvement($urlEdit),
  147.         ];
  148.     }
  149.     public function getId(): ?int
  150.     {
  151.         return $this->id;
  152.     }
  153.     public function getDateMouvement(): ?\DateTimeInterface
  154.     {
  155.         return $this->dateMouvement;
  156.     }
  157.     public function setDateMouvement(\DateTimeInterface $dateMouvement): self
  158.     {
  159.         $this->dateMouvement $dateMouvement;
  160.         return $this;
  161.     }
  162.     public function getTypeProduit(): ?RefTypeProduit
  163.     {
  164.         return $this->typeProduit;
  165.     }
  166.     public function setTypeProduit(?RefTypeProduit $typeProduit): self
  167.     {
  168.         $this->typeProduit $typeProduit;
  169.         return $this;
  170.     }
  171.     public function getQuantite(): ?float
  172.     {
  173.         return $this->quantite;
  174.     }
  175.     public function setQuantite(?float $quantite): self
  176.     {
  177.         $this->quantite $quantite;
  178.         return $this;
  179.     }
  180.     public function getNumFacture(): ?string
  181.     {
  182.         return $this->NumFacture;
  183.     }
  184.     public function setNumFacture(?string $NumFacture): self
  185.     {
  186.         $this->NumFacture $NumFacture;
  187.         return $this;
  188.     }
  189.     public function getAcheterPar(): ?User
  190.     {
  191.         return $this->acheterPar;
  192.     }
  193.     public function setAcheterPar(?User $acheterPar): self
  194.     {
  195.         $this->acheterPar $acheterPar;
  196.         return $this;
  197.     }
  198.     public function getEtatMouvement(): ?RefEtatMouvement
  199.     {
  200.         return $this->etatMouvement;
  201.     }
  202.     public function setEtatMouvement(?RefEtatMouvement $etatMouvement): self
  203.     {
  204.         $this->etatMouvement $etatMouvement;
  205.         return $this;
  206.     }
  207.     public function getTypeMouvement(): ?RefTypeMouvement
  208.     {
  209.         return $this->typeMouvement;
  210.     }
  211.     public function setTypeMouvement(?RefTypeMouvement $typeMouvement): self
  212.     {
  213.         $this->typeMouvement $typeMouvement;
  214.         return $this;
  215.     }
  216.     public function getPrixAchatUnitaire(): ?float
  217.     {
  218.         return $this->prixAchatUnitaire;
  219.     }
  220.     public function setPrixAchatUnitaire(float $prixAchatUnitaire): self
  221.     {
  222.         $this->prixAchatUnitaire $prixAchatUnitaire;
  223.         return $this;
  224.     }
  225.     public function getDescription(): ?string
  226.     {
  227.         return $this->description;
  228.     }
  229.     public function setDescription(?string $description): self
  230.     {
  231.         $this->description $description;
  232.         return $this;
  233.     }
  234.     /**
  235.      * @return Collection<int, TblFile>
  236.      */
  237.     public function getFiles(): Collection
  238.     {
  239.         return $this->files;
  240.     }
  241.     public function addFile(TblFile $file): self
  242.     {
  243.         if (!$this->files->contains($file)) {
  244.             $this->files[] = $file;
  245.         }
  246.         return $this;
  247.     }
  248.     public function removeFile(TblFile $file): self
  249.     {
  250.         $this->files->removeElement($file);
  251.         return $this;
  252.     }
  253.     public function getEntrepot(): ?RefTypeStock
  254.     {
  255.         return $this->entrepot;
  256.     }
  257.     public function setEntrepot(?RefTypeStock $entrepot): self
  258.     {
  259.         $this->entrepot $entrepot;
  260.         return $this;
  261.     }
  262.     
  263.     /**
  264.      * @return Collection<int, TblParcelle>
  265.      */
  266.     public function getParcelle(): Collection
  267.     {
  268.         return $this->parcelle;
  269.     }
  270.     public function addParcelle(TblParcelle $parcelle): self
  271.     {
  272.         if (!$this->parcelle->contains($parcelle)) {
  273.             $this->parcelle[] = $parcelle;
  274.         }
  275.         return $this;
  276.     }
  277.     public function removeParcelle(TblParcelle $parcelle): self
  278.     {
  279.         $this->parcelle->removeElement($parcelle);
  280.         return $this;
  281.     }
  282.     public function getConsommateur(): ?User
  283.     {
  284.         return $this->consommateur;
  285.     }
  286.     public function setConsommateur(?User $consommateur): self
  287.     {
  288.         $this->consommateur $consommateur;
  289.         return $this;
  290.     }
  291.     public function getOperations(): ?TblOperations
  292.     {
  293.         return $this->operations;
  294.     }
  295.     public function setOperations(?TblOperations $operations): self
  296.     {
  297.         $this->operations $operations;
  298.         return $this;
  299.     }
  300.     public function getDetailProduitOperation(): ?TblDetailProduitOperation
  301.     {
  302.         return $this->detailProduitOperation;
  303.     }
  304.     public function setDetailProduitOperation(?TblDetailProduitOperation $detailProduitOperation): self
  305.     {
  306.         // unset the owning side of the relation if necessary
  307.         if ($detailProduitOperation === null && $this->detailProduitOperation !== null) {
  308.             $this->detailProduitOperation->setMouvement(null);
  309.         }
  310.         // set the owning side of the relation if necessary
  311.         if ($detailProduitOperation !== null && $detailProduitOperation->getMouvement() !== $this) {
  312.             $detailProduitOperation->setMouvement($this);
  313.         }
  314.         $this->detailProduitOperation $detailProduitOperation;
  315.         return $this;
  316.     }
  317.     public function getTblDetailQuantiteParcelle(): ?TblDetailQuantiteParcelle
  318.     {
  319.         return $this->tblDetailQuantiteParcelle;
  320.     }
  321.     public function setTblDetailQuantiteParcelle(?TblDetailQuantiteParcelle $tblDetailQuantiteParcelle): self
  322.     {
  323.         // unset the owning side of the relation if necessary
  324.         if ($tblDetailQuantiteParcelle === null && $this->tblDetailQuantiteParcelle !== null) {
  325.             $this->tblDetailQuantiteParcelle->setMouvement(null);
  326.         }
  327.         // set the owning side of the relation if necessary
  328.         if ($tblDetailQuantiteParcelle !== null && $tblDetailQuantiteParcelle->getMouvement() !== $this) {
  329.             $tblDetailQuantiteParcelle->setMouvement($this);
  330.         }
  331.         $this->tblDetailQuantiteParcelle $tblDetailQuantiteParcelle;
  332.         return $this;
  333.     }
  334.     public function getPersonnel(): ?TblPersonnel
  335.     {
  336.         return $this->personnel;
  337.     }
  338.     public function setPersonnel(?TblPersonnel $personnel): self
  339.     {
  340.         $this->personnel $personnel;
  341.         return $this;
  342.     }
  343. }