src/Services/GenerateDocuments.php line 59

Open in your IDE?
  1. <?php
  2. namespace App\Services;
  3. use Symfony\Component\DependencyInjection\Tests\Fixtures\StdClassDecorator;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Symfony\Component\Finder\SplFileInfo;
  7. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  8. use Symfony\Component\HttpFoundation\RedirectResponse;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use Symfony\Component\HttpFoundation\Session\Session;
  12. use Symfony\Component\HttpFoundation\JsonResponse;
  13. use Symfony\Component\DependencyInjection\ContainerInterface;
  14. use Symfony\Component\Translation\TranslatorInterface;
  15. use Symfony\Component\Form\FormEvent;
  16. use Symfony\Component\Form\FormEvents;
  17. use Symfony\Component\Form\FormError;
  18. use GuzzleHttp\Client;
  19. use App\Entity\User;
  20. use App\Entity\Membership;
  21. use App\Entity\Dic;
  22. use App\Entity\Fic;
  23. use App\Entity\Ba;
  24. use Symfony\Component\HttpFoundation\RequestStack;
  25. // Import the Twig Environment
  26. use Twig\Environment;
  27. use setasign\Fpdi\Fpdi;
  28. class GenerateDocuments
  29. {
  30.     private $container;
  31.     private $twig;
  32.     protected $fileUploader;
  33.     private $yousignApi;
  34.     private $yousignUrl;
  35.     private $yousignUi;
  36.     private $yousignUiConditions;
  37.     /**
  38.      * Constructor
  39.      *
  40.      * @param ContainerInterface $container
  41.      */
  42.     public function __construct(ContainerInterface $container$yousignApi$yousignUrl$yousignUi$yousignUiConditionsEntityManagerInterface $entityManager\Swift_Mailer $mailerEnvironment $twig\Knp\Snappy\Pdf $knpSnappyFileUploader $fileUploader)
  43.     {
  44.         $this->container $container;
  45.         $this->mailer $mailer;
  46.         $this->em $entityManager;
  47.         $this->twig $twig;
  48.         $this->knpSnappy $knpSnappy;
  49.         $this->fileUploader $fileUploader;
  50.         $this->yousignApi $yousignApi['yousignApi'];
  51.         $this->yousignUrl $yousignUrl['yousignUrl'];
  52.         $this->yousignUi $yousignUi['yousignUi'];
  53.         $this->yousignUiConditions $yousignUiConditions['yousignUiConditions'];
  54.     }
  55.     public function generateFic($customer)
  56.     {
  57.         $fic $customer->getCurrentMemberships()->getFic();
  58.         $ficFileName "fic-no-sign.pdf";
  59.         $ficFullPath $this->fileUploader->getTargetDirectory() . "/" $customer->getId() . "/" $ficFileName;
  60.         //If file exist
  61.         if (file_exists($ficFullPath)) {
  62.             //Remove last file
  63.             unlink($ficFullPath);
  64.         }
  65.         /*
  66.         $this->knpSnappy->setOption('page-size', 'A4');
  67.         $this->knpSnappy->setOption('encoding', 'UTF-8');
  68.         $this->knpSnappy->setOption('zoom', '1.62');
  69.         $this->knpSnappy->setOption('margin-left', '0');
  70.         $this->knpSnappy->setOption('margin-right', '0');
  71.         $this->knpSnappy->setOption('margin-top', '5');
  72.         $this->knpSnappy->setOption('margin-bottom', '5');
  73.         $this->knpSnappy->setOption('dpi', '96');
  74.         $this->knpSnappy->generateFromHtml(
  75.             $this->twig->render(
  76.                 'membership/pdf/ficView.html.twig',
  77.                 array(
  78.                     'fic' => 
  79.                 )
  80.             ),
  81.             $ficFullPath
  82.         );
  83.         */
  84.         //Valid checkbox
  85.         $fic->setReconnaisConnaissanceFic(true);
  86.         $fic->setAttesteRecuInformationDetaillee(true);
  87.         $fic->setAttesteRecuDicEtReglement(true);
  88.         $fic->setReconnaisPreconisationsAdaptees(true);
  89.         $this->em->persist($fic);
  90.         $this->em->flush();
  91.         // initiate FPDI
  92.         $pdf = new Fpdi();
  93.         // add a page
  94.         $pdf->AddPage();
  95.         // set the source file
  96.         if($customer->getAdherentDistributeur() == 0){
  97.             $numberPagesSource $pdf->setSourceFile("default/FIC_2024.pdf");
  98.         }
  99.         else{
  100.             $numberPagesSource $pdf->setSourceFile("default/FIC_2024_distributeur.pdf");
  101.         }
  102.         for ($i 1$i <= $numberPagesSource $i++) { 
  103.             if($i 1){
  104.                 $pdf->AddPage();
  105.             }
  106.             // import page
  107.             $tplId $pdf->importPage($i);
  108.             $pdf->useTemplate($tplId00);
  109.             //Global pages
  110.             $font "Helvetica";
  111.             $fontSizeText 11;
  112.             $fontSizeChecked 14;
  113.             $pdf->setFont($fontnull10);
  114.             switch ($i) {
  115.                 case '1':
  116.                     break;
  117.                 case '2':
  118.                     //Sexe
  119.                     if($fic->getSex() === "0"){
  120.                         $pdf->setFont($fontnull$fontSizeChecked);
  121.                         $pdf->Text(13.6155.6'X');
  122.                     } 
  123.                     else {
  124.                         $pdf->setFont($fontnull$fontSizeChecked);
  125.                         $pdf->Text(29.4155.6'X');
  126.                     }
  127.                     //Name
  128.                     $pdf->setFont($fontnull$fontSizeText);
  129.                     $pdf->Text(65.6160$this->decode($fic->getNom())." ".$this->decode($fic->getPrenom()));
  130.                     //Naissance année
  131.                     $pdf->setFont($fontnull$fontSizeText);
  132.                     $pdf->Text(50.4166.6$this->formatString($fic->getDateDeNaissance()->format("d")));
  133.                     $pdf->setFont($fontnull$fontSizeText);
  134.                     $pdf->Text(58.8166.6$this->formatString($fic->getDateDeNaissance()->format("m")));
  135.                     $pdf->setFont($fontnull$fontSizeText);
  136.                     $pdf->Text(67.2166.6$this->formatString($fic->getDateDeNaissance()->format("Y")));
  137.                     //Lieu naissance
  138.                     $pdf->setFont($fontnull$fontSizeText);
  139.                     $pdf->Text(83.3166.7$this->decode($fic->getLieuDeNaissance()));
  140.                     //Nationalité
  141.                     $pdf->setFont($fontnull$fontSizeText);
  142.                     $pdf->Text(30172.4$this->decode($fic->getNationalite()));
  143.                     //Résidence fiscal FR
  144.                     if($fic->isAdresseFiscaleResidenceFrance() == "0"){
  145.                         $pdf->setFont($fontnull$fontSizeChecked);
  146.                         $pdf->Text(51.1195.3'X');
  147.                     }
  148.                     else{
  149.                         $pdf->setFont($fontnull$fontSizeChecked);
  150.                         $pdf->Text(64.6195.3'X');
  151.                     }
  152.                     //adresse fiscale
  153.                     $pdf->setFont($fontnull$fontSizeText);
  154.                     $pdf->Text(34.1201$this->decode($fic->getAdresseFiscale()));
  155.                     //code postale fiscal
  156.                     $pdf->setFont($fontnull$fontSizeText);
  157.                     $pdf->Text(32.1207$this->formatString($fic->getAdresseFiscaleCodePostal()));
  158.                     //ville fiscal
  159.                     $pdf->setFont($fontnull$fontSizeText);
  160.                     $pdf->Text(59206.6$this->decode($fic->getAdresseFiscaleVille()));
  161.                     //pays fiscal
  162.                     $pdf->setFont($fontnull$fontSizeText);
  163.                     $pdf->Text(147207$this->decode($fic->getAdresseFiscalePays()));
  164.                     //adresse postale
  165.                     $pdf->setFont($fontnull$fontSizeText);
  166.                     $pdf->Text(53212.5$this->decode($fic->getAdressePostale()));
  167.                     //code postale
  168.                     $pdf->setFont($fontnull$fontSizeText);
  169.                     $pdf->Text(32.1218.6$this->formatString($fic->getAdresseCodePostal()));
  170.                     //ville
  171.                     $pdf->setFont($fontnull$fontSizeText);
  172.                     $pdf->Text(58.5218.6$this->decode($fic->getAdresseVille()));
  173.                     //pays
  174.                     $pdf->setFont($fontnull$fontSizeText);
  175.                     $pdf->Text(147218.6$this->decode($fic->getAdressePays()));
  176.                     //téléphone
  177.                     $pdf->setFont($fontnull11.3);
  178.                     $pdf->Text(38.6224.7$this->formatString($customer->getPhonePrefix()));
  179.                     $phone $customer->getPhone();
  180.                     $phone str_replace("("""$phone);
  181.                     $phone str_replace(")"""$phone);
  182.                     $phone str_replace(" """$phone);
  183.                     $pdf->Text(51.4224.7$this->formatString($phone));
  184.                     if($fic->getTelFix()){
  185.                         //téléphone fixe
  186.                         $pdf->setFont($fontnull11.3);
  187.                         $pdf->Text(116.6224.7$this->formatString($fic->getTelFixPrefix()));
  188.                         $phoneFixe $fic->getTelFix();
  189.                         $phoneFixe str_replace("("""$phoneFixe);
  190.                         $phoneFixe str_replace(")"""$phoneFixe);
  191.                         $phoneFixe str_replace(" """$phoneFixe);
  192.                         $pdf->Text(129.4224.7$this->formatString($phoneFixe));
  193.                     }
  194.                     
  195.                     //email
  196.                     $pdf->setFont($fontnull$fontSizeText);
  197.                     $pdf->Text(22230.4$this->decode($fic->getEmail()));
  198.                     //J'accepte 1
  199.                     if($fic->isAcceptRecevoirDocumentGarantieEmail() == false){
  200.                         $pdf->setFont($fontnull$fontSizeChecked);
  201.                         $pdf->Text(13.3242.9'X');
  202.                     }
  203.                     if($fic->isAcceptPropositionCommercialEmail() == false){
  204.                         //J'accepte 2
  205.                         $pdf->setFont($fontnull$fontSizeChecked);
  206.                         $pdf->Text(145.6249.5'X');
  207.                     }
  208.                     else{
  209.                         //Je refuse 2
  210.                         $pdf->setFont($fontnull$fontSizeChecked);
  211.                         $pdf->Text(159.3249.5'X');
  212.                     }
  213.                     if($fic->isAcceptPropositionCommercialTelephone() == false){
  214.                         //J'accepte 3
  215.                         $pdf->setFont($fontnull$fontSizeChecked);
  216.                         $pdf->Text(145.4255.5'X');
  217.                     }
  218.                     else{
  219.                         //Je refuse 3
  220.                         $pdf->setFont($fontnull$fontSizeChecked);
  221.                         $pdf->Text(159.4255.5'X');
  222.                     }
  223.                     break;
  224.                 case '3':
  225.                     //Politiquement exposé
  226.                     if($fic->isPersonnePolitiquementExposee() == false){
  227.                         $pdf->setFont($fontnull$fontSizeChecked);
  228.                         $pdf->Text(119.843.9'X');
  229.                         if($fic->getPersonnePolitiquementExposeeType() === "0"){
  230.                             //Politiquement exposé votre fonction
  231.                             $pdf->setFont($fontnull8);
  232.                             $pdf->Text(103.471.3$this->decode($fic->getPersonnePolitiquementExposeeMaFonction()));
  233.                         }
  234.                         else{
  235.                             //Politiquement exposé famille nom
  236.                             /*
  237.                             $pdf->setFont($font, null, $fontSizeText);
  238.                             $pdf->Text(93, 75.7, $this->decode($fic->getPersonnePolitiquementExposeeEntourageNom()));
  239.                             */
  240.                             //Politiquement exposé famille fonction
  241.                             $pdf->setFont($fontnull8);
  242.                             $pdf->Text(57.682$this->decode($fic->getPersonnePolitiquementExposeeEntourageFonction()));
  243.                             //Politiquement exposé famille lien
  244.                             $pdf->setFont($fontnull8);
  245.                             $pdf->Text(67.388.2$this->decode($fic->getPersonnePolitiquementExposeeEntourageLien()));
  246.                         }
  247.                     }
  248.                     else{
  249.                         $pdf->setFont($fontnull$fontSizeChecked);
  250.                         $pdf->Text(133.443.9'X');
  251.                     }
  252.                     //Situation familiale
  253.                     if($fic->getSituationFamilliale() === "0"){
  254.                         $pdf->setFont($fontnull$fontSizeChecked);
  255.                         $pdf->Text(14107.4'X');
  256.                     }
  257.                     else if($fic->getSituationFamilliale() === "1"){
  258.                         $pdf->setFont($fontnull$fontSizeChecked);
  259.                         $pdf->Text(35.8107.4'X');
  260.                     }
  261.                     else if($fic->getSituationFamilliale() === "2"){
  262.                         $pdf->setFont($fontnull$fontSizeChecked);
  263.                         $pdf->Text(57.3107.4'X');
  264.                     }
  265.                     else if($fic->getSituationFamilliale() === "3"){
  266.                         $pdf->setFont($fontnull$fontSizeChecked);
  267.                         $pdf->Text(88.8107.4'X');
  268.                     }
  269.                     else if($fic->getSituationFamilliale() === "4"){
  270.                         $pdf->setFont($fontnull$fontSizeChecked);
  271.                         $pdf->Text(113.7107.4'X');
  272.                     }
  273.                     else if($fic->getSituationFamilliale() === "5"){
  274.                         $pdf->setFont($fontnull$fontSizeChecked);
  275.                         $pdf->Text(137.2107.4'X');
  276.                     }
  277.                     //Nombre d'enfant
  278.                     $pdf->setFont($fontnull$fontSizeText);
  279.                     $pdf->Text(38.6113.1$fic->getNombreEnfant());
  280.                     //Nombre d'enfant à charge
  281.                     $pdf->setFont($fontnull$fontSizeText);
  282.                     $pdf->Text(109.5113.6$fic->getNombreEnfantCharge());
  283.                     //Situation professionnelle
  284.                     $pdf->setFont($fontnull11.2);
  285.                     $pdf->Text(51.7131.7$this->formatString($fic->getProfessionCspCategory()));
  286.                     $pdf->setFont($fontnull11.2);
  287.                     $pdf->Text(105.6131.7$this->formatString($fic->getProfessionCspSousCategory()));
  288.                     //Avez vous titre de reconnaissance nation
  289.                     if($fic->isReconnaisanceNation() == false){
  290.                         $pdf->setFont($fontnull$fontSizeChecked);
  291.                         $pdf->Text(117.9138'X');
  292.                         if($fic->getDateReconnaisanceNation()){
  293.                             //Avez vous titre de reconnaissance nation année
  294.                             $pdf->setFont($fontnull11.4);
  295.                             $pdf->Text(65.9144$this->formatString($fic->getDateReconnaisanceNation()->format("Y")));
  296.                         }
  297.                     }
  298.                     else{
  299.                         $pdf->setFont($fontnull$fontSizeChecked);
  300.                         $pdf->Text(134138'X');
  301.                     }
  302.                     /*
  303.                     if($fic->getProtectionJuridique() === "0" || $fic->getProtectionJuridique() === "1" || $fic->getProtectionJuridique() === "2" || $fic->getProtectionJuridique() === "3"){
  304.                         //Régime légal de protection ?
  305.                         $pdf->setFont($font, null, $fontSizeChecked);
  306.                         $pdf->Text(84.6, 165.8, 'X');
  307.                         //Régime légal de protection choix
  308.                         if($fic->getProtectionJuridique() == "0"){
  309.                             $pdf->setFont($font, null, $fontSizeChecked);
  310.                             $pdf->Text(13.3, 182.4, 'X');
  311.                         }
  312.                         else if($fic->getProtectionJuridique() == "1"){
  313.                             $pdf->setFont($font, null, $fontSizeChecked);
  314.                             $pdf->Text(32.6, 182.4, 'X');
  315.                         }
  316.                         else if($fic->getProtectionJuridique() == "2"){
  317.                             $pdf->setFont($font, null, $fontSizeChecked);
  318.                             $pdf->Text(54.7, 182.4, 'X');
  319.                         }
  320.                         else if($fic->getProtectionJuridique() == "3"){
  321.                             $pdf->setFont($font, null, $fontSizeChecked);
  322.                             $pdf->Text(94, 182.4, 'X');
  323.                             $pdf->setFont($font, null, $fontSizeText);
  324.                             $pdf->Text(111.9, 182.2, $this->decode($fic->getProtectionJuridiqueOther()));
  325.                         }
  326.                         //Mineur
  327.                         if($fic->getProtectionJuridiqueMineur() == "0"){
  328.                             $pdf->setFont($font, null, $fontSizeChecked);
  329.                             $pdf->Text(26.4, 191.2, 'X');
  330.                         }
  331.                         else if($fic->getProtectionJuridiqueMineur() == "1"){
  332.                             $pdf->setFont($font, null, $fontSizeChecked);
  333.                             $pdf->Text(71.4, 191.2, 'X');
  334.                         }
  335.                         else if($fic->getProtectionJuridiqueMineur() == "2"){
  336.                             $pdf->setFont($font, null, $fontSizeChecked);
  337.                             $pdf->Text(93.5, 191.2, 'X');
  338.                         }
  339.                     }
  340.                     */
  341.                     //Force "Non"
  342.                     $pdf->setFont($fontnull$fontSizeChecked);
  343.                     $pdf->Text(100.2165.8'X');
  344.                     break;
  345.                 case '4':
  346.                     //Estimation patrimoine net
  347.                     if($fic->getEvaluationPatrimoine() == "0"){
  348.                         $pdf->setFont($fontnull$fontSizeChecked);
  349.                         $pdf->Text(13.7101.9'X');
  350.                     }
  351.                     else if($fic->getEvaluationPatrimoine() == "1"){
  352.                         $pdf->setFont($fontnull$fontSizeChecked);
  353.                         $pdf->Text(34.2101.9'X');
  354.                     }
  355.                     else if($fic->getEvaluationPatrimoine() == "2"){
  356.                         $pdf->setFont($fontnull$fontSizeChecked);
  357.                         $pdf->Text(71.8101.9'X');
  358.                     }
  359.                     else if($fic->getEvaluationPatrimoine() == "3"){
  360.                         $pdf->setFont($fontnull$fontSizeChecked);
  361.                         $pdf->Text(110101.9'X');
  362.                     }
  363.                     else if($fic->getEvaluationPatrimoine() == "4"){
  364.                         $pdf->setFont($fontnull$fontSizeChecked);
  365.                         $pdf->Text(150.7101.9'X');
  366.                     }
  367.                     //Composition patrimoine
  368.                     foreach ($fic->getEvaluationPatrimoineComposition() as $composition) {
  369.                         switch ($composition) {
  370.                             case '0':
  371.                                 $pdf->setFont($fontnull$fontSizeChecked);
  372.                                 $pdf->Text(13.5118.9'X');
  373.                                 break;
  374.                             case '1':
  375.                                 $pdf->setFont($fontnull$fontSizeChecked);
  376.                                 $pdf->Text(60.8118.9'X');
  377.                                 break;
  378.                             case '2':
  379.                                 $pdf->setFont($fontnull$fontSizeChecked);
  380.                                 $pdf->Text(105.7118.9'X');
  381.                                 
  382.                                 break;
  383.                             case '4':
  384.                                 $pdf->setFont($fontnull$fontSizeChecked);
  385.                                 $pdf->Text(13.5125.9'X');
  386.                                 break;
  387.                             case '3':
  388.                                 $pdf->setFont($fontnull$fontSizeChecked);
  389.                                 $pdf->Text(49.8125.9'X');
  390.                                 break;
  391.                             case '5':
  392.                                 $pdf->setFont($fontnull$fontSizeChecked);
  393.                                 $pdf->Text(89.1125.9'X');
  394.                                 $pdf->setFont($fontnull$fontSizeText);
  395.                                 $pdf->Text(105125.9$this->decode($fic->getEvaluationPatrimoineCompositionOther()));
  396.                                 break;
  397.                             
  398.                             default:
  399.                                 // code...
  400.                                 break;
  401.                         }
  402.                     }
  403.                     //Ressource financiere perçue n-1
  404.                     if($fic->getRevenusNetMensuelsFoyer() == "0"){
  405.                         $pdf->setFont($fontnull$fontSizeChecked);
  406.                         $pdf->Text(13.5147.8'X');
  407.                     }
  408.                     else if($fic->getRevenusNetMensuelsFoyer() == "1"){
  409.                         $pdf->setFont($fontnull$fontSizeChecked);
  410.                         $pdf->Text(37.6147.8'X');
  411.                     }
  412.                     else if($fic->getRevenusNetMensuelsFoyer() == "2"){
  413.                         $pdf->setFont($fontnull$fontSizeChecked);
  414.                         $pdf->Text(80147.8'X');
  415.                     }
  416.                     else if($fic->getRevenusNetMensuelsFoyer() == "3"){
  417.                         $pdf->setFont($fontnull$fontSizeChecked);
  418.                         $pdf->Text(123.7147.8'X');
  419.                     }
  420.                     //Composition de foyer fiscal 
  421.                     foreach ($fic->getRevenusNetMensuelsFoyerComposition() as $composition) {
  422.                         switch ($composition) {
  423.                             case '0':
  424.                                 $pdf->setFont($fontnull$fontSizeChecked);
  425.                                 $pdf->Text(13.6165.5'X');
  426.                                 break;
  427.                             case '1':
  428.                                 $pdf->setFont($fontnull$fontSizeChecked);
  429.                                 $pdf->Text(55165.5'X');
  430.                                 break;
  431.                             case '2':
  432.                                 $pdf->setFont($fontnull$fontSizeChecked);
  433.                                 $pdf->Text(87.3165.5'X');
  434.                                 break;
  435.                             case '3':
  436.                                 $pdf->setFont($fontnull$fontSizeChecked);
  437.                                 $pdf->Text(110165.5'X');
  438.                                 break;
  439.                             case '4':
  440.                                 $pdf->setFont($fontnull$fontSizeChecked);
  441.                                 $pdf->Text(141.1165.5'X');
  442.                                 break;
  443.                             case '5':
  444.                                 $pdf->setFont($fontnull$fontSizeChecked);
  445.                                 $pdf->Text(13.6171.8'X');
  446.                                 $pdf->setFont($fontnull$fontSizeText);
  447.                                 $pdf->Text(28.8171.5$this->decode($fic->getRevenusNetMensuelsFoyerCompositionOther()));
  448.                                 break;
  449.                             
  450.                             default:
  451.                                 // code...
  452.                                 break;
  453.                         }
  454.                     }
  455.                     //Part de revenu 
  456.                     if($fic->getPartChargeReguliere() == "0"){
  457.                         $pdf->setFont($fontnull$fontSizeChecked);
  458.                         $pdf->Text(13.6193'X');
  459.                     }
  460.                     else if($fic->getPartChargeReguliere() == "1"){
  461.                         $pdf->setFont($fontnull$fontSizeChecked);
  462.                         $pdf->Text(33193'X');
  463.                     }
  464.                     else if($fic->getPartChargeReguliere() == "2"){
  465.                         $pdf->setFont($fontnull$fontSizeChecked);
  466.                         $pdf->Text(67193'X');
  467.                     }
  468.                     else if($fic->getPartChargeReguliere() == "3"){
  469.                         $pdf->setFont($fontnull$fontSizeChecked);
  470.                         $pdf->Text(101193'X');
  471.                     }
  472.                     //Expérience financière
  473.                     if($fic->getNiveauConnaissanceRetraite() == "0"){
  474.                         $pdf->setFont($fontnull$fontSizeChecked);
  475.                         $pdf->Text(12.9226.5'X');
  476.                     }
  477.                     else if($fic->getNiveauConnaissanceRetraite() == "1"){
  478.                         $pdf->setFont($fontnull$fontSizeChecked);
  479.                         $pdf->Text(12.9235.1'X');
  480.                     }
  481.                     else if($fic->getNiveauConnaissanceRetraite() == "2"){
  482.                         $pdf->setFont($fontnull$fontSizeChecked);
  483.                         $pdf->Text(12.9243.8'X');
  484.                     }
  485.                     break;
  486.                 case '5':
  487.                     //Objectifs principaux
  488.                     foreach ($fic->getObjectifsPricipaux() as $objectif) {
  489.                         switch ($objectif) {
  490.                             case '0':
  491.                                 $pdf->setFont($fontnull$fontSizeChecked);
  492.                                 $pdf->Text(1454.8'X');
  493.                                 break;
  494.                             case '1':
  495.                                 $pdf->setFont($fontnull$fontSizeChecked);
  496.                                 $pdf->Text(56.254.8'X');
  497.                                 break;
  498.                             case '2':
  499.                                 $pdf->setFont($fontnull$fontSizeChecked);
  500.                                 $pdf->Text(112.254.8'X');
  501.                                 break;
  502.                             case '3':
  503.                                 $pdf->setFont($fontnull$fontSizeChecked);
  504.                                 $pdf->Text(1462'X');
  505.                                 break;
  506.                             case '4':
  507.                                 $pdf->setFont($fontnull$fontSizeChecked);
  508.                                 $pdf->Text(61.762'X');
  509.                                 break;
  510.                             case '5':
  511.                                 $pdf->setFont($fontnull$fontSizeChecked);
  512.                                 $pdf->Text(101.862'X');
  513.                                 break;
  514.                             
  515.                             default:
  516.                                 // code...
  517.                                 break;
  518.                         }
  519.                     }
  520.                     //Temps fond placé
  521.                     if($fic->getObjectifsTempsFonds() == "0"){
  522.                         $pdf->setFont($fontnull$fontSizeChecked);
  523.                         $pdf->Text(13.284.3'X');
  524.                     }
  525.                     else if($fic->getObjectifsTempsFonds() == "1"){
  526.                         $pdf->setFont($fontnull$fontSizeChecked);
  527.                         $pdf->Text(46.284.3'X');
  528.                     }
  529.                     else if($fic->getObjectifsTempsFonds() == "2"){
  530.                         $pdf->setFont($fontnull$fontSizeChecked);
  531.                         $pdf->Text(7584.3'X');
  532.                     }
  533.                     //Montant initial
  534.                     $pdf->setFont($fontnull$fontSizeText);
  535.                     $pdf->Text(130100.3$fic->getObjectifsMontantIntial());
  536.                     //Placement pra raport au patromoine (%) 
  537.                     if($fic->getObjectifsPlacementSurPatrimoineTotal() == "0"){
  538.                         $pdf->setFont($fontnull$fontSizeChecked);
  539.                         $pdf->Text(13.2117.2'X');
  540.                     }
  541.                     else if($fic->getObjectifsPlacementSurPatrimoineTotal() == "1"){
  542.                         $pdf->setFont($fontnull$fontSizeChecked);
  543.                         $pdf->Text(41.2117.2'X');
  544.                     }
  545.                     else if($fic->getObjectifsPlacementSurPatrimoineTotal() == "2"){
  546.                         $pdf->setFont($fontnull$fontSizeChecked);
  547.                         $pdf->Text(68.3117.2'X');
  548.                     }
  549.                     else if($fic->getObjectifsPlacementSurPatrimoineTotal() == "3"){
  550.                         $pdf->setFont($fontnull$fontSizeChecked);
  551.                         $pdf->Text(93.8116.9'X');
  552.                     }
  553.                     //Date souhaité
  554.                     /*
  555.                     $pdf->setFont($font, null, 22);
  556.                     $pdf->Text(87.4, 131, $this->formatString($fic->getGarantieDateSouhaite()->format("d")));
  557.                     $pdf->setFont($font, null, 22);
  558.                     $pdf->Text(104, 131, $this->formatString($fic->getGarantieDateSouhaite()->format("m")));
  559.                     $pdf->setFont($font, null, 22);
  560.                     $pdf->Text(120.1, 131, $this->formatString($fic->getGarantieDateSouhaite()->format("Y")));
  561.                     */
  562.                     //Nos recommendations
  563.                     if($fic->getSouscrireRetraiteMutualistePourConstituer() == "0"){
  564.                         $pdf->setFont($fontnull$fontSizeChecked);
  565.                         $pdf->Text(13.2189.4'X');
  566.                     }
  567.                     else if($fic->getSouscrireRetraiteMutualistePourConstituer() == "1"){
  568.                         $pdf->setFont($fontnull$fontSizeChecked);
  569.                         $pdf->Text(13.2198.7'X');
  570.                     }
  571.                     else if($fic->getSouscrireRetraiteMutualistePourConstituer() == "2"){
  572.                         $pdf->setFont($fontnull$fontSizeChecked);
  573.                         $pdf->Text(13.2207.5'X');
  574.                     }
  575.                     break;
  576.                 case '6':
  577.                     //Votre choix
  578.                     if($fic->isJacceptePreconisation()){
  579.                         $pdf->setFont($fontnull$fontSizeChecked);
  580.                         $pdf->Text(13.250.2'X');
  581.                     }
  582.                     if($fic->isSouscrireAutreContrat()){
  583.                         $pdf->setFont($fontnull$fontSizeChecked);
  584.                         $pdf->Text(13.260.1'X');
  585.                     }
  586.                     break;
  587.                 case '7':
  588.                     //Vos déclarations
  589.                     if($fic->isReconnaisConnaissanceFic()){
  590.                         $pdf->setFont($fontnull$fontSizeChecked);
  591.                         $pdf->Text(13.361.9'X');
  592.                     }
  593.                     if($fic->isAttesteRecuInformationDetaillee()){
  594.                         $pdf->setFont($fontnull$fontSizeChecked);
  595.                         $pdf->Text(13.373.4'X');
  596.                     }
  597.                     if($fic->isAttesteRecuDicEtReglement()){
  598.                         $pdf->setFont($fontnull$fontSizeChecked);
  599.                         $pdf->Text(13.384.9'X');
  600.                     }
  601.                     if($fic->isReconnaisPreconisationsAdaptees()){
  602.                         $pdf->setFont($fontnull$fontSizeChecked);
  603.                         $pdf->Text(13.396.5'X');
  604.                     }
  605.                     break;
  606.                 case '8':
  607.                     break;
  608.                 
  609.                 default:
  610.                     // code...
  611.                     break;
  612.             }
  613.         }
  614.         //Third parameter : ISO-8859-1 (false) or UTF-8 (true) > default : false
  615.         $pdf->Output('F'$ficFullPath);
  616.         return $ficFileName;
  617.     }
  618.     public function generateBa($customer)
  619.     {
  620.         $baFileName "ba-no-sign.pdf";
  621.         $baFullPath $this->fileUploader->getTargetDirectory() . "/" $customer->getId() . "/" $baFileName;
  622.         //If file exist
  623.         if (file_exists($baFullPath)) {
  624.             //Remove last file
  625.             unlink($baFullPath);
  626.         }
  627.         $ba $customer->getCurrentMemberships()->getBa();
  628.         //Valid checkbox
  629.         if($ba->getJaiDemandeAttributionDe()){
  630.             $ba->setEngageFournirCopieTitreAttribue(true);
  631.         }
  632.         else{
  633.             $ba->setEngageFournirCopieTitreAttribue(false);
  634.         }
  635.         $ba->setReconnaisEtreInforme(true);
  636.         $ba->setConnaissanceDesStatuts(true);
  637.         $ba->setReconnaisRenoncer30Jours(true);
  638.         $ba->setReconnaisAvoirPrisConnaissance(true);
  639.         $this->em->persist($ba);
  640.         $this->em->flush();
  641.         // initiate FPDI
  642.         $pdf = new Fpdi();
  643.         // add a page
  644.         $pdf->AddPage();
  645.         // set the source file
  646.         $numberPagesSource $pdf->setSourceFile("default/BA_2024.pdf");
  647.         for ($i 1$i <= $numberPagesSource $i++) { 
  648.             if($i 1){
  649.                 $pdf->AddPage();
  650.             }
  651.             // import page
  652.             $tplId $pdf->importPage($i);
  653.             $pdf->useTemplate($tplId00);
  654.             //Global pages
  655.             $font "Helvetica";
  656.             $fontSizeText 11;
  657.             $fontSizeChecked 11;
  658.             $pdf->setFont($fontnull10);
  659.             switch ($i) {
  660.                 case '3':
  661.                     //Numéro adhérent
  662.                     $pdf->setFont($fontnull$fontSizeText);
  663.                     $pdf->Text(38.255.5$ba->getNumeroAdherent());
  664.                     //code conseiller
  665.                     $pdf->setFont($fontnull10.5);
  666.                     $pdf->Text(171.755.7$this->formatString($customer->getSeller()->getCodeConseiller()));
  667.                     //Vente distance
  668.                     if($ba->getVenteADistance()){
  669.                         $pdf->setFont($fontnull$fontSizeChecked);
  670.                         $pdf->Text(45.970.6'X');
  671.                     }
  672.                     else {
  673.                         $pdf->setFont($fontnull$fontSizeChecked);
  674.                         $pdf->Text(6270.6'X');
  675.                     }
  676.                     //Nom conseiller
  677.                     $pdf->setFont($fontnull$fontSizeText);
  678.                     $pdf->Text(46.576.7$this->decode($customer->getSeller()->getFirstName())." ".$this->decode($customer->getSeller()->getLastName()));
  679.                     //Téléphone conseiller
  680.                     $pdf->setFont($fontnull11.4);
  681.                     $phone $customer->getSeller()->getPhone();
  682.                     $phone str_replace("("""$phone);
  683.                     $phone str_replace(")"""$phone);
  684.                     $phone str_replace(" """$phone);
  685.                     $pdf->Text(43.383$this->formatString($phone));
  686.                     //Numéro adhérent distributeur
  687.                     $pdf->setFont($fontnull$fontSizeText);
  688.                     $pdf->Text(5689.4$customer->getAdherentDistributeur());
  689.                     //Siren
  690.                     $pdf->setFont($fontnull11.6);
  691.                     $pdf->Text(13989.6$this->formatString($customer->getSeller()->getNumeroSiren()));
  692.                     //Sex
  693.                     if($ba->getSex() === "0"){
  694.                         $pdf->setFont($fontnull$fontSizeChecked);
  695.                         $pdf->Text(39.5118.9'X');
  696.                     }
  697.                     else {
  698.                         $pdf->setFont($fontnull$fontSizeChecked);
  699.                         $pdf->Text(53118.8'X');
  700.                     }
  701.                     //Nom et prénoms
  702.                     $pdf->setFont($fontnull$fontSizeText);
  703.                     $pdf->Text(65.4124.4$this->decode($ba->getNom())." ".$this->decode($ba->getPrenom()));
  704.                     //Date naissance
  705.                     $pdf->setFont($fontnull11);
  706.                     $pdf->Text(49.8129.3$this->formatString($ba->getDateDeNaissance()->format("d")));
  707.                     $pdf->setFont($fontnull11);
  708.                     $pdf->Text(58.3129.3$this->formatString($ba->getDateDeNaissance()->format("m")));
  709.                     $pdf->setFont($fontnull11);
  710.                     $pdf->Text(66.7129.3$this->formatString($ba->getDateDeNaissance()->format("Y")));
  711.                     //Lieu de naissance
  712.                     $pdf->setFont($fontnull$fontSizeText);
  713.                     $pdf->Text(82129.2$this->decode($ba->getLieuDeNaissance()));
  714.                     //Sécurité social
  715.                     $pdf->setFont($fontnull12.2);
  716.                     $pdf->Text(24.8134.6$this->formatString($ba->getNumeroSS(), "ss"));
  717.                     $pdf->setFont($fontnull12.2);
  718.                     $pdf->Text(79.7134.6$this->formatString($ba->getCleNumeroSS()));
  719.                     //Nationnalité
  720.                     $pdf->setFont($fontnull9);
  721.                     $pdf->Text(30.9139$this->decode($ba->getNationalite()));
  722.                     //Type identité
  723.                     $typeIdentite "";
  724.                     switch ($ba->getTypeDePieceIdentite()) {
  725.                         case 0:
  726.                             $typeIdentite "Carte d'identité";
  727.                             break;
  728.                         case 1:
  729.                             $typeIdentite "Passeport";
  730.                             break;
  731.                         case 2:
  732.                             $typeIdentite "Titre de séjour";
  733.                             break;
  734.                         
  735.                         default:
  736.                             $typeIdentite "Carte d'identité";
  737.                             break;
  738.                     }
  739.                     $pdf->setFont($fontnull11);
  740.                     $pdf->Text(69.2144.3$this->decode($typeIdentite));
  741.                     //Green card ?
  742.                     if($ba->isGreenCard()){
  743.                         $pdf->setFont($fontnull$fontSizeChecked);
  744.                         $pdf->Text(124.1150.2'X');
  745.                     }
  746.                     else{
  747.                         $pdf->setFont($fontnull$fontSizeChecked);
  748.                         $pdf->Text(137150.2'X');
  749.                     }
  750.                     //Residence fiscale ?
  751.                     if($ba->isResidenceFrance() == "1"){
  752.                         $pdf->setFont($fontnull$fontSizeChecked);
  753.                         $pdf->Text(77.1155.1'X');
  754.                     } 
  755.                     else {
  756.                         $pdf->setFont($fontnull$fontSizeChecked);
  757.                         $pdf->Text(90155.1'X');
  758.                         //Numéro fiscal
  759.                         $pdf->setFont($fontnull11.6);
  760.                         $pdf->Text(147.4159.8$this->formatString($ba->getResidenceIdentificationFiscalPays()));
  761.                     }
  762.                     //adresse fiscal
  763.                     $pdf->setFont($fontnull$fontSizeText);
  764.                     $pdf->Text(36164.8$this->decode($ba->getFiscaleAddress()));
  765.                     //Code postal fiscal
  766.                     $pdf->setFont($fontnull11.2);
  767.                     $pdf->Text(32.1170.1$this->formatString($ba->getFiscaleCodePostal()));
  768.                     //Ville fiscal
  769.                     $pdf->setFont($fontnull$fontSizeText);
  770.                     $pdf->Text(58.2169.8$this->decode($ba->getFiscaleVille()));
  771.                     //Pays fiscal
  772.                     $pdf->setFont($fontnull$fontSizeText);
  773.                     $pdf->Text(146169.8$this->decode($ba->getFiscalePays()));
  774.                     //Adresse postale
  775.                     $pdf->setFont($fontnull$fontSizeText);
  776.                     $pdf->Text(52174.9$this->decode($ba->getNumeroDeVoie()));
  777.                     //POSTALE
  778.                     //Code postal fiscal
  779.                     $pdf->setFont($fontnull11.2);
  780.                     $pdf->Text(32.1180.1$this->formatString($ba->getCodePostal()));
  781.                     //Ville postal
  782.                     $pdf->setFont($fontnull$fontSizeText);
  783.                     $pdf->Text(58.2180.1$this->decode($ba->getVille()));
  784.                     //Pays postal
  785.                     $pdf->setFont($fontnull$fontSizeText);
  786.                     $pdf->Text(146180.1$this->decode($ba->getPays()));
  787.                     
  788.                     //Téléphone
  789.                     $pdf->setFont($fontnull11.3);
  790.                     $pdf->Text(39.8189.9$this->formatString($customer->getPhonePrefix()));
  791.                     $pdf->setFont($fontnull11.3);
  792.                     $phone $customer->getPhone();
  793.                     $phone str_replace("("""$phone);
  794.                     $phone str_replace(")"""$phone);
  795.                     $phone str_replace(" """$phone);
  796.                     $pdf->Text(52.2189.9$this->formatString($phone));
  797.                     //Email
  798.                     $pdf->setFont($fontnull$fontSizeText);
  799.                     $pdf->Text(25185$ba->getEmail());
  800.                     if($ba->getTelFix()){
  801.                         //téléphone fixe
  802.                         $pdf->setFont($fontnull11.3);
  803.                         $pdf->Text(114.6189.9$this->formatString($ba->getTelFixPrefix()));
  804.                         $phoneFixe $ba->getTelFix();
  805.                         $phoneFixe str_replace("("""$phoneFixe);
  806.                         $phoneFixe str_replace(")"""$phoneFixe);
  807.                         $phoneFixe str_replace(" """$phoneFixe);
  808.                         $pdf->Text(127189.9$this->formatString($phoneFixe));
  809.                     }
  810.                     //J'accepte 1 
  811.                     if($ba->isAcceptRecevoirDocumentGarantieEmail() == false){
  812.                         $pdf->setFont($fontnull$fontSizeChecked);
  813.                         $pdf->Text(13.1202.7'X');
  814.                     }
  815.                     //J'accepte 2 Oui
  816.                     if($ba->isAcceptPropositionCommercialEmail() == false){
  817.                         $pdf->setFont($fontnull$fontSizeChecked);
  818.                         $pdf->Text(145.2207.7'X');
  819.                     }
  820.                     else{
  821.                         //J'accepte 2 Non
  822.                         $pdf->setFont($fontnull$fontSizeChecked);
  823.                         $pdf->Text(159.1207.7'X');
  824.                     }
  825.                     //J'accepte 3 Oui
  826.                     if($ba->isAcceptPropositionCommercialTelephone() == false){
  827.                         $pdf->setFont($fontnull$fontSizeChecked);
  828.                         $pdf->Text(145.2212.6'X');
  829.                     }
  830.                     else{
  831.                         //J'accepte 3 Non
  832.                         $pdf->setFont($fontnull$fontSizeChecked);
  833.                         $pdf->Text(159.2212.6'X');
  834.                     }
  835.                     //Situation famille
  836.                     switch ($ba->getSituationFamilliale()) {
  837.                         case 0:
  838.                             $pdf->setFont($fontnull$fontSizeChecked);
  839.                             $pdf->Text(13.7224.8'X');
  840.                             break;
  841.                         case 1:
  842.                             $pdf->setFont($fontnull$fontSizeChecked);
  843.                             $pdf->Text(34.8224.8'X');
  844.                             break;
  845.                         case 2:
  846.                             $pdf->setFont($fontnull$fontSizeChecked);
  847.                             $pdf->Text(55.8224.8'X');
  848.                             break;
  849.                         case 3:
  850.                             $pdf->setFont($fontnull$fontSizeChecked);
  851.                             $pdf->Text(86.6224.8'X');
  852.                             break;
  853.                         case 4:
  854.                             $pdf->setFont($fontnull$fontSizeChecked);
  855.                             $pdf->Text(110.8224.8'X');
  856.                             break;
  857.                         case 5:
  858.                             $pdf->setFont($fontnull$fontSizeChecked);
  859.                             $pdf->Text(132.3224.8'X');
  860.                             break;
  861.                         
  862.                         default:
  863.                             // code...
  864.                             break;
  865.                     }
  866.                         
  867.                     //Situation pro
  868.                     $pdf->setFont($fontnull11.2);
  869.                     $pdf->Text(51.7237.1$this->formatString($ba->getProfessionCspCategory()));
  870.                     $pdf->setFont($fontnull11.2);
  871.                     $pdf->Text(105.2237.1$this->formatString($ba->getProfessionCspSousCategory()));
  872.                     //Titulaire de
  873.                     if($ba->getTitulaireDe()){
  874.                         foreach($ba->getTitulaireDe() as $titulaireDe){
  875.                             switch ($titulaireDe) {
  876.                                 case 0:
  877.                                     $pdf->setFont($fontnull$fontSizeChecked);
  878.                                     $pdf->Text(13.1260.1'X');
  879.                                     //Date obtention 1
  880.                                     $pdf->setFont($fontnull11.2);
  881.                                     $pdf->Text(138.8259.1$this->formatString($ba->getDateCarteCombattant()->format("d")));
  882.                                     $pdf->setFont($fontnull11.2);
  883.                                     $pdf->Text(147.1259.1$this->formatString($ba->getDateCarteCombattant()->format("m")));
  884.                                     $pdf->setFont($fontnull11.2);
  885.                                     $pdf->Text(155.3259.1$this->formatString($ba->getDateCarteCombattant()->format("Y")));
  886.                                     break;
  887.                                 case 1:
  888.                                     $pdf->setFont($fontnull$fontSizeChecked);
  889.                                     $pdf->Text(13.1265.1'X');
  890.                                     //Date obtention 2
  891.                                     $pdf->setFont($fontnull11.2);
  892.                                     $pdf->Text(138.8264.3$this->formatString($ba->getDateReconnaisanceNation()->format("d")));
  893.                                     $pdf->setFont($fontnull11.2);
  894.                                     $pdf->Text(147.1264.3$this->formatString($ba->getDateReconnaisanceNation()->format("m")));
  895.                                     $pdf->setFont($fontnull11.2);
  896.                                     $pdf->Text(155.3264.3$this->formatString($ba->getDateReconnaisanceNation()->format("Y")));
  897.                                     break;
  898.                                 case 2:
  899.                                     $pdf->setFont($fontnull$fontSizeChecked);
  900.                                     $pdf->Text(13.1270'X');
  901.                                     //Date obtention 3
  902.                                     $pdf->setFont($fontnull11.2);
  903.                                     $pdf->Text(162269.2$this->formatString($ba->getDateTranscriptionMention()->format("d")));
  904.                                     $pdf->setFont($fontnull11.2);
  905.                                     $pdf->Text(170.4269.2$this->formatString($ba->getDateTranscriptionMention()->format("m")));
  906.                                     $pdf->setFont($fontnull11.2);
  907.                                     $pdf->Text(178.7269.2$this->formatString($ba->getDateTranscriptionMention()->format("Y")));
  908.                                     break;
  909.                                 
  910.                                 default:
  911.                                     // code...
  912.                                     break;
  913.                             }
  914.                         }
  915.                     }
  916.                     //Conflit concerné
  917.                     if($ba->getConflitConcerne()){
  918.                         foreach($ba->getConflitConcerne() as $conflitConcerne){
  919.                             switch ($conflitConcerne) {
  920.                                 case 0:
  921.                                     $pdf->setFont($fontnull$fontSizeChecked);
  922.                                     $pdf->Text(13.1284.1'X');
  923.                                     break;
  924.                                 case 1:
  925.                                     $pdf->setFont($fontnull$fontSizeChecked);
  926.                                     $pdf->Text(61.3284.1'X');
  927.                                     break;
  928.                                 case 2:
  929.                                     $pdf->setFont($fontnull$fontSizeChecked);
  930.                                     $pdf->Text(80.5284.1'X');
  931.                                     break;
  932.                                 case 3:
  933.                                     $pdf->setFont($fontnull$fontSizeChecked);
  934.                                     $pdf->Text(99.7284.1'X');
  935.                                     break;
  936.                                 case 4:
  937.                                     $pdf->setFont($fontnull$fontSizeChecked);
  938.                                     $pdf->Text(118.3284.1'X');
  939.                                     $pdf->setFont($fontnull$fontSizeText);
  940.                                     $pdf->Text(143284.2$this->decode($ba->getConflitOpexDescription()));
  941.                                     break;
  942.                                 
  943.                                 default:
  944.                                     // code...
  945.                                     break;
  946.                             }
  947.                         }
  948.                     }
  949.                     break;
  950.                 case '4':
  951.                     //conflit concerné OU -> J'ai demandé l'attributiond de
  952.                     if($ba->getJaiDemandeAttributionDe()){
  953.                         $pdf->setFont($fontnull$fontSizeChecked);
  954.                         $pdf->Text(13.121.5'X');
  955.                     }
  956.                     //conflit concerné OU -> Titres
  957.                     if($ba->getJaiDemandeAttributionDe()){
  958.                         foreach($ba->getJaiDemandeAttributionDe() as $demandeAttributionDe){
  959.                             switch ($demandeAttributionDe) {
  960.                                 case 0:
  961.                                     $pdf->setFont($fontnull$fontSizeChecked);
  962.                                     $pdf->Text(13.127.1'X');
  963.                                     break;
  964.                                 case 1:
  965.                                     $pdf->setFont($fontnull$fontSizeChecked);
  966.                                     $pdf->Text(51.627.1'X');
  967.                                     break;
  968.                                 case 2:
  969.                                     $pdf->setFont($fontnull$fontSizeChecked);
  970.                                     $pdf->Text(110.727.1'X');
  971.                                     break;
  972.                                 
  973.                                 default:
  974.                                     // code...
  975.                                     break;
  976.                             }
  977.                         }
  978.                     }
  979.                     //Je m'engage
  980.                     if($ba->isEngageFournirCopieTitreAttribue()){
  981.                         $pdf->setFont($fontnull$fontSizeChecked);
  982.                         $pdf->Text(1351'X');
  983.                     }
  984.                     //date effet adhesion
  985.                     if($ba->getDateEffetAdhesion()){
  986.                         $pdf->setFont($fontnull11.2);
  987.                         $pdf->Text(49.489.4$this->formatString($ba->getDateEffetAdhesion()->format("d")));
  988.                         $pdf->setFont($fontnull11.2);
  989.                         $pdf->Text(57.889.4$this->formatString($ba->getDateEffetAdhesion()->format("m")));
  990.                         $pdf->setFont($fontnull11.2);
  991.                         $pdf->Text(66.289.4$this->formatString($ba->getDateEffetAdhesion()->format("Y")));
  992.                     }
  993.                     //age adhesion
  994.                     if($ba->getAgeAdhesion()){
  995.                         $pdf->setFont($fontnull11.2);
  996.                         $pdf->Text(115.289.4$this->formatString($ba->getAgeAdhesion()));
  997.                     }
  998.                     //date liquidation
  999.                     if($ba->getDateDeLiquidation()){
  1000.                         $pdf->setFont($fontnull11.2);
  1001.                         $pdf->Text(46.295$this->formatString($ba->getDateDeLiquidation()->format("d")));
  1002.                         $pdf->setFont($fontnull11.2);
  1003.                         $pdf->Text(54.595$this->formatString($ba->getDateDeLiquidation()->format("m")));
  1004.                         $pdf->setFont($fontnull11.2);
  1005.                         $pdf->Text(6395$this->formatString($ba->getDateDeLiquidation()->format("Y")));
  1006.                     }
  1007.                     //taux majoration rente
  1008.                     $tauxMajoration $this->container->get('translator')->trans('ba.majoration-rente-v2.'.$ba->getMajorationRente(), domain'global');
  1009.                     $pdf->setFont($fontnull11.2);
  1010.                     $pdf->Text(128.895.2$this->formatString($tauxMajoration));
  1011.                     //taux majoration rente part 2
  1012.                     /*
  1013.                     $pdf->setFont($font, null, 11.2);
  1014.                     $pdf->Text(136.2, 95.2, $this->formatString($tauxMajoration));
  1015.                     */
  1016.                     //Option
  1017.                     if($ba->getOptionCapital() == 0){
  1018.                         $pdf->setFont($fontnull$fontSizeChecked);
  1019.                         $pdf->Text(13.1132.5'X');
  1020.                     }
  1021.                     else if($ba->getOptionCapital() == 1){
  1022.                         $pdf->setFont($fontnull$fontSizeChecked);
  1023.                         $pdf->Text(13.1137.4'X');
  1024.                     }
  1025.                     else if($ba->getOptionCapital() == 2){
  1026.                         $pdf->setFont($fontnull$fontSizeChecked);
  1027.                         $pdf->Text(13.1142.4'X');
  1028.                     }
  1029.                     //montant intial versement
  1030.                     $initialVersement $ba->getVersementInitial();
  1031.                     if(ctype_digit($ba->getVersementInitial())) {
  1032.                         $initialVersement round($ba->getVersementInitial(), 2);
  1033.                         $initialVersement str_replace("."","$initialVersement);
  1034.                     } else {
  1035.                         $initialVersement strval($ba->getVersementInitial()).",00";
  1036.                     }
  1037.                     $initialVersementNumber strlen($initialVersement);
  1038.                     $space 0;
  1039.                     if($initialVersementNumber 8){
  1040.                         for($iNumber 1$iNumber <= ($initialVersementNumber); $iNumber++){
  1041.                             $space $space 3.2;
  1042.                         }
  1043.                     }
  1044.                     $pdf->setFont($fontnull11);
  1045.                     $pdf->Text(79.9 $space162.3$this->formatString($initialVersement));
  1046.                     //versement initial fiscalement OUI / NON
  1047.                     if($ba->isVersementInitialDeduit()){
  1048.                         $pdf->setFont($fontnull$fontSizeChecked);
  1049.                         $pdf->Text(95.4182.9'X');
  1050.                     } 
  1051.                     else {
  1052.                         $pdf->setFont($fontnull$fontSizeChecked);
  1053.                         $pdf->Text(107.8182.8'X');
  1054.                     }
  1055.                     //Mode de paiement
  1056.                     switch ($ba->getMoyenDeVersement()) {
  1057.                         case 0:
  1058.                             // code...
  1059.                             break;
  1060.                         case 2:
  1061.                             $pdf->setFont($fontnull$fontSizeChecked);
  1062.                             $pdf->Text(13.1193.5'X');
  1063.                             break;
  1064.                         case 3:
  1065.                             $pdf->setFont($fontnull$fontSizeChecked);
  1066.                             $pdf->Text(13.1198.4'X');
  1067.                             
  1068.                             break;
  1069.                         case 1:
  1070.                             $pdf->setFont($fontnull$fontSizeChecked);
  1071.                             $pdf->Text(13.1207.2'X');
  1072.                             break;
  1073.                         
  1074.                         default:
  1075.                             // code...
  1076.                             break;
  1077.                     }
  1078.                     //versement programmé OUI / NON
  1079.                     if($ba->isVersementProgramme()){
  1080.                         $pdf->setFont($fontnull$fontSizeChecked);
  1081.                         $pdf->Text(88.6234.6'X');
  1082.                         //montant programmé versement
  1083.                         $programmeVersement $ba->getMontantVersementPeriodique();
  1084.                         if(ctype_digit($ba->getMontantVersementPeriodique())) {
  1085.                             $programmeVersement round($ba->getMontantVersementPeriodique(), 2);
  1086.                             $programmeVersement str_replace("."","$programmeVersement);
  1087.                         } else {
  1088.                             $programmeVersement strval($ba->getMontantVersementPeriodique()).",00";
  1089.                         }
  1090.                         $programmeVersementNumber strlen($programmeVersement);
  1091.                         $space 0;
  1092.                         if($programmeVersementNumber 8){
  1093.                             for($iNumber 1$iNumber <= ($programmeVersementNumber); $iNumber++){
  1094.                                 $space $space 3.2;
  1095.                             }
  1096.                         }
  1097.                         $pdf->setFont($fontnull11);
  1098.                         $pdf->Text(29.9 $space239.8$this->formatString($programmeVersement));
  1099.                         /* part2
  1100.                         $pdf->setFont($font, null, 11.2);
  1101.                         $pdf->Text(48.1, 239.8, '0 0');
  1102.                         */
  1103.                         //montant programmé a compter du
  1104.                         $pdf->setFont($fontnull11.2);
  1105.                         $pdf->Text(95239.8$this->formatString($ba->getDateACompterDu()->format("d")));
  1106.                         $pdf->setFont($fontnull11.2);
  1107.                         $pdf->Text(103.8239.8$this->formatString($ba->getDateACompterDu()->format("m")));
  1108.                         $pdf->setFont($fontnull11.2);
  1109.                         $pdf->Text(112.2239.8$this->formatString($ba->getDateACompterDu()->format("Y")));
  1110.                         //montant programmé préiodicité
  1111.                                
  1112.                         switch ($ba->getPeriodicite()) {
  1113.                             case 0:
  1114.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1115.                                 $pdf->Text(30.8245.9'X');
  1116.                                 break;
  1117.                             case 1:
  1118.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1119.                                 $pdf->Text(50.8245.9'X');
  1120.                                 break;
  1121.                             case 2:
  1122.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1123.                                 $pdf->Text(72.5245.9'X');
  1124.                                 break;
  1125.                             case 3:
  1126.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1127.                                 $pdf->Text(95245.9'X');
  1128.                                 break;
  1129.                             
  1130.                             default:
  1131.                                 // code...
  1132.                                 break;
  1133.                         }
  1134.                         //montant programmé jour du mois
  1135.                         switch ($ba->getVersementProgrammePeriodiciteJourDuMois()) {
  1136.                             case 0:
  1137.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1138.                                 $pdf->Text(13.7251.2'X');
  1139.                                 break;
  1140.                             case 1:
  1141.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1142.                                 $pdf->Text(40.5251.2'X');
  1143.                                 break;
  1144.                             
  1145.                             default:
  1146.                                 // code...
  1147.                                 break;
  1148.                         }
  1149.                         //montant programmé indexation annuelle
  1150.                         switch ($ba->getIndexationAnnuelle()) {
  1151.                             case 0:
  1152.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1153.                                 $pdf->Text(43.7256.9'X');
  1154.                                 break;
  1155.                             case 1:
  1156.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1157.                                 $pdf->Text(56.4256.9'X');
  1158.                                 break;
  1159.                             case 2:
  1160.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1161.                                 $pdf->Text(68.2256.9'X');
  1162.                                 break;
  1163.                             case 3:
  1164.                                 $pdf->setFont($fontnull$fontSizeChecked);
  1165.                                 $pdf->Text(80.5256.9'X');
  1166.                                 break;
  1167.                             
  1168.                             default:
  1169.                                 // code...
  1170.                                 break;
  1171.                         }
  1172.                             
  1173.                         //montant programmé traitement fiscal
  1174.                         if($ba->isVersementProgrammeDeduit()){
  1175.                             $pdf->setFont($fontnull$fontSizeChecked);
  1176.                             $pdf->Text(111.3278'X');
  1177.                         } 
  1178.                         else {
  1179.                             $pdf->setFont($fontnull$fontSizeChecked);
  1180.                             $pdf->Text(123.2278'X');
  1181.                         }
  1182.                     }
  1183.                     else {
  1184.                         $pdf->setFont($fontnull$fontSizeChecked);
  1185.                         $pdf->Text(100.6234.6'X');
  1186.                     }
  1187.                     break;
  1188.                 case '5':
  1189.                     //Origine fond 1 fondContratEpargne
  1190.                     if($ba->isFondContratEpargne()){
  1191.                         $pdf->setFont($fontnull14);
  1192.                         $pdf->Text(16.266.4'X');
  1193.                         if($ba->getFondContratEpargneDate()){
  1194.                             $pdf->setFont($fontnull11.2);
  1195.                             $pdf->Text(33.571$this->formatString($ba->getFondContratEpargneDate()->format("d")));
  1196.                             $pdf->setFont($fontnull11.2);
  1197.                             $pdf->Text(41.971$this->formatString($ba->getFondContratEpargneDate()->format("m")));
  1198.                             $pdf->setFont($fontnull11.2);
  1199.                             $pdf->Text(50.471$this->formatString($ba->getFondContratEpargneDate()->format("Y")));
  1200.                         }
  1201.                         $pdf->setFont($fontnull18);
  1202.                         $pdf->Text(81.768.3$ba->getfondContratEpargneNumber());
  1203.                         $pdf->setFont($fontnull8);
  1204.                         $pdf->Text(126.167.3$this->decode($ba->getFondContratEpargneDescription()));
  1205.                     }
  1206.                     //Origine fond 2
  1207.                     if($ba->isFondContratPartSociete()){
  1208.                         $pdf->setFont($fontnull14);
  1209.                         $pdf->Text(16.286.6'X');
  1210.                         if($ba->getFondContratPartSocieteDate()){
  1211.                             $pdf->setFont($fontnull11.2);
  1212.                             $pdf->Text(34.591.2$this->formatString($ba->getFondContratPartSocieteDate()->format("d")));
  1213.                             $pdf->setFont($fontnull11.2);
  1214.                             $pdf->Text(42.791.2$this->formatString($ba->getFondContratPartSocieteDate()->format("m")));
  1215.                             $pdf->setFont($fontnull11.2);
  1216.                             $pdf->Text(51.291.2$this->formatString($ba->getFondContratPartSocieteDate()->format("Y")));
  1217.                         }
  1218.                         $pdf->setFont($fontnull18);
  1219.                         $pdf->Text(81.788.3$ba->getFondContratPartSocieteNumber());
  1220.                         $pdf->setFont($fontnull8);
  1221.                         $pdf->Text(126.187.3$this->decode($ba->getFondContratPartSocieteDescription()));
  1222.                     }
  1223.                     //Origine fond 3
  1224.                     if($ba->isFondContratHeritage()){
  1225.                         $pdf->setFont($fontnull14);
  1226.                         $pdf->Text(16.2107'X');
  1227.                         if($ba->getFondContratHeritageDate()){
  1228.                             $pdf->setFont($fontnull11.2);
  1229.                             $pdf->Text(33.1109.4$this->formatString($ba->getFondContratHeritageDate()->format("d")));
  1230.                             $pdf->setFont($fontnull11.2);
  1231.                             $pdf->Text(41.5109.4$this->formatString($ba->getFondContratHeritageDate()->format("m")));
  1232.                             $pdf->setFont($fontnull11.2);
  1233.                             $pdf->Text(49.9109.4$this->formatString($ba->getFondContratHeritageDate()->format("Y")));
  1234.                         }
  1235.                         $pdf->setFont($fontnull18);
  1236.                         $pdf->Text(81.7108.5$ba->getFondContratHeritageNumber());
  1237.                         $pdf->setFont($fontnull8);
  1238.                         $pdf->Text(126.1108.5$this->decode($ba->getFondContratHeritageDescription()));
  1239.                     }
  1240.                     //Origine fond 4
  1241.                     if($ba->isFondContratImmobilier()){
  1242.                         $pdf->setFont($fontnull14);
  1243.                         $pdf->Text(16.2127'X');
  1244.                         if($ba->getFondContratImmobilierDate()){
  1245.                             $pdf->setFont($fontnull11.2);
  1246.                             $pdf->Text(33.5129.3$this->formatString($ba->getFondContratImmobilierDate()->format("d")));
  1247.                             $pdf->setFont($fontnull11.2);
  1248.                             $pdf->Text(41.7129.3$this->formatString($ba->getFondContratImmobilierDate()->format("m")));
  1249.                             $pdf->setFont($fontnull11.2);
  1250.                             $pdf->Text(50.2129.3$this->formatString($ba->getFondContratImmobilierDate()->format("Y")));
  1251.                         }
  1252.                         $pdf->setFont($fontnull18);
  1253.                         $pdf->Text(81.7128$ba->getFondContratImmobilierNumber());
  1254.                         $pdf->setFont($fontnull8);
  1255.                         $pdf->Text(126.1127$this->decode($ba->getFondContratImmobilierDescription()));
  1256.                     }
  1257.                     //Origine fond 5 fondContratRevenuPro
  1258.                     if($ba->isFondContratRevenuPro()){
  1259.                         $pdf->setFont($fontnull14);
  1260.                         $pdf->Text(16.4146.4'X');
  1261.                         if($ba->getFondContratRevenuProDate()){
  1262.                             $pdf->setFont($fontnull11.2);
  1263.                             $pdf->Text(33.5149.2$this->formatString($ba->getFondContratRevenuProDate()->format("d")));
  1264.                             $pdf->setFont($fontnull11.2);
  1265.                             $pdf->Text(41.7149.2$this->formatString($ba->getFondContratRevenuProDate()->format("m")));
  1266.                             $pdf->setFont($fontnull11.2);
  1267.                             $pdf->Text(50.2149.2$this->formatString($ba->getFondContratRevenuProDate()->format("Y")));
  1268.                         }
  1269.                         $pdf->setFont($fontnull18);
  1270.                         $pdf->Text(81.7147.5$ba->getFondContratRevenuProNumber());
  1271.                         $pdf->setFont($fontnull8);
  1272.                         $pdf->Text(126.1146.4$this->decode($ba->getFondContratRevenuProDescription()));
  1273.                     }
  1274.                     //Origine fond 6
  1275.                     if($ba->isFondContratAutre()){
  1276.                         $pdf->setFont($fontnull14);
  1277.                         $pdf->Text(16.4166.8'X');
  1278.                         if($ba->getFondContratAutreDate()){
  1279.                             $pdf->setFont($fontnull11.2);
  1280.                             $pdf->Text(33.5169$this->formatString($ba->getFondContratAutreDate()->format("d")));
  1281.                             $pdf->setFont($fontnull11.2);
  1282.                             $pdf->Text(41.7169$this->formatString($ba->getFondContratAutreDate()->format("m")));
  1283.                             $pdf->setFont($fontnull11.2);
  1284.                             $pdf->Text(50.2169$this->formatString($ba->getFondContratAutreDate()->format("Y")));
  1285.                         }
  1286.                         $pdf->setFont($fontnull18);
  1287.                         $pdf->Text(81.7168$ba->getFondContratAutreNumber());
  1288.                         $pdf->setFont($fontnull8);
  1289.                         $pdf->Text(126.1166.8$this->decode($ba->getFondContratAutreDescription()));
  1290.                     }
  1291.                     //Atteste sur l'honneur 1
  1292.                     if($ba->getJattesteTitulaireGarantieRetraite() == false){
  1293.                         $pdf->setFont($fontnull$fontSizeChecked);
  1294.                         $pdf->Text(13.1204.1'X');
  1295.                     }
  1296.                     else{
  1297.                         $pdf->setFont($fontnull$fontSizeChecked);
  1298.                         $pdf->Text(13.1209.8'X');
  1299.                     }
  1300.                     foreach($ba->getOtherContracts() as $otherContactKey => $otherContact){
  1301.                        switch ($otherContactKey) {
  1302.                             case 0:
  1303.                                 //Autre contrat 1
  1304.                                 $pdf->setFont($fontnull8);
  1305.                                 $pdf->Text(15.1245.1$this->decode($otherContact->getOrganisme()));
  1306.                                 $pdf->setFont($fontnull8);
  1307.                                 $pdf->Text(53.6245.1$this->decode($otherContact->getAdresse()));
  1308.                                 $pdf->setFont($fontnull9.2);
  1309.                                 $pdf->Text(126.8245.1$this->formatString($otherContact->getDateAdhesion()->format("d/m/Y")));
  1310.                                 $pdf->setFont($fontnull$fontSizeText);
  1311.                                 $pdf->Text(170.3245.1$this->decode($otherContact->getMontantAnnuel()));
  1312.                                 break;
  1313.                             case 1:
  1314.                                 //Autre contrat 2
  1315.                                 $pdf->setFont($fontnull8);
  1316.                                 $pdf->Text(15.1261.5$this->decode($otherContact->getOrganisme()));
  1317.                                 $pdf->setFont($fontnull8);
  1318.                                 $pdf->Text(53.6261.5$this->decode($otherContact->getAdresse()));
  1319.                                 $pdf->setFont($fontnull9.2);
  1320.                                 $pdf->Text(126.8261.5$this->formatString($otherContact->getDateAdhesion()->format("d/m/Y")));
  1321.                                 $pdf->setFont($fontnull$fontSizeText);
  1322.                                 $pdf->Text(170.3261.5$this->decode($otherContact->getMontantAnnuel()));
  1323.                                 break;
  1324.                             
  1325.                             default:
  1326.                                 // code...
  1327.                                 break;
  1328.                         } 
  1329.                     }
  1330.                     break;
  1331.                 case '6':
  1332.                     $benefOtherActive false;
  1333.                     //Type clause
  1334.                     if($ba->isTypeBeneficiaires() == false){
  1335.                         $pdf->setFont($fontnull$fontSizeChecked);
  1336.                         $pdf->Text(13.141.5'X');
  1337.                     }
  1338.                     else if($ba->isTypeBeneficiaires() == true && $ba->isTypeBeneficiairesClauseNotariee() == false){
  1339.                         $pdf->setFont($fontnull$fontSizeChecked);
  1340.                         $pdf->Text(13.182.7'X');
  1341.                         $benefOtherActive true;
  1342.                     }
  1343.                     else {
  1344.                         $pdf->setFont($fontnull$fontSizeChecked);
  1345.                         $pdf->Text(13.164.7'X');
  1346.                         //notaire adresse
  1347.                         $pdf->setFont($fontnull8);
  1348.                         $pdf->Text(56.768.5$this->decode($ba->getTypeBeneficiairesClauseNotarieeCoordonnees()));
  1349.                     }
  1350.                     break;
  1351.                 case '7':
  1352.                     //Type clause
  1353.                     if($ba->isReconnaisEtreInforme()){
  1354.                         $pdf->setFont($fontnull$fontSizeChecked);
  1355.                         $pdf->Text(12.916.1'X');
  1356.                     }
  1357.                     if($ba->isConnaissanceDesStatuts()){
  1358.                         $pdf->setFont($fontnull$fontSizeChecked);
  1359.                         $pdf->Text(12.925.9'X');
  1360.                     }
  1361.                     if($ba->isReconnaisRenoncer30Jours()){
  1362.                         $pdf->setFont($fontnull$fontSizeChecked);
  1363.                         $pdf->Text(12.942.3'X');
  1364.                     }
  1365.                     if($ba->isReconnaisAvoirPrisConnaissance()){
  1366.                         $pdf->setFont($fontnull$fontSizeChecked);
  1367.                         $pdf->Text(12.954.9'X');
  1368.                     }
  1369.                     break;
  1370.                 case '9':
  1371.                     if($benefOtherActive){
  1372.                         //Benef sex
  1373.                         if($ba->getSex() === "0"){
  1374.                             $pdf->setFont($fontnull$fontSizeChecked);
  1375.                             $pdf->Text(54.645.6'X');
  1376.                         }
  1377.                         else{
  1378.                             $pdf->setFont($fontnull$fontSizeChecked);
  1379.                             $pdf->Text(3545.6'X');
  1380.                         }
  1381.                         //Benef nom
  1382.                         $pdf->setFont($fontnull$fontSizeText);
  1383.                         $pdf->Text(22.751.4$this->decode($ba->getNom()));
  1384.                         //Benef prénom
  1385.                         $pdf->setFont($fontnull$fontSizeText);
  1386.                         $pdf->Text(85.651.4$this->decode($ba->getPrenom()));
  1387.                         //Benef adresse
  1388.                         $pdf->setFont($fontnull$fontSizeText);
  1389.                         $pdf->Text(37.358$this->decode($ba->getFiscaleAddress()));
  1390.                         //Benef code postal
  1391.                         $pdf->setFont($fontnull$fontSizeText);
  1392.                         $pdf->Text(33.363.8$this->formatString($ba->getFiscaleCodePostal()));
  1393.                         //Benef ville
  1394.                         $pdf->setFont($fontnull$fontSizeText);
  1395.                         $pdf->Text(65.463.5$this->decode($ba->getFiscaleVille()));
  1396.                         //Benef Je désigne
  1397.                         $pdf->setFont($fontnull$fontSizeChecked);
  1398.                         $pdf->Text(13.172.3'X');
  1399.                         $showCell 0;
  1400.                         foreach($ba->getBeneficiaires() as $keyBenef => $beneficiaire){
  1401.                             switch ($keyBenef) {
  1402.                                 case 0:
  1403.                                     // code...
  1404.                                     
  1405.                                     //Benef ligne 1
  1406.                                     $pdf->setFont($fontnull6);
  1407.                                     $pdf -> SetY(106.9); 
  1408.                                     $pdf -> SetX(30.4); 
  1409.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1410.                                     $pdf->setFont($fontnull6);
  1411.                                     $pdf -> SetY(106.9); 
  1412.                                     $pdf -> SetX(54.3); 
  1413.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1414.                                     $pdf->setFont($fontnull6);
  1415.                                     $pdf -> SetY(106.9); 
  1416.                                     $pdf -> SetX(77.9); 
  1417.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1418.                                     $pdf->setFont($fontnull6);
  1419.                                     $pdf -> SetY(106.9); 
  1420.                                     $pdf -> SetX(102.1); 
  1421.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1422.                                     $pdf->setFont($fontnull6);
  1423.                                     $pdf -> SetY(106.9); 
  1424.                                     $pdf -> SetX(126.5); 
  1425.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1426.                                     $pdf->setFont($fontnull6);
  1427.                                     $pdf -> SetY(106.9); 
  1428.                                     $pdf -> SetX(150.7); 
  1429.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1430.                                     $pdf->setFont($fontnull6);
  1431.                                     $pdf -> SetY(106.9); 
  1432.                                     $pdf -> SetX(174.9); 
  1433.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1434.                                     break;
  1435.                                 case 1:
  1436.                                     //Benef ligne 2
  1437.                                     if($beneficiaire->getConditional() == "et"){
  1438.                                         $pdf->setFont($fontnull9);
  1439.                                         $pdf->Text(16.3126.8'X');
  1440.                                     }
  1441.                                     else{
  1442.                                         $pdf->setFont($fontnull9);
  1443.                                         $pdf->Text(16.3131.3'X');
  1444.                                     }
  1445.                                     $pdf->setFont($fontnull6);
  1446.                                     $pdf -> SetY(121.5); 
  1447.                                     $pdf -> SetX(30.4); 
  1448.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1449.                                     $pdf->setFont($fontnull6);
  1450.                                     $pdf -> SetY(121.5); 
  1451.                                     $pdf -> SetX(54.3); 
  1452.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1453.                                     $pdf->setFont($fontnull6);
  1454.                                     $pdf -> SetY(121.5); 
  1455.                                     $pdf -> SetX(77.9); 
  1456.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1457.                                     $pdf->setFont($fontnull6);
  1458.                                     $pdf -> SetY(121.5); 
  1459.                                     $pdf -> SetX(102.1); 
  1460.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1461.                                     $pdf->setFont($fontnull6);
  1462.                                     $pdf -> SetY(121.5); 
  1463.                                     $pdf -> SetX(126.5); 
  1464.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1465.                                     $pdf->setFont($fontnull6);
  1466.                                     $pdf -> SetY(121.5); 
  1467.                                     $pdf -> SetX(150.7); 
  1468.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1469.                                     $pdf->setFont($fontnull6);
  1470.                                     $pdf -> SetY(121.5); 
  1471.                                     $pdf -> SetX(174.9); 
  1472.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1473.                                     break;
  1474.                                 case 2:
  1475.                                     //Benef ligne 3
  1476.                                     if($beneficiaire->getConditional() == "et"){
  1477.                                         $pdf->setFont($fontnull9);
  1478.                                         $pdf->Text(16.3143.1'X');
  1479.                                     }
  1480.                                     else{
  1481.                                         $pdf->setFont($fontnull9);
  1482.                                         $pdf->Text(16.3147.6'X');
  1483.                                     }
  1484.                                     $pdf->setFont($fontnull6);
  1485.                                     $pdf -> SetY(137.7); 
  1486.                                     $pdf -> SetX(30.4); 
  1487.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1488.                                     $pdf->setFont($fontnull6);
  1489.                                     $pdf -> SetY(137.7); 
  1490.                                     $pdf -> SetX(54.3); 
  1491.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1492.                                     $pdf->setFont($fontnull6);
  1493.                                     $pdf -> SetY(137.7); 
  1494.                                     $pdf -> SetX(77.9); 
  1495.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1496.                                     $pdf->setFont($fontnull6);
  1497.                                     $pdf -> SetY(137.7); 
  1498.                                     $pdf -> SetX(102.1); 
  1499.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1500.                                     $pdf->setFont($fontnull6);
  1501.                                     $pdf -> SetY(137.7); 
  1502.                                     $pdf -> SetX(126.5); 
  1503.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1504.                                     $pdf->setFont($fontnull6);
  1505.                                     $pdf -> SetY(137.7); 
  1506.                                     $pdf -> SetX(150.7); 
  1507.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1508.                                     $pdf->setFont($fontnull6);
  1509.                                     $pdf -> SetY(137.7); 
  1510.                                     $pdf -> SetX(174.9); 
  1511.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1512.                                     break;
  1513.                                 case 3:
  1514.                                     //Benef ligne 4
  1515.                                     if($beneficiaire->getConditional() == "et"){
  1516.                                         $pdf->setFont($fontnull9);
  1517.                                         $pdf->Text(16.3159.4'X');
  1518.                                     }
  1519.                                     else{
  1520.                                         $pdf->setFont($fontnull9);
  1521.                                         $pdf->Text(16.3164'X');
  1522.                                     }
  1523.                                     $pdf->setFont($fontnull6);
  1524.                                     $pdf -> SetY(153.9); 
  1525.                                     $pdf -> SetX(30.4); 
  1526.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1527.                                     $pdf->setFont($fontnull6);
  1528.                                     $pdf -> SetY(153.9); 
  1529.                                     $pdf -> SetX(54.3); 
  1530.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1531.                                     $pdf->setFont($fontnull6);
  1532.                                     $pdf -> SetY(153.9); 
  1533.                                     $pdf -> SetX(77.9); 
  1534.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1535.                                     $pdf->setFont($fontnull6);
  1536.                                     $pdf -> SetY(153.9); 
  1537.                                     $pdf -> SetX(102.1); 
  1538.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1539.                                     $pdf->setFont($fontnull6);
  1540.                                     $pdf -> SetY(153.9); 
  1541.                                     $pdf -> SetX(126.5); 
  1542.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1543.                                     $pdf->setFont($fontnull6);
  1544.                                     $pdf -> SetY(153.9); 
  1545.                                     $pdf -> SetX(150.7); 
  1546.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1547.                                     $pdf->setFont($fontnull6);
  1548.                                     $pdf -> SetY(153.9); 
  1549.                                     $pdf -> SetX(174.9); 
  1550.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1551.                                     break;
  1552.                                 case 4:
  1553.                                     //Benef ligne 5
  1554.                                     if($beneficiaire->getConditional() == "et"){
  1555.                                         $pdf->setFont($fontnull9);
  1556.                                         $pdf->Text(16.3175.8'X');
  1557.                                     } 
  1558.                                     else{ 
  1559.                                         $pdf->setFont($fontnull9);
  1560.                                         $pdf->Text(16.3180.3'X');
  1561.                                     }
  1562.                                     $pdf->setFont($fontnull6);
  1563.                                     $pdf -> SetY(170.3); 
  1564.                                     $pdf -> SetX(30.4); 
  1565.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1566.                                     $pdf->setFont($fontnull6);
  1567.                                     $pdf -> SetY(170.3); 
  1568.                                     $pdf -> SetX(54.3); 
  1569.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1570.                                     $pdf->setFont($fontnull6);
  1571.                                     $pdf -> SetY(170.3); 
  1572.                                     $pdf -> SetX(77.9); 
  1573.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1574.                                     $pdf->setFont($fontnull6);
  1575.                                     $pdf -> SetY(170.3); 
  1576.                                     $pdf -> SetX(102.1); 
  1577.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1578.                                     $pdf->setFont($fontnull6);
  1579.                                     $pdf -> SetY(170.3); 
  1580.                                     $pdf -> SetX(126.5); 
  1581.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1582.                                     $pdf->setFont($fontnull6);
  1583.                                     $pdf -> SetY(170.3); 
  1584.                                     $pdf -> SetX(150.7); 
  1585.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1586.                                     $pdf->setFont($fontnull6);
  1587.                                     $pdf -> SetY(170.3); 
  1588.                                     $pdf -> SetX(174.9); 
  1589.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1590.                                     break;
  1591.                                 case 5:
  1592.                                     //Benef ligne 6
  1593.                                     if($beneficiaire->getConditional() == "et"){
  1594.                                         $pdf->setFont($fontnull9);
  1595.                                         $pdf->Text(16.3192.1'X');
  1596.                                     }
  1597.                                     else{
  1598.                                         $pdf->setFont($fontnull9);
  1599.                                         $pdf->Text(16.3196.6'X');
  1600.                                     }
  1601.                                     $pdf->setFont($fontnull6);
  1602.                                     $pdf -> SetY(186.8); 
  1603.                                     $pdf -> SetX(30.4); 
  1604.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1605.                                     $pdf->setFont($fontnull6);
  1606.                                     $pdf -> SetY(186.8); 
  1607.                                     $pdf -> SetX(54.3); 
  1608.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1609.                                     $pdf->setFont($fontnull6);
  1610.                                     $pdf -> SetY(186.8); 
  1611.                                     $pdf -> SetX(77.9); 
  1612.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1613.                                     $pdf->setFont($fontnull6);
  1614.                                     $pdf -> SetY(186.8); 
  1615.                                     $pdf -> SetX(102.1); 
  1616.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1617.                                     $pdf->setFont($fontnull6);
  1618.                                     $pdf -> SetY(186.8); 
  1619.                                     $pdf -> SetX(126.5); 
  1620.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1621.                                     $pdf->setFont($fontnull6);
  1622.                                     $pdf -> SetY(186.8); 
  1623.                                     $pdf -> SetX(150.7); 
  1624.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1625.                                     $pdf->setFont($fontnull6);
  1626.                                     $pdf -> SetY(186.8); 
  1627.                                     $pdf -> SetX(174.9); 
  1628.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1629.                                     break;
  1630.                                 case 6:
  1631.                                     //Benef ligne 7
  1632.                                     if($beneficiaire->getConditional() == "et"){
  1633.                                         $pdf->setFont($fontnull9);
  1634.                                         $pdf->Text(16.3208.4'X');
  1635.                                     }
  1636.                                     else{
  1637.                                         $pdf->setFont($fontnull9);
  1638.                                         $pdf->Text(16.3212.9'X');
  1639.                                     }
  1640.                                     $pdf->setFont($fontnull6);
  1641.                                     $pdf -> SetY(203); 
  1642.                                     $pdf -> SetX(30.4); 
  1643.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getNomUsage()), $showCell'C'0);
  1644.                                     $pdf->setFont($fontnull6);
  1645.                                     $pdf -> SetY(203);
  1646.                                     $pdf -> SetX(54.3); 
  1647.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getNom()), $showCell'C'0);
  1648.                                     $pdf->setFont($fontnull6);
  1649.                                     $pdf -> SetY(203);
  1650.                                     $pdf -> SetX(77.9); 
  1651.                                     $pdf->MultiCell(21.52$this->decode($beneficiaire->getPrenom()), $showCell'C'0);
  1652.                                     $pdf->setFont($fontnull6);
  1653.                                     $pdf -> SetY(203);
  1654.                                     $pdf -> SetX(102.1); 
  1655.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getAdresse()), $showCell'C'0);
  1656.                                     $pdf->setFont($fontnull6);
  1657.                                     $pdf -> SetY(203);
  1658.                                     $pdf -> SetX(126.5); 
  1659.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getDateDeNaissance()->format("d/m/Y"))."\n".$this->decode($beneficiaire->getLieuDeNaissance()), $showCell'C'0);
  1660.                                     $pdf->setFont($fontnull6);
  1661.                                     $pdf -> SetY(203);
  1662.                                     $pdf -> SetX(150.7); 
  1663.                                     $pdf->MultiCell(212$this->decode($beneficiaire->getLienParente()), $showCell'C'0);
  1664.                                     $pdf->setFont($fontnull6);
  1665.                                     $pdf -> SetY(203);
  1666.                                     $pdf -> SetX(174.9); 
  1667.                                     $pdf->MultiCell(20.52$this->decode($beneficiaire->getPart()."%"), $showCell'C'0);
  1668.                                     break;
  1669.                                 default:
  1670.                                     // code...
  1671.                                     break;
  1672.                             }
  1673.                         }
  1674.                     }
  1675.                     break;
  1676.                 
  1677.                 default:
  1678.                     // code...
  1679.                     break;
  1680.             }
  1681.         }
  1682.         $pdf->Output('F'$baFullPath);
  1683.         return $baFileName;
  1684.     }
  1685.     public function formatString($stringLetters$typeFormat "default"){
  1686.         $string "";
  1687.         $forNumber 1;
  1688.         $tabString str_split($stringLetters);
  1689.         foreach ($tabString as $keyLetter => $stringLetter) {
  1690.             if($keyLetter 0){
  1691.                 $string .= " ";
  1692.             }
  1693.             $string .= $stringLetter;
  1694.             switch ($typeFormat) {
  1695.                 case 'iban':
  1696.                     if($forNumber == && count($tabString) != ($keyLetter 1)){
  1697.                         $string .= " ";
  1698.                         $forNumber 0;
  1699.                     }
  1700.                     break;
  1701.                 case 'ss':
  1702.                     if($keyLetter == || $keyLetter == || $keyLetter == || $keyLetter == || $keyLetter == 9){
  1703.                         $string .= " ";
  1704.                     }
  1705.                     break;
  1706.                 
  1707.                 default:
  1708.                     // code...
  1709.                     break;
  1710.             }
  1711.             $forNumber++;
  1712.         }
  1713.         return $string;
  1714.     }
  1715.     public function decode($value)
  1716.     {
  1717.         // convert from utf8 to latin1
  1718.         return mb_convert_encoding($value'ISO-8859-1''UTF-8');
  1719.     }
  1720. }