src/Entity/GestionComerciale/Devis.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity\GestionComerciale;
  3. use App\Entity\Clients\Client;
  4. use App\Entity\Utilisateur\Utilisateur;
  5. use DateTime;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use App\Annotations\SecuredEntity;
  12. /**
  13.  * Devis
  14.  *
  15.  * @ORM\Table("commerciale__devis")
  16.  * @ORM\Entity(repositoryClass="App\Repository\GestionComerciale\DevisRepository")
  17.  * @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
  18.  * @SecuredEntity(name="Devis", group="VENTES")
  19.  */
  20. class Devis
  21. {
  22.     /**
  23.      * @ORM\Column(name="id", type="integer")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="devis")
  30.      * @ORM\JoinColumn(nullable=true)
  31.      */
  32.     private $utilisateur;
  33.     /**
  34.      * @ORM\Column(name="date", type="datetime", nullable=true)
  35.      */
  36.     private $date;
  37.     /**
  38.      * @ORM\Column(name="dateMaj", type="datetime", nullable=true)
  39.      * @Gedmo\Timestampable(on="update")
  40.      */
  41.     private $dateMaj;
  42.     /**
  43.      * @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
  44.      */
  45.     private $dateSuppression;
  46.     /**
  47.      * @ORM\Column(name="reference", type="string", length=255, nullable=true)
  48.      */
  49.     private $reference;
  50.     
  51.     /**
  52.      * @ORM\Column(name="reference_client", type="string", length=255, nullable=true)
  53.      */
  54.     private $referenceClient;
  55.     
  56.     /**
  57.      * @ORM\ManyToOne(targetEntity="App\Entity\Clients\Client", inversedBy="devis")
  58.      * @ORM\JoinColumn(nullable=true)
  59.      */
  60.     private $client;
  61.     
  62.     /**
  63.      * @ORM\Column(name="client_nom", type="string", length=255, nullable=true)
  64.      */
  65.     private $nom;
  66.     
  67.     /**
  68.      * @ORM\Column(name="client_prenom", type="string", length=255, nullable=true)
  69.      */
  70.     private $prenom;
  71.     
  72.     /**
  73.      * @ORM\Column(name="telephone", type="string", length=255, nullable=true)
  74.      */
  75.     private $telephone;
  76.     
  77.     /**
  78.      * @var float
  79.      * 
  80.      * @ORM\Column(name="nb_pieces", type="float", nullable=true)
  81.      */
  82.     private $nbPieces;
  83.     
  84.     /**
  85.      * @var float
  86.      * 
  87.      * @ORM\Column(name="prix_ht", type="float", nullable=true)
  88.      */
  89.     private $prixHT;
  90.     
  91.     /**
  92.      * @var float
  93.      * 
  94.      * @ORM\Column(name="prix_ttc", type="float", nullable=true)
  95.      */
  96.     private $prixTTC;
  97.     
  98.     /**
  99.      * @ORM\OneToMany(targetEntity="ArticleCommande", mappedBy="devis", cascade={"persist"})
  100.      */
  101.     protected $articlesCommande;
  102.     public function __construct()
  103.     {
  104.         $this->date             = new Datetime();
  105.         $this->articlesCommande = new ArrayCollection();
  106.             /*
  107.             $this->nbPieces = 2;
  108.             $this->prixHT= 10;
  109.             $this->prixTTC = 12;
  110.              * 
  111.              */
  112.     }
  113.     public function __toString()
  114.     {
  115.         return $this->name;
  116.     }
  117.     public function getId(): int
  118.     {
  119.         return $this->id;
  120.     }
  121.     public function setDate(?DateTime $date): Devis
  122.     {
  123.         $this->date $date;
  124.         return $this;
  125.     }
  126.     public function getDate(): ?DateTime
  127.     {
  128.         return $this->date;
  129.     }
  130.     public function setDateMaj(?DateTime $dateMaj): Devis
  131.     {
  132.         $this->dateMaj $dateMaj;
  133.         return $this;
  134.     }
  135.     public function getDateMaj(): ?DateTime
  136.     {
  137.         return $this->dateMaj;
  138.     }
  139.     public function setDateSuppression(?DateTime $dateSuppression): Devis
  140.     {
  141.         $this->dateSuppression $dateSuppression;
  142.         return $this;
  143.     }
  144.     public function getDateSuppression(): ?DateTime
  145.     {
  146.         return $this->dateSuppression;
  147.     }
  148.     public function setReference(?string $reference): Devis
  149.     {
  150.         $this->reference $reference;
  151.         return $this;
  152.     }
  153.     public function getReference(): ?string
  154.     {
  155.         return $this->reference;
  156.     }
  157.     public function setUtilisateur(?Utilisateur $utilisateur): Devis
  158.     {
  159.         $this->utilisateur $utilisateur;
  160.         return $this;
  161.     }
  162.     public function getUtilisateur(): ?Utilisateur
  163.     {
  164.         return $this->utilisateur;
  165.     }
  166.     public function setName($name): Devis
  167.     {
  168.         $this->name $name;
  169.         return $this;
  170.     }
  171.     public function getName(): string
  172.     {
  173.         return $this->name;
  174.     }
  175.     public function setTelephone(?string $telephone): Devis
  176.     {
  177.         $this->telephone $telephone;
  178.         return $this;
  179.     }
  180.     public function getTelephone(): ?string
  181.     {
  182.         return $this->telephone;
  183.     }
  184.     public function setReferenceClient(?string $referenceClient): Devis
  185.     {
  186.         $this->referenceClient $referenceClient;
  187.         return $this;
  188.     }
  189.     public function getReferenceClient(): ?string
  190.     {
  191.         return $this->referenceClient;
  192.     }
  193.     public function getPrixTTC(): float
  194.     {
  195.         $total 0;
  196.         if (count($this->getArticlesCommande())>0)
  197.             foreach ($this->getArticlesCommande() as $articleCommande )
  198.             {
  199.                 $total += $articleCommande->getTotalTTC();
  200.             }
  201.         return $total;
  202.         //return $this->prixTTC;
  203.     }
  204.     public function getPrixHT(): float
  205.     {
  206.         $total 0;
  207.         if (count($this->getArticlesCommande())>0)
  208.             foreach ($this->getArticlesCommande() as $articleCommande )
  209.             {
  210.                 $total += $articleCommande->getTotalHt();
  211.             }
  212.         return $total;
  213.         //return $this->prixHT;
  214.     }
  215.     public function getNbPieces(): float
  216.     {
  217.         $total 0;
  218.         if (count($this->getArticlesCommande())>0)
  219.             foreach ($this->getArticlesCommande() as $articleCommande )
  220.             {
  221.                 $total += $articleCommande->getQuantite();
  222.             }
  223.         return $total;
  224.         //return $this->nbPieces;
  225.     }
  226.     public function addArticlesCommande(ArticleCommande $articlesCommande): Devis
  227.     {
  228.         $this->articlesCommande[] = $articlesCommande;
  229.         $articlesCommande->setDevis($this);
  230.         return $this;
  231.     }
  232.     public function removeArticlesCommande(ArticleCommande $articlesCommande)
  233.     {
  234.         $this->articlesCommande->removeElement($articlesCommande);
  235.     }
  236.     public function getArticlesCommande(): Collection
  237.     {
  238.         return $this->articlesCommande;
  239.     }
  240.     public function setNom(?string $nom): Devis
  241.     {
  242.         $this->nom $nom;
  243.         return $this;
  244.     }
  245.     public function getNom(): ?string
  246.     {
  247.         return $this->nom;
  248.     }
  249.     public function setPrenom(?string $prenom): Devis
  250.     {
  251.         $this->prenom $prenom;
  252.         return $this;
  253.     }
  254.     public function getPrenom(): ?string
  255.     {
  256.         return $this->prenom;
  257.     }
  258.     public function setClient(?Client $client): Devis
  259.     {
  260.         $this->client $client;
  261.         return $this;
  262.     }
  263.     public function getClient(): ?Client
  264.     {
  265.         return $this->client;
  266.     }
  267.     public function setNbPieces(?float $nbPieces): Devis
  268.     {
  269.         $this->nbPieces $nbPieces;
  270.         return $this;
  271.     }
  272.     public function setPrixHT(?float $prixHT): Devis
  273.     {
  274.         $this->prixHT $prixHT;
  275.         return $this;
  276.     }
  277.     public function setPrixTTC(?float $prixTTC): Devis
  278.     {
  279.         $this->prixTTC $prixTTC;
  280.         return $this;
  281.     }
  282. }