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

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