<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Company;
/**
* @ORM\Entity(repositoryClass="App\Repository\ReglementRepository")
*/
class Reglement
{
const MODE_CHEQUE = 'cheque';
const MODE_CB = 'cb';
const MODE_ESPECES = 'especes';
const MODE_VIREMENT = 'virement';
const MODE_SEPA = 'sepa';
const STATUS_ISSUED = 'Emis';
const STATUS_CANCEL = 'Annulé';
const CANCEL_STATUS_1 = 'Régularisation';
const CANCEL_STATUS_2 = 'Provision insuffisante';
const CANCEL_STATUS_3 = 'Contestation débiteur';
const CANCEL_STATUS_4 = 'Compte clôturé';
const CANCEL_STATUS_5 = 'Autre';
const CANCEL_STATUS_6 = 'Remboursement';
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $mode;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $reference;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $status;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Billing", mappedBy="reglement")
*/
private $billings;
/**
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateRemiseChaque;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Client", inversedBy="reglements")
*/
private $client;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="reglements")
*/
private $company;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $ttc;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $numeroRemise;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $motifCancel;
public function __construct()
{
$this->status = self::STATUS_ISSUED;
$this->billings = new ArrayCollection();
$this->date = new \DateTime('now');
}
public function __toString()
{
return (string) $this->id;
}
public function getId()
{
return $this->id;
}
public function getMode(): ?string
{
return $this->mode;
}
public function setMode(?string $mode): self
{
$this->mode = $mode;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): self
{
$this->reference = $reference;
return $this;
}
/**
* @return Collection|Billing[]
*/
public function getBillings(): Collection
{
return $this->billings;
}
/**
* @return Collection|Billing[]
*/
public function setBillings($billings)
{
$this->billings = $billings;
}
public function addBilling(Billing $billing): self
{
if (!$this->billings->contains($billing)) {
$this->billings[] = $billing;
$billing->setReglement($this);
}
return $this;
}
public function removeBilling(Billing $billing): self
{
if ($this->billings->contains($billing)) {
$this->billings->removeElement($billing);
// set the owning side to null (unless already changed)
if ($billing->getReglement() === $this) {
$billing->setReglement(null);
}
}
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getClient(): ?Client
{
return $this->client;
}
public function setClient(?Client $client): self
{
$this->client = $client;
return $this;
}
public function getTtc(): ?float
{
return $this->ttc;
}
public function setTtc(?float $ttc): self
{
$this->ttc = $ttc;
return $this;
}
public function getNumeroRemise(): ?string
{
return $this->numeroRemise;
}
public function setNumeroRemise(?string $numeroRemise): self
{
$this->numeroRemise = $numeroRemise;
return $this;
}
/**
* @return mixed
*/
public function getDateRemiseChaque()
{
return $this->dateRemiseChaque;
}
/**
* @param mixed $dateRemiseChaque
*/
public function setDateRemiseChaque($dateRemiseChaque): void
{
$this->dateRemiseChaque = $dateRemiseChaque;
}
/**
* @return Company
*/
public function getCompany()
{
return $this->company;
}
/**
* @param mixed $company
*/
public function setCompany($company): void
{
$this->company = $company;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status): void
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getMotifCancel()
{
return $this->motifCancel;
}
/**
* @param mixed $motifCancel
*/
public function setMotifCancel($motifCancel): void
{
$this->motifCancel = $motifCancel;
}
}