<?php
/**
* RetourDetail.php
* Created by Stéphane Brun
* Date: 25/07/2018 at 10:47
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\RetourDetailRepository")
* @ORM\Table(name="retour_detail")
*/
class RetourDetail
{
public const RAISON_A_DETERMINER = 1;
public const RAISON_PERDU = 2;
public const RAISON_DETRUIT = 3;
public const RAISONS = [
self::RAISON_A_DETERMINER => 'À déterminer',
self::RAISON_PERDU => 'Perdu',
self::RAISON_DETRUIT => 'Détruit',
];
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="titre", type="string", length=255, nullable=true)
*/
protected $titre;
/**
* @ORM\Column(name="qte", type="integer")
*/
protected $qte = 0;
/**
* @ORM\Column(name="qte_retournee", type="integer")
*/
protected $qteRetournee = 0;
/**
* @ORM\Column(name="qte_retournee_sadr", type="integer")
*/
protected $qteRetourneeSADR = 0;
/**
* @ORM\Column(name="retrait", type="boolean")
*/
protected $retrait = 0;
/**
* @ORM\Column(name="pvu", type="float")
*/
protected $pvu =0 ;
/**
* @ORM\Column(name="remise", type="integer")
*/
protected $remise = 0;
/**
* @ORM\Column(name="facture", type="string", length=25, nullable=true)
*/
protected $facture;
/**
* @ORM\Column(name="autorisation", type="string", length=50, nullable=true)
*/
protected $autorisation;
/**
* @ORM\Column(name="facture_originale", type="string", length=15, nullable=true)
*/
protected $factureOriginale;
/**
* @ORM\Column(name="raison", type="integer", nullable=true)
*/
protected $raison = self::RAISON_A_DETERMINER;
/**
* has one Retour
*
* @ORM\ManyToOne(targetEntity="App\Entity\Retour", inversedBy="details")
* @ORM\JoinColumn(name="retour_id", referencedColumnName="id")
*/
protected $retour;
/**
* has one Titre
*
* @ORM\ManyToOne(targetEntity="App\Entity\Titre")
* @ORM\JoinColumn(name="titre_id", referencedColumnName="TISBN", nullable=true)
*/
protected $produit;
/**
* has one Reception
*
* @ORM\ManyToOne(targetEntity="App\Entity\Reception")
* @ORM\JoinColumn(name="reception_id", referencedColumnName="id", nullable=true)
*/
protected $reception;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
* @return RetourDetail
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return mixed
*/
public function getTitre()
{
return $this->titre;
}
/**
* @param mixed $titre
* @return RetourDetail
*/
public function setTitre($titre)
{
$this->titre = $titre;
return $this;
}
/**
* @return mixed
*/
public function getQte()
{
return $this->qte;
}
/**
* @param mixed $qte
* @return RetourDetail
*/
public function setQte($qte)
{
$this->qte = $qte;
return $this;
}
/**
* @return mixed
*/
public function getQteRetournee()
{
return $this->qteRetournee;
}
/**
* @param mixed $qteRetournee
* @return RetourDetail
*/
public function setQteRetournee($qteRetournee)
{
$this->qteRetournee = $qteRetournee;
return $this;
}
/**
* @return mixed
*/
public function getQteRetourneeSADR()
{
return $this->qteRetourneeSADR;
}
/**
* @param mixed $qteRetourneeSADR
* @return RetourDetail
*/
public function setQteRetourneeSADR($qteRetourneeSADR)
{
$this->qteRetourneeSADR = $qteRetourneeSADR;
return $this;
}
/**
* @return mixed
*/
public function getRetrait()
{
return $this->retrait;
}
/**
* @param mixed $retrait
* @return RetourDetail
*/
public function setRetrait($retrait)
{
$this->retrait = $retrait;
return $this;
}
/**
* @return mixed
*/
public function getPvu()
{
return $this->pvu;
}
/**
* @param mixed $pvu
* @return RetourDetail
*/
public function setPvu($pvu)
{
$this->pvu = $pvu;
return $this;
}
/**
* @return mixed
*/
public function getRemise()
{
return $this->remise;
}
/**
* @param mixed $remise
* @return RetourDetail
*/
public function setRemise($remise)
{
$this->remise = $remise;
return $this;
}
/**
* @return mixed
*/
public function getFacture()
{
return $this->facture;
}
/**
* @param mixed $facture
* @return RetourDetail
*/
public function setFacture($facture)
{
$this->facture = $facture;
return $this;
}
/**
* @return mixed
*/
public function getAutorisation()
{
return $this->autorisation;
}
/**
* @param mixed $autorisation
* @return RetourDetail
*/
public function setAutorisation($autorisation)
{
$this->autorisation = $autorisation;
return $this;
}
/**
* @return mixed
*/
public function getFactureOriginale()
{
return $this->factureOriginale;
}
/**
* @param mixed $factureOriginale
* @return RetourDetail
*/
public function setFactureOriginale($factureOriginale)
{
$this->factureOriginale = $factureOriginale;
return $this;
}
/**
* @return mixed
*/
public function getRetour()
{
return $this->retour;
}
/**
* @param mixed $retour
* @return RetourDetail
*/
public function setRetour($retour)
{
$this->retour = $retour;
return $this;
}
/**
* @return Titre
*/
public function getProduit()
{
return $this->produit;
}
/**
* @param mixed $produit
* @return RetourDetail
*/
public function setProduit($produit)
{
$this->produit = $produit;
return $this;
}
/**
* @return mixed
*/
public function getReception()
{
return $this->reception;
}
/**
* @param mixed $reception
* @return RetourDetail
*/
public function setReception($reception)
{
$this->reception = $reception;
return $this;
}
public function getBrut()
{
return ($this->getQteRetournee() * $this->getPvu()) - ($this->getQteRetournee() * $this->getPvu() * $this->getRemise() / 100);
}
public function getTps($taux)
{
$tps = 0;
if ($this->getProduit()->isTps()){
$tps = $this->getBrut() * $taux;
}
return $tps;
}
public function getTvq($taux)
{
$tvq = 0;
if ($this->getProduit()->isTvq()){
$tvq = $this->getBrut() * $taux;
}
return $tvq;
}
/**
* @return mixed
*/
public function getRaison()
{
return $this->raison;
}
/**
* @param mixed $raison
* @return RetourDetail
*/
public function setRaison($raison)
{
$this->raison = $raison;
return $this;
}
}