<?php
/**
* TitreCompany.php
* Created by Stéphane Brun
* Date: 03/05/2018 at 15:57
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="titre_company")
* @ORM\Entity(repositoryClass="App\Repository\TitreCompanyRepository")
*/
class TitreCompany
{
const HISTORY_WATCH = [
'titre' => 'ISBN',
'qSeuil' => 'Seuil',
'qem' => 'En main',
'qManquante' => 'Manquante',
'qAbimes' => 'Abimé',
'qMisDeCote' => 'Mis de coté',
'qConsignation' => 'Consig X2',
'qCommandeReguliere' => 'Commande régulière',
'qCommandeSpeciale' => 'Commande spéciale',
];
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="TEnSalle", type="boolean", nullable=true)
*/
protected $enSalle;
/**
* @ORM\Column(name="TVedette", type="float", nullable=true)
*/
protected $vedette;
/**
* @ORM\Column(name="TSVedette1", type="float", nullable=true)
*/
protected $sousVedette1;
/**
* @ORM\Column(name="TEtatDepuis", type="datetime", nullable=true)
*/
protected $etatDepuis;
/**
* @ORM\Column(name="TAcquisition", type="integer", nullable=true)
*/
protected $acquisition;
/**
* @ORM\Column(name="TCatalogue", type="boolean", nullable=true)
*/
protected $catalogue;
/**
* @ORM\Column(name="TQSeuil", type="integer", nullable=true)
*/
protected $qSeuil;
/**
* @ORM\Column(name="TQEM", type="integer", nullable=true)
*/
protected $qem;
/**
* @ORM\Column(name="TQManquante", type="integer", nullable=true)
*/
protected $qManquante;
/**
* @ORM\Column(name="TQAbimes", type="integer", nullable=true)
*/
protected $qAbimes;
/**
* @ORM\Column(name="TQMdeCote", type="integer", nullable=true)
*/
protected $qMisDeCote;
/**
* @ORM\Column(name="TQConsignation", type="integer", nullable=true)
*/
protected $qConsignation;
/**
* @ORM\Column(name="TQCommandeReguliere", type="integer", nullable=true)
*/
protected $qCommandeReguliere;
/**
* @ORM\Column(name="TQCommandeSpeciale", type="integer", nullable=true)
*/
protected $qCommandeSpeciale;
/**
* @ORM\OneToMany(targetEntity="App\Entity\CommandeSpecialeDetail", mappedBy="titreCompany")
*/
protected $commandesSpecialeDetails;
/**
* @ORM\Column(name="TCommentaire", type="text", nullable=true)
*/
protected $commentaire;
/**
* @ORM\Column(name="TQComptee", type="integer", nullable=true)
*/
protected $qComptee;
/**
* @ORM\Column(name="TQCompteeDate", type="datetime", nullable=true)
*/
protected $qCompteeDate;
/**
* @ORM\Column(name="TQAjustement", type="integer", nullable=true)
*/
protected $qAjustement;
/**
* @ORM\Column(name="TDate", type="datetime", nullable=true)
*/
protected $date;
/**
* @ORM\Column(name="TDateCompteeReelle", type="datetime", nullable=true)
*/
protected $dateCompteeReelle;
/**
* @ORM\Column(name="TCategorie", type="string", length=255, nullable=true)
*/
protected $categorie;
/**
* @ORM\Column(name="TEtiquettesSpeciales", type="integer", nullable=true)
*/
protected $etiquettesSpeciales;
/**
* @ORM\Column(name="TEnLigne", type="integer", nullable=true)
*/
protected $enLigne;
/**
* @ORM\Column(name="TVitrine", type="integer", nullable=true)
*/
protected $vitrine;
/**
* @ORM\Column(name="tqtereserve", type="integer", nullable=true)
*/
protected $qReserve;
/**
* @ORM\Column(name="TSSCollectionNumero", type="string", length=50, nullable=true)
*/
protected $ssCollectionNumero;
/**
* @ORM\Column(name="TCollectionNumero", type="string", length=50, nullable=true)
*/
protected $collectionNumero;
/**
* @ORM\Column(name="Collqc", type="integer", nullable=true)
*/
protected $collqc;
/**
* Many Titres has one Collections
*
* @ORM\ManyToOne(targetEntity="App\Entity\Collections", cascade={"persist"})
* @ORM\JoinColumn(name="TCollection", referencedColumnName="id", nullable=true)
*/
protected $collection;
/**
* Many Titres has one (Sub)Collections
*
* @ORM\ManyToOne(targetEntity="App\Entity\Collections", cascade={"persist"})
* @ORM\JoinColumn(name="TSSCollection", referencedColumnName="id", nullable=true)
*/
protected $sousCollection;
/**
* Many Titres has one Departements
*
* @ORM\ManyToOne(targetEntity="App\Entity\Departements", cascade={"persist"}, inversedBy="titresCompany")
* @ORM\JoinColumn(name="TDepartement", referencedColumnName="id", nullable=true)
*/
protected $departement;
/**
* Many Titres has one Rayons
*
* @ORM\ManyToOne(targetEntity="App\Entity\Rayons", cascade={"persist"})
* @ORM\JoinColumn(name="TRayon", referencedColumnName="id", nullable=true)
*/
protected $rayon;
/**
* Many Titres has one (Sub) Rayons
*
* @ORM\ManyToOne(targetEntity="App\Entity\Rayons", cascade={"persist"})
* @ORM\JoinColumn(name="TRayon2", referencedColumnName="id", nullable=true)
*/
protected $rayon2;
/**
* Many Titres has one Sujets(1)
*
* @ORM\ManyToOne(targetEntity="App\Entity\Sujets", cascade={"persist"})
* @ORM\JoinColumn(name="TSujet1", referencedColumnName="id", nullable=true)
*/
protected $sujet1;
/**
* Many Titres has one Sujets(2)
*
* @ORM\ManyToOne(targetEntity="App\Entity\Sujets", cascade={"persist"})
* @ORM\JoinColumn(name="TSujet2", referencedColumnName="id", nullable=true)
*/
protected $sujet2;
/**
* Many Titres has one Sujets(3)
*
* @ORM\ManyToOne(targetEntity="App\Entity\Sujets", cascade={"persist"})
* @ORM\JoinColumn(name="TSujet3", referencedColumnName="id", nullable=true)
*/
protected $sujet3;
/**
* Many Titres has one Etats
*
* @ORM\ManyToOne(targetEntity="App\Entity\Etats", cascade={"persist"})
* @ORM\JoinColumn(name="TEtat", referencedColumnName="id", nullable=true)
*/
protected $etat;
/**
* has one Titre
*
* @ORM\ManyToOne(targetEntity="App\Entity\Titre", inversedBy="titreCompany", cascade={"persist"})
* @ORM\JoinColumn(name="titre_id", referencedColumnName="TISBN")
*/
protected $titre;
/**
* has one Company
*
* @ORM\ManyToOne(targetEntity="Company", inversedBy="titresCompany", cascade={"persist"})
* @ORM\JoinColumn(name="company_id", referencedColumnName="id")
*/
protected $company;
public function __construct()
{
/*Defined default values to 0 for original structure data
* Order reporting need integer values to calculate result
*/
$this->qSeuil = 0;
$this->qem = 0;
$this->qManquante = 0;
$this->qAbimes = 0;
$this->qMisDeCote = 0;
$this->qConsignation = 0;
$this->qCommandeReguliere = 0;
$this->qCommandeSpeciale = 0;
}
/**
* @return mixed
*/
public function getCompany()
{
return $this->company;
}
/**
* @param Company $company
*/
public function setCompany(Company $company)
{
$this->company = $company;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id): void
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getEnSalle()
{
return $this->enSalle;
}
/**
* @param mixed $enSalle
*/
public function setEnSalle($enSalle = null)
{
$this->enSalle = $enSalle;
}
/**
* @return mixed
*/
public function getVedette()
{
return $this->vedette;
}
/**
* @param mixed $vedette
*/
public function setVedette($vedette = null)
{
$this->vedette = $vedette;
}
/**
* @return mixed
*/
public function getSousVedette1()
{
return $this->sousVedette1;
}
/**
* @param mixed $sousVedette1
*/
public function setSousVedette1($sousVedette1 = null)
{
$this->sousVedette1 = $sousVedette1;
}
/**
* @return mixed
*/
public function getEtatDepuis()
{
return $this->etatDepuis;
}
/**
* @param mixed $etatDepuis
*/
public function setEtatDepuis($etatDepuis = null)
{
$this->etatDepuis = $etatDepuis;
}
/**
* @return mixed
*/
public function getAcquisition()
{
return $this->acquisition;
}
/**
* @param mixed $acquisition
*/
public function setAcquisition($acquisition = null)
{
$this->acquisition = $acquisition;
}
/**
* @return mixed
*/
public function getCatalogue()
{
return $this->catalogue;
}
/**
* @param mixed $catalogue
*/
public function setCatalogue($catalogue = null)
{
$this->catalogue = $catalogue;
}
/**
* @return mixed
*/
public function getQSeuil()
{
return $this->qSeuil;
}
/**
* @param mixed $qSeuil
*/
public function setQSeuil($qSeuil = null)
{
$this->qSeuil = $qSeuil;
}
/**
* @return mixed
*/
public function getQem()
{
return $this->qem;
}
/**
* @param mixed $qem
*/
public function setQem($qem = null)
{
$this->qem = $qem;
}
/**
* @return mixed
*/
public function getQManquante()
{
return $this->qManquante;
}
/**
* @param mixed $qManquante
*/
public function setQManquante($qManquante = null)
{
$this->qManquante = $qManquante;
}
/**
* @return mixed
*/
public function getQAbimes()
{
return $this->qAbimes;
}
/**
* @param mixed $qAbimes
*/
public function setQAbimes($qAbimes = null)
{
$this->qAbimes = $qAbimes;
}
/**
* @return mixed
*/
public function getQMisDeCote()
{
return $this->qMisDeCote;
}
/**
* @param mixed $qMisDeCote
*/
public function setQMisDeCote($qMisDeCote = null)
{
$this->qMisDeCote = $qMisDeCote;
}
/**
* @return mixed
*/
public function getQConsignation()
{
return $this->qConsignation;
}
/**
* @param mixed $qConsignation
*/
public function setQConsignation($qConsignation = null)
{
$this->qConsignation = $qConsignation;
}
/**
* @return mixed
*/
public function getQCommandeReguliere()
{
return $this->qCommandeReguliere;
}
/**
* @param mixed $qCommandeReguliere
*/
public function setQCommandeReguliere($qCommandeReguliere = null)
{
$this->qCommandeReguliere = $qCommandeReguliere;
}
/**
* @return mixed
*/
public function getQCommandeSpeciale()
{
return $this->qCommandeSpeciale;
}
/**
* @param mixed $qCommandeSpeciale
*/
public function setQCommandeSpeciale($qCommandeSpeciale = null)
{
$this->qCommandeSpeciale = $qCommandeSpeciale;
}
/**
* @return mixed
*/
public function getCommandesSpecialeDetails()
{
return $this->commandesSpecialeDetails;
}
/**
* @param mixed $commandesSpecialeDetails
*/
public function setCommandesSpecialeDetails($commandesSpecialeDetails): void
{
$this->commandesSpecialeDetails = $commandesSpecialeDetails;
}
/**
* @return mixed
*/
public function getCommentaire()
{
return $this->commentaire;
}
/**
* @param mixed $commentaire
*/
public function setCommentaire($commentaire = null)
{
$this->commentaire = $commentaire;
}
/**
* @return mixed
*/
public function getQComptee()
{
return $this->qComptee;
}
/**
* @param mixed $qComptee
*/
public function setQComptee($qComptee = null)
{
$this->qComptee = $qComptee;
}
/**
* @return mixed
*/
public function getQCompteeDate()
{
return $this->qCompteeDate;
}
/**
* @param mixed $qCompteeDate
*/
public function setQCompteeDate($qCompteeDate = null)
{
if (!empty($qCompteeDate) && !is_a($qCompteeDate, 'DateTime')) {
$this->qCompteeDate = new \DateTime($qCompteeDate);
} else {
$this->qCompteeDate = $qCompteeDate;
}
}
/**
* @return mixed
*/
public function getQAjustement()
{
return $this->qAjustement;
}
/**
* @param mixed $qAjustement
*/
public function setQAjustement($qAjustement = null)
{
$this->qAjustement = $qAjustement;
}
/**
* @return mixed
*/
public function getDate()
{
return $this->date;
}
/**
* @param mixed $date
*/
public function setDate($date = null)
{
$this->date = $date;
}
/**
* @return mixed
*/
public function getDateCompteeReelle()
{
return $this->dateCompteeReelle;
}
/**
* @param mixed $dateCompteeReelle
*/
public function setDateCompteeReelle($dateCompteeReelle = null)
{
$this->dateCompteeReelle = $dateCompteeReelle;
}
/**
* @return mixed
*/
public function getCategorie()
{
return $this->categorie;
}
/**
* @param mixed $categorie
*/
public function setCategorie($categorie = null)
{
$this->categorie = $categorie;
}
/**
* @return mixed
*/
public function getEtiquettesSpeciales()
{
return $this->etiquettesSpeciales;
}
/**
* @param mixed $etiquettesSpeciales
*/
public function setEtiquettesSpeciales($etiquettesSpeciales = null)
{
$this->etiquettesSpeciales = $etiquettesSpeciales;
}
/**
* @return mixed
*/
public function getEnLigne()
{
return $this->enLigne;
}
/**
* @param mixed $enLigne
*/
public function setEnLigne($enLigne = null)
{
$this->enLigne = $enLigne;
}
/**
* @return mixed
*/
public function getVitrine()
{
return $this->vitrine;
}
/**
* @param mixed $vitrine
*/
public function setVitrine($vitrine = null)
{
$this->vitrine = $vitrine;
}
/**
* @return mixed
*/
public function getQReserve()
{
return $this->qReserve;
}
/**
* @param mixed $qReserve
*/
public function setQReserve($qReserve = null)
{
$this->qReserve = $qReserve;
}
/**
* @return mixed
*/
public function getSsCollectionNumero()
{
return $this->ssCollectionNumero;
}
/**
* @param mixed $ssCollectionNumero
*/
public function setSsCollectionNumero($ssCollectionNumero = null)
{
$this->ssCollectionNumero = $ssCollectionNumero;
}
/**
* @return mixed
*/
public function getCollectionNumero()
{
return $this->collectionNumero;
}
/**
* @param mixed $collectionNumero
*/
public function setCollectionNumero($collectionNumero = null)
{
$this->collectionNumero = $collectionNumero;
}
/**
* @return mixed
*/
public function getCollqc()
{
return $this->collqc;
}
/**
* @param mixed $collqc
*/
public function setCollqc($collqc = null)
{
$this->collqc = $collqc;
}
/**
* @return mixed
*/
public function getCollection()
{
return $this->collection;
}
/**
* @param mixed $collection
*/
public function setCollection($collection = null)
{
$this->collection = $collection;
}
/**
* @return mixed
*/
public function getSousCollection()
{
return $this->sousCollection;
}
/**
* @param mixed $sousCollection
*/
public function setSousCollection($sousCollection = null)
{
$this->sousCollection = $sousCollection;
}
/**
* @return mixed
*/
public function getDepartement()
{
return $this->departement;
}
/**
* @param mixed $departement
*/
public function setDepartement($departement = null)
{
$this->departement = $departement;
}
/**
* @return mixed
*/
public function getRayon()
{
return $this->rayon;
}
/**
* @param mixed $rayon
*/
public function setRayon($rayon = null)
{
$this->rayon = $rayon;
}
/**
* @return mixed
*/
public function getRayon2()
{
return $this->rayon2;
}
/**
* @param mixed $rayon2
*/
public function setRayon2($rayon2 = null)
{
$this->rayon2 = $rayon2;
}
/**
* @return mixed
*/
public function getSujet1()
{
return $this->sujet1;
}
/**
* @param mixed $sujet1
*/
public function setSujet1($sujet1 = null)
{
$this->sujet1 = $sujet1;
}
/**
* @return mixed
*/
public function getSujet2()
{
return $this->sujet2;
}
/**
* @param mixed $sujet2
*/
public function setSujet2($sujet2 = null)
{
$this->sujet2 = $sujet2;
}
/**
* @return mixed
*/
public function getSujet3()
{
return $this->sujet3;
}
/**
* @param mixed $sujet3
*/
public function setSujet3($sujet3 = null)
{
$this->sujet3 = $sujet3;
}
/**
* @return mixed
*/
public function getEtat()
{
return $this->etat;
}
/**
* @param mixed $etat
*/
public function setEtat($etat = null)
{
$this->etat = $etat;
}
/**
* @return mixed
*/
public function getTitre()
{
return $this->titre;
}
/**
* @param Titre $titre
*/
public function setTitre(Titre $titre)
{
$this->titre = $titre;
}
/**
* Calculate the available quantity
*
* @return mixed
*/
public function getDisponible()
{
$disponible = $this->getQem()
- $this->getQManquante()
- $this->getQAbimes()
- $this->getQMisDeCote()
- $this->getQConsignation();
return $disponible;
}
/***
* Retourne this first non empty subject
*
* @return null|Sujets
*/
public function getFirstSujet()
{
if (!empty($this->sujet1)) {
return $this->sujet1;
}
if (!empty($this->sujet2)) {
return $this->sujet2;
}
if (!empty($this->sujet3)) {
return $this->sujet3;
}
return null;
}
}