Affichage raisonSociale

This commit is contained in:
Michael RICOIS 2016-09-22 15:26:02 +02:00
parent b3d7731325
commit 726293c4ec
2 changed files with 137 additions and 133 deletions

View File

@ -258,160 +258,164 @@ class Legal_EvaluationController extends Zend_Controller_Action
$this->view->headTitle()->prepend("Siret ".$this->siret);
$user = new Scores_Utilisateur();
if(!$user->checkPerm('INDISCORE2') && !$user->checkPerm('INDISCORE2P'))
if(!$user->checkPerm('INDISCORE2') && !$user->checkPerm('INDISCORE2P')) {
$this->forward('perms', 'error');
}
$siren = substr($this->siret,0,9);
$siren = substr($this->siret,0,9);
//@todo : transformer le webservice pour ne faire qu'une seule requete
$ws = new WsScores();
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$identite = $ws->getIdentite($siren);
$indiscore = $ws->getIndiScore($siren);
$infos = $ws->getRatios($siren, 'indiscore2');
//@todo : transformer le webservice pour ne faire qu'une seule requete
$ws = new WsScores();
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
$identite = $ws->getIdentite($siren);
$indiscore = $ws->getIndiScore($siren);
$infos = $ws->getRatios($siren, 'indiscore2');
$score = array();
$tabRatio = array(
'r5' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"CHIFFRE D'AFFAIRES"),
'r16' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"RESULTAT D'EXPLOITATION"),
'r7' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"RESULTAT COURANT"),
'r10' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"RESULTAT NET"),
'r18' => array('total'=>'r22', 'total_info'=>'% bilan', 'op'=>1000, 'titre'=>"FONDS PROPRES"),
'r231' => array('total'=>'r22', 'total_info'=>'% bilan', 'op'=>1000, 'titre'=>"FONDS DE ROULEMENT"),
'r232' => array('total'=>'r22', 'total_info'=>'% bilan', 'op'=>1000, 'titre'=>"BESOIN EN FONDS DE ROULEMENT"),
'r249' => array('total'=>'', 'total_info'=>'', 'op'=>1000, 'titre'=>"TRESORERIE NETTE"),
'r20' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"FRAIS FINANCIER"),
);
$score = array();
$tabRatio = array(
'r5' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"CHIFFRE D'AFFAIRES"),
'r16' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"RESULTAT D'EXPLOITATION"),
'r7' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"RESULTAT COURANT"),
'r10' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"RESULTAT NET"),
'r18' => array('total'=>'r22', 'total_info'=>'% bilan', 'op'=>1000, 'titre'=>"FONDS PROPRES"),
'r231' => array('total'=>'r22', 'total_info'=>'% bilan', 'op'=>1000, 'titre'=>"FONDS DE ROULEMENT"),
'r232' => array('total'=>'r22', 'total_info'=>'% bilan', 'op'=>1000, 'titre'=>"BESOIN EN FONDS DE ROULEMENT"),
'r249' => array('total'=>'', 'total_info'=>'', 'op'=>1000, 'titre'=>"TRESORERIE NETTE"),
'r20' => array('total'=>'r5', 'total_info'=>'% ca', 'op'=>1000, 'titre'=>"FRAIS FINANCIER"),
);
//Formattage des données
$typeBilan = 'N';
$ratiosData = new Scores_Finance_Ratios_Data($infos);
//Formattage des données
$typeBilan = 'N';
$ratiosData = new Scores_Finance_Ratios_Data($infos);
$nbBilanN = $ratiosData->getNbBilan('N');
$nbBilanC = $ratiosData->getNbBilan('C');
$nbBilanN = $ratiosData->getNbBilan('N');
$nbBilanC = $ratiosData->getNbBilan('C');
if ($nbBilanN!=0)
if ($nbBilanN!=0) {
foreach($tabRatio as $idRatio => $valRatio) {
$tabRatio[$idRatio]['comment'] = $ratiosData->wrapComment($idRatio);
}
$this->view->assign('tabRatio', $tabRatio);
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
$annees = array_keys($infosAnnee);
//On prend les 3 derniers bilans pour l'affichage
$nbMaxBilan = 3;
rsort($annees);
$annees = array_slice($annees, 0, $nbMaxBilan);
sort($annees);
$tabResult = array();
foreach($annees as $annee)
{
$data = array();
$dataEvol = array();
//Formatter les données
foreach($tabRatio as $idRatio => $valRatio)
{
$tabRatio[$idRatio]['comment'] = $ratiosData->wrapComment($idRatio);
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
$dataTotal[$idRatio] = $ratiosData->dTotal($typeBilan, $annee, $idRatio, $valRatio['total']);
$dInfo[$idRatio] = $valRatio['total_info'];
}
$this->view->assign('tabRatio', $tabRatio);
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
$annees = array_keys($infosAnnee);
//On prend les 3 derniers bilans pour l'affichage
$nbMaxBilan = 3;
rsort($annees);
$annees = array_slice($annees, 0, $nbMaxBilan);
sort($annees);
$tabResult = array();
foreach($annees as $annee)
{
$data = array();
$dataEvol = array();
//Formatter les données
foreach($tabRatio as $idRatio => $valRatio)
{
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
$dataTotal[$idRatio] = $ratiosData->dTotal($typeBilan, $annee, $idRatio, $valRatio['total']);
$dInfo[$idRatio] = $valRatio['total_info'];
}
$date = new Zend_Date($annee, 'yyyyMMdd');
$tabResult[] = array(
'dateCloture' => $date->toString('dd/MM/yyyy'),
'duree' => $infosAnnee[$annee]->duree.' Mois',
'ratio' => $data,
'total' => $dataTotal,
'info' => $dInfo,
);
}
$this->view->assign('tabResult', $tabResult);
}
$this->view->assign('tabRatio', $tabRatio);
/*
Correction pour indiscore seule
$indiscore->Siege;
$indiscore->SiretSiege;
$indiscore->NumRC;
*/
$indiscore->SiretSiege = $identite->SiretSiege;
$identite = new IdentiteEntreprise($identite);
//Définition des blocks
$blocks = array(
'Siret',
'SiretSiege',
'NumRC',
'Actif',
'RaisonSociale',
'FormeJuridique',
'DateImmat',
'DateCreaEt',
'Adresse',
'ActiviteEn',
'Naf4',
'OrigineFond',
'TypeExploitation',
'Saisonnalite',
'Capital',
'ChiffreAffaire',
);
$dBlock = array();
foreach ($blocks as $item) {
$display = array(
'label' => method_exists($identite, 'get'.$item.'Label') ? $identite->{'get'.$item.'Label'}() : '',
'texte' => method_exists($identite, 'get'.$item.'Texte') ? $identite->{'get'.$item.'Texte'}() : '',
'titre' => method_exists($identite, 'get'.$item.'Titre') ? $identite->{'get'.$item.'Titre'}() : '',
$date = new Zend_Date($annee, 'yyyyMMdd');
$tabResult[] = array(
'dateCloture' => $date->toString('dd/MM/yyyy'),
'duree' => $infosAnnee[$annee]->duree.' Mois',
'ratio' => $data,
'total' => $dataTotal,
'info' => $dInfo,
);
$dBlock[$item] = $display;
}
$this->view->assign('dBlock', $dBlock);
$this->view->assign('tabResult', $tabResult);
}
$dateRadiation = '';
if(isset($indiscore->DateRadiation) && $indiscore->DateRadiation!='' && $indiscore->DateRadiation!='0000-00-00') {
$date = new Zend_Date(str_replace('-','',$indiscore->DateRadiation), 'yyyyMMdd');
$this->view->assign('dateRadiation', $date->toString('dd/MM/yyyy'));
$this->view->assign('tabRatio', $tabRatio);
$this->view->assign('siret', $this->siret);
$this->view->assign('id', $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('raisonSociale', $identite->Nom);
/*
Correction pour indiscore seule
$indiscore->Siege;
$indiscore->SiretSiege;
$indiscore->NumRC;
*/
$indiscore->SiretSiege = $identite->SiretSiege;
$identite = new IdentiteEntreprise($identite);
//Définition des blocks
$blocks = array(
'Siret',
'SiretSiege',
'NumRC',
'Actif',
'RaisonSociale',
'FormeJuridique',
'DateImmat',
'DateCreaEt',
'Adresse',
'ActiviteEn',
'Naf4',
'OrigineFond',
'TypeExploitation',
'Saisonnalite',
'Capital',
'ChiffreAffaire',
);
$dBlock = array();
foreach ($blocks as $item) {
$display = array(
'label' => method_exists($identite, 'get'.$item.'Label') ? $identite->{'get'.$item.'Label'}() : '',
'texte' => method_exists($identite, 'get'.$item.'Texte') ? $identite->{'get'.$item.'Texte'}() : '',
'titre' => method_exists($identite, 'get'.$item.'Titre') ? $identite->{'get'.$item.'Titre'}() : '',
);
$dBlock[$item] = $display;
}
$this->view->assign('dBlock', $dBlock);
$dateRadiation = '';
if(isset($indiscore->DateRadiation) && $indiscore->DateRadiation!='' && $indiscore->DateRadiation!='0000-00-00') {
$date = new Zend_Date(str_replace('-','',$indiscore->DateRadiation), 'yyyyMMdd');
$this->view->assign('dateRadiation', $date->toString('dd/MM/yyyy'));
}
foreach($indiscore->scores as $name => $sc) {
if ($name == 'ConanH') {
$score[$name] = array($sc, 'Score Conan Holder');
}
foreach($indiscore->scores as $name => $sc){
if($name == 'ConanH')
$score[$name] = array($sc, 'Score Conan Holder');
if($name == 'Afdcc1')
$score[$name] = array($sc, 'Score Afdcc 1');
if($name == 'Afdcc2')
$score[$name] = array($sc, 'Score Afdcc 2');
if($name == 'Z')
$score[$name] = array($sc, 'Score Z');
if ($name == 'Afdcc1') {
$score[$name] = array($sc, 'Score Afdcc 1');
}
$typeScore = $user->getTypeScore();
switch($typeScore) {
case '20':
$maxIndiscore = $typeScore;
$score['Indiscore'] = array($indiscore->Indiscore20, 'IndiScore');
break;
case '100':
default:
$maxIndiscore = empty($typeScore)? '100' : $typeScore;
$score['Indiscore'] = array($indiscore->Indiscore, 'IndiScore');
break;
if ($name == 'Afdcc2') {
$score[$name] = array($sc, 'Score Afdcc 2');
}
if ($name == 'Z') {
$score[$name] = array($sc, 'Score Z');
}
}
$this->view->assign('siret', $this->siret);
$this->view->assign('id', $this->id);
$this->view->assign('siren', $siren);
$typeScore = $user->getTypeScore();
switch($typeScore) {
case '20':
$maxIndiscore = $typeScore;
$score['Indiscore'] = array($indiscore->Indiscore20, 'IndiScore');
break;
case '100':
default:
$maxIndiscore = empty($typeScore)? '100' : $typeScore;
$score['Indiscore'] = array($indiscore->Indiscore, 'IndiScore');
break;
}
$this->view->assign('encours', $indiscore->encours);
$this->view->assign('TendanceIndiscore', $indiscore->TendanceIndiscore);
$this->view->assign('SituationJuridique', $indiscore->SituationJuridique);
$this->view->assign('paiement', $indiscore->infoPaiement);
$this->view->assign('encours', $indiscore->encours);
$this->view->assign('TendanceIndiscore', $indiscore->TendanceIndiscore);
$this->view->assign('SituationJuridique', $indiscore->SituationJuridique);
$this->view->assign('paiement', $indiscore->infoPaiement);
$this->view->assign('scores', $score);
$this->view->assign('scores', $score);
$this->view->assign('bilanReference', $bilanReference);
$this->view->assign('bilanReference', $bilanReference);
}
/**

View File

@ -96,7 +96,7 @@ Aucun bilan disponible.
<td width="200">Situation juridique</td>
<td class="StyleInfoData" width="350">
<?php if ($this->SituationJuridique == 'P'):?>
<a href="<?=$this->url(array('module'=>'legal',
<a href="<?=$this->url(array('module'=>'legal',
'controller' => 'juridique',
'action' => 'annonces',
'siret' => $this->siret,