<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\BillingItem;
use App\Entity\Client;
use App\Repository\BillingRepository;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Billing
*
* @ORM\Table(name="billing")
* @ORM\Entity(repositoryClass=BillingRepository::class)
*/
class Billing
{
const MODE_FFDP = 'MODE_FFDP';
const MODE_FRDV = 'MODE_FRDV';
const STATUS_A_REGLE = 'a_regle';
const STATUS_EN_COURS = 'en cours';
const STATUS_VALIDE = 'validée';
const STATUS_SENT = 'envoyée';
const STATUS_SOLDE = 'soldée';
const STATUS_SOLDE_AVOIR = 'soldée (avoir)';
const STATUS_REGLEE = 'reglée';
const STATUS_CONTENTIEUX = 'contentieux';
const TYPE_FACTURE = 'facture';
const TYPE_AVOIR = 'avoir';
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \DateTime|null
*
* @ORM\Column(name="dateBilling", type="date", nullable=true)
*/
private $dateBilling;
/**
* @var \DateTime|null
*
* @ORM\Column(name="sendingDate", type="datetime", nullable=true)
*/
private $sendingDate;
/**
* @var string|null
*
* @ORM\Column(name="modeFacturation", type="string", nullable=true)
*/
private $modeFacturation;
/**
* @var string|null
*
* @ORM\Column(name="code", type="string", nullable=true)
*/
private $code;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var string|null
*
* @ORM\Column(name="paidPaytweak", type="boolean", nullable=true)
*/
private $paidPaytweak = false;
/**
* @var float|null
*
* @ORM\Column(name="ht", type="float", nullable=true)
*/
private $ht;
/**
* @var float|null
*
* @ORM\Column(name="ttc", type="float", nullable=true)
*/
private $ttc;
/**
* @var float|null
*
* @ORM\Column(name="solde", type="float", nullable=true)
*/
private $solde;
/**
* @var string|null
*
* @ORM\Column(name="status", type="string", nullable=true)
*/
private $status = self::STATUS_EN_COURS;
/**
* @var string|null
*
* @ORM\Column(name="accompte", type="string", nullable=true)
*/
private $accompte;
/**
* @var string|null
*
* @ORM\Column(name="linkPaytweak", type="string", nullable=true)
*/
private $linkPaytweak;
/**
* @var string|null
*
* @ORM\Column(name="linkPaytweakExpire", type="boolean", nullable=true)
*/
private $linkPaytweakExpire = false;
/**
* @var string|null
*
* @ORM\Column(name="type", type="string", nullable=true)
*/
private $type = Billing::TYPE_FACTURE;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity=BillingItem::class, mappedBy="billing", cascade={"remove","persist"})
*/
protected $billingItems;
/**
* @var Client
*
* @ORM\ManyToOne(targetEntity=Client::class, cascade={"persist"}, inversedBy="billings")
* @ORM\JoinColumn(name="client_id", referencedColumnName="id")
*/
private $client;
/**
* @var Site
*
* @ORM\ManyToOne(targetEntity=Site::class, cascade={"persist"})
* @ORM\JoinColumn(name="site_id", referencedColumnName="id")
*/
private $site;
/**
* @var Company
* Société emetrice
* @ORM\ManyToOne(targetEntity=Company::class, cascade={"persist"})
* @ORM\JoinColumn(name="company_id", referencedColumnName="id")
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Reglement", inversedBy="billings", cascade={"persist"})
* @ORM\JoinColumn(name="reglement_id", referencedColumnName="id")
*/
private $reglement;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\RDV", inversedBy="RDVBillings")
*/
private $RDV;
/**
* @ORM\OneToMany(targetEntity="App\Entity\RDVBilling", mappedBy="Billing")
*/
private $RDVBillings;
/**
* @var \DateTime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
*/
private $created;
/**
* @var \DateTime $updated
*
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
*/
private $updated;
/**
* @ORM\ManyToOne(targetEntity=User::class, cascade={"persist"})
* @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
*/
protected $creator;
/**
* @ORM\ManyToOne(targetEntity=User::class, cascade={"persist"})
* @ORM\JoinColumn(name="maj_id", referencedColumnName="id")
*/
protected $maj;
public function __toString(){
return (string) $this->code;
}
public function __construct()
{
$this->billingItems = new ArrayCollection();
$this->RDVBillings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
*/
public function getDateBilling()
{
return $this->dateBilling;
}
/**
* @param string|null $dateBilling
*/
public function setDateBilling($dateBilling): void
{
$this->dateBilling = $dateBilling;
}
/**
* @return string|null
*/
public function getModeFacturation(): ?string
{
return $this->modeFacturation;
}
/**
* @param string|null $modeFacturation
*/
public function setModeFacturation(?string $modeFacturation): void
{
$this->modeFacturation = $modeFacturation;
}
/**
* @return string|null
*/
public function getStatus(): ?string
{
return $this->status;
}
/**
* @return string|null
*/
public function getStatusLabel(): ?string
{
return $this->status;
}
/**
* @param string|null $status
*/
public function setStatus(?string $status): void
{
$this->status = $status;
}
/**
* @return string|null
*/
public function getAccompte(): ?string
{
return $this->accompte;
}
/**
* @param string|null $accompte
*/
public function setAccompte(?string $accompte): void
{
$this->accompte = $accompte;
}
/**
* @return ArrayCollection
*/
public function getBillingItems()
{
return $this->billingItems;
}
/**
* @param ArrayCollection $billingItems
*/
public function setBillingItems(ArrayCollection $billingItems): void
{
$this->billingItems = $billingItems;
}
/**
* @return Client
*/
public function getClient(): ?Client
{
return $this->client;
}
/**
* @param Client $client
*/
public function setClient(Client $client): void
{
$this->client = $client;
}
/**
* @return float|null
*/
public function getTtc(): ?float
{
return $this->ttc;
}
/**
* @param float|null $ttc
*/
public function setTtc(?float $ttc): void
{
$this->ttc = $ttc;
}
/**
* @return string|null
*/
public function getType(): ?string
{
return $this->type;
}
/**
* @param string|null $type
*/
public function setType(?string $type): void
{
$this->type = $type;
}
/**
* @return Company
*/
public function getCompany(): ?Company
{
return $this->company;
}
/**
* @param Company $company
*/
public function setCompany($company): void
{
$this->company = $company;
}
/**
* @return Site
*/
public function getSite(): ?Site
{
return $this->site;
}
/**
* @param Site $site
*/
public function setSite(Site $site): void
{
$this->site = $site;
}
/**
* @return string|null
*/
public function getComment()
{
return $this->comment;
}
/**
* @param string|null $comment
*/
public function setComment($comment): void
{
$this->comment = $comment;
}
/**
* @return string|null
*/
public function getCode(): ?string
{
return $this->code;
}
/**
* @param string|null $code
*/
public function setCode(?string $code): void
{
$this->code = $code;
}
/**
* @return RDV
*/
public function getRDV()
{
return $this->RDV;
}
/**
* @param mixed $RDV
*/
public function setRDV($RDV): void
{
$this->RDV = $RDV;
}
/*********/
/* ADD */
/********/
public function addBillingItem(BillingItem $item)
{
$this->billingItems->add($item);
$item->setBilling($this);
}
/*********/
/* REMVOE */
/********/
public function removeBillingItem(BillingItem $item)
{
$this->billingItems->remove($item);
}
public function getReglement(): ?Reglement
{
return $this->reglement;
}
public function setReglement(?Reglement $reglement): self
{
$this->reglement = $reglement;
return $this;
}
/**
* @return Collection|RDVBilling[]
*/
public function getRDVBillings()
{
return $this->RDVBillings;
}
public function addRDVBilling(RDVBilling $rDVBilling): self
{
if (!$this->RDVBillings->contains($rDVBilling)) {
$this->RDVBillings[] = $rDVBilling;
$rDVBilling->setBilling($this);
}
return $this;
}
public function removeRDVBilling(RDVBilling $rDVBilling): self
{
if ($this->RDVBillings->contains($rDVBilling)) {
$this->RDVBillings->removeElement($rDVBilling);
// set the owning side to null (unless already changed)
if ($rDVBilling->getBilling() === $this) {
$rDVBilling->setBilling(null);
}
}
return $this;
}
/**
* @return float|null
*/
public function getSolde(): ?float
{
return $this->solde;
}
/**
* @param float|null $solde
*/
public function setSolde(?float $solde): void
{
$this->solde = $solde;
}
/**
* @return string|null
*/
public function getPaidPaytweak(): ?bool
{
return $this->paidPaytweak;
}
/**
* @param string|null $paidPaytweak
*/
public function setPaidPaytweak(?bool $paidPaytweak): void
{
$this->paidPaytweak = $paidPaytweak;
}
/**
* @return \DateTime
*/
public function getCreated(): ?\DateTime
{
return $this->created;
}
/**
* @param \DateTime $created
*/
public function setCreated(\DateTime $created): void
{
$this->created = $created;
}
/**
* @return \DateTime
*/
public function getUpdated(): ?\DateTime
{
return $this->updated;
}
/**
* @param \DateTime $updated
*/
public function setUpdated(\DateTime $updated): void
{
$this->updated = $updated;
}
/**
* @return mixed
*/
public function getCreator()
{
return $this->creator;
}
/**
* @param mixed $creator
*/
public function setCreator($creator): void
{
$this->creator = $creator;
}
/**
* @return \DateTime|null
*/
public function getSendingDate(): ?\DateTime
{
return $this->sendingDate;
}
/**
* @param \DateTime|null $sendingDate
*/
public function setSendingDate(?\DateTime $sendingDate): void
{
$this->sendingDate = $sendingDate;
}
/**
* @return mixed
*/
public function getMaj()
{
return $this->maj;
}
/**
* @param mixed $maj
*/
public function setMaj($maj): void
{
$this->maj = $maj;
}
/**
* @return float|null
*/
public function getHt(): ?float
{
return $this->ht;
}
/**
* @param float|null $ht
*/
public function setHt(?float $ht): void
{
$this->ht = $ht;
}
/**
* @return string|null
*/
public function getLinkPaytweak(): ?string
{
return $this->linkPaytweak;
}
/**
* @param string|null $linkPaytweak
*/
public function setLinkPaytweak($linkPaytweak)
{
$this->linkPaytweak = $linkPaytweak;
}
/**
* @return string|null
*/
public function getLinkPaytweakExpire()
{
return $this->linkPaytweakExpire;
}
/**
* @param string|null $linkPaytweakExpire
*/
public function setLinkPaytweakExpire(?string $linkPaytweakExpire): void
{
$this->linkPaytweakExpire = $linkPaytweakExpire;
}
}