src/Entity/IctusCommande.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Repository\IctusCommandeRepository;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. /**
  8.  * @ORM\Entity(repositoryClass=IctusCommandeRepository::class)
  9.  */
  10. class IctusCommande
  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 $createdAt;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=true)
  24.      */
  25.     private $isReadyPov;
  26.     /**
  27.      * @ORM\Column(type="boolean", nullable=true)
  28.      */
  29.     private $isLivrer;
  30.     /**
  31.      * @ORM\Column(type="datetime", nullable=true)
  32.      */
  33.     private $dateReadyPov;
  34.     /**
  35.      * @ORM\Column(type="datetime", nullable=true)
  36.      */
  37.     private $dateLivraison;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=IctusEtatPaiement::class, inversedBy="ictusCommandes")
  40.      */
  41.     private $etatpaiement;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=IctusTypeLivraison::class, inversedBy="ictusCommandes")
  44.      */
  45.     private $typeLivraison;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity=IctusPharmacie::class, inversedBy="ictusCommandes")
  48.      */
  49.     private $pharmacie;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity=IctusTypePaiement::class, inversedBy="ictusCommandes")
  52.      */
  53.     private $typePaiement;
  54.     /**
  55.      * @ORM\Column(type="integer", nullable=true)
  56.      */
  57.     private $reference;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      */
  61.     private $stripeSessionId;
  62.     /**
  63.      * @ORM\OneToMany(targetEntity=IctusCommandeLine::class, mappedBy="commande", orphanRemoval=true)
  64.      */
  65.     private $ictusCommandeLines;
  66.     /**
  67.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="ictusCommandes")
  68.      */
  69.     private $user;
  70.     /**
  71.      * @ORM\OneToMany(targetEntity=IctusHistoriquePaiement::class, mappedBy="commande", orphanRemoval=true)
  72.      */
  73.     private $ictusHistoriquePaiements;
  74.     /**
  75.      * @ORM\Column(type="string", length=255, nullable=true)
  76.      */
  77.     private $token;
  78.     /**
  79.      * @ORM\Column(type="text", nullable=true)
  80.      */
  81.     private $tokenStrippe;
  82.     /**
  83.      * @ORM\Column(type="boolean", nullable=true)
  84.      */
  85.     private $isLivraisonValide;
  86.     /**
  87.      * @ORM\Column(type="boolean", nullable=true)
  88.      */
  89.     private $isValide;
  90.     /**
  91.      * @ORM\ManyToMany(targetEntity=Ordonnance::class, inversedBy="ictusCommandes")
  92.      */
  93.     private $Ordonnance;
  94.     /**
  95.      * @ORM\Column(type="string", length=255, nullable=true)
  96.      */
  97.     private $code;
  98.     /**
  99.      * @ORM\Column(type="string", length=255, nullable=true)
  100.      */
  101.     private $codeSecret;
  102.     /**
  103.      * @ORM\Column(type="text", nullable=true)
  104.      */
  105.     private $raisonAnnulation;
  106.     /**
  107.      * @ORM\ManyToOne(targetEntity=Tierpayant::class, inversedBy="ictusCommandes")
  108.      */
  109.     private $tierpayant;
  110.     /**
  111.      * @ORM\Column(type="string", length=255, nullable=true)
  112.      */
  113.     private $referenceClientTP;
  114.     /**
  115.      * @ORM\Column(type="string", length=255, nullable=true)
  116.      */
  117.     private $societename;
  118.     /**
  119.      * @ORM\OneToMany(targetEntity=IctusReclamation::class, mappedBy="commande")
  120.      */
  121.     private $ictusReclamations;
  122.     /*
  123.      * @ORM\ManyToOne(targetEntity=SocieteLivraison::class, inversedBy="ictusCommandes")
  124.      */
  125.     private $societeLivraison;
  126.     /**
  127.      * @ORM\Column(type="boolean")
  128.      */
  129.     private $isRecuperer;
  130.     /**
  131.      * @ORM\ManyToOne(targetEntity=Adresse::class, inversedBy="ictusCommandes")
  132.      */
  133.     private $adressePatient;
  134.     /**
  135.      * @ORM\Column(type="boolean", nullable=true)
  136.      */
  137.     private $isChanged;
  138.     /**
  139.      * @ORM\OneToMany(targetEntity=FacturePatient::class, mappedBy="commande")
  140.      */
  141.     private $facturePatients;
  142.     /**
  143.      * @ORM\Column(type="text", nullable=true)
  144.      */
  145.     private $commentaire;
  146.     /**
  147.      * @ORM\Column(type="boolean", nullable=true)
  148.      */
  149.     private $isAnnule;
  150.     public function __construct()
  151.     {
  152.         $this->ictusCommandeLines = new ArrayCollection();
  153.         $this->ictusHistoriquePaiements = new ArrayCollection();
  154.         $this->Ordonnance = new ArrayCollection();
  155.         $this->ictusReclamations = new ArrayCollection();
  156.         $this->facturePatients = new ArrayCollection();
  157.     }
  158.     public function getId(): ?int
  159.     {
  160.         return $this->id;
  161.     }
  162.     public function getCreatedAt(): ?\DateTimeInterface
  163.     {
  164.         return $this->createdAt;
  165.     }
  166.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  167.     {
  168.         $this->createdAt $createdAt;
  169.         return $this;
  170.     }
  171.     public function isIsReadyPov(): ?bool
  172.     {
  173.         return $this->isReadyPov;
  174.     }
  175.     public function setIsReadyPov(?bool $isReadyPov): self
  176.     {
  177.         $this->isReadyPov $isReadyPov;
  178.         return $this;
  179.     }
  180.     public function isIsLivrer(): ?bool
  181.     {
  182.         return $this->isLivrer;
  183.     }
  184.     public function setIsLivrer(?bool $isLivrer): self
  185.     {
  186.         $this->isLivrer $isLivrer;
  187.         return $this;
  188.     }
  189.     public function getDateReadyPov(): ?\DateTimeInterface
  190.     {
  191.         return $this->dateReadyPov;
  192.     }
  193.     public function setDateReadyPov(?\DateTimeInterface $dateReadyPov): self
  194.     {
  195.         $this->dateReadyPov $dateReadyPov;
  196.         return $this;
  197.     }
  198.     public function getDateLivraison(): ?\DateTimeInterface
  199.     {
  200.         return $this->dateLivraison;
  201.     }
  202.     public function setDateLivraison(?\DateTimeInterface $dateLivraison): self
  203.     {
  204.         $this->dateLivraison $dateLivraison;
  205.         return $this;
  206.     }
  207.     public function getEtatpaiement(): ?IctusEtatPaiement
  208.     {
  209.         return $this->etatpaiement;
  210.     }
  211.     public function setEtatpaiement(?IctusEtatPaiement $etatpaiement): self
  212.     {
  213.         $this->etatpaiement $etatpaiement;
  214.         return $this;
  215.     }
  216.     public function getTypeLivraison(): ?IctusTypeLivraison
  217.     {
  218.         return $this->typeLivraison;
  219.     }
  220.     public function setTypeLivraison(?IctusTypeLivraison $typeLivraison): self
  221.     {
  222.         $this->typeLivraison $typeLivraison;
  223.         return $this;
  224.     }
  225.     public function getPharmacie(): ?IctusPharmacie
  226.     {
  227.         return $this->pharmacie;
  228.     }
  229.     public function setPharmacie(?IctusPharmacie $pharmacie): self
  230.     {
  231.         $this->pharmacie $pharmacie;
  232.         return $this;
  233.     }
  234.     public function getTypePaiement(): ?IctusTypePaiement
  235.     {
  236.         return $this->typePaiement;
  237.     }
  238.     public function setTypePaiement(?IctusTypePaiement $typePaiement): self
  239.     {
  240.         $this->typePaiement $typePaiement;
  241.         return $this;
  242.     }
  243.     public function getReference(): ?string
  244.     {
  245.         return $this->reference;
  246.     }
  247.     public function setReference(string $reference): self
  248.     {
  249.         $this->reference $reference;
  250.         return $this;
  251.     }
  252.     public function getStripeSessionId(): ?string
  253.     {
  254.         return $this->stripeSessionId;
  255.     }
  256.     public function setStripeSessionId(?string $stripeSessionId): self
  257.     {
  258.         $this->stripeSessionId $stripeSessionId;
  259.         return $this;
  260.     }
  261.     /**
  262.      * @return Collection<int, IctusCommandeLine>
  263.      */
  264.     public function getIctusCommandeLines(): Collection
  265.     {
  266.         return $this->ictusCommandeLines;
  267.     }
  268.     public function addIctusCommandeLine(IctusCommandeLine $ictusCommandeLine): self
  269.     {
  270.         if (!$this->ictusCommandeLines->contains($ictusCommandeLine)) {
  271.             $this->ictusCommandeLines[] = $ictusCommandeLine;
  272.             $ictusCommandeLine->setCommande($this);
  273.         }
  274.         return $this;
  275.     }
  276.     public function removeIctusCommandeLine(IctusCommandeLine $ictusCommandeLine): self
  277.     {
  278.         if ($this->ictusCommandeLines->removeElement($ictusCommandeLine)) {
  279.             // set the owning side to null (unless already changed)
  280.             if ($ictusCommandeLine->getCommande() === $this) {
  281.                 $ictusCommandeLine->setCommande(null);
  282.             }
  283.         }
  284.         return $this;
  285.     }
  286.     public function getUser(): ?User
  287.     {
  288.         return $this->user;
  289.     }
  290.     public function setUser(?User $user): self
  291.     {
  292.         $this->user $user;
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return Collection<int, IctusHistoriquePaiement>
  297.      */
  298.     public function getIctusHistoriquePaiements(): Collection
  299.     {
  300.         return $this->ictusHistoriquePaiements;
  301.     }
  302.     public function addIctusHistoriquePaiement(IctusHistoriquePaiement $ictusHistoriquePaiement): self
  303.     {
  304.         if (!$this->ictusHistoriquePaiements->contains($ictusHistoriquePaiement)) {
  305.             $this->ictusHistoriquePaiements[] = $ictusHistoriquePaiement;
  306.             $ictusHistoriquePaiement->setCommande($this);
  307.         }
  308.         return $this;
  309.     }
  310.     public function removeIctusHistoriquePaiement(IctusHistoriquePaiement $ictusHistoriquePaiement): self
  311.     {
  312.         if ($this->ictusHistoriquePaiements->removeElement($ictusHistoriquePaiement)) {
  313.             // set the owning side to null (unless already changed)
  314.             if ($ictusHistoriquePaiement->getCommande() === $this) {
  315.                 $ictusHistoriquePaiement->setCommande(null);
  316.             }
  317.         }
  318.         return $this;
  319.     }
  320.     public function getTotalProduit()
  321.     {
  322.         return count($this->getIctusCommandeLines());
  323.     }
  324.     public function getTotalCommande()
  325.     {
  326.         $total 0;
  327.         foreach ($this->getIctusCommandeLines() as $commendeLine) {
  328.             if ($this->isIsValide() == 1) {
  329.                 if ($commendeLine->isIsValide() == && $commendeLine->getChanged() == null) {
  330.                     $total += ($commendeLine->getQuantite() * $commendeLine->getPrixunitaire());
  331.                 }
  332.             } else {
  333.                 if ($commendeLine->getChanged() == null) {
  334.                     $total += ($commendeLine->getQuantite() * $commendeLine->getPrixunitaire());
  335.                 }
  336.             }
  337.         }
  338.         return $total;
  339.     }
  340.     public function getTotalPaiement()
  341.     {
  342.         $total 0;
  343.         foreach ($this->getIctusHistoriquePaiements() as $historique) {
  344.             $total += $historique->getMontant();
  345.         }
  346.         return $total;
  347.     }
  348.     public function getToken(): ?string
  349.     {
  350.         return $this->token;
  351.     }
  352.     public function setToken(?string $token): self
  353.     {
  354.         $this->token $token;
  355.         return $this;
  356.     }
  357.     public function getTokenStrippe(): ?string
  358.     {
  359.         return $this->tokenStrippe;
  360.     }
  361.     public function setTokenStrippe(?string $tokenStrippe): self
  362.     {
  363.         $this->tokenStrippe $tokenStrippe;
  364.         return $this;
  365.     }
  366.     public function isIsLivraisonValide(): ?bool
  367.     {
  368.         return $this->isLivraisonValide;
  369.     }
  370.     public function setIsLivraisonValide(?bool $isLivraisonValide): self
  371.     {
  372.         $this->isLivraisonValide $isLivraisonValide;
  373.         return $this;
  374.     }
  375.     public function isIsValide(): ?bool
  376.     {
  377.         return $this->isValide;
  378.     }
  379.     public function setIsValide(?bool $isValide): self
  380.     {
  381.         $this->isValide $isValide;
  382.         return $this;
  383.     }
  384.     /**
  385.      * @return Collection<int, Ordonnance>
  386.      */
  387.     public function getOrdonnance(): Collection
  388.     {
  389.         return $this->Ordonnance;
  390.     }
  391.     public function addOrdonnance(Ordonnance $ordonnance): self
  392.     {
  393.         if (!$this->Ordonnance->contains($ordonnance)) {
  394.             $this->Ordonnance[] = $ordonnance;
  395.         }
  396.         return $this;
  397.     }
  398.     public function removeOrdonnance(Ordonnance $ordonnance): self
  399.     {
  400.         $this->Ordonnance->removeElement($ordonnance);
  401.         return $this;
  402.     }
  403.     /**
  404.      * Get the value of raisonAnnulation
  405.      */
  406.     public function getRaisonAnnulation()
  407.     {
  408.         return $this->raisonAnnulation;
  409.     }
  410.     /**
  411.      * Set the value of raisonAnnulation
  412.      *
  413.      * @return  self
  414.      */
  415.     public function setRaisonAnnulation($raisonAnnulation)
  416.     {
  417.         $this->raisonAnnulation $raisonAnnulation;
  418.         return $this;
  419.     }
  420.     public function getCode(): ?string
  421.     {
  422.         return $this->code;
  423.     }
  424.     public function setCode(?string $code): self
  425.     {
  426.         $this->code $code;
  427.         return $this;
  428.     }
  429.     public function getCodeSecret(): ?string
  430.     {
  431.         return $this->codeSecret;
  432.     }
  433.     public function setCodeSecret(?string $codeSecret): self
  434.     {
  435.         $this->codeSecret $codeSecret;
  436.         return $this;
  437.     }
  438.     public function getTierpayant(): ?Tierpayant
  439.     {
  440.         return $this->tierpayant;
  441.     }
  442.     public function setTierpayant(?Tierpayant $tierpayant): self
  443.     {
  444.         $this->tierpayant $tierpayant;
  445.         return $this;
  446.     }
  447.     public function getReferenceClientTP(): ?string
  448.     {
  449.         return $this->referenceClientTP;
  450.     }
  451.     public function setReferenceClientTP(?string $referenceClientTP): self
  452.     {
  453.         $this->referenceClientTP $referenceClientTP;
  454.         return $this;
  455.     }
  456.     public function getSocietename(): ?string
  457.     {
  458.         return $this->societename;
  459.     }
  460.     public function setSocietename(?string $societename): self
  461.     {
  462.         $this->societename $societename;
  463.         return $this;
  464.     }
  465.     /**
  466.      * @return Collection<int, IctusReclamation>
  467.      */
  468.     public function getIctusReclamations(): Collection
  469.     {
  470.         return $this->ictusReclamations;
  471.     }
  472.     public function addIctusReclamation(IctusReclamation $ictusReclamation): self
  473.     {
  474.         if (!$this->ictusReclamations->contains($ictusReclamation)) {
  475.             $this->ictusReclamations[] = $ictusReclamation;
  476.             $ictusReclamation->setCommande($this);
  477.         }
  478.         return $this;
  479.     }
  480.     public function getSocieteLivraison(): ?SocieteLivraison
  481.     {
  482.         return $this->societeLivraison;
  483.     }
  484.     public function setSocieteLivraison(?SocieteLivraison $societeLivraison): self
  485.     {
  486.         $this->societeLivraison $societeLivraison;
  487.         return $this;
  488.     }
  489.     public function removeIctusReclamation(IctusReclamation $ictusReclamation): self
  490.     {
  491.         if ($this->ictusReclamations->removeElement($ictusReclamation)) {
  492.             // set the owning side to null (unless already changed)
  493.             if ($ictusReclamation->getCommande() === $this) {
  494.                 $ictusReclamation->setCommande(null);
  495.             }
  496.         }
  497.         return $this;
  498.     }
  499.     public function isIsRecuperer(): ?bool
  500.     {
  501.         return $this->isRecuperer;
  502.     }
  503.     public function setIsRecuperer(bool $isRecuperer): self
  504.     {
  505.         $this->isRecuperer $isRecuperer;
  506.         return $this;
  507.     }
  508.     public function getAdressePatient(): ?Adresse
  509.     {
  510.         return $this->adressePatient;
  511.     }
  512.     public function setAdressePatient(?Adresse $adressePatient): self
  513.     {
  514.         $this->adressePatient $adressePatient;
  515.         return $this;
  516.     }
  517.     public function isIsChanged(): ?bool
  518.     {
  519.         return $this->isChanged;
  520.     }
  521.     public function setIsChanged(?bool $isChanged): self
  522.     {
  523.         $this->isChanged $isChanged;
  524.         return $this;
  525.     }
  526.     /**
  527.      * @return Collection<int, FacturePatient>
  528.      */
  529.     public function getFacturePatients(): Collection
  530.     {
  531.         return $this->facturePatients;
  532.     }
  533.     public function addFacturePatient(FacturePatient $facturePatient): self
  534.     {
  535.         if (!$this->facturePatients->contains($facturePatient)) {
  536.             $this->facturePatients[] = $facturePatient;
  537.             $facturePatient->setCommande($this);
  538.         }
  539.         return $this;
  540.     }
  541.     public function removeFacturePatient(FacturePatient $facturePatient): self
  542.     {
  543.         if ($this->facturePatients->removeElement($facturePatient)) {
  544.             // set the owning side to null (unless already changed)
  545.             if ($facturePatient->getCommande() === $this) {
  546.                 $facturePatient->setCommande(null);
  547.             }
  548.         }
  549.         return $this;
  550.     }
  551.     public function getCommentaire(): ?string
  552.     {
  553.         return $this->commentaire;
  554.     }
  555.     public function setCommentaire(?string $commentaire): self
  556.     {
  557.         $this->commentaire $commentaire;
  558.         return $this;
  559.     }
  560.     public function isIsAnnule(): ?bool
  561.     {
  562.         return $this->isAnnule;
  563.     }
  564.     public function setIsAnnule(?bool $isAnnule): self
  565.     {
  566.         $this->isAnnule $isAnnule;
  567.         return $this;
  568.     }
  569. }