src/Entity/FacturePatient.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\Collection;
  5. use App\Repository\FacturePatientRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=FacturePatientRepository::class)
  9.  */
  10. class FacturePatient
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="datetime")
  20.      */
  21.     private $date;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=true)
  24.      */
  25.     private $isPayer;
  26.     /**
  27.      * @ORM\Column(type="boolean", nullable=true)
  28.      */
  29.     private $isLivrer;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=TypeFacture::class, inversedBy="facturePatients")
  32.      * @ORM\JoinColumn(nullable=false)
  33.      */
  34.     private $typefacture;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity=IctusPharmacie::class, inversedBy="facturePatients")
  37.      * @ORM\JoinColumn(nullable=false)
  38.      */
  39.     private $pharmacie;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="facturePatients")
  42.      * @ORM\JoinColumn(nullable=false)
  43.      */
  44.     private $User;
  45.     /**
  46.      * @ORM\OneToOne(targetEntity=CommandeSpecial::class, inversedBy="facturePatient", cascade={"persist", "remove"})
  47.      */
  48.     private $commandespecial;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=DetailFacturePatient::class, mappedBy="facturePatient", orphanRemoval=true)
  51.      */
  52.     private $detailFacturePatients;
  53.     /**
  54.      * @ORM\Column(type="integer")
  55.      */
  56.     private $reference;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=IctusCommande::class, inversedBy="facturePatients")
  59.      */
  60.     private $commande;
  61.     /**
  62.      * @ORM\Column(type="boolean", nullable=true)
  63.      */
  64.     private $isCanceled;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=IctusReclamation::class, mappedBy="facture")
  67.      */
  68.     private $ictusReclamations;
  69.     /**
  70.      * @ORM\Column(type="float", nullable=true)
  71.      */
  72.     private $remise;
  73.     public function __construct()
  74.     {
  75.         $this->detailFacturePatients = new ArrayCollection();
  76.         $this->ictusReclamations = new ArrayCollection();
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getDate(): ?\DateTimeInterface
  83.     {
  84.         return $this->date;
  85.     }
  86.     public function setDate(\DateTimeInterface $date): self
  87.     {
  88.         $this->date $date;
  89.         return $this;
  90.     }
  91.     public function isIsPayer(): ?bool
  92.     {
  93.         return $this->isPayer;
  94.     }
  95.     public function setIsPayer(?bool $isPayer): self
  96.     {
  97.         $this->isPayer $isPayer;
  98.         return $this;
  99.     }
  100.     public function isIsLivrer(): ?bool
  101.     {
  102.         return $this->isLivrer;
  103.     }
  104.     public function setIsLivrer(?bool $isLivrer): self
  105.     {
  106.         $this->isLivrer $isLivrer;
  107.         return $this;
  108.     }
  109.     public function getTypefacture(): ?TypeFacture
  110.     {
  111.         return $this->typefacture;
  112.     }
  113.     public function setTypefacture(?TypeFacture $typefacture): self
  114.     {
  115.         $this->typefacture $typefacture;
  116.         return $this;
  117.     }
  118.     public function getPharmacie(): ?IctusPharmacie
  119.     {
  120.         return $this->pharmacie;
  121.     }
  122.     public function setPharmacie(?IctusPharmacie $pharmacie): self
  123.     {
  124.         $this->pharmacie $pharmacie;
  125.         return $this;
  126.     }
  127.     public function getUser(): ?User
  128.     {
  129.         return $this->User;
  130.     }
  131.     public function setUser(?User $User): self
  132.     {
  133.         $this->User $User;
  134.         return $this;
  135.     }
  136.     public function getCommandespecial(): ?CommandeSpecial
  137.     {
  138.         return $this->commandespecial;
  139.     }
  140.     public function setCommandespecial(?CommandeSpecial $commandespecial): self
  141.     {
  142.         $this->commandespecial $commandespecial;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, DetailFacturePatient>
  147.      */
  148.     public function getDetailFacturePatients(): Collection
  149.     {
  150.         return $this->detailFacturePatients;
  151.     }
  152.     public function addDetailFacturePatient(DetailFacturePatient $detailFacturePatient): self
  153.     {
  154.         if (!$this->detailFacturePatients->contains($detailFacturePatient)) {
  155.             $this->detailFacturePatients[] = $detailFacturePatient;
  156.             $detailFacturePatient->setFacturePatient($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeDetailFacturePatient(DetailFacturePatient $detailFacturePatient): self
  161.     {
  162.         if ($this->detailFacturePatients->removeElement($detailFacturePatient)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($detailFacturePatient->getFacturePatient() === $this) {
  165.                 $detailFacturePatient->setFacturePatient(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     public function getMontantTotal()
  171.     {
  172.         $total 0;
  173.         foreach ($this->detailFacturePatients as $detail) {
  174.             $total += $detail->getPrixUnitaireTTC() * $detail->getQuantite();
  175.         }
  176.         return $total $this->typefacture->getValue();
  177.     }
  178.     public function getReference(): ?int
  179.     {
  180.         return $this->reference;
  181.     }
  182.     public function getStringReference(): ?string
  183.     {
  184.         return "ICTFACT_".$this->getPharmacie()->getId()."_".$this->getReference();
  185.     }
  186.     public function setReference(int $reference): self
  187.     {
  188.         $this->reference $reference;
  189.         return $this;
  190.     }
  191.     public function getCommande(): ?IctusCommande
  192.     {
  193.         return $this->commande;
  194.     }
  195.     public function setCommande(?IctusCommande $commande): self
  196.     {
  197.         $this->commande $commande;
  198.         return $this;
  199.     }
  200.     public function isIsCanceled(): ?bool
  201.     {
  202.         return $this->isCanceled;
  203.     }
  204.     public function setIsCanceled(?bool $isCanceled): self
  205.     {
  206.         $this->isCanceled $isCanceled;
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return Collection<int, IctusReclamation>
  211.      */
  212.     public function getIctusReclamations(): Collection
  213.     {
  214.         return $this->ictusReclamations;
  215.     }
  216.     public function addIctusReclamation(IctusReclamation $ictusReclamation): self
  217.     {
  218.         if (!$this->ictusReclamations->contains($ictusReclamation)) {
  219.             $this->ictusReclamations[] = $ictusReclamation;
  220.             $ictusReclamation->setFacture($this);
  221.         }
  222.         return $this;
  223.     }
  224.     public function removeIctusReclamation(IctusReclamation $ictusReclamation): self
  225.     {
  226.         if ($this->ictusReclamations->removeElement($ictusReclamation)) {
  227.             // set the owning side to null (unless already changed)
  228.             if ($ictusReclamation->getFacture() === $this) {
  229.                 $ictusReclamation->setFacture(null);
  230.             }
  231.         }
  232.         return $this;
  233.     }
  234.     public function getRemise(): ?float
  235.     {
  236.         return $this->remise;
  237.     }
  238.     public function setRemise(?float $remise): self
  239.     {
  240.         $this->remise $remise;
  241.         return $this;
  242.     }
  243. }