src/Entity/TmpReception.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TmpReceptionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TmpReceptionRepository::class)
  9.  */
  10. class TmpReception
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=15)
  20.      */
  21.     private $volume;
  22.     /**
  23.      * @ORM\Column(type="string", length=15)
  24.      */
  25.     private $tonne;
  26.     /**
  27.      * @ORM\Column(type="boolean")
  28.      */
  29.     private $isflag;
  30.     /**
  31.      * @ORM\Column(type="string", length=10)
  32.      */
  33.     private $unite;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $nature;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      */
  41.     private $classementdepot;
  42.     /**
  43.      * @ORM\Column(type="string", length=10)
  44.      */
  45.     private $quantite;
  46.     /**
  47.      * @ORM\Column(type="string", length=100)
  48.      */
  49.     private $flutterid;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=Reception::class, inversedBy="tmpReceptions", cascade={"persist", "remove"})
  52.      */
  53.     private $reception;
  54.     /**
  55.      * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="tmpReceptions")
  56.      */
  57.     private $user;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity=CategoriePrix::class, inversedBy="tmpReceptions")
  60.      * @ORM\JoinColumn(nullable=true)
  61.      */
  62.     private $categoriePrix;
  63.     /**
  64.      * Prix forfaitaire manuel (si la valeur n'est pas dans CategoriePrix)
  65.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  66.      */
  67.     private $prixFixe;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=TmpConteneurReception::class, mappedBy="tmpReception")
  70.      */
  71.     private $tmpConteneurReceptions;
  72.     /**
  73.      * @ORM\OneToMany(targetEntity=PaiementReception::class, mappedBy="tmpReception")
  74.      */
  75.     private $paiementReceptions;
  76.     private $totalLoaded;
  77.     public function __construct()
  78.     {
  79.         $this->tmpConteneurReceptions = new ArrayCollection();
  80.         $this->paiementReceptions = new ArrayCollection();
  81.     }
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     /**
  87.      * Obtenir le montant total déjà payé pour cet article
  88.      */
  89.     public function getTotalPaye(): float
  90.     {
  91.         $total = 0.0;
  92.         foreach ($this->paiementReceptions as $paiement) {
  93.             $total += (float) $paiement->getMontantPaye();
  94.         }
  95.         return $total;
  96.     }
  97.     public function getPrixFixe(): ?string
  98.     {
  99.         return $this->prixFixe;
  100.     }
  101.     public function setPrixFixe(?string $prixFixe): self
  102.     {
  103.         $this->prixFixe = $prixFixe;
  104.         return $this;
  105.     }
  106.     /**
  107.      * Méthode utilitaire pour obtenir le tarif appliqué (Forfait ou Catégorie)
  108.      */
  109.     public function getTarifApplique(): float
  110.     {
  111.         if ($this->prixFixe !== null) {
  112.             return (float) $this->prixFixe;
  113.         }
  114.         if ($this->categoriePrix !== null) {
  115.             return (float) $this->categoriePrix->getPrix(); // Adaptez getPrix() selon votre entité CategoriePrix
  116.         }
  117.         return 0.0;
  118.     }
  119.     public function getNature(): ?string
  120.     {
  121.         return strtoupper($this->nature);
  122.     }
  123.     public function setNature(string $nature): self
  124.     {
  125.         $this->nature = $nature;
  126.         return $this;
  127.     }
  128.     public function getFlutterid(): ?string
  129.     {
  130.         return $this->flutterid;
  131.     }
  132.     public function setFlutterid(string $flutterid): self
  133.     {
  134.         $this->flutterid = $flutterid;
  135.         return $this;
  136.     }
  137.     public function getQuantite(): ?string
  138.     {
  139.         return $this->quantite;
  140.     }
  141.     public function setQuantite(string $quantite): self
  142.     {
  143.         $this->quantite = $quantite;
  144.         return $this;
  145.     }
  146.     public function getVolume(): ?string
  147.     {
  148.         return $this->volume;
  149.     }
  150.     public function setVolume(string $volume): self
  151.     {
  152.         $this->volume = $volume;
  153.         return $this;
  154.     }
  155.     public function getTonne(): ?string
  156.     {
  157.         return $this->tonne;
  158.     }
  159.     public function setTonne(string $tonne): self
  160.     {
  161.         $this->tonne = $tonne;
  162.         return $this;
  163.     }
  164.     public function isIsflag(): ?bool
  165.     {
  166.         return $this->isflag;
  167.     }
  168.     public function setIsflag(bool $isflag): self
  169.     {
  170.         $this->isflag = $isflag;
  171.         return $this;
  172.     }
  173.     public function getUnite(): ?string
  174.     {
  175.         return $this->unite;
  176.     }
  177.     public function setUnite(string $unite): self
  178.     {
  179.         $this->unite = $unite;
  180.         return $this;
  181.     }
  182.     public function getReception(): ?Reception
  183.     {
  184.         return $this->reception;
  185.     }
  186.     public function setReception(?Reception $reception): self
  187.     {
  188.         $this->reception = $reception;
  189.         return $this;
  190.     }
  191.     public function getUser(): ?Utilisateur
  192.     {
  193.         return $this->user;
  194.     }
  195.     public function setUser(?Utilisateur $user): self
  196.     {
  197.         $this->user = $user;
  198.         return $this;
  199.     }
  200.     public function getCategoriePrix(): ?CategoriePrix
  201.     {
  202.         return $this->categoriePrix;
  203.     }
  204.     public function setCategoriePrix(?CategoriePrix $categoriePrix): self
  205.     {
  206.         $this->categoriePrix = $categoriePrix;
  207.         return $this;
  208.     }
  209.     public function getClassementdepot(): string
  210.     {
  211.         return $this->classementdepot;
  212.     }
  213.     public function setClassementdepot(string $classementdepot): self
  214.     {
  215.         $this->classementdepot = $classementdepot;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, TmpConteneurReception>
  220.      */
  221.     public function getTmpConteneurReceptions(): Collection
  222.     {
  223.         return $this->tmpConteneurReceptions;
  224.     }
  225.     public function addTmpConteneurReception(TmpConteneurReception $tmpConteneurReception): self
  226.     {
  227.         if (!$this->tmpConteneurReceptions->contains($tmpConteneurReception)) {
  228.             $this->tmpConteneurReceptions[] = $tmpConteneurReception;
  229.             $tmpConteneurReception->setTmpReception($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeTmpConteneurReception(TmpConteneurReception $tmpConteneurReception): self
  234.     {
  235.         if ($this->tmpConteneurReceptions->removeElement($tmpConteneurReception)) {
  236.             if ($tmpConteneurReception->getTmpReception() === $this) {
  237.                 $tmpConteneurReception->setTmpReception(null);
  238.             }
  239.         }
  240.         return $this;
  241.     }
  242.     public function getTotalLOADED()
  243.     {
  244.         $total = 0;
  245.         foreach($this->getTmpConteneurReceptions() as $v){
  246.             $total = $total + $v->getQuantite();
  247.         }
  248.         return $this->totalLoaded = $total;
  249.     }
  250.     /**
  251.      * @return Collection<int, PaiementReception>
  252.      */
  253.     public function getPaiementReceptions(): Collection
  254.     {
  255.         return $this->paiementReceptions;
  256.     }
  257.     public function addPaiementReception(PaiementReception $paiementReception): self
  258.     {
  259.         if (!$this->paiementReceptions->contains($paiementReception)) {
  260.             $this->paiementReceptions[] = $paiementReception;
  261.             $paiementReception->setTmpReception($this);
  262.         }
  263.         return $this;
  264.     }
  265.     public function removePaiementReception(PaiementReception $paiementReception): self
  266.     {
  267.         if ($this->paiementReceptions->removeElement($paiementReception)) {
  268.             if ($paiementReception->getTmpReception() === $this) {
  269.                 $paiementReception->setTmpReception(null);
  270.             }
  271.         }
  272.         return $this;
  273.     }
  274. }