src/Entity/Main/BookedActivity.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Main;
  3. use App\Repository\BookedActivityRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. /**
  7.  * @ORM\Entity(repositoryClass=BookedActivityRepository::class)
  8.  */
  9. class BookedActivity
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @var Reservation
  19.      * @ORM\ManyToOne(targetEntity="App\Entity\Main\Reservation", inversedBy="bookedActivity")
  20.      */
  21.     private $reservation;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $designation;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $forfait;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $formule;
  34.     /**
  35.      * @ORM\Column(type="string", length=60)
  36.      */
  37.     private $code_activity;
  38.     /**
  39.      * @ORM\Column(type="date")
  40.      */
  41.     private $date;
  42.     /**
  43.      * @ORM\Column(type="time", nullable=true)
  44.      */
  45.     private $creneau;
  46.     /**
  47.      * @ORM\Column(type="integer", nullable=true)
  48.      */
  49.     private $nbre_parties;
  50.     /**
  51.      * @ORM\Column(type="integer", nullable=true)
  52.      */
  53.     private $quantity;
  54.     /**
  55.      * @ORM\Column(type="float", nullable=true)
  56.      */
  57.     private $puTTC;
  58.     /**
  59.      * @ORM\Column(type="float", nullable=true)
  60.      */
  61.     private $taux_TVA;
  62.     /**
  63.      * @ORM\Column(type="float", nullable=true)
  64.      */
  65.     private $total_ht;
  66.     /**
  67.      * @ORM\Column(type="float", nullable=true)
  68.      */
  69.     private $montant_tva;
  70.     /**
  71.      * @ORM\Column(type="float", nullable=true)
  72.      */
  73.     private $totalTTC;
  74.     
  75.     /**
  76.      * @var bookedActivityOptions[]
  77.      *
  78.      * @ORM\OneToMany(targetEntity="App\Entity\Main\BookedActivityOptions", mappedBy="bookedActivity", cascade={"persist","remove"})
  79.      */
  80.     private $bookedActivityOptions;
  81.     
  82.     private $totalTtcWithOptions;
  83.     private $tvaTotalWithOptions;
  84.     private $deleted;
  85.     private $active;
  86.     private $confirmation;
  87.     /**
  88.      * @ORM\Column(type="boolean", nullable=true)
  89.      */
  90.     private $admin;
  91.     public function __toString()
  92.     {
  93.         return (string) $this->designation;
  94.     }
  95.     public function getId(): ?int
  96.     {
  97.         return $this->id;
  98.     }
  99.     
  100.     public function getReservation()
  101.     {
  102.         return $this->reservation;
  103.     }
  104.     public function setReservation(\App\Entity\Main\Reservation $reservation): self
  105.     {
  106.         $this->reservation $reservation;
  107.         return $this;
  108.     }
  109.     public function getDesignation(): ?string
  110.     {
  111.         return $this->designation;
  112.     }
  113.     public function setDesignation(?string $designation): self
  114.     {
  115.         $this->designation $designation;
  116.         return $this;
  117.     }
  118.     public function getForfait(): ?string
  119.     {
  120.         return $this->forfait;
  121.     }
  122.     public function setForfait(string $forfait): self
  123.     {
  124.         $this->forfait $forfait;
  125.         return $this;
  126.     }
  127.     public function getFormule(): ?string
  128.     {
  129.         return $this->formule;
  130.     }
  131.     public function setFormule(string $formule): self
  132.     {
  133.         $this->formule $formule;
  134.         return $this;
  135.     }
  136.     public function getCodeActivity(): ?string
  137.     {
  138.         return $this->code_activity;
  139.     }
  140.     public function setCodeActivity(string $code_activity): self
  141.     {
  142.         $this->code_activity $code_activity;
  143.         return $this;
  144.     }
  145.     public function getDate(): ?\DateTimeInterface
  146.     {
  147.         return $this->date;
  148.     }
  149.     public function setDate(\DateTimeInterface $date): self
  150.     {
  151.         $this->date $date;
  152.         return $this;
  153.     }
  154.     public function getCreneau(): ?\DateTimeInterface
  155.     {
  156.         return $this->creneau;
  157.     }
  158.     public function setCreneau(?\DateTimeInterface $creneau): self
  159.     {
  160.         $this->creneau $creneau;
  161.         return $this;
  162.     }
  163.     public function getNbreParties(): ?int
  164.     {
  165.         return $this->nbre_parties;
  166.     }
  167.     public function setNbreParties(?int $nbre_parties): self
  168.     {
  169.         $this->nbre_parties $nbre_parties;
  170.         return $this;
  171.     }
  172.     public function getQuantity(): ?int
  173.     {
  174.         return $this->quantity;
  175.     }
  176.     public function setQuantity(?int $quantity): self
  177.     {
  178.         $this->quantity $quantity;
  179.         return $this;
  180.     }
  181.     public function getPuTTC(): ?float
  182.     {
  183.         return $this->puTTC;
  184.     }
  185.     public function setPuTTC(?float $puTTC): self
  186.     {
  187.         $this->puTTC $puTTC;
  188.         return $this;
  189.     }
  190.     public function getTauxTVA(): ?float
  191.     {
  192.         return $this->taux_TVA;
  193.     }
  194.     public function setTauxTVA(?float $taux_TVA): self
  195.     {
  196.         $this->taux_TVA $taux_TVA;
  197.         return $this;
  198.     }
  199.     public function getTotalHt(): ?float
  200.     {
  201.         return $this->total_ht;
  202.     }
  203.     public function setTotalHt(?float $total_ht): self
  204.     {
  205.         $this->total_ht $total_ht;
  206.         return $this;
  207.     }
  208.     public function getMontantTva(): ?float
  209.     {
  210.         return $this->montant_tva;
  211.     }
  212.     public function setMontantTva(?float $montant_tva): self
  213.     {
  214.         $this->montant_tva $montant_tva;
  215.         return $this;
  216.     }
  217.     public function getTotalTTC(): ?float
  218.     {
  219.         return $this->totalTTC;
  220.     }
  221.     public function setTotalTTC(?float $totalTTC): self
  222.     {
  223.         $this->totalTTC $totalTTC;
  224.         return $this;
  225.     }
  226.     public function getAdmin(): ?bool
  227.     {
  228.         return $this->admin;
  229.     }
  230.     public function setAdmin(?bool $admin): self
  231.     {
  232.         $this->admin $admin;
  233.         return $this;
  234.     }
  235.     
  236.     /**
  237.      * @param bookedActivityOptions[] $bookedActivityOptions
  238.      */
  239.     public function setBookedActivityOptions($bookedActivityOptions)
  240.     {
  241.         $this->bookedActivityOptions $bookedActivityOptions;
  242.     }
  243.     /**
  244.      * @return bookedActivityOptions[]
  245.      */
  246.     public function getBookedActivityOptions()
  247.     {
  248.         return $this->bookedActivityOptions;
  249.     }
  250.     
  251.     public function getCreneauString()
  252.     {
  253.         if($this->creneau != null)
  254.             return (string) $this->creneau->format('H\hi');
  255.         else
  256.             return $this->creneau;          
  257.     }
  258.     
  259.     public function getTotalTtcWithOptions(): ?float
  260.     {
  261.         $this->totalTtcWithOptions $this->totalTTC;
  262.         foreach($this->bookedActivityOptions as $option) {
  263.             $this->totalTtcWithOptions += $option->getTotalTtc();
  264.         }
  265.         return $this->totalTtcWithOptions;
  266.     }
  267.     public function getTotalTtcWithOptionsString()
  268.     {
  269.         return number_format($this->getTotalTtcWithOptions(), 2'.'' ') . ' €';
  270.     }
  271.     
  272.     public function getTvaTotalWithOptions(): ?float
  273.     {
  274.         $this->tvaTotalWithOptions $this->montant_tva;
  275.         
  276.         foreach($this->bookedActivityOptions as $option) {
  277.             $this->tvaTotalWithOptions += $option->getMontantTva();
  278.         }
  279.         return $this->tvaTotalWithOptions;
  280.     }
  281.     public function getHasOptions()
  282.     {
  283.         return (count($this->bookedActivityOptions)) ? true false;
  284.     }   
  285.     
  286.     public function getCustomer()
  287.     {
  288.         $customer $this->reservation->getCustomer();
  289.         return $customer;
  290.     }
  291.     public function getConfirmation()
  292.     {
  293.         $this->confirmation = (string) $this->reservation->getConfirmation();
  294.         return $this->confirmation;
  295.     }   
  296.     
  297.     public function getDeleted()
  298.     {
  299.         $this->deleted = (string) $this->reservation->getDeleted();
  300.         return $this->deleted;
  301.     }
  302.     
  303.     public function getActive()
  304.     {
  305.         $this->active = (string) $this->reservation->getActive();
  306.         return $this->active;
  307.     }   
  308.     
  309.     public static function getFormulesList() {
  310.         return array("A la carte" => "carte""Anniversaire" => "anniversaire""Pass Journée" => "pass");      
  311.     }
  312. }