src/Entity/Gestiform/Admin/Tarifs/TarifVenteThemeIntra.php line 14

  1. <?php
  2. namespace App\Entity\Gestiform\Admin\Tarifs;
  3. use App\Entity\Gestiform\Formations\Catalogue\Module\Module;
  4. use App\Entity\Gestiform\Formations\Catalogue\Theme\Theme;
  5. use App\Repository\Gestiform\Admin\Tarifs\TarifVenteThemeIntraRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\Entity(repositoryClassTarifVenteThemeIntraRepository::class)]
  11. class TarifVenteThemeIntra extends TarifVente
  12. {
  13.     #[Assert\Regex('/\d+(\.\d+)?/')]
  14.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  15.     private ?string $testPrerequisPersint null;
  16.     #[Assert\Regex('/\d+(\.\d+)?/')]
  17.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  18.     private ?string $testPrerequisPersext null;
  19.     #[Assert\Regex('/\d+(\.\d+)?/')]
  20.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  21.     private ?string $ingenierieJourint null;
  22.     #[Assert\Regex('/\d+(\.\d+)?/')]
  23.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  24.     private ?string $ingenierieJourext null;
  25.     #[Assert\Regex('/\d+(\.\d+)?/')]
  26.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  27.     private ?string $supportInternePersint null;
  28.     #[Assert\Regex('/\d+(\.\d+)?/')]
  29.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  30.     private ?string $supportInternePersext null;
  31.     #[Assert\Regex('/\d+(\.\d+)?/')]
  32.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  33.     private ?string $locationSalleJourint null;
  34.     #[Assert\Regex('/\d+(\.\d+)?/')]
  35.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  36.     private ?string $repasJourint null;
  37.     #[Assert\Regex('/\d+(\.\d+)?/')]
  38.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  39.     private ?string $testValidationPersint null;
  40.     #[Assert\Regex('/\d+(\.\d+)?/')]
  41.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  42.     private ?string $testValidationPersext null;
  43.     #[ORM\OneToMany(targetEntityTarifVenteIntraJourClient::class, mappedBy'tarifVenteThemeIntra'cascade: ['persist''remove'], orphanRemovaltrue)]
  44.     private Collection $intraJourClients;
  45.     #[ORM\OneToMany(targetEntityTarifVenteIntraJourOf::class, mappedBy'tarifVenteThemeIntra'cascade: ['persist''remove'], orphanRemovaltrue)]
  46.     private Collection $intraJourOfs;
  47.     #[ORM\OneToMany(targetEntityTarifVenteIntraJour::class, mappedBy'tarifVenteThemeIntra'cascade: ['persist''remove'], orphanRemovaltrue)]
  48.     private Collection $intraJours;
  49.     #[ORM\ManyToOne(targetEntityTheme::class, cascade: ['persist'], inversedBy'tarifsVenteIntras')]
  50.     #[ORM\JoinColumn(name'theme_intra_id'referencedColumnName'id'onDelete'CASCADE')]
  51.     private ?Theme $themeIntra null;
  52.     #[ORM\ManyToOne(targetEntityModule::class, cascade: ['persist'], inversedBy'tarifsVenteIntras')]
  53.     #[ORM\JoinColumn(name'module_intra_id'referencedColumnName'id'onDelete'CASCADE')]
  54.     private ?Module $moduleIntra null;
  55.     public function __construct()
  56.     {
  57.         $this->intraJourClients = new ArrayCollection();
  58.         $this->intraJourOfs = new ArrayCollection();
  59.         $this->intraJours = new ArrayCollection();
  60.     }
  61.     public function getThemeIntra(): ?Theme
  62.     {
  63.         return $this->themeIntra;
  64.     }
  65.     public function setThemeIntra(?Theme $themeIntra): self
  66.     {
  67.         $this->themeIntra $themeIntra;
  68.         return $this;
  69.     }
  70.     public function getModuleIntra(): ?Module
  71.     {
  72.         return $this->moduleIntra;
  73.     }
  74.     public function setModuleIntra(?Module $moduleIntra): self
  75.     {
  76.         $this->moduleIntra $moduleIntra;
  77.         return $this;
  78.     }
  79.     public function getTestPrerequisPersint(): ?float
  80.     {
  81.         return $this->testPrerequisPersint;
  82.     }
  83.     public function setTestPrerequisPersint(?float $testPrerequisPersint): self
  84.     {
  85.         $this->testPrerequisPersint $testPrerequisPersint;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Collection<int, TarifVenteIntraJour>
  90.      */
  91.     public function getIntraJours(): Collection
  92.     {
  93.         return $this->intraJours;
  94.     }
  95.     public function addIntraJour(TarifVenteIntraJour $intraJour): self
  96.     {
  97.         if (!$this->intraJours->contains($intraJour)) {
  98.             $this->intraJours->add($intraJour);
  99.             $intraJour->setTarifVenteThemeIntra($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removeIntraJour(TarifVenteIntraJour $intraJour): self
  104.     {
  105.         if ($this->intraJours->removeElement($intraJour)) {
  106.             if ($intraJour->getTarifVenteThemeIntra() === $this) {
  107.                 $intraJour->setTarifVenteThemeIntra(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     public function getTestPrerequisPersext(): ?float
  113.     {
  114.         return $this->testPrerequisPersext;
  115.     }
  116.     public function setTestPrerequisPersext(?float $testPrerequisPersext): self
  117.     {
  118.         $this->testPrerequisPersext $testPrerequisPersext;
  119.         return $this;
  120.     }
  121.     public function getIngenierieJourint(): ?float
  122.     {
  123.         return $this->ingenierieJourint;
  124.     }
  125.     public function setIngenierieJourint(?float $ingenierieJourint): self
  126.     {
  127.         $this->ingenierieJourint $ingenierieJourint;
  128.         return $this;
  129.     }
  130.     public function getIngenierieJourext(): ?float
  131.     {
  132.         return $this->ingenierieJourext;
  133.     }
  134.     public function setIngenierieJourext(?float $ingenierieJourext): self
  135.     {
  136.         $this->ingenierieJourext $ingenierieJourext;
  137.         return $this;
  138.     }
  139.     public function getSupportInternePersint(): ?float
  140.     {
  141.         return $this->supportInternePersint;
  142.     }
  143.     public function setSupportInternePersint(?float $supportInternePersint): self
  144.     {
  145.         $this->supportInternePersint $supportInternePersint;
  146.         return $this;
  147.     }
  148.     public function getSupportInternePersext(): ?float
  149.     {
  150.         return $this->supportInternePersext;
  151.     }
  152.     public function setSupportInternePersext(?float $supportInternePersext): self
  153.     {
  154.         $this->supportInternePersext $supportInternePersext;
  155.         return $this;
  156.     }
  157.     public function getLocationSalleJourint(): ?float
  158.     {
  159.         return $this->locationSalleJourint;
  160.     }
  161.     public function setLocationSalleJourint(?float $locationSalleJourint): self
  162.     {
  163.         $this->locationSalleJourint $locationSalleJourint;
  164.         return $this;
  165.     }
  166.     public function getRepasJourint(): ?float
  167.     {
  168.         return $this->repasJourint;
  169.     }
  170.     public function setRepasJourint(?float $repasJourint): self
  171.     {
  172.         $this->repasJourint $repasJourint;
  173.         return $this;
  174.     }
  175.     public function getTestValidationPersint(): ?float
  176.     {
  177.         return $this->testValidationPersint;
  178.     }
  179.     public function setTestValidationPersint(?float $testValidationPersint): self
  180.     {
  181.         $this->testValidationPersint $testValidationPersint;
  182.         return $this;
  183.     }
  184.     public function getTestValidationPersext(): ?float
  185.     {
  186.         return $this->testValidationPersext;
  187.     }
  188.     public function setTestValidationPersext(?float $testValidationPersext): self
  189.     {
  190.         $this->testValidationPersext $testValidationPersext;
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, TarifVenteIntraJourClient>
  195.      */
  196.     public function getIntraJourClients(): Collection
  197.     {
  198.         return $this->intraJourClients;
  199.     }
  200.     public function addIntraJourClient(TarifVenteIntraJourClient $intraJourClient): self
  201.     {
  202.         if (!$this->intraJourClients->contains($intraJourClient)) {
  203.             $this->intraJourClients->add($intraJourClient);
  204.             $intraJourClient->setTarifVenteThemeIntra($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeIntraJourClient(TarifVenteIntraJourClient $intraJourClient): self
  209.     {
  210.         if ($this->intraJourClients->removeElement($intraJourClient)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($intraJourClient->getTarifVenteThemeIntra() === $this) {
  213.                 $intraJourClient->setTarifVenteThemeIntra(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, TarifVenteIntraJourOf>
  220.      */
  221.     public function getIntraJourOfs(): Collection
  222.     {
  223.         return $this->intraJourOfs;
  224.     }
  225.     public function addIntraJourOf(TarifVenteIntraJourOf $intraJourOf): self
  226.     {
  227.         if (!$this->intraJourOfs->contains($intraJourOf)) {
  228.             $this->intraJourOfs->add($intraJourOf);
  229.             $intraJourOf->setTarifVenteThemeIntra($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeIntraJourOf(TarifVenteIntraJourOf $intraJourOf): self
  234.     {
  235.         if ($this->intraJourOfs->removeElement($intraJourOf)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($intraJourOf->getTarifVenteThemeIntra() === $this) {
  238.                 $intraJourOf->setTarifVenteThemeIntra(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     public function getTarifForValue($combien)
  244.     {
  245.         $lignemax=$this->getLignemax($this->getIntraJourOfs());
  246.         if($this->getIntraJourOfs())
  247.         {
  248.             $lignemax=$this->getLignemax(true);
  249.             foreach($this->getLignes() as $ligne)
  250.             {
  251.                 if($ligne->isTarifjour() && $ligne->getValeurmin()==$combien){
  252.                     return $ligne;
  253.                 }
  254.             }
  255.             return $lignemax;
  256.         }else{
  257.             $lignemax=$this->getLignemax(false);
  258.             foreach($this->getLignes() as $ligne)
  259.             {
  260.                 if(!$ligne->isTarifjour() && $ligne->getValeurmin()<=$combien && $ligne->getValeurmax()>=$combien){
  261.                     return $ligne;
  262.                 }
  263.             }
  264.             return $lignemax;
  265.         }
  266.         $lignemax=$this->getLignemax($this->getIntraJourOfs());
  267.         return $lignemax;
  268.     }
  269.     public function getLignemax($tarifjour)
  270.     {
  271.         $lignemax=null;
  272.         $valeurmax=0;
  273.         foreach($this->getLignes() as $ligne)
  274.         {
  275.             if($ligne->isTarifjour()==$tarifjour){
  276.                 if($ligne->getValeurmin()>=$valeurmax){
  277.                     $valeurmax=$ligne->getValeurmin();
  278.                     $lignemax=$ligne;
  279.                 }
  280.             }
  281.         }
  282.         return $lignemax;
  283.     }
  284. }