diff --git a/application/modules/default/controllers/FinanceController.php b/application/modules/default/controllers/FinanceController.php index e2f1ec73d..c4d6ef931 100644 --- a/application/modules/default/controllers/FinanceController.php +++ b/application/modules/default/controllers/FinanceController.php @@ -941,8 +941,6 @@ class FinanceController extends Zend_Controller_Action $request = $this->getRequest(); $unite = $request->getParam('unit','K'); $entreprise = new Scores_Session_Entreprise($this->siret, $this->id); - $ws = new WsScores(); - // Récupération de la date $dateAndType = $request->getParam('date', $defaultTypeBilan.$defaultDateExercice); @@ -953,38 +951,51 @@ class FinanceController extends Zend_Controller_Action $date = substr($dateAndType, 1); // Récupération des postes du bilan - $infos = $ws->getBilan(substr($this->siret, 0, 9), $date, $type, true); - if ($infos === false) $this->forward('soap', 'error'); + try { + $ws = new Scores_Ws_Client('entreprise', '0.8'); + $params = new stdClass(); + $params->siren = substr($this->siret, 0, 9); + $params->millesime = $date; + $params->typeBilan = $type; + $params->ref = ''; + $infos = $ws->getBilan($params); - // Formatage de la liasse - $infoLiasse = new Scores_Finance_Liasse($infos, $unite); - $this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture')); - $this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre')); + // Error + if ($infos === false) { + $this->forward('soap', 'error'); + } - $date = new Zend_Date($infoLiasse->getInfo('dateCloture'), 'yyyyMMdd'); - $this->view->assign('dateClotureD', $date->toString('dd/MM/yyyy')); + // Formatage de la liasse + $infoLiasse = new Scores_Finance_Liasse($infos, $unite); + $this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture')); + $this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre')); - $dateCloturePre = $infoLiasse->getInfo('dateCloturePre'); - if ( $dateCloturePre == '' ) { - $this->view->assign('dateCloturePreD', '-'); - } else { - $date = new Zend_Date($dateCloturePre, 'yyyyMMdd'); - $this->view->assign('dateCloturePreD', $date->toString('dd/MM/yyyy')); + $date = new Zend_Date($infoLiasse->getInfo('dateCloture'), 'yyyyMMdd'); + $this->view->assign('dateClotureD', $date->toString('dd/MM/yyyy')); + + $dateCloturePre = $infoLiasse->getInfo('dateCloturePre'); + if ($dateCloturePre == '') { + $this->view->assign('dateCloturePreD', '-'); + } else { + $date = new Zend_Date($dateCloturePre, 'yyyyMMdd'); + $this->view->assign('dateCloturePreD', $date->toString('dd/MM/yyyy')); + } + + $this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois')); + $this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre')); + + $this->view->assign('date', $date); + $this->view->assign('champType', $type); + $this->view->assign('liasse', $infoLiasse->getPostes()); + $this->view->assign('ancres', $ancres[$type]); + } catch (Exception $e) { + $this->view->msg = $e->getMessage(); } - $this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois')); - $this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre')); - - $this->view->assign('date', $date); - $this->view->assign('champType', $type); - $this->view->assign('liasse', $infoLiasse->getPostes()); - $this->view->assign('ancres', $ancres[$type]); - //Gestion export de la liasse au format XLS if ( $user->checkPerm('liassexls') & in_array($type,array('C', 'N', 'S')) ) { $this->view->assign('exportxls', true); } - } $this->view->assign('id', $id); diff --git a/application/modules/default/views/default/scripts/finance/banque.phtml b/application/modules/default/views/default/scripts/finance/banque.phtml index 09f34882f..c522021a1 100644 --- a/application/modules/default/views/default/scripts/finance/banque.phtml +++ b/application/modules/default/views/default/scripts/finance/banque.phtml @@ -17,15 +17,14 @@
+=$this->msg?> +
+ + champType) { case 'N' : $name = 'Réel Normal'; break; @@ -64,12 +70,12 @@ switch ($this->champType) {