<?php
namespace App\Entity;
use App\Repository\TblOperationPaieRepository;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\TimestampableTrait;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Validator as PaieAssert;
/**
* @ORM\Entity(repositoryClass=TblOperationPaieRepository::class)
* @PaieAssert\Paie
* @Gedmo\Loggable
*/
class TblOperationPaie
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="date")
* @Gedmo\Versioned
*/
private $date;
/**
* @ORM\Column(type="float")
* @Gedmo\Versioned
*/
private $montant;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Gedmo\Versioned
*/
private $description;
/**
* @ORM\ManyToOne(targetEntity=TblPersonnel::class , inversedBy="tblOperationPaie")
* @ORM\JoinColumn(nullable=false)
* @Gedmo\Versioned
*/
private $personnel;
/**
* @ORM\ManyToOne(targetEntity=RefTypeOperationPaie::class, inversedBy="operationPaies")
* @ORM\JoinColumn(name="type_operation_id", referencedColumnName="id", nullable=false)
* @Gedmo\Versioned
*/
private $typeOperation;
use TimestampableTrait;
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getMontant(): ?float
{
return $this->montant;
}
public function setMontant(float $montant): self
{
$this->montant = $montant;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPersonnel(): ?TblPersonnel
{
return $this->personnel;
}
public function setPersonnel(?TblPersonnel $personnel): self
{
$this->personnel = $personnel;
return $this;
}
public function getTypeOperation(): ?RefTypeOperationPaie
{
return $this->typeOperation;
}
public function setTypeOperation(?RefTypeOperationPaie $typeOperation): self
{
$this->typeOperation = $typeOperation;
return $this;
}
public function toArrayDatatable($urlEdit)
{
return [
$this->getPersonnel()->__toString(),
$this->getTypeOperation()->getId() == RefTypeOperationPaie::AVANCE ? "<span class='badge badge-outline text-warning'>Avance</span>" : "<span class='badge badge-outline text-green'>Paie</span>",
number_format($this->getMontant(), 2, ",", " "),
$this->getCreatedBy()->__toString(),
$this->getDate()->format('d/m/Y'),
'<a class="btn btn-primary" title="Modifier" href=' . $urlEdit . '><i class="ti ti-edit"></i></a>',
];
}
}