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