<?php
/**
* CommandeSpecialeDetail.php
* Created by Stéphane Brun
* Date: 08/06/2018 at 10:50
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="commande_speciale_detail")
*/
class CommandeSpecialeDetail
{
const HISTORY_WATCH = array(
'quantite' => 'Quantité',
'motes' => 'Note',
'pvu' => 'Prix de vente unitaire',
'reponse' => 'Réponse',
'status' => 'Status',
'comptant' => 'Comptant',
'mastercard' => 'Mastercard',
'visa' => 'Visa',
'interact' => 'Interact',
'certificatCadeau' => 'Certificat cadeau',
'quantiteRecu' => 'Quantité reçue',
'quantiteFacturee' => 'Quantité facturée',
'dateAnnule' => 'Date d\'annulation',
'dateRembourse' => 'Date de remboursement',
'dateEnvoye' => 'Date d\'envoi',
);
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="bon_commande", type="string", length=100, nullable=true)
*/
protected $bonCommande;
/**
* @ORM\Column(name="client_telephone", type="string", length=50, nullable=true)
*/
protected $clientTelephone;
/**
* @ORM\Column(name="client_nom", type="string", length=50, nullable=true)
*/
protected $clientNom;
/**
* @ORM\Column(name="titre", type="string", length=150, nullable=true)
*/
protected $titre;
/**
* @ORM\Column(name="diff", type="integer", nullable=true)
*/
protected $diff;
/**
* @ORM\Column(name="quantite", type="integer")
*/
protected $quantite;
/**
* @ORM\Column(name="notes", type="text", nullable=true)
*/
protected $notes;
/**
* @ORM\Column(name="commentaire_interne", type="text", nullable=true)
*/
protected $commentaireInterne;
/**
* @ORM\Column(name="pvu", type="float", nullable=true)
*/
protected $pvu;
/**
* @ORM\Column(name="commander", type="boolean")
*/
protected $commander = false;
/**
* @ORM\Column(name="repondu", type="boolean")
*/
protected $repondu = false;
/**
* @ORM\Column(name="acompte_recu", type="boolean")
*/
protected $acompteRecu = false;
/**
* @ORM\Column(name="imprime", type="boolean")
*/
protected $imprime = false;
/**
* TODO: c'est une liaison HasOne(Factures)
* @ORM\Column(name="acompte_pris_sur", type="integer", nullable=true)
*/
protected $acomptePrisSur;
/**
* @ORM\Column(name="comptant", type="float", nullable=true)
*/
protected $comptant;
/**
* @ORM\Column(name="mastercard", type="float", nullable=true)
*/
protected $mastercard;
/**
* @ORM\Column(name="visa", type="float", nullable=true)
*/
protected $visa;
/**
* @ORM\Column(name="interact", type="float", nullable=true)
*/
protected $interact;
/**
* @ORM\Column(name="certificat_cadeau", type="float", nullable=true)
*/
protected $certificatCadeau;
/**
* @ORM\Column(name="commande_passee", type="boolean")
*/
protected $commandePassee = false;
/**
* @ORM\Column(name="quantite_recue", type="integer", nullable=true)
*/
protected $quantiteRecue = 0;
/**
* @ORM\Column(name="quantite_facturee", type="integer", nullable=true)
*/
protected $quantiteFacturee = 0;
/**
* @ORM\Column(name="init", type="string", length=10, nullable=true)
*/
protected $init;
/**
* @ORM\Column(name="date", type="datetime")
*/
protected $date;
/**
* @ORM\Column(name="prix_fixe", type="boolean")
*/
protected $prixFixe = false;
/**
* @ORM\Column(name="date_annule", type="datetime", nullable=true)
*/
protected $dateAnnule;
/**
* @ORM\Column(name="date_rembourse", type="datetime", nullable=true)
*/
protected $dateRembourse;
/**
* @ORM\Column(name="date_envoye", type="datetime", nullable=true)
*/
protected $dateEnvoye;
/**
* @ORM\Column(name="commentaire_client", type="string", length=50, nullable=true)
*/
protected $commentaireClient;
/**
* has one Commande
*
* @ORM\ManyToOne(targetEntity="App\Entity\Commande")
* @ORM\JoinColumn(name="commande_id", referencedColumnName="id", nullable=true)
*/
protected $commande;
/**
* has one CommandeSpeciale
*
* @ORM\ManyToOne(targetEntity="App\Entity\CommandeSpeciale", inversedBy="details", cascade={"persist"})
* @ORM\JoinColumn(name="commande_speciale_id", referencedColumnName="id")
*/
protected $commandeSpeciale;
/**
* has one Titre
*
* @ORM\ManyToOne(targetEntity="App\Entity\Titre", inversedBy="commandesSpecialesDetail")
* @ORM\JoinColumn(name="titre_id", referencedColumnName="TISBN")
*/
protected $produit;
/**
* has one TitreCompany
*
* @ORM\ManyToOne(targetEntity="App\Entity\TitreCompany", inversedBy="commandesSpecialeDetails")
* @ORM\JoinColumn(name="titre_company_id", referencedColumnName="id")
*/
protected $titreCompany;
/**
* has one Company
*
* @ORM\ManyToOne(targetEntity="App\Entity\Company")
* @ORM\JoinColumn(name="company_id", referencedColumnName="id")
*/
protected $company;
/**
* has one CommandeSpecialeDetailType
*
* @ORM\ManyToOne(targetEntity="App\Entity\CommandeReponse")
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
*/
protected $reponse;
/**
* has one CommandeSpecialeDetailStatus
*
* @ORM\ManyToOne(targetEntity="App\Entity\CommandeSpecialeDetailStatus")
* @ORM\JoinColumn(name="status_id", referencedColumnName="id")
*/
protected $status;
/**
* @ORM\OneToMany(targetEntity="ReceptionDetail", mappedBy="commandeSpecialeDetail")
*/
protected $receptionDetail;
/**
* @ORM\OneToMany(targetEntity="FacturesDetail", mappedBy="recuAcompte")
*/
protected $facturesDetail;
public function __construct()
{
// Default values
$this->quantite = 1;
$this->date = new \DateTime();
}
public function __toString()
{
return (string)$this->getId();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getClientTelephone()
{
return $this->clientTelephone;
}
/**
* @param mixed $clientTelephone
* @return CommandeSpecialeDetail
*/
public function setClientTelephone($clientTelephone)
{
$this->clientTelephone = $clientTelephone;
return $this;
}
/**
* @return mixed
*/
public function getClientNom()
{
return $this->clientNom;
}
/**
* @param mixed $clientNom
* @return CommandeSpecialeDetail
*/
public function setClientNom($clientNom)
{
$this->clientNom = $clientNom;
return $this;
}
/**
* @return mixed
*/
public function getTitre()
{
return $this->titre;
}
/**
* @param mixed $titre
* @return CommandeSpecialeDetail
*/
public function setTitre($titre)
{
$this->titre = $titre;
return $this;
}
/**
* @return mixed
*/
public function getDiff()
{
return $this->diff;
}
/**
* @param mixed $diff
* @return CommandeSpecialeDetail
*/
public function setDiff($diff)
{
$this->diff = $diff;
return $this;
}
/**
* @return mixed
*/
public function getQuantite()
{
return $this->quantite;
}
/**
* @param mixed $quantite
* @return CommandeSpecialeDetail
*/
public function setQuantite($quantite)
{
$this->quantite = $quantite;
return $this;
}
/**
* @return mixed
*/
public function getNotes()
{
return $this->notes;
}
/**
* @param mixed $notes
* @return CommandeSpecialeDetail
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* @return mixed
*/
public function getCommentaireInterne()
{
return $this->commentaireInterne;
}
/**
* @param mixed $commentaireInterne
* @return CommandeSpecialeDetail
*/
public function setCommentaireInterne($commentaireInterne)
{
$this->commentaireInterne = $commentaireInterne;
return $this;
}
/**
* @return mixed
*/
public function getPvu()
{
return $this->pvu;
}
/**
* @param mixed $pvu
* @return CommandeSpecialeDetail
*/
public function setPvu($pvu)
{
$this->pvu = $pvu;
return $this;
}
/**
* @return mixed
*/
public function getCommander()
{
return $this->commander;
}
/**
* @param mixed $commander
* @return CommandeSpecialeDetail
*/
public function setCommander($commander)
{
$this->commander = $commander;
return $this;
}
/**
* @return mixed
*/
public function getRepondu()
{
return $this->repondu;
}
/**
* @param mixed $repondu
* @return CommandeSpecialeDetail
*/
public function setRepondu($repondu)
{
$this->repondu = $repondu;
return $this;
}
/**
* @return mixed
*/
public function getAcompteRecu()
{
return $this->acompteRecu;
}
/**
* @param mixed $acompteRecu
* @return CommandeSpecialeDetail
*/
public function setAcompteRecu($acompteRecu)
{
$this->acompteRecu = $acompteRecu;
return $this;
}
/**
* @return mixed
*/
public function getImprime()
{
return $this->imprime;
}
/**
* @param mixed $imprime
* @return CommandeSpecialeDetail
*/
public function setImprime($imprime)
{
$this->imprime = $imprime;
return $this;
}
/**
* @return mixed
*/
public function getAcomptePrisSur()
{
return $this->acomptePrisSur;
}
/**
* @param mixed $acomptePrisSur
* @return CommandeSpecialeDetail
*/
public function setAcomptePrisSur($acomptePrisSur)
{
$this->acomptePrisSur = $acomptePrisSur;
return $this;
}
/**
* @return mixed
*/
public function getComptant()
{
return $this->comptant;
}
/**
* @param mixed $comptant
* @return CommandeSpecialeDetail
*/
public function setComptant($comptant)
{
$this->comptant = $comptant;
return $this;
}
/**
* @return mixed
*/
public function getMastercard()
{
return $this->mastercard;
}
/**
* @param mixed $mastercard
* @return CommandeSpecialeDetail
*/
public function setMastercard($mastercard)
{
$this->mastercard = $mastercard;
return $this;
}
/**
* @return mixed
*/
public function getVisa()
{
return $this->visa;
}
/**
* @param mixed $visa
* @return CommandeSpecialeDetail
*/
public function setVisa($visa)
{
$this->visa = $visa;
return $this;
}
/**
* @return mixed
*/
public function getInteract()
{
return $this->interact;
}
/**
* @param mixed $interact
* @return CommandeSpecialeDetail
*/
public function setInteract($interact)
{
$this->interact = $interact;
return $this;
}
/**
* @return mixed
*/
public function getCertificatCadeau()
{
return $this->certificatCadeau;
}
/**
* @param mixed $certificatCadeau
* @return CommandeSpecialeDetail
*/
public function setCertificatCadeau($certificatCadeau)
{
$this->certificatCadeau = $certificatCadeau;
return $this;
}
/**
* @return mixed
*/
public function getCommandePassee()
{
return $this->commandePassee;
}
/**
* @param mixed $commandePassee
* @return CommandeSpecialeDetail
*/
public function setCommandePassee($commandePassee)
{
$this->commandePassee = $commandePassee;
return $this;
}
/**
* @return mixed
*/
public function getQuantiteRecue()
{
return $this->quantiteRecue;
}
/**
* @param mixed $quantiteRecue
* @return CommandeSpecialeDetail
*/
public function setQuantiteRecue($quantiteRecue)
{
$this->quantiteRecue = $quantiteRecue;
return $this;
}
/**
* @return mixed
*/
public function getQuantiteFacturee()
{
return $this->quantiteFacturee;
}
/**
* @param mixed $quantiteFacturee
* @return CommandeSpecialeDetail
*/
public function setQuantiteFacturee($quantiteFacturee)
{
$this->quantiteFacturee = $quantiteFacturee;
return $this;
}
/**
* @return mixed
*/
public function getInit()
{
return $this->init;
}
/**
* @param mixed $init
* @return CommandeSpecialeDetail
*/
public function setInit($init)
{
$this->init = $init;
return $this;
}
/**
* @return mixed
*/
public function getDate()
{
return $this->date;
}
/**
* @param mixed $date
* @return CommandeSpecialeDetail
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* @return mixed
*/
public function getPrixFixe()
{
return $this->prixFixe;
}
/**
* @param mixed $prixFixe
* @return CommandeSpecialeDetail
*/
public function setPrixFixe($prixFixe)
{
$this->prixFixe = $prixFixe;
return $this;
}
/**
* @return mixed
*/
public function getDateAnnule()
{
return $this->dateAnnule;
}
/**
* @param mixed $dateAnnule
* @return CommandeSpecialeDetail
*/
public function setDateAnnule($dateAnnule)
{
$this->dateAnnule = $dateAnnule;
return $this;
}
/**
* @return mixed
*/
public function getDateRembourse()
{
return $this->dateRembourse;
}
/**
* @param mixed $dateRembourse
* @return CommandeSpecialeDetail
*/
public function setDateRembourse($dateRembourse)
{
$this->dateRembourse = $dateRembourse;
return $this;
}
/**
* @return mixed
*/
public function getCommentaireClient()
{
return $this->commentaireClient;
}
/**
* @param mixed $commentaireClient
* @return CommandeSpecialeDetail
*/
public function setCommentaireClient($commentaireClient)
{
$this->commentaireClient = $commentaireClient;
return $this;
}
/**
* @return mixed
*/
public function getCommandeSpeciale()
{
return $this->commandeSpeciale;
}
/**
* @param mixed $commandeSpeciale
* @return CommandeSpecialeDetail
*/
public function setCommandeSpeciale($commandeSpeciale)
{
$this->commandeSpeciale = $commandeSpeciale;
return $this;
}
/**
* @return mixed
*/
public function getProduit()
{
return $this->produit;
}
/**
* @param mixed $produit
* @return CommandeSpecialeDetail
*/
public function setProduit($produit)
{
$this->produit = $produit;
return $this;
}
/**
* @return mixed
*/
public function getCompany()
{
return $this->company;
}
/**
* @param mixed $company
* @return CommandeSpecialeDetail
*/
public function setCompany($company)
{
$this->company = $company;
return $this;
}
/**
* @return mixed
*/
public function getReponse()
{
return $this->reponse;
}
/**
* @param mixed $reponse
* @return CommandeSpecialeDetail
*/
public function setReponse(CommandeReponse $reponse)
{
$this->reponse = $reponse;
return $this;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
* @return CommandeSpecialeDetail
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* @return mixed
*/
public function getDateEnvoye()
{
return $this->dateEnvoye;
}
/**
* @param mixed $dateEnvoye
* @return CommandeSpecialeDetail
*/
public function setDateEnvoye($dateEnvoye)
{
$this->dateEnvoye = $dateEnvoye;
return $this;
}
/**
* @return TitreCompany
*/
public function getTitreCompany()
{
return $this->titreCompany;
}
/**
* @param TitreCompany $titreCompany
* @return CommandeSpecialeDetail
*/
public function setTitreCompany(TitreCompany $titreCompany)
{
$this->titreCompany = $titreCompany;
return $this;
}
/**
* @return Commande
*/
public function getCommande()
{
return $this->commande;
}
/**
* @param Commande $commande
* @return CommandeSpecialeDetail
*/
public function setCommande(Commande $commande = null)
{
$this->commande = $commande;
return $this;
}
/**
* @return mixed
*/
public function getReceptionDetail()
{
return $this->receptionDetail;
}
/**
* @param mixed $receptionDetail
*/
public function setReceptionDetail($receptionDetail)
{
$this->receptionDetail = $receptionDetail;
}
/**
* @return mixed
*/
public function getFacturesDetail()
{
return $this->facturesDetail;
}
/**
* @param mixed $facturesDetail
*/
public function setFacturesDetail($facturesDetail): void
{
$this->facturesDetail = $facturesDetail;
}
/**
* @return mixed
*/
public function getBonCommande()
{
return $this->bonCommande;
}
/**
* @param mixed $bonCommande
* @return CommandeSpecialeDetail
*/
public function setBonCommande($bonCommande)
{
$this->bonCommande = $bonCommande;
return $this;
}
public function getTotalDetail()
{
return $this->getQuantite() * $this->getPvu();
}
public function getTotalAccompte()
{
$total = 0;
$total += $this->getComptant();
$total += $this->getMastercard();
$total += $this->getVisa();
$total += $this->getInteract();
$total += $this->getCertificatCadeau();
$accomptes['comptant'] = $this->getComptant();
$accomptes['mastercard'] = $this->getMastercard();
$accomptes['visa'] = $this->getVisa();
$accomptes['interact'] = $this->getInteract();
$accomptes['certificatCadeau'] = $this->getCertificatCadeau();
$accomptes['total'] = $total;
return $accomptes;
}
}