src/Entity/RetourDetail.php line 15

Open in your IDE?
  1. <?php
  2. /**
  3.  * RetourDetail.php
  4.  * Created by Stéphane Brun
  5.  * Date: 25/07/2018 at 10:47
  6.  */
  7. namespace App\Entity;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Repository\RetourDetailRepository")
  11.  * @ORM\Table(name="retour_detail")
  12.  */
  13. class RetourDetail
  14. {
  15.     public const RAISON_A_DETERMINER 1;
  16.     public const RAISON_PERDU 2;
  17.     public const RAISON_DETRUIT 3;
  18.     public const RAISONS = [
  19.         self::RAISON_A_DETERMINER => 'À déterminer',
  20.         self::RAISON_PERDU        => 'Perdu',
  21.         self::RAISON_DETRUIT      => 'Détruit',
  22.     ];
  23.     /**
  24.      * @ORM\Column(type="integer")
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="AUTO")
  27.      */
  28.     protected $id;
  29.     /**
  30.      * @ORM\Column(name="titre", type="string", length=255, nullable=true)
  31.      */
  32.     protected $titre;
  33.     /**
  34.      * @ORM\Column(name="qte", type="integer")
  35.      */
  36.     protected $qte 0;
  37.     /**
  38.      * @ORM\Column(name="qte_retournee", type="integer")
  39.      */
  40.     protected $qteRetournee 0;
  41.     /**
  42.      * @ORM\Column(name="qte_retournee_sadr", type="integer")
  43.      */
  44.     protected $qteRetourneeSADR 0;
  45.     /**
  46.      * @ORM\Column(name="retrait", type="boolean")
  47.      */
  48.     protected $retrait 0;
  49.     /**
  50.      * @ORM\Column(name="pvu", type="float")
  51.      */
  52.     protected $pvu =;
  53.     /**
  54.      * @ORM\Column(name="remise", type="integer")
  55.      */
  56.     protected $remise 0;
  57.     /**
  58.      * @ORM\Column(name="facture", type="string", length=25, nullable=true)
  59.      */
  60.     protected $facture;
  61.     /**
  62.      * @ORM\Column(name="autorisation", type="string", length=50, nullable=true)
  63.      */
  64.     protected $autorisation;
  65.     /**
  66.      * @ORM\Column(name="facture_originale", type="string", length=15, nullable=true)
  67.      */
  68.     protected $factureOriginale;
  69.     /**
  70.      * @ORM\Column(name="raison", type="integer", nullable=true)
  71.      */
  72.     protected $raison self::RAISON_A_DETERMINER;
  73.     /**
  74.      * has one Retour
  75.      *
  76.      * @ORM\ManyToOne(targetEntity="App\Entity\Retour", inversedBy="details")
  77.      * @ORM\JoinColumn(name="retour_id", referencedColumnName="id")
  78.      */
  79.     protected $retour;
  80.     /**
  81.      * has one Titre
  82.      *
  83.      * @ORM\ManyToOne(targetEntity="App\Entity\Titre")
  84.      * @ORM\JoinColumn(name="titre_id", referencedColumnName="TISBN", nullable=true)
  85.      */
  86.     protected $produit;
  87.     /**
  88.      * has one Reception
  89.      *
  90.      * @ORM\ManyToOne(targetEntity="App\Entity\Reception")
  91.      * @ORM\JoinColumn(name="reception_id", referencedColumnName="id", nullable=true)
  92.      */
  93.     protected $reception;
  94.     /**
  95.      * @return mixed
  96.      */
  97.     public function getId()
  98.     {
  99.         return $this->id;
  100.     }
  101.     /**
  102.      * @param mixed $id
  103.      * @return RetourDetail
  104.      */
  105.     public function setId($id)
  106.     {
  107.         $this->id $id;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return mixed
  112.      */
  113.     public function getTitre()
  114.     {
  115.         return $this->titre;
  116.     }
  117.     /**
  118.      * @param mixed $titre
  119.      * @return RetourDetail
  120.      */
  121.     public function setTitre($titre)
  122.     {
  123.         $this->titre $titre;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return mixed
  128.      */
  129.     public function getQte()
  130.     {
  131.         return $this->qte;
  132.     }
  133.     /**
  134.      * @param mixed $qte
  135.      * @return RetourDetail
  136.      */
  137.     public function setQte($qte)
  138.     {
  139.         $this->qte $qte;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return mixed
  144.      */
  145.     public function getQteRetournee()
  146.     {
  147.         return $this->qteRetournee;
  148.     }
  149.     /**
  150.      * @param mixed $qteRetournee
  151.      * @return RetourDetail
  152.      */
  153.     public function setQteRetournee($qteRetournee)
  154.     {
  155.         $this->qteRetournee $qteRetournee;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return mixed
  160.      */
  161.     public function getQteRetourneeSADR()
  162.     {
  163.         return $this->qteRetourneeSADR;
  164.     }
  165.     /**
  166.      * @param mixed $qteRetourneeSADR
  167.      * @return RetourDetail
  168.      */
  169.     public function setQteRetourneeSADR($qteRetourneeSADR)
  170.     {
  171.         $this->qteRetourneeSADR $qteRetourneeSADR;
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return mixed
  176.      */
  177.     public function getRetrait()
  178.     {
  179.         return $this->retrait;
  180.     }
  181.     /**
  182.      * @param mixed $retrait
  183.      * @return RetourDetail
  184.      */
  185.     public function setRetrait($retrait)
  186.     {
  187.         $this->retrait $retrait;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return mixed
  192.      */
  193.     public function getPvu()
  194.     {
  195.         return $this->pvu;
  196.     }
  197.     /**
  198.      * @param mixed $pvu
  199.      * @return RetourDetail
  200.      */
  201.     public function setPvu($pvu)
  202.     {
  203.         $this->pvu $pvu;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return mixed
  208.      */
  209.     public function getRemise()
  210.     {
  211.         return $this->remise;
  212.     }
  213.     /**
  214.      * @param mixed $remise
  215.      * @return RetourDetail
  216.      */
  217.     public function setRemise($remise)
  218.     {
  219.         $this->remise $remise;
  220.         return $this;
  221.     }
  222.     /**
  223.      * @return mixed
  224.      */
  225.     public function getFacture()
  226.     {
  227.         return $this->facture;
  228.     }
  229.     /**
  230.      * @param mixed $facture
  231.      * @return RetourDetail
  232.      */
  233.     public function setFacture($facture)
  234.     {
  235.         $this->facture $facture;
  236.         return $this;
  237.     }
  238.     /**
  239.      * @return mixed
  240.      */
  241.     public function getAutorisation()
  242.     {
  243.         return $this->autorisation;
  244.     }
  245.     /**
  246.      * @param mixed $autorisation
  247.      * @return RetourDetail
  248.      */
  249.     public function setAutorisation($autorisation)
  250.     {
  251.         $this->autorisation $autorisation;
  252.         return $this;
  253.     }
  254.     /**
  255.      * @return mixed
  256.      */
  257.     public function getFactureOriginale()
  258.     {
  259.         return $this->factureOriginale;
  260.     }
  261.     /**
  262.      * @param mixed $factureOriginale
  263.      * @return RetourDetail
  264.      */
  265.     public function setFactureOriginale($factureOriginale)
  266.     {
  267.         $this->factureOriginale $factureOriginale;
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return mixed
  272.      */
  273.     public function getRetour()
  274.     {
  275.         return $this->retour;
  276.     }
  277.     /**
  278.      * @param mixed $retour
  279.      * @return RetourDetail
  280.      */
  281.     public function setRetour($retour)
  282.     {
  283.         $this->retour $retour;
  284.         return $this;
  285.     }
  286.     /**
  287.      * @return Titre
  288.      */
  289.     public function getProduit()
  290.     {
  291.         return $this->produit;
  292.     }
  293.     /**
  294.      * @param mixed $produit
  295.      * @return RetourDetail
  296.      */
  297.     public function setProduit($produit)
  298.     {
  299.         $this->produit $produit;
  300.         return $this;
  301.     }
  302.     /**
  303.      * @return mixed
  304.      */
  305.     public function getReception()
  306.     {
  307.         return $this->reception;
  308.     }
  309.     /**
  310.      * @param mixed $reception
  311.      * @return RetourDetail
  312.      */
  313.     public function setReception($reception)
  314.     {
  315.         $this->reception $reception;
  316.         return $this;
  317.     }
  318.     public function getBrut()
  319.     {
  320.         return ($this->getQteRetournee() * $this->getPvu()) - ($this->getQteRetournee() * $this->getPvu() * $this->getRemise() / 100);
  321.     }
  322.     public function getTps($taux)
  323.     {
  324.         $tps 0;
  325.         if ($this->getProduit()->isTps()){
  326.             $tps $this->getBrut() * $taux;
  327.         }
  328.         return $tps;
  329.     }
  330.     public function getTvq($taux)
  331.     {
  332.         $tvq 0;
  333.         if ($this->getProduit()->isTvq()){
  334.             $tvq $this->getBrut() * $taux;
  335.         }
  336.         return $tvq;
  337.     }
  338.     /**
  339.      * @return mixed
  340.      */
  341.     public function getRaison()
  342.     {
  343.         return $this->raison;
  344.     }
  345.     /**
  346.      * @param mixed $raison
  347.      * @return RetourDetail
  348.      */
  349.     public function setRaison($raison)
  350.     {
  351.         $this->raison $raison;
  352.         return $this;
  353.     }
  354. }