src/Services/GenerateDocumentsFullweb.php line 53

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