src/Entity/FacturePharmacie.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FacturePharmacieRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=FacturePharmacieRepository::class)
  9.  */
  10. class FacturePharmacie
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $reference;
  22.     /**
  23.      * @ORM\Column(type="datetime")
  24.      */
  25.     private $createdat;
  26.     /**
  27.      * @ORM\Column(type="boolean", nullable=true)
  28.      */
  29.     private $isDownloadedFinance;
  30.     /**
  31.      * @ORM\Column(type="boolean", nullable=true)
  32.      */
  33.     private $isDownloadedPharmacie;
  34.     /**
  35.      * @ORM\Column(type="boolean", nullable=true)
  36.      */
  37.     private $isDownloadedLogistic;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=DetailFacturePharmacie::class, mappedBy="facture", orphanRemoval=true)
  40.      */
  41.     private $detailFacturePharmacies;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=IctusEtatPaiement::class, inversedBy="facturePharmacies")
  44.      * @ORM\JoinColumn(nullable=false)
  45.      */
  46.     private $etatPaiement;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=Typepaiement::class, inversedBy="facturePharmacies")
  49.      */
  50.     private $typePaiement;
  51.     /**
  52.      * @ORM\OneToOne(targetEntity=IctoMouvement::class, mappedBy="facture", cascade={"persist", "remove"})
  53.      */
  54.     private $ictoMouvement;
  55.     /**
  56.      * @ORM\OneToMany(targetEntity=FactPcieHistoriquePaiement::class, mappedBy="facture", orphanRemoval=true)
  57.      */
  58.     private $factPcieHistoriquePaiements;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=IctusPharmacie::class, inversedBy="facturePharmacies")
  61.      * @ORM\JoinColumn(nullable=false)
  62.      */
  63.     private $pharmacie;
  64.     /**
  65.      * @ORM\OneToMany(targetEntity=IctoMouvement::class, mappedBy="facture")
  66.      */
  67.     private $ictoMouvements;
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity=TypeFacture::class, inversedBy="facturePharmacies")
  70.      * @ORM\JoinColumn(nullable=false)
  71.      */
  72.     private $typeFacture;
  73.     public function __construct()
  74.     {
  75.         $this->detailFacturePharmacies = new ArrayCollection();
  76.         $this->factPcieHistoriquePaiements = new ArrayCollection();
  77.         $this->ictoMouvements = new ArrayCollection();
  78.     }
  79.     public function getId(): ?int
  80.     {
  81.         return $this->id;
  82.     }
  83.     public function getReference(): ?int
  84.     {
  85.         return $this->reference;
  86.     }
  87.     public function setReference(int $reference): self
  88.     {
  89.         $this->reference $reference;
  90.         return $this;
  91.     }
  92.     public function getCreatedat(): ?\DateTimeInterface
  93.     {
  94.         return $this->createdat;
  95.     }
  96.     public function setCreatedat(\DateTimeInterface $createdat): self
  97.     {
  98.         $this->createdat $createdat;
  99.         return $this;
  100.     }
  101.     public function isIsDownloadedFinance(): ?bool
  102.     {
  103.         return $this->isDownloadedFinance;
  104.     }
  105.     public function setIsDownloadedFinance(?bool $isDownloadedFinance): self
  106.     {
  107.         $this->isDownloadedFinance $isDownloadedFinance;
  108.         return $this;
  109.     }
  110.     public function isIsDownloadedPharmacie(): ?bool
  111.     {
  112.         return $this->isDownloadedPharmacie;
  113.     }
  114.     public function setIsDownloadedPharmacie(?bool $isDownloadedPharmacie): self
  115.     {
  116.         $this->isDownloadedPharmacie $isDownloadedPharmacie;
  117.         return $this;
  118.     }
  119.     public function isIsDownloadedLogistic(): ?bool
  120.     {
  121.         return $this->isDownloadedLogistic;
  122.     }
  123.     public function setIsDownloadedLogistic(?bool $isDownloadedLogistic): self
  124.     {
  125.         $this->isDownloadedLogistic $isDownloadedLogistic;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, DetailFacturePharmacie>
  130.      */
  131.     public function getDetailFacturePharmacies(): Collection
  132.     {
  133.         return $this->detailFacturePharmacies;
  134.     }
  135.     public function addDetailFacturePharmacy(DetailFacturePharmacie $detailFacturePharmacy): self
  136.     {
  137.         if (!$this->detailFacturePharmacies->contains($detailFacturePharmacy)) {
  138.             $this->detailFacturePharmacies[] = $detailFacturePharmacy;
  139.             $detailFacturePharmacy->setFacture($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeDetailFacturePharmacy(DetailFacturePharmacie $detailFacturePharmacy): self
  144.     {
  145.         if ($this->detailFacturePharmacies->removeElement($detailFacturePharmacy)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($detailFacturePharmacy->getFacture() === $this) {
  148.                 $detailFacturePharmacy->setFacture(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153.     public function getEtatPaiement(): ?IctusEtatPaiement
  154.     {
  155.         return $this->etatPaiement;
  156.     }
  157.     public function setEtatPaiement(?IctusEtatPaiement $etatPaiement): self
  158.     {
  159.         $this->etatPaiement $etatPaiement;
  160.         return $this;
  161.     }
  162.     public function getTypePaiement(): ?Typepaiement
  163.     {
  164.         return $this->typePaiement;
  165.     }
  166.     public function setTypePaiement(?Typepaiement $typePaiement): self
  167.     {
  168.         $this->typePaiement $typePaiement;
  169.         return $this;
  170.     }
  171.     public function getIctoMouvement(): ?IctoMouvement
  172.     {
  173.         return $this->ictoMouvement;
  174.     }
  175.     public function setIctoMouvement(?IctoMouvement $ictoMouvement): self
  176.     {
  177.         // unset the owning side of the relation if necessary
  178.         if ($ictoMouvement === null && $this->ictoMouvement !== null) {
  179.             $this->ictoMouvement->setFacture(null);
  180.         }
  181.         // set the owning side of the relation if necessary
  182.         if ($ictoMouvement !== null && $ictoMouvement->getFacture() !== $this) {
  183.             $ictoMouvement->setFacture($this);
  184.         }
  185.         $this->ictoMouvement $ictoMouvement;
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, FactPcieHistoriquePaiement>
  190.      */
  191.     public function getFactPcieHistoriquePaiements(): Collection
  192.     {
  193.         return $this->factPcieHistoriquePaiements;
  194.     }
  195.     public function addFactPcieHistoriquePaiement(FactPcieHistoriquePaiement $factPcieHistoriquePaiement): self
  196.     {
  197.         if (!$this->factPcieHistoriquePaiements->contains($factPcieHistoriquePaiement)) {
  198.             $this->factPcieHistoriquePaiements[] = $factPcieHistoriquePaiement;
  199.             $factPcieHistoriquePaiement->setFacture($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeFactPcieHistoriquePaiement(FactPcieHistoriquePaiement $factPcieHistoriquePaiement): self
  204.     {
  205.         if ($this->factPcieHistoriquePaiements->removeElement($factPcieHistoriquePaiement)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($factPcieHistoriquePaiement->getFacture() === $this) {
  208.                 $factPcieHistoriquePaiement->setFacture(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213.     public function getPharmacie(): ?IctusPharmacie
  214.     {
  215.         return $this->pharmacie;
  216.     }
  217.     public function setPharmacie(?IctusPharmacie $pharmacie): self
  218.     {
  219.         $this->pharmacie $pharmacie;
  220.         return $this;
  221.     }
  222.     public function getMontantTotal()
  223.     {
  224.         $details $this->getDetailFacturePharmacies();
  225.         $montant 0;
  226.         foreach ($details as $detail) {
  227.             $montant += $detail->getQuantite() * $detail->getPuttc();
  228.         }
  229.         return $montant;
  230.     }
  231.     /**
  232.      * @return Collection<int, IctoMouvement>
  233.      */
  234.     public function getIctoMouvements(): Collection
  235.     {
  236.         return $this->ictoMouvements;
  237.     }
  238.     public function addIctoMouvement(IctoMouvement $ictoMouvement): self
  239.     {
  240.         if (!$this->ictoMouvements->contains($ictoMouvement)) {
  241.             $this->ictoMouvements[] = $ictoMouvement;
  242.             $ictoMouvement->setFacture($this);
  243.         }
  244.         return $this;
  245.     }
  246.     public function removeIctoMouvement(IctoMouvement $ictoMouvement): self
  247.     {
  248.         if ($this->ictoMouvements->removeElement($ictoMouvement)) {
  249.             // set the owning side to null (unless already changed)
  250.             if ($ictoMouvement->getFacture() === $this) {
  251.                 $ictoMouvement->setFacture(null);
  252.             }
  253.         }
  254.         return $this;
  255.     }
  256.     public function getTypeFacture(): ?TypeFacture
  257.     {
  258.         return $this->typeFacture;
  259.     }
  260.     public function setTypeFacture(?TypeFacture $typeFacture): self
  261.     {
  262.         $this->typeFacture $typeFacture;
  263.         return $this;
  264.     }
  265. }