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