getRequest(); $this->siret = $request->getParam('siret'); $this->id = $request->getParam('id', 0); require_once 'common/dates.php'; require_once 'Scores/WsScores.php'; require_once 'Scores/Utilisateur.php'; require_once 'Scores/SessionEntreprise.php'; require_once 'Scores/IdentiteEntreprise.php'; require_once 'Finance/RatiosData.php'; $this->view->headLink() ->appendStylesheet('/themes/default/styles/evaluation.css', 'all'); } public function indexAction() { $this->_forward('entreprise', 'recherche'); } /** * Affichage d'une reglette représentant le score */ public function printscoresAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $score = strtolower($request->getParam('score')); if( $score == 'indiscore' ){ $user = new Utilisateur(); switch($user->getTypeScore()) { case '20': $score.='20'; break; case '100': default: $score.='100'; break; } } $note = $request->getParam('note'); $bornes = array( 'conanh' => array( 'min' => -4.5 , 'max' => 16 ), 'afdcc2' => array( 'min' => 0 , 'max' => 5 ), 'afdcc1' => array( 'min' => -10 , 'max' => 10 ), 'z' => array( 'min' => -3 , 'max' => 3 ), 'indiscore100' => array( 'min' => 0 , 'max' => 100 ), 'indiscore20' => array( 'min' => 0 , 'max' => 20 ), ); $note = round(($note - $bornes[$score]['min'])*100/($bornes[$score]['max'] - $bornes[$score]['min'])); if($note < 0) $note = 0; if($note > 100) $note = 100; $this->view->assign('note', $note); $this->view->assign('min', $bornes[$score]['min']); $this->view->assign('max', $bornes[$score]['max']); } /** * IndiScore */ public function indiscoreAction() { $user = new Utilisateur(); if(!$user->checkPerm('INDISCORE') && !$user->checkPerm('INDISCOREP')) $this->_forward('perms', 'error'); $request = $this->getRequest(); $autrePage = $request->getParam('apage'); //Récupération des informations if (empty($autrePage)) { $plus = false; if ($user->checkPerm('indiscorep')){ $plus = true; } $ref = $request->getParam('ref', ''); $encours = $request->getParam('encours', 0); $email = $request->getParam('email', ''); $ws = new WsScores(); $infos = $ws->getIndiScore(substr($this->siret, 0,9), 0, 1, $plus, $ref, $encours, $email); if ($infos === false) $this->_forward('soap', 'error'); } else { $infos = $this->getRequest()->getParam('infos'); } $this->view->assign('siret', $this->siret); $this->view->assign('typeScore', $user->getTypeScore()); $this->view->assign('indiscore', $infos); $this->view->assign('AutrePage', $autrePage); $this->view->assign('exportObjet', $infos); $this->view->assign('surveillance', $user->checkPerm('aviscredit')); $this->view->assign('surveillance', $user->checkPerm('survscore')); } /** * Rapport de synthese */ public function indiscore2Action() { $this->view->headScript()->appendFile('/themes/default/scripts/finance.js', 'text/javascript'); $user = new Utilisateur(); if(!$user->checkPerm('INDISCORE2') && !$user->checkPerm('INDISCORE2P')) $this->_forward('perms', 'error'); $siren = substr($this->siret,0,9); $ws = new WsScores(); $entreprise = new SessionEntreprise($this->siret, $this->id); $identite = $ws->getIdentite($siren); $indiscore = $ws->getIndiScore($siren); $infos = $ws->getRatios($siren, 'indiscore2'); // @todo : vérifier la page $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 RatiosData($infos); $nbBilanN = $ratiosData->getNbBilan('N'); $nbBilanC = $ratiosData->getNbBilan('C'); 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){ $data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio); $dataTotal[$idRatio] = $ratiosData->dTotal($typeBilan, $annee, $idRatio, $valRatio['total']); $dInfo[$idRatio] = $valRatio['total_info']; } $tabResult[] = array( 'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee), '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'}() : '', ); $dBlock[$item] = $display; } $this->view->assign('dBlock', $dBlock); $dateRadiation = ''; if(isset($indiscore->DateRadiation) && $indiscore->DateRadiation!='' && $indiscore->DateRadiation!='0000-00-00') $this->view->assign('dateRadiation', WDate::dateT('Ymd', 'd/m/Y', str_replace('-','',$indiscore->DateRadiation))); foreach($indiscore->scores as $name => $sc){ if($name == 'ConanH') $score[$name] = array($sc, 'Score Conan Holder'); if($name == 'Afdcc2') $score[$name] = array($sc, 'Score Afdcc 2'); if($name == 'Z') $score[$name] = array($sc, 'Score Z'); } $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; } $score['Indiscore'] = array($indiscore->Indiscore20, 'IndiScore'); $this->view->assign('siret', $this->siret); $this->view->assign('id', $this->id); $this->view->assign('siren', $siren); $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('bilanReference', $bilanReference); } /** * Rapport complet */ public function indiscore3Action() { $this->view->headLink()->appendStylesheet('/themes/default/styles/comment.css', 'all'); $this->view->headScript()->appendFile('/themes/default/scripts/evaluation.js', 'text/javascript'); $user = new Utilisateur(); if(!$user->checkPerm('INDISCORE3') && !$user->checkPerm('INDISCORE3P')) $this->_forward('perms', 'error'); // Lien pour le rapport personnalisé if ($user->getIdClient() == '110' || $user->checkModeEdition()) { $this->view->assign('customRapport', $this->view->url(array( 'controller'=>'evaluation', 'action'=>'customindiscore3', 'siret'=>$this->siret, 'id'=>$this->id) )); } $sessionEntreprise = new SessionEntreprise($this->siret, $this->id); $ws = new WsScores(); $siren = substr($this->siret,0,9); $plus = false; if ($user->checkPerm('indiscore3p')){ $plus = true; } $request = $this->getRequest(); $ref = $request->getParam('ref', ''); $encours = $request->getParam('encours', 0); $email = $request->getParam('email', ''); $infos = $ws->getRapport($siren, 3, 0, $plus, $ref, $encours, $email); $this->view->assign('Identite', $infos->Identite); $this->view->assign('Dirigeants', $infos->Dirigeants); $this->view->assign('Liens', $infos->Liens); $this->view->assign('Annonces', $infos->Annonces); $this->view->assign('Ratios', $infos->Ratios); $this->view->assign('Indiscore', $infos->Indiscore); require_once 'Scores/RapportComment.php'; $rapportComment = new RapportComment($siren, $this->id, $infos->Indiscore->tabCommentaires->item, $infos->Ratios, $infos->Indiscore->tabVariables); $this->view->assign('comment',$rapportComment->out()); $this->view->assign('siret', $this->siret); $this->view->assign('id', $this->id); $this->view->assign('siren', $siren); $this->view->assign('raisonSociale', $sessionEntreprise->getRaisonSociale()); $this->view->assign('exportObjet', $infos); } /** * Génération de rapport personnalisé * @todo : à améliorer */ public function customindiscore3Action() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $upload = $request->getParam('upload', null); $user = new Utilisateur(); if (empty($upload)){ $adresse = array(); if ($user->checkModeEdition()){ $adresse[] = 'Order to Cash'; $adresse[] = '70 AVENUE DE LA MARNE '; $adresse[] = '92600 ASNIERES SUR SEINE'; $color1 = '#DFDB00'; $color2 = '#EFED9A'; $background = "background-image:url('/themes/default/images/customrapport/logo_ordertocash.jpg');background-repeat:no-repeat;background-position:center"; } else { $adresse[] = 'Financement Entreprise'; $adresse[] = '16 RUE SENAC DE MEILHAN'; $adresse[] = '17000 LA ROCHELLE'; $color1 = '#6699FF'; $color2 = '##66CCFF'; $background = null; } $this->view->assign('adresse', $adresse); $this->view->assign('color1', $color1); $this->view->assign('color2', $color2); $this->view->assign('background', $background); $this->view->assign('siret', $this->siret); $this->view->assign('id', $this->id); } else { $this->_helper->viewRenderer->setNoRender(true); $couleurh1 = $request->getParam('couleurh1', null); $couleurh2 = $request->getParam('couleurh2', null); $texth1 = $request->getParam('texth1', null); $texth2 = $request->getParam('texth2', null); $societe_name = $request->getParam('societe_name', null); $adresse = $request->getParam('adresse', null); $logo_background = $request->getParam('logo_background', null); $siren = substr($this->siret, 0, 9); if ($this->id!=0){ $file = 'evaluation-indiscore3-'.$this->siret.'-'.$this->id.'.html'; } else { $file = 'evaluation-indiscore3-'.$this->siret.'.html'; } if (file_exists(APPLICATION_PATH.'/../cache/pages/'.$file)) { $doc = new DOMDocument(); $doc->preserveWhiteSpace = true; @$doc->loadHTMLFile(APPLICATION_PATH.'/../cache/pages/'.$file); //Générer style particulier pour le rapport $style.= 'body { background-color:#ffffff; }'; $style.= '#customRapport { display:none; }'; $style.= '#center h1 {background-color:'.$couleurh1.';color:'.$texth1.'}'; if($logo_background) { $style.= '#center {background-image:url(./themes/default/images/customrapport/logo_ordertocash.jpg);background-repeat:repeat-y}'; } $style.= '#center h2 {background-color:'.$couleurh2.';color:'.$texth2.'}'; $styleDom = $doc->createElement('style', $style); //Ajout information $contentDom = $doc->createElement('div'); if(!$user->checkModeEdition()) { $element = $doc->createElement('img'); $element->setAttribute('src', './themes/default/images/customrapport/logo_ordertocash.jpg'); $element->setAttribute('width', '12%'); } else { $element = $doc->createElement('img'); $element->setAttribute('src', './themes/default/images/customrapport/logo_ordertocash.jpg'); $element->setAttribute('width', '12%'); } $div = $doc->createElement('div'); $div->setAttribute('style', "clear:both;"); $div->appendChild($element); $contentDom->appendChild($div); $i = 0; foreach($adresse as $item){ $element = $doc->createElement('span', $item); $contentDom->appendChild($element); $element = $doc->createElement('br'); $contentDom->appendChild($element); $i++; } $element = $doc->createElement('center', $societe_name.' Enquête Financière'); $element->setAttribute('style', 'font-size:17px'); $contentDom->appendChild($element); if(!$user->checkModeEdition()){ $element = $doc->createElement('span', "Les équipes d'Order To Cash se tiennent à votre disposition pour vous assister dans l'interprétation de ces données au 01 47 90 94 31 ou par mail à l'adresse suivante : contact@ordertocash.fr"); $contentDom->appendChild($element); } $ajout = $doc->createElement('div'); $ajout->appendChild($styleDom); $ajout->appendChild($contentDom); //Après
".print_r($InfoUser, 1)."". "
".print_r($InfoEnq).""; require_once 'Scores/Mail.php'; $mail = new Mail(); $mail->setFrom('production'); $mail->addToKey('support'); $mail->setSubject($sujet); $mail->setBodyHtml($texte); if ($mail->send()) { $commande = true; } } $this->view->assign('commande', $commande); $this->view->assign('formError', $formError); $this->view->assign('message', $message); $this->view->assign('InfoUser', $InfoUser); $this->view->assign('InfoEnq', $InfoEnq); $this->view->assign('siren', substr($this->siret, 0,9)); } //Affichage du formulaire if ($commande == false) { $ws = new WsScores(); $infosEntrep = $ws->getIdentite($this->siret, $this->id); $this->view->assign('Etab', $infosEntrep); $user = new Utilisateur(); $this->view->assign('user', $user); } } /** * Affichage des informations de scoring creditsafe */ public function scoringAction() { $utilisateur = new Utilisateur(); if(!$utilisateur->checkModeEdition() or !$utilisateur->checkPerm('SCORECSF')) $this->render('error/perms', null, 'error'); require_once 'Evaluation/DomDocument2.lib.php'; require_once 'common/curl.php'; define('CREDITSAFE_WS_URL', 'https://www.creditsafe.fr/getdata/service/CSFRServices.asmx'); define('CREDITSAFE_WS_URI', 'https://www.creditsafe.fr/getdata/service/'); define('CREDITSAFE_WS_USER', 'scores_decisions'); define('CREDITSAFE_WS_PASS', 'yoann1306'); define('CREDITSAFE_WS_REF', 'ref'); /** * L'Url du WSDL est bonne simplament le formatage des données a changés, il faut respecter les données ! * comparer les exemples donnés. * */ $req='