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.     /**
  151.      * @ORM\Column(type="float", nullable=true)
  152.      */
  153.     private $remise;
  154.     /**
  155.      * @ORM\ManyToOne(targetEntity=Parrainage::class, inversedBy="ictusCommandes")
  156.      */
  157.     private $parrainage;
  158.     /**
  159.      * @ORM\OneToOne(targetEntity=PrisEnCharge::class, cascade={"persist", "remove"})
  160.      */
  161.     private $prisencharge;
  162.     /**
  163.      * @ORM\OneToOne(targetEntity=Parcours::class, mappedBy="ictusCommande", cascade={"persist", "remove"})
  164.      */
  165.     private $parcours;
  166.     public function __construct()
  167.     {
  168.         $this->ictusCommandeLines = new ArrayCollection();
  169.         $this->ictusHistoriquePaiements = new ArrayCollection();
  170.         $this->Ordonnance = new ArrayCollection();
  171.         $this->ictusReclamations = new ArrayCollection();
  172.         $this->facturePatients = new ArrayCollection();
  173.     }
  174.     public function getId(): ?int
  175.     {
  176.         return $this->id;
  177.     }
  178.     public function getCreatedAt(): ?\DateTimeInterface
  179.     {
  180.         return $this->createdAt;
  181.     }
  182.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  183.     {
  184.         $this->createdAt $createdAt;
  185.         return $this;
  186.     }
  187.     public function isIsReadyPov(): ?bool
  188.     {
  189.         return $this->isReadyPov;
  190.     }
  191.     public function setIsReadyPov(?bool $isReadyPov): self
  192.     {
  193.         $this->isReadyPov $isReadyPov;
  194.         return $this;
  195.     }
  196.     public function isIsLivrer(): ?bool
  197.     {
  198.         return $this->isLivrer;
  199.     }
  200.     public function setIsLivrer(?bool $isLivrer): self
  201.     {
  202.         $this->isLivrer $isLivrer;
  203.         return $this;
  204.     }
  205.     public function getDateReadyPov(): ?\DateTimeInterface
  206.     {
  207.         return $this->dateReadyPov;
  208.     }
  209.     public function setDateReadyPov(?\DateTimeInterface $dateReadyPov): self
  210.     {
  211.         $this->dateReadyPov $dateReadyPov;
  212.         return $this;
  213.     }
  214.     public function getDateLivraison(): ?\DateTimeInterface
  215.     {
  216.         return $this->dateLivraison;
  217.     }
  218.     public function setDateLivraison(?\DateTimeInterface $dateLivraison): self
  219.     {
  220.         $this->dateLivraison $dateLivraison;
  221.         return $this;
  222.     }
  223.     public function getEtatpaiement(): ?IctusEtatPaiement
  224.     {
  225.         return $this->etatpaiement;
  226.     }
  227.     public function setEtatpaiement(?IctusEtatPaiement $etatpaiement): self
  228.     {
  229.         $this->etatpaiement $etatpaiement;
  230.         return $this;
  231.     }
  232.     public function getTypeLivraison(): ?IctusTypeLivraison
  233.     {
  234.         return $this->typeLivraison;
  235.     }
  236.     public function setTypeLivraison(?IctusTypeLivraison $typeLivraison): self
  237.     {
  238.         $this->typeLivraison $typeLivraison;
  239.         return $this;
  240.     }
  241.     public function getPharmacie(): ?IctusPharmacie
  242.     {
  243.         return $this->pharmacie;
  244.     }
  245.     public function setPharmacie(?IctusPharmacie $pharmacie): self
  246.     {
  247.         $this->pharmacie $pharmacie;
  248.         return $this;
  249.     }
  250.     public function getTypePaiement(): ?IctusTypePaiement
  251.     {
  252.         return $this->typePaiement;
  253.     }
  254.     public function setTypePaiement(?IctusTypePaiement $typePaiement): self
  255.     {
  256.         $this->typePaiement $typePaiement;
  257.         return $this;
  258.     }
  259.     public function getReference(): ?string
  260.     {
  261.         return $this->reference;
  262.     }
  263.     public function setReference(string $reference): self
  264.     {
  265.         $this->reference $reference;
  266.         return $this;
  267.     }
  268.     public function getStripeSessionId(): ?string
  269.     {
  270.         return $this->stripeSessionId;
  271.     }
  272.     public function setStripeSessionId(?string $stripeSessionId): self
  273.     {
  274.         $this->stripeSessionId $stripeSessionId;
  275.         return $this;
  276.     }
  277.     /**
  278.      * @return Collection<int, IctusCommandeLine>
  279.      */
  280.     public function getIctusCommandeLines(): Collection
  281.     {
  282.         return $this->ictusCommandeLines;
  283.     }
  284.     public function addIctusCommandeLine(IctusCommandeLine $ictusCommandeLine): self
  285.     {
  286.         if (!$this->ictusCommandeLines->contains($ictusCommandeLine)) {
  287.             $this->ictusCommandeLines[] = $ictusCommandeLine;
  288.             $ictusCommandeLine->setCommande($this);
  289.         }
  290.         return $this;
  291.     }
  292.     public function removeIctusCommandeLine(IctusCommandeLine $ictusCommandeLine): self
  293.     {
  294.         if ($this->ictusCommandeLines->removeElement($ictusCommandeLine)) {
  295.             // set the owning side to null (unless already changed)
  296.             if ($ictusCommandeLine->getCommande() === $this) {
  297.                 $ictusCommandeLine->setCommande(null);
  298.             }
  299.         }
  300.         return $this;
  301.     }
  302.     public function getUser(): ?User
  303.     {
  304.         return $this->user;
  305.     }
  306.     public function setUser(?User $user): self
  307.     {
  308.         $this->user $user;
  309.         return $this;
  310.     }
  311.     /**
  312.      * @return Collection<int, IctusHistoriquePaiement>
  313.      */
  314.     public function getIctusHistoriquePaiements(): Collection
  315.     {
  316.         return $this->ictusHistoriquePaiements;
  317.     }
  318.     public function addIctusHistoriquePaiement(IctusHistoriquePaiement $ictusHistoriquePaiement): self
  319.     {
  320.         if (!$this->ictusHistoriquePaiements->contains($ictusHistoriquePaiement)) {
  321.             $this->ictusHistoriquePaiements[] = $ictusHistoriquePaiement;
  322.             $ictusHistoriquePaiement->setCommande($this);
  323.         }
  324.         return $this;
  325.     }
  326.     public function removeIctusHistoriquePaiement(IctusHistoriquePaiement $ictusHistoriquePaiement): self
  327.     {
  328.         if ($this->ictusHistoriquePaiements->removeElement($ictusHistoriquePaiement)) {
  329.             // set the owning side to null (unless already changed)
  330.             if ($ictusHistoriquePaiement->getCommande() === $this) {
  331.                 $ictusHistoriquePaiement->setCommande(null);
  332.             }
  333.         }
  334.         return $this;
  335.     }
  336.     public function getTotalProduit()
  337.     {
  338.         return count($this->getIctusCommandeLines());
  339.     }
  340.     public function getTotalCommande($afficheremise true)
  341.     {
  342.         $total 0;
  343.         foreach ($this->getIctusCommandeLines() as $commendeLine) {
  344.             if ($this->isIsValide() == 1) {
  345.                 if ($commendeLine->isIsValide() == && $commendeLine->getChanged() == null) {
  346.                     $pu $commendeLine->getPrixunitaire();
  347.                     if($this->getPrisencharge() != null){
  348.                         if($this->getPrisencharge()->getPrisencharge() != null && $commendeLine->isIsPrisencharge()){
  349.                             $pu $pu - ($pu $this->getPrisencharge()->getPrisencharge() / 100);
  350.                         }
  351.                     }
  352.                     $total += ($commendeLine->getQuantite() * $pu);
  353.                 }
  354.             } else {
  355.                 if ($commendeLine->getChanged() == null) {
  356.                     $total += ($commendeLine->getQuantite() * $commendeLine->getPrixunitaire());
  357.                 }
  358.             }
  359.         }
  360.         if ($this->getRemise() != null && $afficheremise == true) {
  361.             $total $total - ($total $this->getRemise()) / 100;
  362.         }
  363.         return $total;
  364.     }
  365.     public function getTotalPaiement()
  366.     {
  367.         $total 0;
  368.         foreach ($this->getIctusHistoriquePaiements() as $historique) {
  369.             $total += $historique->getMontant();
  370.         }
  371.         return $total;
  372.     }
  373.     public function getToken(): ?string
  374.     {
  375.         return $this->token;
  376.     }
  377.     public function setToken(?string $token): self
  378.     {
  379.         $this->token $token;
  380.         return $this;
  381.     }
  382.     public function getTokenStrippe(): ?string
  383.     {
  384.         return $this->tokenStrippe;
  385.     }
  386.     public function setTokenStrippe(?string $tokenStrippe): self
  387.     {
  388.         $this->tokenStrippe $tokenStrippe;
  389.         return $this;
  390.     }
  391.     public function isIsLivraisonValide(): ?bool
  392.     {
  393.         return $this->isLivraisonValide;
  394.     }
  395.     public function setIsLivraisonValide(?bool $isLivraisonValide): self
  396.     {
  397.         $this->isLivraisonValide $isLivraisonValide;
  398.         return $this;
  399.     }
  400.     public function isIsValide(): ?bool
  401.     {
  402.         return $this->isValide;
  403.     }
  404.     public function setIsValide(?bool $isValide): self
  405.     {
  406.         $this->isValide $isValide;
  407.         return $this;
  408.     }
  409.     /**
  410.      * @return Collection<int, Ordonnance>
  411.      */
  412.     public function getOrdonnance(): Collection
  413.     {
  414.         return $this->Ordonnance;
  415.     }
  416.     public function addOrdonnance(Ordonnance $ordonnance): self
  417.     {
  418.         if (!$this->Ordonnance->contains($ordonnance)) {
  419.             $this->Ordonnance[] = $ordonnance;
  420.         }
  421.         return $this;
  422.     }
  423.     public function removeOrdonnance(Ordonnance $ordonnance): self
  424.     {
  425.         $this->Ordonnance->removeElement($ordonnance);
  426.         return $this;
  427.     }
  428.     /**
  429.      * Get the value of raisonAnnulation
  430.      */
  431.     public function getRaisonAnnulation()
  432.     {
  433.         return $this->raisonAnnulation;
  434.     }
  435.     /**
  436.      * Set the value of raisonAnnulation
  437.      *
  438.      * @return  self
  439.      */
  440.     public function setRaisonAnnulation($raisonAnnulation)
  441.     {
  442.         $this->raisonAnnulation $raisonAnnulation;
  443.         return $this;
  444.     }
  445.     public function getCode(): ?string
  446.     {
  447.         return $this->code;
  448.     }
  449.     public function setCode(?string $code): self
  450.     {
  451.         $this->code $code;
  452.         return $this;
  453.     }
  454.     public function getCodeSecret(): ?string
  455.     {
  456.         return $this->codeSecret;
  457.     }
  458.     public function setCodeSecret(?string $codeSecret): self
  459.     {
  460.         $this->codeSecret $codeSecret;
  461.         return $this;
  462.     }
  463.     public function getTierpayant(): ?Tierpayant
  464.     {
  465.         return $this->tierpayant;
  466.     }
  467.     public function setTierpayant(?Tierpayant $tierpayant): self
  468.     {
  469.         $this->tierpayant $tierpayant;
  470.         return $this;
  471.     }
  472.     public function getReferenceClientTP(): ?string
  473.     {
  474.         return $this->referenceClientTP;
  475.     }
  476.     public function setReferenceClientTP(?string $referenceClientTP): self
  477.     {
  478.         $this->referenceClientTP $referenceClientTP;
  479.         return $this;
  480.     }
  481.     public function getSocietename(): ?string
  482.     {
  483.         return $this->societename;
  484.     }
  485.     public function setSocietename(?string $societename): self
  486.     {
  487.         $this->societename $societename;
  488.         return $this;
  489.     }
  490.     /**
  491.      * @return Collection<int, IctusReclamation>
  492.      */
  493.     public function getIctusReclamations(): Collection
  494.     {
  495.         return $this->ictusReclamations;
  496.     }
  497.     public function addIctusReclamation(IctusReclamation $ictusReclamation): self
  498.     {
  499.         if (!$this->ictusReclamations->contains($ictusReclamation)) {
  500.             $this->ictusReclamations[] = $ictusReclamation;
  501.             $ictusReclamation->setCommande($this);
  502.         }
  503.         return $this;
  504.     }
  505.     public function getSocieteLivraison(): ?SocieteLivraison
  506.     {
  507.         return $this->societeLivraison;
  508.     }
  509.     public function setSocieteLivraison(?SocieteLivraison $societeLivraison): self
  510.     {
  511.         $this->societeLivraison $societeLivraison;
  512.         return $this;
  513.     }
  514.     public function removeIctusReclamation(IctusReclamation $ictusReclamation): self
  515.     {
  516.         if ($this->ictusReclamations->removeElement($ictusReclamation)) {
  517.             // set the owning side to null (unless already changed)
  518.             if ($ictusReclamation->getCommande() === $this) {
  519.                 $ictusReclamation->setCommande(null);
  520.             }
  521.         }
  522.         return $this;
  523.     }
  524.     public function isIsRecuperer(): ?bool
  525.     {
  526.         return $this->isRecuperer;
  527.     }
  528.     public function setIsRecuperer(bool $isRecuperer): self
  529.     {
  530.         $this->isRecuperer $isRecuperer;
  531.         return $this;
  532.     }
  533.     public function getAdressePatient(): ?Adresse
  534.     {
  535.         return $this->adressePatient;
  536.     }
  537.     public function setAdressePatient(?Adresse $adressePatient): self
  538.     {
  539.         $this->adressePatient $adressePatient;
  540.         return $this;
  541.     }
  542.     public function isIsChanged(): ?bool
  543.     {
  544.         return $this->isChanged;
  545.     }
  546.     public function setIsChanged(?bool $isChanged): self
  547.     {
  548.         $this->isChanged $isChanged;
  549.         return $this;
  550.     }
  551.     /**
  552.      * @return Collection<int, FacturePatient>
  553.      */
  554.     public function getFacturePatients(): Collection
  555.     {
  556.         return $this->facturePatients;
  557.     }
  558.     public function addFacturePatient(FacturePatient $facturePatient): self
  559.     {
  560.         if (!$this->facturePatients->contains($facturePatient)) {
  561.             $this->facturePatients[] = $facturePatient;
  562.             $facturePatient->setCommande($this);
  563.         }
  564.         return $this;
  565.     }
  566.     public function removeFacturePatient(FacturePatient $facturePatient): self
  567.     {
  568.         if ($this->facturePatients->removeElement($facturePatient)) {
  569.             // set the owning side to null (unless already changed)
  570.             if ($facturePatient->getCommande() === $this) {
  571.                 $facturePatient->setCommande(null);
  572.             }
  573.         }
  574.         return $this;
  575.     }
  576.     public function getCommentaire(): ?string
  577.     {
  578.         return $this->commentaire;
  579.     }
  580.     public function setCommentaire(?string $commentaire): self
  581.     {
  582.         $this->commentaire $commentaire;
  583.         return $this;
  584.     }
  585.     public function isIsAnnule(): ?bool
  586.     {
  587.         return $this->isAnnule;
  588.     }
  589.     public function setIsAnnule(?bool $isAnnule): self
  590.     {
  591.         $this->isAnnule $isAnnule;
  592.         return $this;
  593.     }
  594.     public function getRemise(): ?float
  595.     {
  596.         return $this->remise;
  597.     }
  598.     public function setRemise(?float $remise): self
  599.     {
  600.         $this->remise $remise;
  601.         return $this;
  602.     }
  603.     public function getConcatRefCmd(): ?string
  604.     {
  605.         return "ICTCMD_MG_" $this->getPharmacie()->getId() . "_" $this->getReference();
  606.     }
  607.     public function getParrainage(): ?Parrainage
  608.     {
  609.         return $this->parrainage;
  610.     }
  611.     public function setParrainage(?Parrainage $parrainage): self
  612.     {
  613.         $this->parrainage $parrainage;
  614.         return $this;
  615.     }
  616.     public function getPrisencharge(): ?PrisEnCharge
  617.     {
  618.         return $this->prisencharge;
  619.     }
  620.     public function setPrisencharge(?PrisEnCharge $prisencharge): self
  621.     {
  622.         $this->prisencharge $prisencharge;
  623.         return $this;
  624.     }
  625.     public function getNumberOrdonnance(){
  626.         $nb 0;
  627.         foreach($this->getIctusCommandeLines() as $commandeLine){
  628.             if($commandeLine->getOrdonnance() !== null){
  629.                 $nb++;
  630.             }
  631.         }
  632.         return $nb;
  633.     }
  634.     public function getParcours(): ?Parcours
  635.     {
  636.         return $this->parcours;
  637.     }
  638.     public function setParcours(?Parcours $parcours): self
  639.     {
  640.         // Synchronisation du côté inverse
  641.         if ($parcours === null && $this->parcours !== null) {
  642.             $this->parcours->setIctusCommande(null);
  643.         }
  644.         if ($parcours !== null && $parcours->getIctusCommande() !== $this) {
  645.             $parcours->setIctusCommande($this);
  646.         }
  647.         $this->parcours $parcours;
  648.         return $this;
  649.     }
  650. }