src/Controller/IctusCommandePatientController.php line 106

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use DateTime;
  4. use ZipArchive;
  5. use App\Entity\IctusCommande;
  6. use App\Entity\FacturePatient;
  7. use App\Entity\TarifParDefaut;
  8. use App\Entity\CommandeSpecial;
  9. use App\Services\DomPDFService;
  10. use App\Services\FactureService;
  11. use App\Services\MailerServices;
  12. use App\Services\IctocoinService;
  13. use App\Repository\UserRepository;
  14. use App\Repository\ZoneRepository;
  15. use App\Services\OrangeSmsService;
  16. use App\Repository\AdresseRepository;
  17. use App\Services\NotificationService;
  18. use App\Repository\ParcoursRepository;
  19. use App\Repository\QuartierRepository;
  20. use App\Entity\IctusHistoriquePaiement;
  21. use App\Repository\LivraisonRepository;
  22. use App\Repository\TarifZoneRepository;
  23. use Doctrine\ORM\EntityManagerInterface;
  24. use App\Services\SocieteLivraisonService;
  25. use App\Repository\ZoneQuartierRepository;
  26. use App\Repository\IctusCommandeRepository;
  27. use App\Repository\IctusPharmacieRepository;
  28. use App\Repository\TarifParDefautRepository;
  29. use App\Repository\CommandeSpecialRepository;
  30. use Symfony\Component\HttpFoundation\Request;
  31. use Symfony\Component\Mailer\MailerInterface;
  32. use App\Repository\EtatPrisenchargeRepository;
  33. use App\Repository\NonDisponibiliteRepository;
  34. use App\Repository\SocieteLivraisonRepository;
  35. use Symfony\Component\HttpFoundation\Response;
  36. use App\Repository\IctusEtatPaiementRepository;
  37. use App\Repository\IctusTypePaiementRepository;
  38. use App\Repository\TarifKilometriqueRepository;
  39. use Symfony\Component\Routing\Annotation\Route;
  40. use App\Repository\HistoriqueReglementRepository;
  41. use App\Repository\IctusMobileAppareilRepository;
  42. use Symfony\Component\HttpFoundation\JsonResponse;
  43. use App\Services\api\NotificationTwoPackagesService;
  44. use App\Repository\IctusHistoriquePaiementRepository;
  45. use App\Services\NotificationSocieteLivraisonService;
  46. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  47. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  48. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  49. /**
  50.  * @Route("/ictus/commande/patient", name="app_ictus_commande_patient_")
  51.  * @IsGranted("ROLE_PHARMACIE")
  52.  */
  53. class IctusCommandePatientController extends AbstractController
  54. {
  55.     private $em;
  56.     private $params;
  57.     public function __construct(EntityManagerInterface $emParameterBagInterface $params)
  58.     {
  59.         $this->em $em;
  60.         $this->params $params;
  61.     }
  62.     /**
  63.      * @Route("/", name="liste")
  64.      */
  65.     public function index(IctusCommandeRepository $commandeRepository): Response
  66.     {
  67.         $where = array(
  68.             "pharmacie" => $this->getUser()->getIctusPharmacie()
  69.         );
  70.         $order = array(
  71.             "createdAt" => "DESC"
  72.         );
  73.         return $this->render('ictus_commande/index.html.twig', [
  74.             'commandes' => $commandeRepository->findBy($where$order),
  75.             'enAttente' => $commandeRepository->getCountEnAttente($this->getUser()->getIctusPharmacie())[0]["nb"],
  76.             'menuActive' => 3
  77.         ]);
  78.     }
  79.     /**
  80.      * @Route("/liste-special", name="liste_special")
  81.      */
  82.     public function listeSpecial(CommandeSpecialRepository $commandeRepository): Response
  83.     {
  84.         $where = array(
  85.             "pharmacie" => $this->getUser()->getIctusPharmacie()
  86.         );
  87.         $order = array(
  88.             "createdAt" => "DESC"
  89.         );
  90.         return $this->render('ictus_commande/liste-special.html.twig', [
  91.             'commandes' => $commandeRepository->findBy($where$order),
  92.             'menuActive' => 4,
  93.             'enAttente' => 0
  94.         ]);
  95.     }
  96.     /**
  97.      * @Route("/detail/{id}", name="detail")
  98.      */
  99.     public function detail(IctusCommande $commande): Response
  100.     {
  101.         return $this->render('ictus_commande/detail.html.twig', [
  102.             'commande' => $commande,
  103.             'menuActive' => 3
  104.         ]);
  105.     }
  106.     /**
  107.      * @Route("/detail-cmd-speciale/{id}", name="detail_special")
  108.      */
  109.     public function detailCmdSpecial(CommandeSpecial $commande): Response
  110.     {
  111.         return $this->render('ictus_commande/detailSpecial.html.twig', [
  112.             'commande' => $commande,
  113.         ]);
  114.     }
  115.     /**
  116.      * @Route("/update-statut-livraison/{id}", name="update_statut_livrer")
  117.      */
  118.     public function updateStatLivraison($idIctusCommande $commandeRequest $requestIctusCommandeRepository $ictusCommandeRepo): Response
  119.     {
  120.         if ($request->isMethod('POST')) {
  121.             $commande->setIsLivrer($request->get('is_livrer'));
  122.             $this->em->flush();
  123.             return new JsonResponse('OK');
  124.         }
  125.         $ictusCommandeRepo->updateIctusCommande($id1);
  126.         return new JsonResponse('NOK');
  127.     }
  128.     /**
  129.      * @Route("/disponible-commandespecial-form/{id}", name="disponible_commandespecial_form")
  130.      */
  131.     public function disponibleCommandespecialForm(CommandeSpecial $commandeRequest $requestIctocoinService $ictocoinServiceMailerServices $mailerServicesMailerInterface $mi): Response
  132.     {
  133.         if ($request->isMethod('POST')) {
  134.             foreach ($commande->getCommandeSpecialLines() as $line) {
  135.                 if ($request->get('prixunitaire-' $line->getId()) == && $request->get('valide-' $line->getId()) != null) {
  136.                     $this->addFlash('success''Erreur prix non defini');
  137.                     return $this->redirectToRoute('app_ictus_commande_patient_liste_special');
  138.                 }
  139.                 $quantite $line->getQuantite();
  140.                 $newQuantite $request->get('quantite-' $line->getId());
  141.                 if ($newQuantite $quantite) {
  142.                     $newQuantite $quantite;
  143.                 }
  144.                 $isValide 0;
  145.                 if ($request->get('valide-' $line->getId()) != null) {
  146.                     $isValide 1;
  147.                 }
  148.                 $line->setIsValide($isValide)->setQuantite($newQuantite)->setPrixunitaire($request->get('prixunitaire-' $line->getId()));
  149.                 $this->em->persist($line);
  150.             }
  151.             $commande->setIsValidePharmacie(1)->setDaysLimit(1);
  152.             $this->em->persist($commande);
  153.             $this->em->flush();
  154.             $raison 'Frais de gestion sur la commande du ' date("d M Y") . ', Référence :/cmd {{' $commande->getId() . '}}';
  155.             $ictocoinService->debiter($this->getUser()->getIctusPharmacie(), $commande->getPrixTotal(), $raison);
  156.             //Envoie mail patient pour paiement ou recuperation
  157.             $to $commande->getUser()->getEmail();
  158.             $from "siteweb@ictuspharma.com";
  159.             $subject "COMMANDE SPECIAL DEJA DISPONIBLE";
  160.             $templateMail 'emails/disponibleCommandeSpecial.html.twig';
  161.             $paramsMail = [
  162.                 'dayslimit' => 1,
  163.                 'link'    => "https://ictuspharm.com/commande/historique/non-payer",
  164.                 'numeroCommande' => "ICT_CMD_SP_" $commande->getId(),
  165.                 'pharmacy' => $commande->getPharmacie()->getDesignation()
  166.             ];
  167.             $mailerServices->send($mi$to$from$subject$templateMail$paramsMail);
  168.             return $this->redirectToRoute('app_ictus_commande_patient_liste_special');
  169.         }
  170.     }
  171.     /**
  172.      * @Route("/validate-commandespecial-form/{id}", name="validate_commandespecial_form")
  173.      */
  174.     public function validateCommandespecialForm(CommandeSpecial $commandeRequest $requestMailerServices $mailerServicesMailerInterface $mi): Response
  175.     {
  176.         if ($request->isMethod('POST')) {
  177.             foreach ($commande->getCommandeSpecialLines() as $line) {
  178.                 $quantite $line->getQuantite();
  179.                 $newQuantite $request->get('quantite-' $line->getId());
  180.                 if ($newQuantite $quantite) {
  181.                     $newQuantite $quantite;
  182.                 }
  183.                 $isValide 0;
  184.                 if ($request->get('valide-' $line->getId()) != null) {
  185.                     $isValide 1;
  186.                 }
  187.                 $line->setIsValide($isValide)->setQuantite($newQuantite);
  188.                 $this->em->persist($line);
  189.             }
  190.         }
  191.         $grossiste $this->getUser()->getGrossiste();
  192.         $commande->setIsValidePharmacie(true)->setGrossiste($grossiste);
  193.         $to $grossiste->getEmail();
  194.         $from "siteweb@ictuspharma.com";
  195.         $subject "COMMANDE SPECIAL ICTUSPHARMA";
  196.         $templateMail 'emails/commandeSpecialGrossiste.html.twig';
  197.         $paramsMail = [
  198.             'link'    => "https://ictuspharm.com/grossiste/commandespecial/clients/detail/" $commande->getId(),
  199.             'numeroCommande' => "ICT_CMD_SP_" $commande->getId(),
  200.             'pharmacy' => $commande->getPharmacie()->getDesignation()
  201.         ];
  202.         $mailerServices->send($mi$to$from$subject$templateMail$paramsMail);
  203.         $this->em->persist($commande);
  204.         $this->em->flush();
  205.         return $this->redirectToRoute('app_ictus_commande_patient_liste_special');
  206.     }
  207.     //******icic */
  208.     /**
  209.      * @Route("/validate/{id}", name="validate_commande")
  210.      */
  211.     public function validation(IctusCommande $commande$etatMailerServices $mailerServicesMailerInterface $mi): Response
  212.     {
  213.         $commande->setIsValide($etat);
  214.         $this->em->persist($commande);
  215.         $this->em->flush();
  216.         if ($etat == 0) {
  217.             $to $commande->getUser()->getEmail();
  218.             $from "siteweb@ictuspharma.com";
  219.             $subject "COMMANDE REFUSEE";
  220.             $templateMail 'emails/refusCommandeSpecial.html.twig';
  221.             $paramsMail = [
  222.                 'numeroCommande' => "ICT_CMD_" $commande->getId(),
  223.                 'pharmacy' => $commande->getPharmacie()->getDesignation()
  224.             ];
  225.             $mailerServices->send($mi$to$from$subject$templateMail$paramsMail);
  226.         }
  227.         return $this->redirectToRoute('app_ictus_commande_patient_liste');
  228.     }
  229.     /**
  230.      * @Route("/refuscommande/{id}", name="refus_commande")
  231.      */
  232.     public function refusCommande(
  233.         IctusCommande $commande,
  234.         MailerServices $mailerServices,
  235.         MailerInterface $mi,
  236.         Request $request,
  237.         NotificationTwoPackagesService $notificationService,
  238.         IctusMobileAppareilRepository $mobileAppareilRepo
  239.     ): Response {
  240.         //REFUS
  241.         if ($request->isMethod('POST')) {
  242.             $commande->setIsValide(0)->setRaisonAnnulation($request->get('raison'));
  243.             $this->em->persist($commande);
  244.             $this->em->flush();
  245.             $to $commande->getUser()->getEmail();
  246.             $from "siteweb@ictuspharma.com";
  247.             $subject "Commande refusée";
  248.             $templateMail 'emails/refusCommandeSpecial.html.twig';
  249.             $paramsMail = [
  250.                 'numeroCommande' => "ICTCMD_MG_" $commande->getPharmacie()->getId() . "_" $commande->getReference(),
  251.                 'pharmacy' => $commande->getPharmacie()->getDesignation(),
  252.                 'raison' => $request->get('raison')
  253.             ];
  254.             $mailerServices->send($mi$to$from$subject$templateMail$paramsMail);
  255.             //SEND NOTIFICATION DANS PATIENT
  256.             $notificationService->pushNotification($commande$mobileAppareilRepo$subject);
  257.             //Fin envoie notification
  258.             return $this->redirectToRoute('app_ictus_commande_patient_liste');
  259.         }
  260.     }
  261.     /**
  262.      * @Route("/validateCommande/{id}", name="validate_commande_form")
  263.      */
  264.     public function validateCommande($idOrangeSmsService $orangeSmsServiceAdresseRepository $adresseRepoIctusPharmacieRepository $ictusPharmacieRepoParcoursRepository $parcoursRepoQuartierRepository $quartierRepoZoneRepository $zoneRepoNonDisponibiliteRepository $nonDisponibiliteRepoLivraisonRepository $livraisonRepoTarifParDefautRepository $tarifParDefautRepoZoneQuartierRepository $zoneQuartierRepoUserRepository $userRepoTarifKilometriqueRepository $tarifKilometriqueRepoTarifZoneRepository $tarifZoneRepoSocieteLivraisonService $societeLivraisonServiceSocieteLivraisonRepository $societeLivraisonRepoIctusCommandeRepository $ictusCommandeRepoIctusCommande $commandeRequest $requestIctocoinService $ictocoinServiceMailerServices $mailerServicesMailerInterface $miFactureService $factureService/* NotificationTwoPackagesService $notificationService, */ IctusMobileAppareilRepository $mobileAppareilRepoEtatPrisenchargeRepository $etatPrisenchargeRepoIctusEtatPaiementRepository $ictusEtatPaiementRepoNotificationSocieteLivraisonService $notificationSLServiceNotificationService $notificationService): Response
  265.     {
  266.         if ($request->isMethod('POST')) {
  267.             $prisencharge null;
  268.             foreach ($commande->getIctusCommandeLines() as $line) {
  269.                 if ($line->getChanged() == null) {
  270.                     $quantite $line->getQuantite();
  271.                     $remarque null;
  272.                     $isPrisencharge null;
  273.                     $newQuantite $request->get('quantite-' $line->getId());
  274.                     $prix $request->get('prix-' $line->getId());
  275.                     if ($request->get('remarque-' $line->getId()) != "") {
  276.                         $remarque $request->get('remarque-' $line->getId());
  277.                     }
  278.                     if ($newQuantite $quantite) {
  279.                         $newQuantite $quantite;
  280.                     }
  281.                     $isValide 0;
  282.                     if ($request->get('valide-' $line->getId()) != null) {
  283.                         $isValide 1;
  284.                     }
  285.                     if ($request->request->has('prisencharge-' $line->getId())) {
  286.                         if ($request->get('prisencharge-' $line->getId()) != null) {
  287.                             $isPrisencharge 1;
  288.                         }
  289.                     }
  290.                     $line->setIsValide($isValide)->setQuantite($newQuantite)->setPrixunitaire($prix)->setRemarque($remarque)->setIsPrisencharge($isPrisencharge);
  291.                     $this->em->persist($line);
  292.                 }
  293.             }
  294.             if ($request->request->has('prisencharge')) {
  295.                 if ($request->get('prisencharge') != "" && $request->get('prisencharge') != 0) {
  296.                     $prisencharge $commande->getPrisencharge();
  297.                     if ($prisencharge != null) {
  298.                         $partielementPayer $ictusEtatPaiementRepo->find(3);
  299.                         $etat $etatPrisenchargeRepo->find(2);
  300.                         $prisencharge->setEtat($etat)->setPrisencharge($request->get('prisencharge'));
  301.                         $this->em->persist($prisencharge);
  302.                         $historiquePaiement = new IctusHistoriquePaiement();
  303.                         $montant $commande->getTotalCommande(true) * $request->get('prisencharge') / 100;
  304.                         $historiquePaiement->setCommande($commande)->setMontant($montant);
  305.                         $this->em->persist($historiquePaiement);
  306.                         $commande->setEtatpaiement($partielementPayer);
  307.                     }
  308.                 }
  309.             }
  310.             $commandeRemise null;
  311.             if ($request->get('remise') !== null && $request->get('remise') != "") {
  312.                 $commandeRemise $request->get('remise');
  313.             }
  314.             $commande->setIsValide(true)->setRemise($commandeRemise);
  315.             $this->em->persist($commande);
  316.             $this->em->flush();
  317.             $factureService->editPatient($commande$prisencharge);
  318.             $raison 'Profit Ictuspharma sur la commande du ' date("d M Y") . ', Référence :/cmd {{' $commande->getId() . '}}';
  319.             $montantDebit $ictocoinService->montantIctocoin($commande->getPharmacie()->getid(), $commande->getTotalCommande());
  320.             $ictocoinService->debiter($this->getUser()->getIctusPharmacie(), $montantDebit$raison);
  321.             $to $commande->getUser()->getEmail();
  322.             $from "siteweb@ictuspharma.com";
  323.             $subject "VALIDATION COMMANDE";
  324.             $templateMail 'emails/validationCommande.html.twig';
  325.             $paramsMail = [
  326.                 'link'    => "https://ictuspharm.com/commande/historique/non-payer",
  327.                 'numeroCommande' => "ICT_CMD_" $commande->getId(),
  328.                 'pharmacy' => $commande->getPharmacie()->getDesignation()
  329.             ];
  330.             $mailerServices->send($mi$to$from$subject$templateMail$paramsMail);
  331.             //envoye message livreur de la societe de livraison choisi
  332.             $ictusCommande $ictusCommandeRepo->findById($id);
  333.             $sl null;
  334.             $parcours $ictusCommande->getParcours();
  335.             if ($parcours!= null) {
  336.               $sl $parcours->getLivraison()->getSocieteLivraison();
  337.             }
  338.             //dd($sl2->getUsers()[0]);
  339.             //$sl = $ictusCommande->getSocieteLivraison();
  340.             //$pt = $ictusCommande->getUser();
  341.             if ($sl) {
  342.                 $user_sl  $sl->getUsers()[0];
  343.                 $mobileAppareils $mobileAppareilRepo->findAllToArray($user_sl);
  344.                 $array_cfm_token array_unique((array_column($mobileAppareils"cfm_tokem")));
  345.                 if (!empty($array_cfm_token)) {
  346.                     $data = [
  347.                         'type'       => 'delivery_request',
  348.                         'status'     => 'validated_by_pharmacy',
  349.                         'click_action' => 'FLUTTER_NOTIFICATION_CLICK'// utile si tu as une app Flutter
  350.                     ];
  351.                     foreach ($array_cfm_token as $token) {
  352.                         $notificationSLService->sendNotification(
  353.                             $token,
  354.                             'Nouvelle demande de livraison',
  355.                             'Demande validée par la pharmacie, veuillez attribuer un livreur.',
  356.                             $data
  357.                         );
  358.                     }
  359.                 }
  360.             }
  361.             /*Livraison*/
  362.             //if commande.livraison is not null envoie notification User Societe de livraison $user[0] where role ROLE_SOCIETE_LIVRAISON
  363.             //Message : Demande valider par la pharmacie, veuillez attribuer un livreur a cette demande
  364.             
  365.             
  366.             /*Livraison*/
  367.             
  368.             //SEND NOTIFICATION DANS PATIENT
  369.             /* $notificationService->pushNotification($commande, $mobileAppareilRepo, $subject); */
  370.             //Fin envoie notification
  371.             return $this->redirectToRoute('app_ictus_commande_patient_liste');
  372.         }
  373.     }
  374.     /**
  375.      * @Route("/pharmacie/validation/commande/{code}/{codeSecret}", name="app_pharmacie_validation_commande")
  376.      */
  377.     public function validationCommande($code$codeSecretIctusPharmacieRepository $ictusPharmacieRepoIctusCommandeRepository $ictusCommandeRepoUserRepository $userRepoSocieteLivraisonRepository $societeLivraisonRepo): Response
  378.     {
  379.         if (!$this->getUser()) {
  380.             return $this->redirectToRoute('login');
  381.         } else {
  382.             $user $this->getUser();
  383.             $ictusPharmacie $ictusPharmacieRepo->findById($user->getIctusPharmacie()->getId());
  384.             $commande $ictusCommandeRepo->findIctusCommandeByCodeEtCodeSecretPharmacie($code$codeSecret$ictusPharmacie);
  385.             if ($commande) {
  386.                 $commande->setIsRecuperer(1);
  387.                 $ictusCommandeRepo->ReinitCodeCodeSecret($commande->getId());
  388.             } else {
  389.                 dd("a verifier ");
  390.             }
  391.         }
  392.     }
  393.     /**
  394.      * @Route("/pharmacie/validation/manuel/{id}" ,name="validation_manuel")
  395.      */
  396.     public function validationCommandeManuel($idRequest $requestIctusTypePaiementRepository $ictusTypePaiementRepoIctusPharmacieRepository $ictusPharmacieRepoIctusCommandeRepository $ictusCommandeRepoUserRepository $userRepoSocieteLivraisonRepository $societeLivraisonRepoIctusEtatPaiementRepository $ictusEtatPaiementRepo)
  397.     {
  398.         $role $request->get('role');
  399.         $codeSecret $request->get('codeSecret');
  400.         $user $this->getUser();
  401.         $ictusPharmacie $ictusPharmacieRepo->findById($user->getIctusPharmacie()->getId());
  402.         $commande $ictusCommandeRepo->findIctusCommandeByCodeEtCodeSecretPharmacie($id$codeSecret$ictusPharmacie);
  403.         if ($commande && $commande->isIsValide() == true) {
  404.             $paiement $ictusEtatPaiementRepo->find(2);
  405.             if ($role == 'patient') {
  406.                 $commande->setIsLivrer(1);
  407.                 //add historique
  408.                 $historiquePaiement = new IctusHistoriquePaiement();
  409.                 $dateNow = new DateTime();
  410.                 $typeEspece $ictusTypePaiementRepo->find(1);
  411.                 $historiquePaiement->setCreatedAt($dateNow)->setCommande($commande)->setMontant($commande->getTotalCommande())->setIctusTypePaiement($typeEspece);
  412.                 $this->em->persist($historiquePaiement);
  413.                 $ictusCommandeRepo->ReinitCodeCodeSecret($commande->getId());
  414.             } elseif ($role == 'livreur') {
  415.                 $commande->setIsRecuperer(1);
  416.                 $ictusCommandeRepo->ReinitCodeCodeSecret($commande->getId());
  417.             }
  418.             $commande->setEtatpaiement($paiement);
  419.             $this->em->persist($commande);
  420.             $this->em->flush($commande);
  421.             $this->addFlash('success''La commande a été marquée comme récupérée.');
  422.             return $this->redirectToRoute('app_ictus_commande_patient_liste');
  423.         } else {
  424.             $this->addFlash('success''La commande n\'a pas encore été validée.');
  425.             return $this->redirectToRoute('app_ictus_commande_patient_detail', ['id' => $id]);
  426.         }
  427.     }
  428.     /**
  429.      * @Route("/recuperer-commande-bycode/{commande}", name="recuperer_commande_bycode")
  430.      */
  431.     public function recupererCommandeBycode(IctusCommande $commandeRequest $requestIctusEtatPaiementRepository $ictusEtatPaiementRepo)
  432.     {
  433.         if ($commande) {
  434.             if ($commande->getCodeSecret() == $request->get("secret")) {
  435.                 $paiement $ictusEtatPaiementRepo->find(2);
  436.                 $commande->setIsLivrer(true)->setEtatpaiement($paiement);
  437.                 $this->em->persist($commande);
  438.                 $this->em->flush($commande);
  439.                 $this->addFlash('success''La commande a été marquée comme récupérée.');
  440.             } else {
  441.                 $this->addFlash('error''Erreur de code secret');
  442.                 return $this->redirectToRoute('app_ictus_commande_patient_liste');
  443.             }
  444.         }
  445.     }
  446.     /**
  447.      * @Route("facture/pdf/{facturepatient}", name="facture_pdf")
  448.      */
  449.     public function facturePdf(FacturePatient $facturepatientDomPDFService $pdfService): Response
  450.     {
  451.         $project_dir $this->params->get('kernel.project_dir');
  452.         $logo $project_dir "/public/assets/img/logo-mini.webp";
  453.         $render_template  'ictus_commande/facturePdf.html.twig';
  454.         $titre            "FACT_PHARM_MD_" $facturepatient->getPharmacie()->getId() . "_" $facturepatient->getId();
  455.         $file_name        $titre;
  456.         $data = [
  457.             'facture' => $facturepatient,
  458.             'logo'    => $logo
  459.         ];
  460.         $pdfService->export($file_name$render_template$file_name$data);
  461.         return new Response(json_encode("OK"));
  462.     }
  463. }