<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\IctusCommandeRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity(repositoryClass=IctusCommandeRepository::class)
*/
class IctusCommande
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isReadyPov;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isLivrer;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateReadyPov;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateLivraison;
/**
* @ORM\ManyToOne(targetEntity=IctusEtatPaiement::class, inversedBy="ictusCommandes")
*/
private $etatpaiement;
/**
* @ORM\ManyToOne(targetEntity=IctusTypeLivraison::class, inversedBy="ictusCommandes")
*/
private $typeLivraison;
/**
* @ORM\ManyToOne(targetEntity=IctusPharmacie::class, inversedBy="ictusCommandes")
*/
private $pharmacie;
/**
* @ORM\ManyToOne(targetEntity=IctusTypePaiement::class, inversedBy="ictusCommandes")
*/
private $typePaiement;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $reference;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $stripeSessionId;
/**
* @ORM\OneToMany(targetEntity=IctusCommandeLine::class, mappedBy="commande", orphanRemoval=true)
*/
private $ictusCommandeLines;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="ictusCommandes")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity=IctusHistoriquePaiement::class, mappedBy="commande", orphanRemoval=true)
*/
private $ictusHistoriquePaiements;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $token;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $tokenStrippe;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isLivraisonValide;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isValide;
/**
* @ORM\ManyToMany(targetEntity=Ordonnance::class, inversedBy="ictusCommandes")
*/
private $Ordonnance;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codeSecret;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $raisonAnnulation;
/**
* @ORM\ManyToOne(targetEntity=Tierpayant::class, inversedBy="ictusCommandes")
*/
private $tierpayant;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $referenceClientTP;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $societename;
/**
* @ORM\OneToMany(targetEntity=IctusReclamation::class, mappedBy="commande")
*/
private $ictusReclamations;
/*
* @ORM\ManyToOne(targetEntity=SocieteLivraison::class, inversedBy="ictusCommandes")
*/
private $societeLivraison;
/**
* @ORM\Column(type="boolean")
*/
private $isRecuperer;
/**
* @ORM\ManyToOne(targetEntity=Adresse::class, inversedBy="ictusCommandes")
*/
private $adressePatient;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isChanged;
/**
* @ORM\OneToMany(targetEntity=FacturePatient::class, mappedBy="commande")
*/
private $facturePatients;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $commentaire;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAnnule;
public function __construct()
{
$this->ictusCommandeLines = new ArrayCollection();
$this->ictusHistoriquePaiements = new ArrayCollection();
$this->Ordonnance = new ArrayCollection();
$this->ictusReclamations = new ArrayCollection();
$this->facturePatients = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function isIsReadyPov(): ?bool
{
return $this->isReadyPov;
}
public function setIsReadyPov(?bool $isReadyPov): self
{
$this->isReadyPov = $isReadyPov;
return $this;
}
public function isIsLivrer(): ?bool
{
return $this->isLivrer;
}
public function setIsLivrer(?bool $isLivrer): self
{
$this->isLivrer = $isLivrer;
return $this;
}
public function getDateReadyPov(): ?\DateTimeInterface
{
return $this->dateReadyPov;
}
public function setDateReadyPov(?\DateTimeInterface $dateReadyPov): self
{
$this->dateReadyPov = $dateReadyPov;
return $this;
}
public function getDateLivraison(): ?\DateTimeInterface
{
return $this->dateLivraison;
}
public function setDateLivraison(?\DateTimeInterface $dateLivraison): self
{
$this->dateLivraison = $dateLivraison;
return $this;
}
public function getEtatpaiement(): ?IctusEtatPaiement
{
return $this->etatpaiement;
}
public function setEtatpaiement(?IctusEtatPaiement $etatpaiement): self
{
$this->etatpaiement = $etatpaiement;
return $this;
}
public function getTypeLivraison(): ?IctusTypeLivraison
{
return $this->typeLivraison;
}
public function setTypeLivraison(?IctusTypeLivraison $typeLivraison): self
{
$this->typeLivraison = $typeLivraison;
return $this;
}
public function getPharmacie(): ?IctusPharmacie
{
return $this->pharmacie;
}
public function setPharmacie(?IctusPharmacie $pharmacie): self
{
$this->pharmacie = $pharmacie;
return $this;
}
public function getTypePaiement(): ?IctusTypePaiement
{
return $this->typePaiement;
}
public function setTypePaiement(?IctusTypePaiement $typePaiement): self
{
$this->typePaiement = $typePaiement;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getStripeSessionId(): ?string
{
return $this->stripeSessionId;
}
public function setStripeSessionId(?string $stripeSessionId): self
{
$this->stripeSessionId = $stripeSessionId;
return $this;
}
/**
* @return Collection<int, IctusCommandeLine>
*/
public function getIctusCommandeLines(): Collection
{
return $this->ictusCommandeLines;
}
public function addIctusCommandeLine(IctusCommandeLine $ictusCommandeLine): self
{
if (!$this->ictusCommandeLines->contains($ictusCommandeLine)) {
$this->ictusCommandeLines[] = $ictusCommandeLine;
$ictusCommandeLine->setCommande($this);
}
return $this;
}
public function removeIctusCommandeLine(IctusCommandeLine $ictusCommandeLine): self
{
if ($this->ictusCommandeLines->removeElement($ictusCommandeLine)) {
// set the owning side to null (unless already changed)
if ($ictusCommandeLine->getCommande() === $this) {
$ictusCommandeLine->setCommande(null);
}
}
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection<int, IctusHistoriquePaiement>
*/
public function getIctusHistoriquePaiements(): Collection
{
return $this->ictusHistoriquePaiements;
}
public function addIctusHistoriquePaiement(IctusHistoriquePaiement $ictusHistoriquePaiement): self
{
if (!$this->ictusHistoriquePaiements->contains($ictusHistoriquePaiement)) {
$this->ictusHistoriquePaiements[] = $ictusHistoriquePaiement;
$ictusHistoriquePaiement->setCommande($this);
}
return $this;
}
public function removeIctusHistoriquePaiement(IctusHistoriquePaiement $ictusHistoriquePaiement): self
{
if ($this->ictusHistoriquePaiements->removeElement($ictusHistoriquePaiement)) {
// set the owning side to null (unless already changed)
if ($ictusHistoriquePaiement->getCommande() === $this) {
$ictusHistoriquePaiement->setCommande(null);
}
}
return $this;
}
public function getTotalProduit()
{
return count($this->getIctusCommandeLines());
}
public function getTotalCommande()
{
$total = 0;
foreach ($this->getIctusCommandeLines() as $commendeLine) {
if ($this->isIsValide() == 1) {
if ($commendeLine->isIsValide() == 1 && $commendeLine->getChanged() == null) {
$total += ($commendeLine->getQuantite() * $commendeLine->getPrixunitaire());
}
} else {
if ($commendeLine->getChanged() == null) {
$total += ($commendeLine->getQuantite() * $commendeLine->getPrixunitaire());
}
}
}
return $total;
}
public function getTotalPaiement()
{
$total = 0;
foreach ($this->getIctusHistoriquePaiements() as $historique) {
$total += $historique->getMontant();
}
return $total;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(?string $token): self
{
$this->token = $token;
return $this;
}
public function getTokenStrippe(): ?string
{
return $this->tokenStrippe;
}
public function setTokenStrippe(?string $tokenStrippe): self
{
$this->tokenStrippe = $tokenStrippe;
return $this;
}
public function isIsLivraisonValide(): ?bool
{
return $this->isLivraisonValide;
}
public function setIsLivraisonValide(?bool $isLivraisonValide): self
{
$this->isLivraisonValide = $isLivraisonValide;
return $this;
}
public function isIsValide(): ?bool
{
return $this->isValide;
}
public function setIsValide(?bool $isValide): self
{
$this->isValide = $isValide;
return $this;
}
/**
* @return Collection<int, Ordonnance>
*/
public function getOrdonnance(): Collection
{
return $this->Ordonnance;
}
public function addOrdonnance(Ordonnance $ordonnance): self
{
if (!$this->Ordonnance->contains($ordonnance)) {
$this->Ordonnance[] = $ordonnance;
}
return $this;
}
public function removeOrdonnance(Ordonnance $ordonnance): self
{
$this->Ordonnance->removeElement($ordonnance);
return $this;
}
/**
* Get the value of raisonAnnulation
*/
public function getRaisonAnnulation()
{
return $this->raisonAnnulation;
}
/**
* Set the value of raisonAnnulation
*
* @return self
*/
public function setRaisonAnnulation($raisonAnnulation)
{
$this->raisonAnnulation = $raisonAnnulation;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getCodeSecret(): ?string
{
return $this->codeSecret;
}
public function setCodeSecret(?string $codeSecret): self
{
$this->codeSecret = $codeSecret;
return $this;
}
public function getTierpayant(): ?Tierpayant
{
return $this->tierpayant;
}
public function setTierpayant(?Tierpayant $tierpayant): self
{
$this->tierpayant = $tierpayant;
return $this;
}
public function getReferenceClientTP(): ?string
{
return $this->referenceClientTP;
}
public function setReferenceClientTP(?string $referenceClientTP): self
{
$this->referenceClientTP = $referenceClientTP;
return $this;
}
public function getSocietename(): ?string
{
return $this->societename;
}
public function setSocietename(?string $societename): self
{
$this->societename = $societename;
return $this;
}
/**
* @return Collection<int, IctusReclamation>
*/
public function getIctusReclamations(): Collection
{
return $this->ictusReclamations;
}
public function addIctusReclamation(IctusReclamation $ictusReclamation): self
{
if (!$this->ictusReclamations->contains($ictusReclamation)) {
$this->ictusReclamations[] = $ictusReclamation;
$ictusReclamation->setCommande($this);
}
return $this;
}
public function getSocieteLivraison(): ?SocieteLivraison
{
return $this->societeLivraison;
}
public function setSocieteLivraison(?SocieteLivraison $societeLivraison): self
{
$this->societeLivraison = $societeLivraison;
return $this;
}
public function removeIctusReclamation(IctusReclamation $ictusReclamation): self
{
if ($this->ictusReclamations->removeElement($ictusReclamation)) {
// set the owning side to null (unless already changed)
if ($ictusReclamation->getCommande() === $this) {
$ictusReclamation->setCommande(null);
}
}
return $this;
}
public function isIsRecuperer(): ?bool
{
return $this->isRecuperer;
}
public function setIsRecuperer(bool $isRecuperer): self
{
$this->isRecuperer = $isRecuperer;
return $this;
}
public function getAdressePatient(): ?Adresse
{
return $this->adressePatient;
}
public function setAdressePatient(?Adresse $adressePatient): self
{
$this->adressePatient = $adressePatient;
return $this;
}
public function isIsChanged(): ?bool
{
return $this->isChanged;
}
public function setIsChanged(?bool $isChanged): self
{
$this->isChanged = $isChanged;
return $this;
}
/**
* @return Collection<int, FacturePatient>
*/
public function getFacturePatients(): Collection
{
return $this->facturePatients;
}
public function addFacturePatient(FacturePatient $facturePatient): self
{
if (!$this->facturePatients->contains($facturePatient)) {
$this->facturePatients[] = $facturePatient;
$facturePatient->setCommande($this);
}
return $this;
}
public function removeFacturePatient(FacturePatient $facturePatient): self
{
if ($this->facturePatients->removeElement($facturePatient)) {
// set the owning side to null (unless already changed)
if ($facturePatient->getCommande() === $this) {
$facturePatient->setCommande(null);
}
}
return $this;
}
public function getCommentaire(): ?string
{
return $this->commentaire;
}
public function setCommentaire(?string $commentaire): self
{
$this->commentaire = $commentaire;
return $this;
}
public function isIsAnnule(): ?bool
{
return $this->isAnnule;
}
public function setIsAnnule(?bool $isAnnule): self
{
$this->isAnnule = $isAnnule;
return $this;
}
}