Maj fonction getIndiscore

This commit is contained in:
Michael RICOIS 2010-12-22 13:43:25 +00:00
parent 64df685f40
commit 592dc7e36b

View File

@ -777,78 +777,135 @@ class WsEntreprise extends WsScore
$error->errmsg = 'Siren incorrect'; $error->errmsg = 'Siren incorrect';
} else { } else {
$tDeb = microtime(true); $tDeb = microtime(true);
global $tva, $tabFormules, $tabFormulesRatios, $mBil, $tabBilan, $efftr, $tabRatiosInfos, $tabInfla;
global $R, $Rp, $Rp2, $Rp3, $Rp4;
global $Rs, $Rsp, $Rsp2, $Rsp3, $Rsp4;
global $Revol, $Revolp, $Revolp2, $Revolp3;
global $regR, $regRs;
global $Ra, $Rap, $Rdiff;
require_once 'Metier/tmp/configMRatios.php';
require_once 'Metier/scores/classMScores.php'; require_once 'Metier/scores/classMScores.php';
$tabRet = calculIndiScore($siren, $nic, $accesDist, $niveau); $tabRet = calculIndiScore($siren, $nic, $accesDist, $niveau);
$duree = round(microtime(true)-$tDeb,3); $duree = round(microtime(true)-$tDeb,3);
debugLog('W', "indiscore DUREE = $duree s", __LINE__, __FILE__, __FUNCTION__, __CLASS__); debugLog('W', "indiscore DUREE = $duree s", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
wsLog('indiscore',$siren); wsLog('indiscore',$siren);
} }
Zend_Registry::get('WsLogger')->info("INDISCORE : ".print_r($tabRet,1)); Zend_Registry::get('WsLogger')->info("INDISCORE : ".print_r($tabRet,1));
//array('paiements', 'Bilans', 'Notes_Structure', 'paiements', 'tabBilans', 'tabBilan', 'tabInfosNotation', 'tabImportExport', 'tabCommentaires', 'tabVariables')
$result = new Indiscore(); $result = new Indiscore();
foreach($tabRet as $key => $value){
if (!is_array($value)){
$result->$key = $value;
}
}
/*
foreach($tabRet as $key => $value){ foreach($tabRet as $key => $value){
if ($key=='paiements'){ if ($key=='paiements'){
$parMont = $tabRet[$key]['parMont']; $parMont = $value['parMont'];
$parTrim = $tabRet[$key]['parTrim']; $parTrim = $value['parTrim'];
$tabMont = array(); $tabMont = array();
foreach($parMont as $parMontK => $parMontV){ foreach($parMont as $parMontK => $parMontV){
$paiementMont = new IndiscorePaiementMont(); $paiementMont = new IndiscorePaiementDetail();
$paiementMont->id = $parMontK; $paiementMont->id = $parMontK;
$paiementMont->val = $parMontV; $paiementMont->nb = $parMontV['nb'];
if (array_key_exists('d=180', $parMontV)){
$paiementMont->d180 = $parMontV['d=180'];
}
if (array_key_exists('d=150', $parMontV)){
$paiementMont->d150 = $parMontV['d=150'];
}
if (array_key_exists('d=120', $parMontV)){
$paiementMont->d120 = $parMontV['d=120'];
}
if (array_key_exists('d=90', $parMontV)){
$paiementMont->d90 = $parMontV['d=90'];
}
if (array_key_exists('d=60', $parMontV)){
$paiementMont->d60 = $parMontV['d=60'];
}
if (array_key_exists('d=30', $parMontV)){
$paiementMont->d30 = $parMontV['d=30'];
}
$tabMont[] = $paiementMont; $tabMont[] = $paiementMont;
} }
$tabTrim = array(); $tabTrim = array();
foreach($parTrim as $parTrimK => $parTrimV){ foreach($parTrim as $parTrimK => $parTrimV){
$paiementTrim = new IndiscorePaiementTrim(); $paiementTrim = new IndiscorePaiementDetail();
$paiementTrim->id = $parTrimK; $paiementTrim->id = $parTrimK;
$paiementTrim->val = $parTrimV; $paiementTrim->nb = $parTrimV['nb'];
if (array_key_exists('d=180', $parTrimV)){
$paiementTrim->d180 = $parTrimV['d=180'];
}
if (array_key_exists('d=150', $parTrimV)){
$paiementTrim->d150 = $parTrimV['d=150'];
}
if (array_key_exists('d=120', $parTrimV)){
$paiementTrim->d120 = $parTrimV['d=120'];
}
if (array_key_exists('d=90', $parTrimV)){
$paiementTrim->d90 = $parTrimV['d=90'];
}
if (array_key_exists('d=60', $parTrimV)){
$paiementTrim->d60 = $parTrimV['d=60'];
}
if (array_key_exists('d=30', $parTrimV)){
$paiementTrim->d30 = $parTrimV['d=30'];
}
$tabTrim[] = $paiementTrim; $tabTrim[] = $paiementTrim;
} }
$paiement = new IndiscorePaiement(); $paiement = new IndiscorePaiement();
$paiement->parMont = $tabMont; $paiement->parMont = $tabMont;
$paiement->parTrim = $tabTrim; $paiement->parTrim = $tabTrim;
$result->paiements = $paiement; $result->paiements = $paiement;
} elseif ($key=='Bilans') {
} elseif ($key=='Notes_Structure') {
$notesStructure = new IndiscoreNotesStructure();
$notesStructure->activite = $value['activite'];
$notesStructure->naf4 = $value['naf4'];
$notesStructure->age = $value['age'];
$notesStructure->capital = $value['capital'];
$notesStructure->effectif = $value['effectif'];
$notesStructure->fj = $value['fj'];
$notesStructure->localite = $value['localite'];
$notesStructure->singulier = $value['singulier'];
$result->Notes_Structure = $notesStructure;
} elseif ($key=='tabBilans') {
$tabRet = array();
foreach($value as $bilan)
{
$element = new ListeBilans();
$element->dateProvPartenaire = $bilan['dateProvPartenaire'];
$element->dateInsert = $bilan['dateInsert'];
$element->typeBilan = $bilan['typeBilan'];
$element->dureeExercice = $bilan['dureeExercice'];
$element->dateExercice = $bilan['dateExercice'];
$element->millesime = $bilan['millesime'];
$element->dateExercicePre = $bilan['dateExercicePre'];
$element->dureeExercicePre = $bilan['dureeExercicePre'];
$element->monnaie = $bilan['monnaie'];
$element->source = $bilan['source'];
$tabRet[] = $element;
}
$result->tabBilans = $tabRet;
} elseif ($key=='tabBilan') {
} elseif ($key=='tabInfosNotation') { } elseif ($key=='tabInfosNotation') {
$tab = $tabRet[$key];
$infosNotation = new IndiscoreInfosNotation(); $infosNotation = new IndiscoreInfosNotation();
$infosNotation->SituationFinanciere = $tabRet[$key]['SituationFinanciere']; $infosNotation->SituationFinanciere = $value['SituationFinanciere'];
$infosNotation->Notation = $tabRet[$key]['Notation']; $infosNotation->Notation = $value['Notation'];
$infosNotation->ProbabiliteDefaut = $tabRet[$key]['ProbabiliteDefaut']; $infosNotation->ProbabiliteDefaut = $value['ProbabiliteDefaut'];
$result->tabInfosNotations = $infosNotation; $result->tabInfosNotations = $infosNotation;
} elseif ($key=='tabImportExport') { } elseif ($key=='tabImportExport') {
$tabRet = array();
foreach($value as $element){
$importExport = new IndiscoreImportExport(); $importExport = new IndiscoreImportExport();
$importExport->importExport = $tabRet[$key]['importExport']; $importExport->importExport = $element['importExport'];
$importExport->annee = $tabRet[$key]['annee']; $importExport->annee = $element['annee'];
$importExport->rangNational = $tabRet[$key]['rangNational']; $importExport->rangNational = $element['rangNational'];
$importExport->deptSiege = $tabRet[$key]['deptSiege']; $importExport->deptSiege = $element['deptSiege'];
$result->tabImportExport = $importExport; $tabRet[] = $importExport;
}
$result->tabImportExport = $tabRet;
} elseif ($key=='tabCommentaires') { } elseif ($key=='tabCommentaires') {
$tab = array(); $tab = array();
foreach($tabRet[$key] as $comment) { foreach($value as $comment) {
$tab[] = $comment; $tab[] = $comment;
} }
$result->tabCommentaires = $tab; $result->tabCommentaires = $tab;
} elseif ($key=='tabVariables') { } elseif ($key=='tabVariables') {
$tab = $tabRet[$key]['CA_Y']; $tab = $value['CA_Y'];
$tabVar = array(); $tabVar = array();
foreach($tab as $key => $value){ foreach($tab as $varName => $varVal){
$var = new CA_Y(); $var = new CA_Y();
$var->id = $key; $var->id = $varName;
$var->val = $value; $var->val = $varVal;
$tabVar[] = $var; $tabVar[] = $var;
} }
$variables = new IndiscoreVariables(); $variables = new IndiscoreVariables();
@ -857,9 +914,9 @@ class WsEntreprise extends WsScore
} else { } else {
//$result->$key = $value; $result->$key = $value;
}
} }
}*/
$output = new IndiscoreReturn(); $output = new IndiscoreReturn();
$output->error = $error; $output->error = $error;
$output->result = $result; $output->result = $result;