/**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function declarationAction()
 {
     $client = $this->getClient();
     $clientDeclaration = new ClientDeclaration($client);
     $clientDeclaration->setShowAllOperations($this->_show_all_operations)->setYear($this->_year)->setMonth($this->_month)->setQueryMonth($this->_query_month);
     $this->get('request')->setLocale(strtolower($client->getLanguage()));
     /** @var $em \Doctrine\ORM\EntityManager */
     $em = $this->getDoctrine()->getManager();
     /** @var $bank \Application\Sonata\ClientBundle\Entity\Coordonnees */
     $bank = $em->getRepository('ApplicationSonataClientBundle:Coordonnees')->findOneBy(array());
     $debug = isset($_GET['d']);
     $page = $this->render('ApplicationSonataClientOperationsBundle::declaration.html.twig', array('info' => array('time' => strtotime($this->_year . '-' . $this->_month . '-01'), 'month' => $this->_month, 'year' => $this->_year, 'quarter' => floor(($this->_month - 1) / 3) + 1), 'debug' => $debug, 'client' => $client, 'bank' => $bank, 'rapState' => $clientDeclaration->getRapprochementState(), 'V01TVAlist' => $clientDeclaration->getV01TVAList(), 'V07EXlist' => $clientDeclaration->getV07EXList(), 'V05LIClist' => $clientDeclaration->getV05LICList(), 'V03283Ilist' => $clientDeclaration->getV03283IList(), 'V11INTlist' => $clientDeclaration->getV11INTList(), 'A02TVAlist' => $clientDeclaration->getA02TVAList(), 'A08IMlist' => $clientDeclaration->getA08IMList(), 'A02TVAPrevlist' => $clientDeclaration->getA02TVAPrevList(), 'A08IMPrevlist' => $clientDeclaration->getA08IMPrevList(), 'A06AIBlist' => $clientDeclaration->getA06AIBList(), 'A04283Ilist' => $clientDeclaration->getA04283IList(), 'A10CAFlist' => $clientDeclaration->getA10CAFList(), 'A04283ISumPrev' => $clientDeclaration->getA04283ISumPrev(), 'A06AIBSumPrev' => $clientDeclaration->getA06AIBSumPrev(), 'RulingNettTotal' => $clientDeclaration->getRulingNettTotal(), 'RulingVatTotal' => $clientDeclaration->getRulingVatTotal(), 'Total1' => $clientDeclaration->getTotalVat1(), 'Total2' => $clientDeclaration->getTotalVat2(), 'SoldeTVATotal' => $clientDeclaration->getSoldeTVATotal(), 'RealSoldeTVATotal' => $clientDeclaration->getRealSoldeTVATotal(), 'TotalBalance' => $clientDeclaration->getTotalBalance(), 'PreviousCreditDeTVA' => $clientDeclaration->getPreviousMonth()->getAbsCreditOfVATCarriedForward(), 'SoldeTVATotalPlusPreviousCreditDeTVA' => $clientDeclaration->getSoldeTVATotalPlusPreviousCreditDeTVA(), 'ClientDeclaration' => $clientDeclaration, 'ClientDeclarationComputation' => new ClientDeclarationComputation($clientDeclaration), 'locked' => $this->getLocking()));
     if (!$debug) {
         $mpdf = new mPDF('c', 'A4', 0, '', 15, 15, 10, 13, 9, 2);
         //$mpdf->SetDisplayMode('fullpage');
         //$mpdf->SetHeader('test header', 'E');
         $mpdf->WriteHTML($page->getContent());
         $mpdf->Output();
         exit;
     }
     return $page;
 }