src/Controller/DefaultController.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use DateTime;
  4. use App\Entity\Log;
  5. use App\Entity\Opco;
  6. use App\Entity\Tuteur;
  7. use App\Entity\LogOpco;
  8. use App\Entity\Echeance;
  9. use App\Entity\Apprenant;
  10. use App\Utils\AjaxContent;
  11. use App\Entity\StatutAccord;
  12. use App\Entity\StatutEcheance;
  13. use App\Entity\CentreFacturation;
  14. use App\Entity\DossierFinancement;
  15. use App\Utils\InfosAdvProGenerator;
  16. use App\Entity\InscriptionFormation;
  17. use App\Utils\InfosAdvPartGenerator;
  18. use App\Form\ReportingInfosAdvProType;
  19. use App\Form\ReportingInfosAdvPartType;
  20. use App\Entity\StatutDossierFinancement;
  21. use Symfony\Component\HttpFoundation\Request;
  22. use Symfony\Component\HttpFoundation\Response;
  23. use Symfony\Component\Routing\Annotation\Route;
  24. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  25. class DefaultController extends AbstractController
  26. {
  27.     /**
  28.      * @Route("/", name="homepage")
  29.      */
  30.     public function indexAction(Request $request)
  31.     {
  32.         // $content = $this->renderView("homepage.html.twig");
  33.         $dateEche = new \DateTime();
  34.         $dateEche1 = new \DateTime();
  35.         $dateEche2 = new \DateTime();
  36.         // Sauvegarde
  37.         $save $this->getUser()->getSettings('filters');
  38.         $listSave = array();
  39.         $tab null;
  40.         if(isset($save['dashboard'])) {
  41.             $save $save['dashboard'];
  42.             // Tableau des sauvegardes en format json
  43.             $tab json_encode($save);
  44.             // Liste des sauvegardes de l'utilisateur
  45.             $listSave array_keys($save);
  46.         }
  47.         $tabDefault = [];
  48.         $tabDefault json_encode($tabDefault);
  49.         // ------------- PEDAGOGIE -------------
  50.         $listApprenants $this->getDoctrine()->getRepository(Apprenant::class)->getApprenantsInactifs($this->getUser()->getId());
  51.         $nombreApprenants sizeof($this->getDoctrine()->getRepository(Apprenant::class)->getApprenantsInactifs($this->getUser()->getId(), true));
  52.         // Recupere les inscriptions de l'apprenant
  53.         $listInscriptionFormation = array();
  54.         foreach($listApprenants as $apprenant) {
  55.             $parameters["apprenant"] = $apprenant;
  56.             $listInscriptionFormation[$apprenant->getId()] = $this->getDoctrine()->getRepository(InscriptionFormation::class)->sortListInscriptions($parameters);
  57.         }
  58.         // ------------- TUTORAT -------------
  59.         $listTuteurs $this->getDoctrine()->getRepository(Tuteur::class)->getTuteursInactifs($this->getUser()->getId());
  60.         $nombreTuteurs sizeof($listTuteurs);
  61.         // Dossier Financement sans accord
  62.         $listDossierFiSa $this->getDoctrine()->getRepository(DossierFinancement::class)->getSansAccordDashboard();
  63.         $nombreDossierFiSa sizeof($listDossierFiSa);
  64.         $actions                = array();
  65.         $entity                 = array();
  66.         $opco                   = array();
  67.         $status                 = array();
  68.         $centreFacturation      = array();
  69.         $keyword                "";
  70.         $page                   1;
  71.         if($this->getUser()->getRole()->getId() == 1){
  72.             $logOpco $this->getDoctrine()->getRepository(LogOpco::class)->listLogsOpco($actions$entity$opco$status$centreFacturation$keywordnull$page);
  73.         }else{
  74.             $logOpco $this->getDoctrine()->getRepository(LogOpco::class)->listLogsOpco($actions$entity$opco$status$centreFacturation$keyword$this->getUser(), $page);
  75.         }
  76.         if($this->getUser()->hasAccessTo("dashboard_adv")){
  77.             // ------------- ADV -------------
  78.             // PART
  79.             $partDossierEnCours = [];
  80.             $partDossierTermines = [];
  81.             $partAnomalieDossierMontant = [];
  82.             $partAnomalieDossierMontantEgal0 = [];
  83.             $partAnomalieDossierEcheanceEnRetard = [];
  84.             $partDossierEcheanceRefusee = [];
  85.             $partDossierEcheanceDepasseeSansFacture = [];
  86.             $partCaDuMois 0;
  87.             $partCaEnAttente 0;
  88.             $partCaEnRetard 0;
  89.             // PRO
  90.             $proDossierEnCours = [];
  91.             $proDossierTermines = [];
  92.             $proDossierSansAccord = [];
  93.             $proDossierSansAccord2Mois = [];
  94.             $proCaDuMois = [];
  95.             $proCaEcheanceRetard = [];
  96.             $proCaEcheanceEnAttenteEncaissement = [];
  97.             $proCaSansAccord = [];
  98.             $proDossierEcheancePasseeSansFacture = [];
  99.             $proDossierPbMontantTotal = [];
  100.             $proDossierMontantTotal0 = [];
  101.             $proDossierEcheanceAttenteDepassee14 = [];
  102.             $proDossierEcheanceTransmiseDepassee30 = [];
  103.             foreach ($this->getDoctrine()->getRepository(DossierFinancement::class)->findExercice() as $dossier) {
  104.                 // PART
  105.                 if($dossier->getFinancement()->getId() == 1){
  106.                     $montantRegle 0;
  107.                     $montantTotal 0;
  108.                     foreach ($dossier->getEcheances() as $echeance) {
  109.                         if($echeance->getDate()->format("Y-m-d") >= date("2023-09-01")){
  110.                             // Montant total des échéances
  111.                             $montantTotal += $echeance->getMontant();
  112.                             // Si échéance est validée ou en perte
  113.                             if($echeance->getStatut()->getId() == || $echeance->getStatut()->getId() == 7){
  114.                                 $montantRegle += $echeance->getMontant();
  115.                             }
  116.                             // Si échéance est en attente ou refusée
  117.                             if($echeance->getStatut()->getId() == || $echeance->getStatut()->getId() == 6){
  118.                                 $partDossierEnCours[] = $dossier;
  119.                             }
  120.                             // Si échéance en retard de facturation
  121.                             if($echeance->getStatut()->getId() == && $echeance->getDate()->modify("+5 jours")->format("Y-m-d") < date("Y-m-d")){
  122.                                 $partAnomalieDossierEcheanceEnRetard[] = $dossier;
  123.                             }
  124.                             // Si échéance dépassée sans facture
  125.                             if($echeance->getDate()->format("Y-m-d") < date("Y-m-d") && $echeance->hasFacture() == false){
  126.                                 $partDossierEcheanceDepasseeSansFacture[] = $dossier;
  127.                                 $partCaEnRetard += $echeance->getMontant();
  128.                             }
  129.                             // Si échéance est refusée
  130.                             if($echeance->getStatut()->getId() == 6){
  131.                                 $partDossierEcheanceRefusee[] = $dossier;
  132.                             }
  133.                             // CA du mois
  134.                             if($echeance->hasFacture() && $echeance->getDate()->format("m/Y") == date("m/Y")){
  135.                                 $partCaDuMois += $echeance->getMontant();
  136.                             }
  137.                             // CA en attente
  138.                             if($echeance->getDate()->format("Y-m-d") < date("Y-m-d") && ($echeance->getStatut()->getId() == || $echeance->getStatut()->getId() == 6)){
  139.                                 $partCaEnAttente += $echeance->getMontant();
  140.                             }
  141.                         }
  142.                     }
  143.                     // Si montant du dossier est égal au montant réglé
  144.                     if($dossier->getMontant() == $montantRegle){
  145.                         $partDossierTermines[] = $dossier;
  146.                     }
  147.                     // Si montant du dossier est égal au montant réglé
  148.                     if($dossier->getDateAdminDebut() >= "2023-09-01" && $dossier->getMontant() != $montantTotal){
  149.                         $partAnomalieDossierMontant[] = $dossier;
  150.                     }
  151.                     // Si montant du dossier est égal au montant réglé
  152.                     if($dossier->getMontant() == || $montantTotal == 0){
  153.                         $partAnomalieDossierMontantEgal0[] = $dossier;
  154.                     }
  155.                 }
  156.                 // PRO
  157.                 else{
  158.                     $montantRegle 0;
  159.                     $montantTotal 0;
  160.                     $boolEcheancePasseeSansFacture false;
  161.                     $boolEcheanceAttenteDepassee14 false;
  162.                     $boolEcheanceTransmiseDepassee30 false;
  163.                     foreach ($dossier->getEcheances() as $echeance) {
  164.                         // Montant total des échéances
  165.                         $montantTotal += $echeance->getMontant();
  166.                         // Si échéance est validée ou en perte
  167.                         if($echeance->getStatut()->getId() == || $echeance->getStatut()->getId() == 7){
  168.                             $montantRegle += $echeance->getMontant();
  169.                         }
  170.                         if($echeance->getDate()->format("Y-m-d") >= date("2023-09-01")){
  171.                             // Si échéance est en attente ou refusée
  172.                             if($echeance->getStatut()->getId() == 3){
  173.                                 $proDossierEnCours[] = $dossier;
  174.                             }
  175.                             
  176.                             // 
  177.                             if($echeance->hasFacture() && $echeance->getDate()->format("m/Y") == date("m/Y")){
  178.                                 if(isset($proCaDuMois[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  179.                                     $proCaDuMois[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] += $echeance->getMontant();
  180.                                 }else{
  181.                                     $proCaDuMois[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] = $echeance->getMontant();
  182.                                 }
  183.                             }
  184.                             // Si échéance en retard de facturation
  185.                             if($echeance->getStatut()->getId() == && $echeance->getDate()->format("Y-m-d") < date("Y-m-d")){
  186.                                 if(isset($proCaEcheanceRetard[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  187.                                     $proCaEcheanceRetard[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] += $echeance->getMontant();
  188.                                 }else{
  189.                                     $proCaEcheanceRetard[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] = $echeance->getMontant();
  190.                                 }
  191.                             }
  192.                             // Si échéance en retard de facturation
  193.                             if($echeance->getStatut()->getId() == 5){
  194.                                 if(isset($proCaEcheanceEnAttenteEncaissement[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  195.                                     $proCaEcheanceEnAttenteEncaissement[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] += $echeance->getMontant();
  196.                                 }else{
  197.                                     $proCaEcheanceEnAttenteEncaissement[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] = $echeance->getMontant();
  198.                                 }
  199.                                 
  200.                             }
  201.                             // Si échéance passée sans facture
  202.                             if($echeance->hasFacture() == false && $echeance->getStatut()->getId() == && $echeance->getDate()->format("Y-m-d") < date("Y-m-d") && $boolEcheancePasseeSansFacture == false){
  203.                                 if(isset($proDossierEcheancePasseeSansFacture[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  204.                                     $proDossierEcheancePasseeSansFacture[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] += 1;
  205.                                 }else{
  206.                                     $proDossierEcheancePasseeSansFacture[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] = 1;
  207.                                 }
  208.                                 
  209.                                 $boolEcheancePasseeSansFacture true;
  210.                             }
  211.                             // Si échéance en attente dépassée de +14 jours
  212.                             if($echeance->getStatut()->getId() == && $echeance->getDate()->modify("+14 jours")->format("Y-m-d") < date("Y-m-d") && $boolEcheanceAttenteDepassee14 == false){
  213.                                 if(isset($proDossierEcheanceAttenteDepassee14[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  214.                                     $proDossierEcheanceAttenteDepassee14[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] += 1;
  215.                                 }else{
  216.                                     $proDossierEcheanceAttenteDepassee14[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] = 1;
  217.                                 }
  218.                                 $boolEcheanceAttenteDepassee14 true;
  219.                             }
  220.                             // Si échéance en attente dépassée de +14 jours
  221.                             if($echeance->getStatut()->getId() == && $echeance->getDate()->modify("+30 jours")->format("Y-m-d") < date("Y-m-d") && $boolEcheanceTransmiseDepassee30 == false){
  222.                                 if(isset($proDossierEcheanceTransmiseDepassee30[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  223.                                     $proDossierEcheanceTransmiseDepassee30[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] += 1;
  224.                                 }else{
  225.                                     $proDossierEcheanceTransmiseDepassee30[$echeance->getDossierFinancement()->getFinancement()->getNom()][$echeance->getDossierFinancement()->getInscriptionFormation()->getCentreFacturation()->getNom()] = 1;
  226.                                 }
  227.                                 $boolEcheanceTransmiseDepassee30 true;
  228.                             }
  229.                         }
  230.                     }
  231.                     // Si montant du dossier est égal au montant réglé
  232.                     if($dossier->getMontant() == $montantRegle){
  233.                         $proDossierTermines[] = $dossier;
  234.                     }
  235.                     // Si montant du dossier est pas égal au montant total
  236.                     if($dossier->getMontant() != $montantTotal){
  237.                         if(isset($proDossierPbMontantTotal[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  238.                             $proDossierPbMontantTotal[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()] += 1;
  239.                         }else{
  240.                             $proDossierPbMontantTotal[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()] = 1;
  241.                         }
  242.                     }
  243.                     // Si montant du dossier est pas égal au montant total
  244.                     if($montantTotal == && ($dossier->getStatutAccord() == null or $dossier->getStatutAccord()->getId() == 1)){
  245.                         if(isset($proDossierMontantTotal0[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  246.                             $proDossierMontantTotal0[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()] += 1;
  247.                         }else{
  248.                             $proDossierMontantTotal0[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()] = 1;
  249.                         }
  250.                     }
  251.                     // Si montant du dossier est égal au montant réglé
  252.                     if($dossier->getStatutAccord() != null && $dossier->getStatutAccord()->getId() == 3){
  253.                         if(isset($proCaSansAccord[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()])){
  254.                             $proCaSansAccord[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()] += $dossier->getmontant();
  255.                         }else{
  256.                             $proCaSansAccord[$dossier->getFinancement()->getNom()][$dossier->getInscriptionFormation()->getCentreFacturation()->getNom()] = $dossier->getmontant();
  257.                         }
  258.                         
  259.                         
  260.                         // Si créé depuis plus de 2 mois
  261.                         if($dossier->getCreatedAt()->modify("+2 months")->format("Y-m-d") < date("Y-m-d")){
  262.                             $proDossierSansAccord2Mois[] = $dossier;
  263.                             $proDossierSansAccord[] = $dossier;
  264.                         }else{
  265.                             $proDossierSansAccord[] = $dossier;
  266.                         }
  267.                     }
  268.                 }
  269.             }
  270.             $listCentreFacturation $this->getDoctrine()->getRepository(CentreFacturation::class)->findBy(["hidden" => 0], []);
  271.         
  272.             $content $this->renderView("dashboard/dashboard.html.twig",[
  273.                 "logsOpco" => $logOpco,
  274.                 "opcos" => $this->getDoctrine()->getRepository(Opco::class)->findAll(),
  275.                 "centreFacturations" => $this->getDoctrine()->getRepository(CentreFacturation::class)->findBy(["hidden" => 0], []),
  276.                 "echeances" => $this->getDoctrine()->getRepository(Echeance::class)->findByRefAdmin($dateEche->format("Y-m-d"), $dateEche1->modify("+1days")->format("Y-m-d"), $dateEche2->modify("+2days")->format("Y-m-d"), $this->getDoctrine()->getRepository(StatutEcheance::class)->findOneBy(["id" => 3], []), $this->getUser()),
  277.                 "echeancesTransmise" => $this->getDoctrine()->getRepository(Echeance::class)->findByRefAdminStatut($this->getDoctrine()->getRepository(StatutEcheance::class)->findOneBy(["id" => 5]), $this->getUser()),
  278.                 "facture" => false,
  279.                 "listSave" => $listSave,
  280.                 "tab" => $tab,
  281.                 "tabDefault" => $tabDefault,
  282.                 "listApprenants" => $listApprenants,
  283.                 "listInscriptionFormation" => $listInscriptionFormation,
  284.                 "nombreApprenants" => $nombreApprenants,
  285.                 "listTuteurs" => $listTuteurs,
  286.                 "nombreTuteurs" => $nombreTuteurs,
  287.                 "listDossierFiSa" => $listDossierFiSa,
  288.                 "nombreDossierFiSa" => $nombreDossierFiSa,
  289.                 "listCentreFacturation" => $listCentreFacturation,
  290.                 // PART
  291.                 "nombreDossiersEnCoursPart" => count(array_unique($partDossierEnCours)),
  292.                 "nombreDossiersTerminesPart" => count(array_unique($partDossierTermines)),
  293.                 "nombreDossierEcheanceRefuseePart" => count(array_unique($partDossierEcheanceRefusee)),
  294.                 "nombreDossierEcheanceDepasseeSansFacturePart" => count(array_unique($partDossierEcheanceDepasseeSansFacture)),
  295.                 "partAnomalieDossierMontant" => count(array_unique($partAnomalieDossierMontant)),
  296.                 "partAnomalieDossierMontantEgal0" => count(array_unique($partAnomalieDossierMontantEgal0)),
  297.                 "partAnomalieDossierEcheanceEnRetard" => count(array_unique($partAnomalieDossierEcheanceEnRetard)),
  298.                 "partCaDuMois" => $partCaDuMois,
  299.                 "partCaEnAttente" => $partCaEnAttente,
  300.                 "partCaEnRetard" => $partCaEnRetard,
  301.                 // PRO
  302.                 "nombreDossiersEnCoursPro" => count(array_unique($proDossierEnCours)),
  303.                 "nombreDossiersTerminesPro" => count(array_unique($proDossierTermines)),
  304.                 "nombreDossiersSansAccordPro" => count(array_unique($proDossierSansAccord)),
  305.                 "nombreDossiersSansAccord2MoisPro" => count(array_unique($proDossierSansAccord2Mois)),
  306.                 "proCaDuMois" => $proCaDuMois,
  307.                 "proCaEcheanceRetard" => $proCaEcheanceRetard,
  308.                 "proCaEcheanceEnAttenteEncaissement" => $proCaEcheanceEnAttenteEncaissement,
  309.                 "proCaSansAccord" => $proCaSansAccord,
  310.                 "proDossierEcheancePasseeSansFacture" => $proDossierEcheancePasseeSansFacture,
  311.                 "proDossierPbMontantTotal" => $proDossierPbMontantTotal,
  312.                 "proDossierMontantTotal0" => $proDossierMontantTotal0,
  313.                 "proDossierEcheanceAttenteDepassee14" => $proDossierEcheanceAttenteDepassee14,
  314.                 "proDossierEcheanceTransmiseDepassee30" => $proDossierEcheanceTransmiseDepassee30
  315.             ]);
  316.         }else{
  317.             $content $this->renderView("dashboard/dashboard.html.twig",[
  318.                 "logsOpco" => $logOpco,
  319.                 "opcos" => $this->getDoctrine()->getRepository(Opco::class)->findAll(),
  320.                 "centreFacturations" => $this->getDoctrine()->getRepository(CentreFacturation::class)->findBy(["hidden" => 0], []),
  321.                 "echeances" => $this->getDoctrine()->getRepository(Echeance::class)->findByRefAdmin($dateEche->format("Y-m-d"), $dateEche1->modify("+1days")->format("Y-m-d"), $dateEche2->modify("+2days")->format("Y-m-d"), $this->getDoctrine()->getRepository(StatutEcheance::class)->findOneBy(["id" => 3], []), $this->getUser()),
  322.                 "echeancesTransmise" => $this->getDoctrine()->getRepository(Echeance::class)->findByRefAdminStatut($this->getDoctrine()->getRepository(StatutEcheance::class)->findOneBy(["id" => 5]), $this->getUser()),
  323.                 "facture" => false,
  324.                 "listSave" => $listSave,
  325.                 "tab" => $tab,
  326.                 "tabDefault" => $tabDefault,
  327.                 "listApprenants" => $listApprenants,
  328.                 "listInscriptionFormation" => $listInscriptionFormation,
  329.                 "nombreApprenants" => $nombreApprenants,
  330.                 "listTuteurs" => $listTuteurs,
  331.                 "nombreTuteurs" => $nombreTuteurs,
  332.                 "listDossierFiSa" => $listDossierFiSa,
  333.                 "nombreDossierFiSa" => $nombreDossierFiSa
  334.             ]);
  335.         }
  336.         $response = new Response($content200);
  337.         $contentLength strlen($content);
  338.         $response->headers->set("Content-Length"$contentLength);
  339.         $response->headers->set("Cache-Control""no-cache");
  340.         return $response;
  341.     }
  342.     /**
  343.      * Liste des logs
  344.      * @Route("/list/logs/opco", name="list_log_opco")
  345.      */
  346.     public function listLogOpco(Request $request)
  347.     {
  348.         $ajaxContent = new AjaxContent($request);
  349.         $formSorting $ajaxContent->getForm("logOpco_sorting");
  350.         $actions                = array();
  351.         $entity                 = array();
  352.         $opco                   = array();
  353.         $status                 = array();
  354.         $centreFacturation      = array();
  355.         $dossierFinancement     = array();
  356.         $keyword                "";
  357.         $page                   null;
  358.         $date1                  null;
  359.         $date2                  null;
  360.         if(!empty($formSorting)) {
  361.             // Actions
  362.             if(isset($formSorting["keyword"])) {
  363.                 $keyword $formSorting["keyword"];
  364.             }
  365.             // Actions
  366.             if(isset($formSorting["action"])) {
  367.                 $actions $formSorting["action"];
  368.             }
  369.             // Actions
  370.             if(isset($formSorting["entity"])) {
  371.                 $entity $formSorting["entity"];
  372.             }
  373.             // Opco
  374.             if(isset($formSorting["opco"])) {
  375.                 $opco $formSorting["opco"];
  376.             }
  377.             // Opco
  378.             if(isset($formSorting["status"])) {
  379.                 $status $formSorting["status"];
  380.             }
  381.             // Centre facturation
  382.             if(isset($formSorting["centreFacturation"])) {
  383.                 $centreFacturation $formSorting["centreFacturation"];
  384.             }
  385.             // Date 1 - Début du créneau
  386.             if(isset($formSorting["date1"]) && $formSorting["date1"] !== "") {
  387.                 $date1 date_create_immutable_from_format("d/m/Y"$formSorting["date1"]);
  388.             }
  389.             // Date 2 - Début du créneau
  390.             if(isset($formSorting["date2"]) && $formSorting["date2"] !== "") {
  391.                 $date2 date_create_immutable_from_format("d/m/Y"$formSorting["date2"]);
  392.             }
  393.             // Page
  394.             if(isset($formSorting["page"])) {
  395.                 $page $formSorting["page"];
  396.             }
  397.         }else {
  398.             // Tri par defaut - Page 1
  399.             $page 1;
  400.         }
  401.         if($this->getUser()->getRole()->getId() == 1){
  402.             $logsOpco $this->getDoctrine()->getRepository(LogOpco::class)->listLogsOpco($actions$entity$opco$status$centreFacturation$keywordnull$page$date1$date2);
  403.         }else{
  404.             $logsOpco $this->getDoctrine()->getRepository(LogOpco::class)->listLogsOpco($actions$entity$opco$status$centreFacturation$keyword$this->getUser(), $page$date1$date2);
  405.         }
  406.         $opcos $this->getDoctrine()->getRepository(Opco::class)->findAll();
  407.         $centreFacturations $this->getDoctrine()->getRepository(CentreFacturation::class)->findBy(["hidden" => 0], []);
  408.         // Render
  409.         return $this->render("dashboard/dashboard.html.twig", array(
  410.             "logsOpco" => $logsOpco,
  411.             "opcos" => $opcos,
  412.             "centreFacturations" => $centreFacturations,
  413.             "echeances" => "",
  414.             "echeancesTransmise" => "",
  415.             "facture" => false,
  416.             "listSave" => "",
  417.             "tab" => "",
  418.             "tabDefault" => "",
  419.             "listApprenants" => "",
  420.             "listInscriptionFormation" => "",
  421.             "listCentreFacturation" => "",
  422.             "nombreApprenants" => "",
  423.             "listTuteurs" => "",
  424.             "nombreTuteurs" => "",
  425.             "listDossierFiSa" => "",
  426.             "nombreDossierFiSa" => "",
  427.             // PART
  428.             "nombreDossiersEnCoursPart" => "",
  429.             "nombreDossiersTerminesPart" => "",
  430.             "nombreDossierEcheanceRefuseePart" => "",
  431.             "nombreDossierEcheanceDepasseeSansFacturePart" => "",
  432.             "partAnomalieDossierMontant" => "",
  433.             "partAnomalieDossierMontantEgal0" => "",
  434.             "partAnomalieDossierEcheanceEnRetard" => "",
  435.             "partCaDuMois" => "",
  436.             "partCaEnAttente" => "",
  437.             "partCaEnRetard" => "",
  438.             // PRO
  439.             "nombreDossiersEnCoursPro" => "",
  440.             "nombreDossiersTerminesPro" => "",
  441.             "nombreDossiersSansAccordPro" => "",
  442.             "nombreDossiersSansAccord2MoisPro" => "",
  443.             "proCaDuMois" => "",
  444.             "proCaEcheanceRetard" => "",
  445.             "proCaEcheanceEnAttenteEncaissement" => "",
  446.             "proDossierEcheancePasseeSansFacture" => "",
  447.             "proCaSansAccord" => "",
  448.             "proDossierPbMontantTotal" => "",
  449.             "proDossierMontantTotal0" => "",
  450.             "proDossierEcheanceAttenteDepassee14" => "",
  451.             "proDossierEcheanceTransmiseDepassee30" => "",
  452.         ));
  453.     }
  454.     /**
  455.      * Liste des logs
  456.      * @Route("/reportin/infos-adv/part", name="reporting_infos_adv_part")
  457.      */
  458.     public function reportingInfoAdvPart(Request $requestInfosAdvPartGenerator $documentGenerator){
  459.         $ajaxContent = new AjaxContent($request);
  460.         $additionalData $ajaxContent->getAdditionalData();
  461.         if($ajaxContent->isMethodGet()) {
  462.             $form $this->createForm(ReportingInfosAdvPartType::class, null, array(
  463.                 "attr" => [
  464.                     "class"                 => "ajax-submit",
  465.                     "novalidate"            => "novalidate",
  466.                     "data-route"            => $this->generateUrl("reporting_infos_adv_part"),
  467.                     "data-id-container"     => "#modal",
  468.                     "data-container-type"   => "modal-file-download",
  469.                 ]
  470.             ));
  471.             // Render form
  472.             return $this->render("formulaire-reporting-infos-adv-part-modal.html.twig", [
  473.                 "form" => $form->createView(),
  474.                 "title" => "Créer un reporting des infos ADV des parts"
  475.             ]);
  476.         }
  477.         else if($ajaxContent->isMethodPost()) {
  478.             $form $this->createForm(ReportingInfosAdvPartType::class, null);
  479.             $form->submit($ajaxContent->getForm($form->getName()));
  480.             if($form->isSubmitted() && $form->isValid()) {
  481.                 $em $this->getDoctrine()->getManager();
  482.                 $log = new Log(Log::ACTIONS["DOWNLOAD"], Log::ENTITIES["EXPORT_REPORTING"], nullnullnull$this->getUser());
  483.                 $em->persist($log);
  484.                 $em->flush();
  485.                 $dossiers $this->getDoctrine()->getRepository(DossierFinancement::class)->findExercice();
  486.                 return $documentGenerator->exportDocument($dossiers);
  487.             }
  488.         }
  489.         else {
  490.             // ERROR - Mauvaise methode HTTP
  491.             return new Response("Method Not Allowed"405);
  492.         }
  493.     }
  494.     /**
  495.      * Liste des logs
  496.      * @Route("/reportin/infos-adv/pro", name="reporting_infos_adv_pro")
  497.      */
  498.     public function reportingInfoAdvPro(Request $requestInfosAdvProGenerator $documentGenerator){
  499.         $ajaxContent = new AjaxContent($request);
  500.         $additionalData $ajaxContent->getAdditionalData();
  501.         if($ajaxContent->isMethodGet()) {
  502.             $form $this->createForm(ReportingInfosAdvProType::class, null, array(
  503.                 "attr" => [
  504.                     "class"                 => "ajax-submit",
  505.                     "novalidate"            => "novalidate",
  506.                     "data-route"            => $this->generateUrl("reporting_infos_adv_pro"),
  507.                     "data-id-container"     => "#modal",
  508.                     "data-container-type"   => "modal-file-download",
  509.                 ]
  510.             ));
  511.             // Render form
  512.             return $this->render("formulaire-reporting-infos-adv-pro-modal.html.twig", [
  513.                 "form" => $form->createView(),
  514.                 "title" => "Créer un reporting des infos ADV des pros"
  515.             ]);
  516.         }
  517.         else if($ajaxContent->isMethodPost()) {
  518.             $form $this->createForm(ReportingInfosAdvProType::class, null);
  519.             $form->submit($ajaxContent->getForm($form->getName()));
  520.             if($form->isSubmitted() && $form->isValid()) {
  521.                 $em $this->getDoctrine()->getManager();
  522.                 $log = new Log(Log::ACTIONS["DOWNLOAD"], Log::ENTITIES["EXPORT_REPORTING"], nullnullnull$this->getUser());
  523.                 $em->persist($log);
  524.                 $em->flush();
  525.                 $dossiers $this->getDoctrine()->getRepository(DossierFinancement::class)->findExercice();
  526.                 $listCentreFacturation $this->getDoctrine()->getRepository(CentreFacturation::class)->findBy(["hidden" => 0], []);
  527.                 return $documentGenerator->exportDocument($dossiers$listCentreFacturation);
  528.             }
  529.         }
  530.         else {
  531.             // ERROR - Mauvaise methode HTTP
  532.             return new Response("Method Not Allowed"405);
  533.         }
  534.     }
  535. }