/**
  * @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;
 }
예제 #2
0
 public function getDeclaration($year = null, $month = null)
 {
     static $instances = array();
     if (is_null($year) || is_null($month)) {
         $now = new \DateTime();
         $dateQuery = $now->format('d') > 25 ? $now : new \DateTime('now -1 month');
         $year = $dateQuery->format('Y');
         $month = $dateQuery->format('m');
     }
     $key = sha1($this->getId() . $year . $month);
     if (!isset($instances[$key])) {
         $clientDeclaration = new ClientDeclaration($this);
         $clientDeclaration->setShowAllOperations(false)->setYear($year)->setMonth($month);
         $instances[$key] = $clientDeclaration;
     }
     return $instances[$key];
 }
예제 #3
0
 public function getPreviousMonth()
 {
     static $instances = array();
     $lastMonth = new \DateTime("{$this->_year}-{$this->_month}-01 -1 month");
     $_year = $lastMonth->format('Y');
     $_month = $lastMonth->format('m');
     $key = sha1($this->client->getId() . $_year . $_month);
     if (!isset($instances[$key])) {
         //$instances[$key] = $this->findRappState($_year, $_month);
         $prevMonthClientDeclaration = new ClientDeclaration($this->client);
         $prevMonthClientDeclaration->setShowAllOperations($this->_show_all_operations)->setYear($_year)->setMonth($_month);
         $instances[$key] = $prevMonthClientDeclaration;
     }
     return $instances[$key];
 }