<?php
namespace App\Controller\Salarie;
use Mpdf\Mpdf;
use App\Entity\Lrib;
use App\Entity\nuts;
use App\Entity\PPiece;
use App\Entity\Diplome;
use App\Entity\Pbareme;
use App\Entity\Periode;
use App\Entity\VMatrix;
use App\Entity\PDossier;
use App\Entity\Pemploye;
use App\Entity\LContract;
use App\Entity\Pfonction;
use App\Entity\Prubrique;
use App\Entity\Tbulletin;
use App\Entity\PBaremeCimr;
use App\Entity\TbulletinLg;
use App\Entity\LelementFixe;
use App\Entity\PbaremeBrute;
use App\Entity\PdureeContract;
use App\Entity\PnatureContract;
use App\Entity\LdossierContract;
use App\Controller\ApiController;
use App\Entity\PNaturesalarieCab;
use App\Entity\LmatriculationCoti;
use App\Service\CalculPaieService;
use App\Entity\PsituationFamiliale;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as Reader;
use Symfony\Component\Finder\Exception\AccessDeniedException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
#[Route('/salarie/salarie')]
class GestionSalarieController extends AbstractController
{
private $em;
private $api;
private $calculPaieService;
public function __construct(ManagerRegistry $doctrine, ApiController $api, CalculPaieService $calculPaieService)
{
$this->em = $doctrine->getManager();
$this->api = $api;
$this->calculPaieService = $calculPaieService;
}
#[Route('/', name: 'app_salarie_salarie', options: ['expose' => true])]
public function index(Request $request): Response
{
$operations = $this->api->check($this->getUser(), 'app_salarie_salarie', $this->em, $request);
if (!is_array($operations)) {
return $this->redirectToRoute('app_site');
} elseif (count($operations) == 0) {
return $this->render('includes/404.html.twig');
}
$natureSalarieCabs = $this->em->getRepository(PNaturesalarieCab::class)->findAll();
$situationFamiliales = $this->em->getRepository(PsituationFamiliale::class)->findAll();
$fonctions = $this->em->getRepository(Pfonction::class)->findAll();
$pemployes = $this->em->getRepository(Pemploye::class)->findAll();
$naturecontract = $this->em->getRepository(PnatureContract::class)->findBy(['active' => true]);
// dd($naturecontract);:
$pbaremes = $this->em->getRepository(Pbareme::class)->findAll();
$contract = $this->em->getRepository(LContract::class)->findBy(['active' => 1]);
$dossiers = $this->em->getRepository(PDossier::class)->findBy(['active' => true]);
$dossiersReafectation = $this->em->getRepository(PDossier::class)->findBy(['active' => true, 'groupement' => 'FCZ']);
return $this->render('salarie/gestion_salarie/index.html.twig', [
'operations' => $operations,
'natureSalarieCabs' => $natureSalarieCabs,
'situationFamiliales' => $situationFamiliales,
'fonctions' => $fonctions,
'pemployes' => $pemployes,
'contracts' => $contract,
'naturecontract' => $naturecontract,
'dossiers' => $dossiers,
'dossiersReafectation' => $dossiersReafectation,
'baremes' => $pbaremes
]);
}
#[Route('/app_salarie_salarie_list', name: 'app_salarie_salarie_list', options: ['expose' => true])]
public function app_salarie_salarie_list(Request $request): Response
{
$draw = $request->query->get('draw');
$start = $request->query->get('start') ?? 0;
$length = $request->query->get('length') ?? 10;
$search = $request->query->all('search')["value"];
$orderColumnIndex = $request->query->all('order')[0]['column'];
$orderColumn = $request->query->all("columns")[$orderColumnIndex]['name'];
$orderDir = $request->query->all('order')[0]['dir'] ?? 'asc';
$dossier = $request->getSession()->get('dossier');
// dd($dossier);
$queryBuilder = $this->em->createQueryBuilder()
->select('p.id as employe_id, n.designation as nature, c.code as contract,p.cin, p.nom as nom, c.id as matricule , p.prenom')
->from(Pemploye::class, 'p')
->innerJoin('p.contracts', 'c')
->innerJoin('c.ldossierContracts', 'ldossierContract')
->innerJoin('c.pnatureContract', 'n')
->Where('c.active = 1')
->andWhere('ldossierContract.active = 1')
->andWhere('ldossierContract.dossier_id = :dossier')
->setParameter('dossier', $dossier);
if (!empty($search)) {
$queryBuilder->andWhere('(n.designation LIKE :search OR p.cin LIKE :search OR c.code LIKE :search OR c.id LIKE :search OR p.matricule LIKE :search OR p.nom LIKE :search OR p.prenom LIKE :search)')
->setParameter('search', "%$search%");
}
if (!empty($orderColumn)) {
$queryBuilder->orderBy("$orderColumn", $orderDir);
}
$filteredRecords = count($queryBuilder->getQuery()->getResult());
// Paginate results
$queryBuilder->setFirstResult($start)
->setMaxResults($length);
$results = $queryBuilder->getQuery()->getResult();
// dd($results);
$totalRecords = $this->em->createQueryBuilder()
->select('COUNT(p.id)')
->from(Pemploye::class, 'p')
->innerJoin('p.contracts', 'c')
->innerJoin('c.ldossierContracts', 'ldossierContract')
->innerJoin('c.pnatureContract', 'n')
->Where('c.active = 1')
->andWhere('ldossierContract.active = 1')
->andWhere('ldossierContract.dossier_id = :dossier')
->setParameter('dossier', $dossier)
->getQuery()
->getSingleScalarResult();
return new JsonResponse([
'draw' => $draw,
'recordsTotal' => $totalRecords,
'recordsFiltered' => $filteredRecords,
'data' => $results,
]);
}
#[Route('/salarienoactive', name: 'app_salarie_salarie_noactive', options: ['expose' => true])]
public function salarienoactive(Request $request): Response
{
$operations = $this->api->check($this->getUser(), 'app_salarie_salarie', $this->em, $request);
if (!$operations) {
return new AccessDeniedException();
}
$natureSalarieCabs = $this->em->getRepository(PNaturesalarieCab::class)->findAll();
$situationFamiliales = $this->em->getRepository(PsituationFamiliale::class)->findAll();
$fonctions = $this->em->getRepository(Pfonction::class)->findAll();
$pemployes = $this->em->getRepository(Pemploye::class)->findBy(['active' => 0]);
$naturecontract = $this->em->getRepository(PnatureContract::class)->findAll();
$pbaremes = $this->em->getRepository(Pbareme::class)->findAll();
$contract = $this->em->getRepository(LContract::class)->findBy(['active' => 1]);
return $this->render('salarie/gestion_salarie/index.html.twig', [
'operations' => $operations,
'natureSalarieCabs' => $natureSalarieCabs,
'situationFamiliales' => $situationFamiliales,
'fonctions' => $fonctions,
'pemployes' => $pemployes,
'contracts' => $contract,
'naturecontract' => $naturecontract,
'baremes' => $pbaremes,
]);
}
#[Route('/new', name: 'app_salarie_salarie_new', options: ['expose' => true])]
public function new(Request $request, UserPasswordHasherInterface $userPasswordHasher): Response
{
// dd($request);
$employe = $this->em->getRepository(Pemploye::class)->findOneBy(['cin' => trim($request->get('cin')), 'active' => true]);
if ($employe) {
return new JsonResponse('Employe déja exist !', 500);
}
if ($request->get('sexe') == 0) {
return new JsonResponse('Veuillez choisir le sexe de l\'employé !', 500);
}
$employe = new Pemploye();
$employe->setNom($request->get('nom'));
$employe->setPrenom($request->get('prenom'));
$employe->setDateNaissance(new \DateTime($request->get('date_naissance')));
$employe->setLieuNaissance($request->get('lieu_naissance'));
$employe->setCin(trim($request->get('cin')));
$employe->setSexe($request->get('sexe'));
$employe->setNombreJourConge((float)$request->get('nbr_jour_conge'));
$employe->setRoles([]);
$employe->setSituationFamilialeId(
$this->em->getRepository(PsituationFamiliale::class)->find($request->get('situation_familiale'))
);
$employe->setPassword($userPasswordHasher->hashPassword(
$employe,
'0123456789'
));
$employe->setIsFirstLogin(true);
if($request->get('nombre_enfant')) {
$employe->setNombreEnfants($request->get('nombre_enfant'));
}
$employe->setAdresse1($request->get('adresse_1'));
if ($request->get('adresse_2')) {
$employe->setAdresse2($request->get('adresse_2'));
}
$employe->setNationalite($request->get('nationalite'));
$employe->setSexe($request->get('sexe'));
$employe->setCodePostal($request->get('code_postal'));
if ($request->get('code_postal')) {
$employe->setCodePostal($request->get('code_postal'));
}
$employe->setVille($request->get('ville'));
$employe->setPays($request->get('pays'));
$employe->setTel1($request->get('telephone_1'));
if ($request->get('telephone_2')) {
$employe->setTel2($request->get('telephone_2'));
}
if ($request->get('email')) {
$employe->setEmail($request->get('email'));
}
$employe->setActive(0);
$this->em->persist($employe);
$this->em->flush();
$employe_id = $employe->getId();
$Diplomes = json_decode($request->get('diplomes'));
$diplome = $this->em->getRepository(Diplome::class)->add_diplome(
$Diplomes,
$employe_id
);
return new JsonResponse($employe_id);
}
#[Route('/update_emp', name: 'app_salarie_salarie_update', options: ['expose' => true])]
public function update_emp(Request $request): Response
{
// dd($request->get('diplomes'));
$employe = $this->em->getRepository(Pemploye::class)->update_employe($request);
$employe_id = $employe->getId();
$Diplomes = json_decode($request->get('diplomes'));
$diplome = $this->em->getRepository(Diplome::class)->add_diplome(
$Diplomes,
$employe_id
);
return new JsonResponse($employe_id);
}
#[Route('/contract', name: 'app_salarie_contract', options: ['expose' => true])]
public function contract(Request $request): Response
{
// dd($request);
if (
$request->get('nature_contrat') == "" or $request->get('duree_contrat') == "" or $request->get('bareme') == "" or $request->get('fonction') == "0"
or $request->get('affectation') == "" or $request->get('date_contrat') == "" or $request->get('date_fin') == "" or $request->get('affectation') == ""
) {
return new JsonResponse('Veuillez remplir tous les champs!', 500);
}
$employe = $this->em->getRepository(Pemploye::class)->find($request->get('employe_id'));
$natureContrat = $this->em->getRepository(PnatureContract::class)->find($request->get('nature_contrat'));
$dossier = $this->em->getRepository(PDossier::class)->find($request->get('affectation'));
$contract = $this->em->getRepository(LContract::class)->findOneBy(['employe' => $employe, 'dossier' => $dossier, 'pnatureContract' => $natureContrat, 'active' => true]);
// dd($contract);
if ($contract) {
return new JsonResponse('Vous avez une contrat active!', 500);
}
$piece = $this->em->getRepository(PPiece::class)->find(8); //
$contract = new LContract();
$contract->setUserCreated($this->getUser());
$contract->setEmploye($employe);
$contract->setPnatureContract($natureContrat);
$contract->setBareme(
$this->em->getRepository(Pbareme::class)->find($request->get('bareme'))
);
$contract->setDateDebut(new \DateTime($request->get('date_contrat')));
$contract->setDateAnciennte(new \DateTime($request->get('date_contrat')));
$contract->setDossier($dossier);
$contract->setDureeContract(
$this->em->getRepository(PdureeContract::class)->find($request->get('duree_contrat'))
);
$contract->setPiece($piece);
$contract->setfonction(
$this->em->getRepository(Pfonction::class)->find($request->get('fonction'))
);
$contract->setActive(1);
$contract->setPriseEnCharge($employe->getNombreEnfants());
$contract->setSalaireaffecte($request->get('salaire_affecte'));
$contract->setCreated(new \DateTime());
if ($request->get('salaire_grille')) {
$contract->setSalairegrille($request->get('salaire_grille'));
}
if ($request->get('date_fin')) {
$contract->setDateFin(new \DateTime($request->get('date_fin')));
}
$employe->setActive(1);
$this->em->persist($contract);
// $this->em->flush();
$rubrique_ppc = $this->em->getRepository(Prubrique::class)->find(16);
$rubrique_rpc = $this->em->getRepository(Prubrique::class)->find(37);
$dossierContract = $this->em->getRepository(LdossierContract::class)->findOneBy(['contract_id' => $contract, 'active' => true]);
// dd($Lcontract);
if ($dossierContract) {
$dossierContract->setDossierId($contract->getDossier());
} else {
$dossierContract = new LdossierContract();
$dossierContract->setDossierId($contract->getDossier());
$dossierContract->setContractId($contract);
$dossierContract->setUserCreated($this->getUser());
$dossierContract->setCreated(new \DateTime());
$this->em->persist($dossierContract);
// $this->em->flush();
}
if ($request->get('ppc')) {
$ppc = (int)$request->get('ppc');
if ($ppc != 0) {
$elementFixe = new LelementFixe();
$elementFixe->setContract($contract);
$elementFixe->setRubrique($rubrique_ppc);
$elementFixe->setSens(1);
$elementFixe->setMontant($request->get('ppc'));
$this->em->persist($elementFixe);
}
}
if ($request->get('rpc')) {
$rpc = (int)$request->get('rpc');
if ($rpc != 0) {
$elementFixe = new LelementFixe();
$elementFixe->setContract($contract);
$elementFixe->setRubrique($rubrique_rpc);
$elementFixe->setSens(-1);
$elementFixe->setMontant($request->get('rpc'));
$this->em->persist($elementFixe);
}
}
$this->em->flush();
return new JsonResponse($contract->getId());
}
#[Route('/update_contract', name: 'app_salarie_contract_update', options: ['expose' => true])]
public function update_contract(Request $request): Response
{
// dd($request->get('contract_id'));
$contract = $this->em->getRepository(LContract::class)->update_contract_full($request);
return new JsonResponse($contract);
}
#[Route('/cnss', name: 'app_salarie_cnss', options: ['expose' => true])]
public function cnss(Request $request): Response
{
// dd($request);
$contract = $this->em->getRepository(LContract::class)->find($request->get('contract_id'));
if ($request->get('rib') != "") {
if (preg_match('/^[0-9\s]+$/', $request->get('rib')) && strlen(trim($request->get('rib'))) < 24) {
return new JsonResponse('RIB incorrect', 500);
}
$Lrib = $this->em->getRepository(Lrib::class)->findOneBy(['contact_id' => $contract, 'active' => true, 'code' => $request->get('rib')]);
if (!$Lrib) {
$checkRibAlreadyExist = $this->em->getRepository(Lrib::class)->findOneBy(['active' => true, 'code' => $request->get('rib')]);
if($checkRibAlreadyExist && $checkRibAlreadyExist->getContactId()->getEmploye()->getCin() != $contract->getEmploye()->getCin()) {
return new JsonResponse('Rib déja lié à une autre personne! ('.$checkRibAlreadyExist->getContactId()->getEmploye()->getCin().')', 500);
}
$Lrib = new Lrib();
$Lrib->setContactId($contract );
$Lrib->setCode($request->get('rib'));
$Lrib->setDesignation('-');
$Lrib->setSwift($request->get('swift'));
$Lrib->setBanque($request->get('banque'));
$this->em->persist($Lrib);
}
}
// cnss
if ($request->get('cnss') && trim($request->get('cnss')) != "") {
$contract->setCnss($request->get('cnss'));
$contract->setDateCnss(new \DateTime($request->get('date_declaration_cnss')));
} else {
$contract->setCnss('CNSS00000');
$contract->setDateCnss(new \DateTime());
}
// cimr
if ($request->get('cimr') && trim($request->get('cimr')) != "") {
$contract->setCimr($request->get('cimr'));
$contract->setDateCimr(new \DateTime($request->get('date_declaration_cimr')));
} else {
$contract->setCimr('CIMR0000');
$contract->setDateCimr(new \DateTime());
}
$this->em->flush();
return new JsonResponse('ok');
}
#[Route('/update_cnss', name: 'app_salarie_cnss_update', options: ['expose' => true])]
public function update_cnss(Request $request): Response
{
$contract = $this->em->getRepository(LContract::class)->find($request->get('contract_id'));
if ($request->get('rib') && trim($request->get('rib')) != "") {
if (preg_match('/^[0-9\s]+$/', $request->get('rib')) && strlen(trim($request->get('rib'))) < 24) {
return new JsonResponse('RIB incorrect', 500);
}
$oldRib = $this->em->getRepository(Lrib::class)->findOneBy(['contact_id' => $contract, 'active' => true]);
$checkRibAlreadyExist = $this->em->getRepository(Lrib::class)->findOneBy(['active' => true, 'code' => $request->get('rib')]);
if($checkRibAlreadyExist && $checkRibAlreadyExist->getContactId()->getEmploye()->getCin() != $contract->getEmploye()->getCin()) {
return new JsonResponse('Rib déja lié à une autre personne! ('.$checkRibAlreadyExist->getContactId()->getId().')', 500,[] , JSON_UNESCAPED_UNICODE);
}
if (!$oldRib) {
$Lrib = new Lrib();
$Lrib->setContactId($contract);
$Lrib->setCode($request->get('rib'));
$Lrib->setDesignation('-');
$Lrib->setSwift($request->get('swift'));
$Lrib->setBanque($request->get('banque'));
$this->em->persist($Lrib);
} elseif ($oldRib && $oldRib->getCode() != $request->get('rib')) {
$oldRib->setActive(false);
$Lrib = new Lrib();
$Lrib->setContactId(
$this->em->getRepository(LContract::class)->find($request->get('contract_id'))
);
$Lrib->setCode($request->get('rib'));
$Lrib->setDesignation('-');
$Lrib->setSwift($request->get('swift'));
$Lrib->setBanque($request->get('banque'));
$this->em->persist($Lrib);
} elseif ($oldRib) {
$oldRib->setSwift($request->get('swift'));
$oldRib->setBanque($request->get('banque'));
}
}
if ($request->get('cnss') && trim($request->get('cnss')) != "" && trim($request->get('cnss')) != $contract->getCnss()) {
$contract->setCnss($request->get('cnss'));
$contract->setDateCnss(new \DateTime($request->get('date_declaration_cnss')));
}
// cimr
if ($request->get('cimr') && trim($request->get('cimr')) != "" && trim($request->get('cimr')) != $contract->getCimr()) {
$contract->setCimr($request->get('cimr'));
$contract->setDateCimr(new \DateTime($request->get('date_declaration_cimr')));
}
$this->em->flush();
return new JsonResponse('ok');
}
#[Route('/plusinfo', name: 'app_salarie_plusinfo', options: ['expose' => true])]
public function plusinfo(Request $request): Response
{
$LmatriculationCoti = $this->em->getRepository(Pemploye::class)->add_plusinfo($request);
return new JsonResponse('ok');
}
#[Route('/contractaff', name: 'app_salarie_contractaff', options: ['expose' => true])]
public function contractaff(Request $request): Response
{
$operations = $this->api->check($this->getUser(), 'app_salarie_salarie', $this->em, $request);
$employe = $request->get('employe_id');
$queryBuilder = $this->em->createQueryBuilder()
// n.designation')
->select('contract.id as id, p.id as employe, contract.code, p.nom as nom, p.matricule as matricule ,
p.prenom,n.Abreviation,t.designation as type,n.designation')
// ->select('contract.id as id, contract.code, p.nom as nom, p.matricule as matricule , p.prenom, n.type')
->from(LContract::class, 'contract')
->innerJoin('contract.employe', 'p')
->innerJoin('contract.pnatureContract', 'n')
->innerJoin('n.type', 't')
->Where('contract.active = 1')
->andWhere('contract.employe = :employe')
->setParameter('employe', $employe);
$results = $queryBuilder->getQuery()->getResult();
// dd($results);
$data = $this->render('salarie/gestion_salarie/modals/contract_detail.html.twig', [
'contracts' => $results, 'operations' => $operations, 'employe' => $employe
])->getContent();
return new JsonResponse($data);
}
#[Route('/contractinfo', name: 'app_salarie_contractinfo', options: ['expose' => true])]
public function contractinfo(Request $request): Response
{
$contract_id = $request->get('contract_id');
$queryBuilder = $this->em->createQueryBuilder()
->select("contract.id as id,p.id as employeid,n.id as pnatureid,
p.nom, p.adresse2, p.tel2,p.nationalite, p.ville,p.pays, p.email, p.prenom, p.adresse1, p.tel1, p.date_naissance, p.nombre_enfants,p.lieu_naissance, p.nbr_pris_en_charge,p.cin, p.sexe,situation_familiale.id as situation_familiale_id,
n.Abreviation,n.designation,contract.date_fin,contract.date_debut,f.id as fonctionid,f.Designation as fonction,
contract.Salaireaffecte,d.Designation as dure,d.id as iddure,b.id as bareme,ds.id as dossier, ds.abreviation as dossierAbrev
,contract.Salairegrille,contract.PPC,contract.RPC,b.Profil")
->from(LContract::class, 'contract')
->innerJoin('contract.employe', 'p')
->innerJoin('contract.pnatureContract', 'n')
->LEFTJoin('contract.fonction', 'f')
->LEFTJoin('p.situation_familiale_id', 'situation_familiale')
->LEFTJoin('contract.dureeContract', 'd')
->LEFTJoin('contract.bareme', 'b')
->LEFTJoin('contract.dossier', 'ds')
->Where('contract.active = 1')
->andWhere('contract.id = :contractid')
->setParameter('contractid', $contract_id);
$results = $queryBuilder->getQuery()->getResult();
// dd($results);
return new JsonResponse($results);
}
#[Route('/app_salarie_update_save', name: 'app_salarie_update_save', options: ['expose' => true])]
public function app_salarie_update_save(Request $request): Response
{
// dd($request);
$contract = $this->em->getRepository(LContract::class)->find($request->get('contract_id'));
if($contract) {
$employe = $contract->getEmploye();
$employe->setNom($request->get('nom'));
$employe->setPrenom($request->get('prenom'));
$employe->setDateNaissance(new \DateTime($request->get('date_naissance')));
$employe->setLieuNaissance($request->get('lieu_naissance'));
$employe->setSexe($request->get('sexe'));
if($request->get('situation_familiale')) {
$employe->setSituationFamilialeId(
$this->em->getRepository(PsituationFamiliale::class)->find($request->get('situation_familiale'))
);
}
$employe->setAdresse1($request->get('adresse_1'));
if ($request->get('adresse_2')) {
$employe->setAdresse2($request->get('adresse_2'));
}
if($request->get('nombre_enfant')) {
$employe->setNombreEnfants($request->get('nombre_enfant'));
}
$employe->setNationalite($request->get('nationalite'));
$employe->setSexe($request->get('sexe'));
$employe->setVille($request->get('ville'));
$employe->setPays($request->get('pays'));
if ($request->get('telephone_2')) {
$employe->setTel2($request->get('telephone_2'));
}
if ($request->get('telephone_1')) {
$employe->setTel1($request->get('telephone_1'));
}
if ($request->get('email')) {
$employe->setEmail($request->get('email'));
}
$employe->setUpdated(new \DateTime());
$employe->setUserUpdated($this->getUser());
$this->em->flush();
}
return new JsonResponse(1);
}
#[Route('/updatecontract', name: 'app_salarie_updatecontract', options: ['expose' => true])]
public function updatecontract(Request $request): Response
{
$updatecontract = $this->em->getRepository(LContract::class)->update_contract($request);
return new JsonResponse($updatecontract);
}
#[Route('/getmatricule', name: 'app_salarie_get_cnss_cimr', options: ['expose' => true])]
public function getmatricule(Request $request): Response
{
// dd($request);
$contract = $this->em->getRepository(LContract::class)->find($request->get('contract_id'));
if($request->get('newfonction')){
$contract->setFonction(
$this->em->getRepository(Pfonction::class)->find($request->get('newfonction'))
);
$contract->setUpdated(new \DateTime());
$contract->setUserUpdated($this->getUser());
$this->em->flush();
}
$rib = $this->em->getRepository(Lrib::class)->findOneBy(['contact_id' => $contract, 'active' => true]);
return new JsonResponse([
'rib' => $rib ? $rib->getCode() : '',
'swift' => $rib ? $rib->getSwift() : '',
'banque' => $rib ? $rib->getBanque() : '',
'cimr' => $contract->getCimr(),
'datecimr' => $contract->getDateCimr() ? $contract->getDateCimr()->format("Y-m-d") : null,
'datecnss' => $contract->getDateCnss() ? $contract->getDateCnss()->format("Y-m-d") : null,
'cnss' => $contract->getCnss(),
]);
}
#[Route('/updatecotis', name: 'app_salarie_updatecotis', options: ['expose' => true])]
public function updatecotis(Request $request): Response
{
// dd($request->get('date_cnssup'));
$updatecontract = $this->em->getRepository(LmatriculationCoti::class)->update_cnss_cimr($request);
return new JsonResponse($updatecontract);
}
#[Route('/desactiver_cnt', name: 'app_salarie_desactiver', options: ['expose' => true])]
public function desactiver_cnt(Request $request): Response
{
$Lcontract = $this->em->getRepository(LContract::class)->find($request->get('contract'));
$this->disableContract($Lcontract, $request->get('date'), $request->get('motif'));
// $contract_id = $request->get('contract_id');
// $contract = $this->em->getRepository(LContract::class)->find($contract_id);
return new JsonResponse('Bien enregistrer');
}
public function disableContract($Lcontract, $date, $motif) :void {
$employe = $Lcontract->getEmploye();
$Lcontract->setActive(0);
$Lcontract->setDateSortie(new \DateTime($date));
$Lcontract->setMotifSortie($motif);
$Lcontract->setUserDesactiver($this->getUser());
$Lcontract->setDateDesactiver(new \DateTime());
$dossierContract = $this->em->getRepository(LdossierContract::class)->findBy(['contract_id' => $Lcontract, 'active' => true]);
foreach ($dossierContract as $key => $dc) {
$dc->setActive(false);
}
// $LmatriculationCoti = $this->em->getRepository(Lrib::class)->desactivate_rib($request);
// $rib = $this->em->getRepository(Lrib::class)->findBy(['contact_id' => $Lcontract]);
// foreach ($rib as $key => $r) {
// $r->setActive(false);
// }
$LmatriculationCoti = $this->em->getRepository(LmatriculationCoti::class)->findBy(['contract_id' => $Lcontract]);
foreach ($LmatriculationCoti as $key => $r) {
$r->setActive(false);
}
$this->em->flush();
if(count($employe->getActiveContracts()) == 0) {
$employe->setActive(false);
}
$this->em->flush();
}
#[Route('/reaffectation', name: 'app_salarie_reaffectation', options: ['expose' => true])]
public function app_salarie_reaffectation(Request $request): Response
{
$dossierReaffectation = $request->get('nouvelle_affectation');
$dossierReaffectation = $this->em->getRepository(PDossier::class)->find($dossierReaffectation);
$contract = $this->em->getRepository(LContract::class)->find($request->get('contract'));
if ($contract->getDossier()->getId() == $dossierReaffectation->getId()) {
return new JsonResponse('Contrat déja exist dans cette affecation !', 500);
} else if (in_array($contract->getDossier()->getId(), [17, 39,40])) {
return new JsonResponse('Vous ne pouvez pas changer l\'affectation!', 500);
}
$ldossierContrat = $this->em->getRepository(LdossierContract::class)->findOneBy(['contract_id' => $contract, 'active' => true]);
if ($ldossierContrat) {
$ldossierContrat->setActive(false);
$ldossierContrat->setDateReaffectation(new \DateTime());
$ldossierContrat->setUserReaffectation($this->getUser());
}
$ldossierContrat = new LdossierContract();
$ldossierContrat->setContractId($contract);
$ldossierContrat->setDossierId($dossierReaffectation);
$ldossierContrat->setCreated(new \DateTime());
$ldossierContrat->setDateReaffectation(new \DateTime());
$ldossierContrat->setUserCreated($this->getUser());
$ldossierContrat->setUserReaffectation($this->getUser());
$this->em->persist($ldossierContrat);
$contract->setDossier($dossierReaffectation);
$this->em->flush();
// $contract_id = $request->get('contract_id');
// $contract = $this->em->getRepository(LContract::class)->find($contract_id);
return new JsonResponse('Bien enregistrer');
}
#[Route('/app_salarie_import_sortant', name: 'app_salarie_import_sortant', options: ['expose' => true])]
public function app_salarie_import_sortant(Request $request): Response
{
// $dossier = $this->em->getRepository(PDossier::class)->find($request->get('dossier'));
$reader = new Reader();
$spreadsheet = $reader->load($request->files->get('file'));
$worksheet = $spreadsheet->getActiveSheet();
$spreadSheetArys = $worksheet->toArray();
unset($spreadSheetArys[0]);
$array = [];
// dd($spreadSheetArys);
$count = 0;
foreach ($spreadSheetArys as $key => $sheet) {
$count++;
$contract = $this->em->getRepository(LContract::class)->findOneBy(['id' => $sheet[0]]);
// $contract = $this->em->getRepository(LContract::class)->findOneBy(['id' => $sheet[0],'active' => true]);
if(!$contract) {
return new JsonResponse('Contrat introuvable à la ligne '.($key + 1).' !', 500);
}
if(strtolower($contract->getEmploye()->getCin()) != strtolower($sheet[3])) {
return new JsonResponse('le contrat n\'appartient pas à ce cin '.($key + 1).' !', 500);
}
array_push($array, [
'id' => $count,
'nom' => $contract->getEmploye()->getNom(),
'prenom' => $contract->getEmploye()->getPrenom(),
'cin' => $contract->getEmploye()->getCin(),
'contract_id' => $contract->getId(),
'dossier' => $contract->getDossier()->getAbreviation(),
'motif' => $sheet[5],
'dateSortie' => $sheet[4],
]);
}
return new JsonResponse($array);
}
#[Route('/app_salarie_import_sortant_save', name: 'app_salarie_import_sortant_save', options: ['expose' => true])]
public function app_salarie_import_sortant_save(Request $request): Response
{
$sortants = json_decode($request->get('sortants'));
foreach ($sortants as $key => $sortant) {
$Lcontract = $this->em->getRepository(LContract::class)->find($sortant->contract_id);
$this->disableContract($Lcontract, $sortant->dateSortie, $sortant->motif);
}
return new JsonResponse('Bien enregistrer');
}
#[Route('/app_salarie_imprimer_attestation_salaire/{contract}/{credit}', name: 'app_salarie_imprimer_attestation_salaire', options: ['expose' => true])]
public function app_salarie_imprimer_attestation_salaire(Request $request, LContract $contract, $credit): Response
{
$html="<div style='text-align:justify; line-height:2.8; margin-left: 10px; margin-right: 10px;'>
<p>".$this->getParagraphAttestationSalaire($contract)[0]."
<br/>
<br/>
".$this->getCredit($credit)."
</p>
<br/>"
;
if(in_array($contract->getDossier()->getAbreviation(), ['ISAA', 'IMIN']) ) {
$html .= "<p style='text-align: left;margin-top:30px; margin-right: 60px; font-weight: bold' >".$this->getParagraphAttestationSalaire($contract)[1]."</p>
</div>";
} else {
$html .= "<p style='text-align: left;margin-top:80px; margin-right: 60px; font-weight: bold' >".$this->getParagraphAttestationSalaire($contract)[1]."</p>
</div>";
}
$html = $this->render("salarie/gestion_salarie/pdfs/attestation.html.twig", [
"titre" => "ATTESTATION DE SALAIRE",
"contract" => $contract,
"html" => $html,
'ref' => 'DRH-ATS-' . $contract->getId() . '_' . $this->calculPaieService->getPeriode()->getCode()
])->getContent();
$mpdf = new Mpdf([
'mode' => 'utf-8',
'margin_left' => 25,
'margin_right' => 25
]);
$mpdf->SetTitle('Attestation Salaire');
$mpdf->WriteHTML($html);
$mpdf->Output("Attestation Salaire " . $contract->getEmploye()->getPrenom() . " " . $contract->getEmploye()->getNom() . ".pdf", "I");
die;
}
#[Route('/app_salarie_imprimer_attestation_travail/{contract}/{credit}', name: 'app_salarie_imprimer_attestation_travail', options: ['expose' => true])]
public function app_salarie_imprimer_attestation_travail(Request $request, LContract $contract, $credit): Response
{
$html = "<div style='text-align:justify; line-height:2.8; margin-left: 10px; margin-right: 10px;'>
<p>" . $this->getParagraphAttestationTravail($contract)[0] . "
<br/>
<br/>
" . $this->getCredit($credit) . "
</p>
<br/>
<p style='text-align: left;margin-top:80px; margin-right: 60px; font-weight: bold' >" . $this->getParagraphAttestationTravail($contract)[1] . "</p>
</div>";
$html = $this->render("salarie/gestion_salarie/pdfs/attestation.html.twig", [
"titre" => "ATTESTATION DE TRAVAIL",
"contract" => $contract,
"html" => $html,
'ref' => 'DRH-ATT-' . $contract->getId() . '_' . $this->calculPaieService->getPeriode()->getCode()
])->getContent();
$mpdf = new Mpdf([
'mode' => 'utf-8',
'margin_left' => 25,
'margin_right' => 25
]);
$mpdf->SetTitle('Attestation Travail');
// $mpdf->SetHTMLFooter(
// $this->render("planification/pdfs/footer.html.twig")->getContent()
// );
$mpdf->WriteHTML($html);
$mpdf->Output("Attestation Travail " . $contract->getEmploye()->getPrenom() . " " . $contract->getEmploye()->getNom() . ".pdf", "I");
die;
}
public function getCredit($credit)
{
switch ($credit) {
case 1:
$result = "Cette attestation est délivrée à l’intéressé(e) pour des raisons administratives et <b style='font-weight: bold'>ne peut nullement servir à la contractualisation d'un emprunt</b>.";
break;
case 2:
$result = "Ce document est délivré à la demande de l’interesse(e) uniquement pour contracter un crédit de logement.";
break;
case 3:
$result = "Cette attestation est délivré(e) à l’interesse(e) pour servir et valoir ce que de droit.";
break;
}
return $result;
}
public function getParagraphAttestationTravail($contract)
{
if ($contract->getEmploye()->getSexe() == 'M') {
$nomPrenom = 'M. ' . $contract->getEmploye()->getPrenom() . ' ' . $contract->getEmploye()->getNom();
} elseif ($contract->getEmploye()->getSexe() == 'F') {
$nomPrenom = 'Mme ' . $contract->getEmploye()->getPrenom() . ' ' . $contract->getEmploye()->getNom();
} else {
$nomPrenom = $contract->getEmploye()->getPrenom() . ' ' . $contract->getEmploye()->getNom();
}
switch ($contract->getDossier()->getAbreviation()) {
case 'SLMG':
$paragraph = "Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> csis au : 5 Rue Hussein 1er, Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, est employée au sein de notre établissement en qualité de(d') <b style='font-weight: bold'> " . $contract->getFonction()->getDesignation() . " </b> auprès de (du) <b style='font-weight: bold'>" . $contract->getDossier()->getDesignation() . "</b>, et ce depuis le <b style='font-weight: bold'> " . date_format($contract->getDateAnciennete(), 'd/m/Y') . ".</b>";
$dossier=$this->em->getRepository(PDossier::class)->findOneBy(['abreviation'=>'SFCZ'])->getDesignation();
break;
case 'PGRO':
$paragraph = "<p >Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> , société à responsabilité limitée, au capital social 1.000.000 dirhams, immatriculée au registre de commerce de rabat sous n°136363, sise à : Avenue Allal El Fassi, Madinat Al Irfane, Hay Riad, Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, est employé(e) au sein de notre établissement depuis le <b style='font-weight: bold'> " . date_format($contract->getDateAnciennete(), 'd/m/Y') . ".</b>
<br/>
<b style='font-weight: bold'> " . $nomPrenom . " occupe actuellement le poste de « " . $contract->getFonction()->getDesignation() . " ». </b> ";
$dossier = $contract->getDossier()->getDesignation();
break;
case 'PSMS':
$paragraph = "<p >Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> , société à responsabilité limitée, au capital social 1.000.000 dirhams, immatriculée au registre de commerce de rabat sous n°136363, sise à : Avenue Allal El Fassi, Madinat Al Irfane, Hay Riad, Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, est employé(e) au sein de notre établissement depuis le <b style='font-weight: bold'> " . date_format($contract->getDateAnciennete(), 'd/m/Y') . ".</b>
<br/>
<b style='font-weight: bold'> " . $nomPrenom . " occupe actuellement le poste de « " . $contract->getFonction()->getDesignation() . " ». </b> ";
$dossier = $contract->getDossier()->getDesignation();
break;
case 'ISAA':
$paragraph = "<p >Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b>société à responsabilité limitée, au capital social 1.000.000 dirhams, immatriculée au registre de commerce de rabat sous n°148587, sise à : 23,Rue Amrou Bennaceur Zemmouri Agdal-Riad 10000 Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b>
titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, est employé(e) au sein de notre établissement depuis le <b style='font-weight: bold'> " . date_format($contract->getDateAnciennete(), 'd/m/Y') . " .</b>
<br/>
<b style='font-weight: bold'> " . $nomPrenom . " occupe actuellement le poste de « " . $contract->getFonction()->getDesignation() . " ». </b> ";
$dossier = $contract->getDossier()->getDesignation();
break;
default:
$paragraph = "Nous soussignés,<b style='font-weight: bold'> la Fondation Cheikh Zaid Ibn Soltan,</b> créée par Dahir portant loi <b style='font-weight: bold'> n°1-93-228 du 22 rabii I 1414 </b>(10 septembre 1993), sise au: Avenue Allal El Fassi, Madinat Al Irfane, Hay Riad Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . ($contract->getCnss() ? "</b>, immatriculé(e) à la CNSS sous le N° <b style='font-weight: bold'> " . $contract->getCnss() : "") ."</b>
, est employé(e) au sein de notre établissement auprès de <b style='font-weight: bold'>«" . $contract->getDossier()->getDesignation() . "»</b>, et ce depuis le <b style='font-weight: bold'> " . date_format($contract->getDateAnciennete(), 'd/m/Y') . ".</b>
<br/>
<b style='font-weight: bold'> " . $nomPrenom . "</b> occupe actuellement le poste de <b style='font-weight: bold'>« " . $contract->getFonction()->getDesignation() . " ». </b>";
$dossier = $this->em->getRepository(PDossier::class)->findOneBy(['abreviation' => 'SFCZ'])->getDesignation();
break;
}
$result = '';
return [$paragraph, $dossier];
}
public function getParagraphAttestationSalaire($contract)
{
if ($contract->getEmploye()->getSexe() == 'M') {
$nomPrenom = 'M. ' . $contract->getEmploye()->getPrenom() . ' ' . $contract->getEmploye()->getNom();
} elseif ($contract->getEmploye()->getSexe() == 'F') {
$nomPrenom = 'Mme ' . $contract->getEmploye()->getPrenom() . ' ' . $contract->getEmploye()->getNom();
} else {
$nomPrenom = $contract->getEmploye()->getPrenom() . ' ' . $contract->getEmploye()->getNom();
}
$date = new \DateTime('now');
$previousMonth=$date->modify('-1 month')->format('mY');
$previousPeriode = $this->em->getRepository(Periode::class)->findOneBy(['code' => $previousMonth]);
// dd($previousPeriode);
$salairetheo = $this->em->createQueryBuilder()
->select('contractTheorique.montant')
->from(Tbulletin::class, 'b')
->innerJoin('b.contract', 'contract')
->innerJoin('b.contractNetTheoriques', 'contractTheorique')
->where('contract = :contractId')
->andWhere('b.periode = :periode')
->setParameter('contractId', $contract)
->setParameter('periode', $previousPeriode)
->getQuery()
->getOneOrNullResult();
$salaire = $salairetheo['montant'];
// dd($salaire);
$obj = new nuts($salaire, "MAD");
$text = $obj->convert("fr-FR");
$salaire = number_format($salaire, 2, ',', ' ');
switch ($contract->getDossier()->getAbreviation()) {
case 'SLMG':
$paragraph = "Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> sis au : 5 Rue Hussein 1er, Rabat attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, perçoit un salaire mensuel de <b style='font-weight: bold'>" . $salaire . " dhs</b> (" . $text . ").";
$dossier=$this->em->getRepository(PDossier::class)->findOneBy(['abreviation'=>'SFCZ'])->getDesignation();
break;
case 'PGRO':
$paragraph = "Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> société à responsabilité limitée, au capital social 1.000.000 dirhams, immatriculée au registre de commerce de rabat sous n°136363, sise à : Avenue Allal El Fassi, Madinat Al Irfane, Hay Riad, Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, perçoit un salaire mensuel net de <b style='font-weight: bold'>" . $salaire . " dhs</b> (" . $text . ").";
$dossier = $contract->getDossier()->getDesignation();
break;
case 'PSMS':
$paragraph = "Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> société à responsabilité limitée, au capital social 1.000.000 dirhams, immatriculée au registre de commerce de rabat sous n°148835, sise à : 04 Rue Nopalea,lot 4 secteur 17,bloc I, Hay Riad, Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, perçoit un salaire mensuel de <b style='font-weight: bold'>" . $salaire . " dhs</b> (" . $text . ").";
$dossier = $contract->getDossier()->getDesignation();
break;
case 'ISAA':
$paragraph = "Nous soussignés,<b style='font-weight: bold'> " . $contract->getDossier()->getDesignation() . ",</b> société à responsabilité limitée, au capital social 1.000.000 dirhams, immatriculée au registre de commerce de rabat sous n°148587, sise à : 23,Rue Amrou Bennaceur Zemmouri Agdal-Riad 10000 Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, perçoit un salaire mensuel de <b style='font-weight: bold'>" . $salaire . " dhs</b> (" . $text . "). ";
$dossier = $contract->getDossier()->getDesignation();
break;
default:
$paragraph = "Nous soussignés,<b style='font-weight: bold'> la Fondation Cheikh Zaid Ibn Soltan,</b> créée par Dahir portant loi <b style='font-weight: bold'> n°1-93-228 du 22 rabii I 1414 </b>(10 septembre 1993), sise à : Avenue Allal El Fassi, Madinat Al Irfane, Hay Riad Rabat, attestons par la présente que <b style='font-weight: bold'> " . $nomPrenom . " </b> titulaire de la CNI n° <b style='font-weight: bold'> " . $contract->getEmploye()->getCin() . " </b>, perçoit un salaire mensuel net de <b style='font-weight: bold'> " . $salaire . " dhs</b> (" . $text . "). ";
$dossier = $this->em->getRepository(PDossier::class)->findOneBy(['abreviation' => 'SFCZ'])->getDesignation();
break;
}
return [$paragraph, $dossier];
}
public function CalculNetTheorique($contract)
{
$rubriqueSalaireBase = $this->em->getRepository(Prubrique::class)->find(1);
$baremeBruteSalaireDeBase = $this->em->getRepository(PbaremeBrute::class)->findOneBy(['bareme' => $contract->getBareme(), 'rubrique' => $rubriqueSalaireBase]);
$salaireBaseTheorique = round(26 * $baremeBruteSalaireDeBase->getTauxPs(), 2);
$salaire = $salaireBaseTheorique;
$sommeCotisation = 0;
$sommeCotisationTheorique = 0;
$irNet = 0;
$irNetTheorique = 0;
$salaireBrute = 0;
$sommePrelevement = 0;
// $salaireBruteImposable = $salaireBrute = $salaireBase;
$salaireImposableTheorique = 0;
$salaireNetImposable = 0;
$salaireNetImposableTheorique = 0;
// calculPrime
$primes = $this->em->getRepository(PbaremeBrute::class)->findBy(['type' => 'prime', 'bareme' => $contract->getBareme()]);
$countPrime = 0;
foreach ($primes as $prime) {
$countPrime++;
$salaire += round($prime->getMontant(), 2);
}
// dd($primes);
if ($contract->getPnatureContract()->getType()->getId() == 1) {
// calculAnciennete();
$vmatirxAnciennte = $this->em->getRepository(VMatrix::class)->getNombreAnneeAnciennte($contract->getDateAnciennete());
if ($vmatirxAnciennte) {
$salaire += round($salaireBaseTheorique * ($vmatirxAnciennte->getTaux() / 100), 2);
$salaireImposableTheorique = round($salaireBaseTheorique + ($salaireBaseTheorique * ($vmatirxAnciennte->getTaux() / 100)), 2);
}
// calculCotisationCnss();
$cotisationscnss = $this->em->getRepository(VMatrix::class)->findBy(['type' => ['cnss']]);
$count = 0;
foreach ($cotisationscnss as $cotisation) {
$count++;
if ($cotisation->getPlafond() > 0 && $salaireImposableTheorique > $cotisation->getPlafond()) {
$sommeCotisationTheorique += round(($cotisation->getPlafond() * ($cotisation->getTaux() / 100)), 2);
} else {
$sommeCotisationTheorique += round(($salaireImposableTheorique * ($cotisation->getTaux() / 100)), 2);
}
}
// calculCotisationCimr();
$cotisationscimr = $this->em->getRepository(PBaremeCimr::class)->findBy(['type' => ['cimr'], 'bareme' => $contract->getBareme()]);
foreach ($cotisationscimr as $cotisation) {
$sommeCotisationTheorique += round($salaireImposableTheorique * ($cotisation->getTaux() / 100), 2);
}
}
dd($sommeCotisationTheorique,$salaireImposableTheorique);
//calculPrelevementIr();
$pourcentage = $contract->getPnatureContract()->getTauxIr() / 100;
if (!$pourcentage) {
$salaireNetImposableTheorique = $salaireImposableTheorique - ($sommeCotisationTheorique + ($salaireImposableTheorique * 0.2));
$cotisationTheorique = $this->em->getRepository(VMatrix::class)->getTauxIr($salaireNetImposableTheorique);
if ($cotisationTheorique) {
$irBruteTheorique = round(($salaireNetImposableTheorique * ($cotisationTheorique->getTaux() / 100)) - $cotisationTheorique->getPlafond(), 2);
$irNetTheorique = round($irBruteTheorique - ($contract->getPriseEnCharge() * $cotisationTheorique->getTauxACharge()), 2);
if ($irNetTheorique < 0) {
$irNetTheorique = 0;
}
}
} else {
$irNetTheorique = round($salaire * $pourcentage, 2);
if ($irNetTheorique < 0) {
$irNetTheorique = 0;
}
}
// calculElementFixe();
foreach ($contract->getActiveElementFixes() as $key => $elementFixe) {
if ($elementFixe->getSens() == 1) {
$salaire += round($elementFixe->getMontant(), 2);
} else {
$salaire -= round($elementFixe->getMontant(), 2);
}
}
// dd($contract->getActiveElementFixes());
// calculElementEcheance();
// !!! $elementEcheances = $this->em->getRepository(LElementEcheance::class)->findBy(['contract' => $this->contract, 'periode' => $this->periode, 'active' => true]);
$salaire -= ($sommeCotisationTheorique + $irNetTheorique);
$salaire = round($salaire, 2);
return $salaire;
}
}