<?php
namespace App\Entity;
use App\Repository\PaiementFournisseurRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PaiementFournisseurRepository::class)]
class PaiementFournisseur
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'paiements')]
#[ORM\JoinColumn(nullable: true)]
private ?Fournisseur $fournisseur = null;
#[ORM\ManyToOne(inversedBy: 'paiements')]
#[ORM\JoinColumn(nullable: true)]
private ?AchatFournisseur $achat = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: true)]
private ?DetteFournisseur $dette = null;
#[ORM\Column]
private ?float $montant = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $datePaiement = null;
#[ORM\Column(length: 100)]
private ?string $modePaiement = null; // ESPECES, CHEQUE, VIREMENT, MOBILE_MONEY
#[ORM\Column(length: 255, nullable: true)]
private ?string $reference = null; // Numéro de chèque, référence virement, etc.
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $notes = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: true)]
private ?User $utilisateur = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: true)]
private ?Boutique $boutique = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $createdAt = null;
public function __construct()
{
$this->datePaiement = new \DateTime();
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getFournisseur(): ?Fournisseur
{
return $this->fournisseur;
}
public function setFournisseur(?Fournisseur $fournisseur): static
{
$this->fournisseur = $fournisseur;
return $this;
}
public function getAchat(): ?AchatFournisseur
{
return $this->achat;
}
public function setAchat(?AchatFournisseur $achat): static
{
$this->achat = $achat;
return $this;
}
public function getDette(): ?DetteFournisseur
{
return $this->dette;
}
public function setDette(?DetteFournisseur $dette): static
{
$this->dette = $dette;
return $this;
}
public function getMontant(): ?float
{
return $this->montant;
}
public function setMontant(float $montant): static
{
$this->montant = $montant;
return $this;
}
public function getDatePaiement(): ?\DateTimeInterface
{
return $this->datePaiement;
}
public function setDatePaiement(\DateTimeInterface $datePaiement): static
{
$this->datePaiement = $datePaiement;
return $this;
}
public function getModePaiement(): ?string
{
return $this->modePaiement;
}
public function setModePaiement(string $modePaiement): static
{
$this->modePaiement = $modePaiement;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): static
{
$this->reference = $reference;
return $this;
}
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(?string $notes): static
{
$this->notes = $notes;
return $this;
}
public function getUtilisateur(): ?User
{
return $this->utilisateur;
}
public function setUtilisateur(?User $utilisateur): static
{
$this->utilisateur = $utilisateur;
return $this;
}
public function getBoutique(): ?Boutique
{
return $this->boutique;
}
public function setBoutique(?Boutique $boutique): static
{
$this->boutique = $boutique;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function __toString(): string
{
return sprintf(
'Paiement #%d - %s FCFA le %s',
$this->id ?? 0,
number_format($this->montant, 0, ',', ' '),
$this->datePaiement ? $this->datePaiement->format('d/m/Y') : ''
);
}
}