Merge, fixed issue #0000463, evite 2 requetes getIdentite, giant

This commit is contained in:
Michael RICOIS 2010-11-18 15:02:00 +00:00
commit 23fe393e06
8 changed files with 171 additions and 37 deletions

View File

@ -956,7 +956,6 @@ function infogreffe_bilan_ref($bilan)
function infogreffe_bilan_filename($siren, $ref)
{
global $firephp;
return 'bilan-'.$siren.'-'.$ref.'.pdf';
}
@ -998,7 +997,7 @@ function infogreffe_logfile($info){
if( !file_exists($file) ){
$entetes = array('siren', 'idCommande', 'type', 'vecteur', 'option');
$fp = fopen($file, 'w');
fputcsv($fp, $entete);
fputcsv($fp, $entetes);
fclose($fp);
}
$fp = fopen($file, 'a');

View File

@ -271,6 +271,10 @@ function menu_href_marques()
function menu_href_indiscore()
{
if (isset($_SESSION['tabInfo']['entrep']['siretSiege']) == false) {
return '#';
}
global $idEntreprise;
$siret = $_SESSION['tabInfo']['entrep']['siretSiege'];
if ($siret*1!=0 && ($_SESSION['tabInfo']['idClient']!=34 || $_SESSION['nowAuthorized']))
@ -283,6 +287,10 @@ function menu_href_indiscore()
function menu_href_indiscoreplus()
{
if (isset($_SESSION['tabInfo']['entrep']['siretSiege']) == false) {
return '#';
}
global $idEntreprise;
$siret = $_SESSION['tabInfo']['entrep']['siretSiege'];
$href = false;
@ -325,6 +333,10 @@ function menu_href_rsynthese()
function menu_href_indiscore3()
{
if (isset($_SESSION['tabInfo']['entrep']['siretSiege']) == false) {
return '#';
}
global $idEntreprise;
$siret = $_SESSION['tabInfo']['entrep']['siretSiege'];
$href = false;
@ -338,6 +350,10 @@ function menu_href_indiscore3()
function menu_href_indiscore2()
{
if (isset($_SESSION['tabInfo']['entrep']['siretSiege']) == false) {
return '#';
}
global $idEntreprise;
$siret = $_SESSION['tabInfo']['entrep']['siretSiege'];
$href = false;

View File

@ -26,8 +26,8 @@ if ($_REQUEST['action']<>'envoyer')
</table>
<table>
<tr>
<td width="208" align="right" class="StyleRechercheLib"><b>Identifiant (SIREN, WALDEC)</b></td>
<td width="300"><input type="text" name="formR[siret]" size="30" maxlength="20" />&nbsp;<img src="img/exclamation.png"/ title="SIREN, SIRET, N&deg; TVA intracommunautaire, N° RC, N° WALDEC, ISIN"></td>
<td width="208" align="right" class="StyleRechercheLib"><b>Identifiant (SIREN, R.N.A.)</b></td>
<td width="300"><input type="text" name="formR[siret]" size="30" maxlength="20" />&nbsp;<img src="img/exclamation.png"/ title="SIREN, SIRET, N&deg; TVA intracommunautaire, N° RC, R.N.A., ISIN"></td>
<td width="72">&nbsp;</td>
</tr>
<tr>
@ -100,25 +100,25 @@ if ($_REQUEST['action']<>'envoyer')
$email = trim($formR['email']);
$remarque = trim($formR['remarque']);
if ( preg_match('#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#',$email)
&& $rs<>'' && $ville<>'' && $remarque<>'')
if ( preg_match('#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,5}$#',$email)
&& $rs<>'' && $ville<>'' && $remarque<>'')
{
$fp=fopen(PATH_LOGS.'enquetes.csv', 'a');
fwrite($fp, date('Y/m/d H:i:s').' - '.print_r($_REQUEST['formR'],true).print_r($tabInfo,true)."\n");
fclose($fp);
require_once 'mail/mail.php';
sendMail(
"Demande d'investigation",
print_r($_REQUEST['formR'],true).print_r($tabInfo,true),
sendMail(
"Demande d'investigation",
print_r($_REQUEST['formR'],true).print_r($tabInfo,true),
//From
array(
array(
'email' => 'contact@scores-decisions.com',
'name' => 'Contact',
),
),
//TO
array(
0 => array(
'email'=> 'contact@scores-decisions.com',
'email'=> 'contact@scores-decisions.com',
'name' => 'Contact'
)
)
@ -132,8 +132,8 @@ if ($_REQUEST['action']<>'envoyer')
</tr>
</table>
<?
}
else
}
else
{
?>
<table width="580" height="100%" border="0" align="left" bgcolor="#FFFFFF">

View File

@ -22,9 +22,9 @@ foreach (array('siret',
<label>SIREN</label>
<input type="text" name="formR[siret]" value="<?=$formR['siret']?>" size="30"
maxlength="20" style="vertical-align:middle;"
title="Recherche par SIREN, SIRET, N° TVA intracommunautaire, N° RC, N° WALDEC, ISIN"/>
title="Recherche par SIREN, SIRET, N° TVA intracommunautaire, N° RC, R.N.A., ISIN"/>
<img src="img/info.gif" style="vertical-align:middle;"
title="Recherche par SIREN, SIRET, N° TVA intracommunautaire, N° RC, N° WALDEC, ISIN"/>
title="Recherche par SIREN, SIRET, N° TVA intracommunautaire, N° RC, R.N.A., ISIN"/>
<img id="goidentite" src="img/siretdirect.gif" style="vertical-align:middle;"
title="Accès direct à la fiche identité (Raccourci clavier : Maintenir touche CTRL puis ENTREE)" />
</div>

View File

@ -100,7 +100,7 @@ function identite_autreid($autreId, $tribunalLib, $numRC)
if (isset($autreId) && $autreId!='' && ( (isset($numRC) && $numRC=='') || substr($autreId,0,1)=='W'))
{
$libTrib = '';
if (substr($autreId,0,1)=='W') $lib = 'Identifiant Association WALDEC';
if (substr($autreId,0,1)=='W') $lib = 'Identifiant R.N.A.';
elseif (preg_match('/(A|B|C|D)/i', $autreId))
{
$lib = 'Num&eacute;ro R.C.';

View File

@ -40,11 +40,13 @@ function redimage($img_src,$dst_w,$dst_h) {
function etabSession($siret, $idEntreprise = 0){
global $client;
if (($siret != false || $idEntreprise != false) &&
(isset($_SESSION['tabInfo']['entrep']) == false ||
if ( ($siret!=false || $idEntreprise!=false) &&
(isset($_SESSION['tabInfo']['entrep'])==false ||
$siret!=$_SESSION['tabInfo']['entrep']['siret'] ||
($siret*1 == 0 &&
$idEntreprise != $_SESSION['tabInfo']['entrep']['id']))) {
($siret*1==0 && $idEntreprise!=$_SESSION['tabInfo']['entrep']['id']))
)
{
FB::info('getIdentite');
$O2 = $client->getIdentite($siret, $idEntreprise, false);
$etab = $O2['result'];
$tabEntrep = array();
@ -65,9 +67,13 @@ function etabSession($siret, $idEntreprise = 0){
$tabEntrep['fj'] = $etab['FJ'];
$_SESSION['tabInfo']['entrep'] = $tabEntrep;
$raisonSociale = $etab['Nom'];
} else if (isset($_SESSION['tabInfo']['entrep']['raisonSociale']) == true) {
}
else if (isset($_SESSION['tabInfo']['entrep']['raisonSociale']) == true)
{
$raisonSociale = $_SESSION['tabInfo']['entrep']['raisonSociale'];
} else {
}
else
{
$raisonSociale = '';
}
return $raisonSociale;

View File

@ -30,8 +30,10 @@ if ($sortie == 'pdf') {
$siret = page_param('siret');
$siren = page_param('siren');
$idEntreprise = page_param('idEntreprise');
$raisonSociale = etabSession($siret, $idEntreprise);
FB::log($_SESSION, 'SESSION');
if ($page!='identite')
{
$raisonSociale = etabSession($siret, $idEntreprise);
}
//Chargement du contenu
switch ($page)
{

View File

@ -322,6 +322,9 @@ case 'Full':
case 'Compact':
print '<h1>RAPPORT DE SYNTHESE</h1>';
break;
case 'CreditRecommendation':
print '<h1>RAPPORT DE SCORE</h1>';
break;
}
$d = unserialize($r->DataSet);
$c = $d->Company;
@ -709,6 +712,112 @@ if (isset($c->PaymentBehaviour) == true) {
dRow('PaymentQualification', $desc);
}
print '</table>';
if (isset($c->PaymentBehaviour->AnalysisByPeriod) == true) {
$ap = $c->PaymentBehaviour->AnalysisByPeriod;
$tab = array();
foreach ($ap->Category as $cat) {
$trim =
pdate($cat->Period->StartDate).' - '.
pdate($cat->Period->EndDate);
$total = 0;
foreach (getArray($cat->DueDateExceeds) as $e) {
if ($e->NrOfDaysExceeds->LowerLimit->_ >= 90) {
$total += $e->Percentage;
} else {
$lab =
$e->NrOfDaysExceeds->LowerLimit->_.' to '.
$e->NrOfDaysExceeds->UpperLimit->_;
$tab[$lab][$trim] = $e->Percentage;
}
}
$tab['90-'][$trim] = $total;
}
ksort($tab);
print '<h2>'.$ap->Description->_.'</h2>';
print '<table cellpadding="10">';
print '<tr>';
print '<td>Quarter</td>';
print '<td>Within term</td>';
foreach ($tab as $tranche => $valeurs) {
print '<td>'.$tranche.'</td>';
}
print '</tr>';
foreach ($ap->Category as $cat) {
$trim =
pdate($cat->Period->StartDate).' - '.
pdate($cat->Period->EndDate);
print '<tr align="right">'.
'<td>'.$trim.'</td>'.
'<td>'.$cat->PercentageWithinTerms.' %</td>';
foreach ($tab as $tranche => $valeurs) {
if (isset($tab[$tranche][$trim]) == true) {
print '<td>'.$tab[$tranche][$trim].' %</td>';
} else {
print '<td>0 %</td>';
}
}
print '</tr>';
}
print '</table>';
}
if (isset($c->PaymentBehaviour->AnalysisByAmount) == true) {
$ap = $c->PaymentBehaviour->AnalysisByAmount;
$tab = array();
foreach ($ap->Category as $cat) {
$amount = '';
if ( isset($cat->AmountCategory->LowerLimit) == true) {
$amount .= $cat->AmountCategory->LowerLimit->_;
}
$amount .= '-';
if ( isset($cat->AmountCategory->HigherLimit) == true) {
$amount .= $cat->AmountCategory->HigherLimit->_;
}
$total = 0;
foreach (getArray($cat->DueDateExceeds) as $e) {
if ($e->NrOfDaysExceeds->LowerLimit->_ >= 90) {
$total += $e->Percentage;
} else {
$lab =
$e->NrOfDaysExceeds->LowerLimit->_.' to '.
$e->NrOfDaysExceeds->UpperLimit->_;
$tab[$lab][$amount] = $e->Percentage;
}
}
$tab['90-'][$amount] = $total;
}
ksort($tab);
print '<h2>'.$ap->Description->_.'</h2>';
print '<table cellpadding="10">';
print '<tr>';
print '<td>Amount</td>';
print '<td>Within term</td>';
foreach ($tab as $tranche => $valeurs) {
print '<td>'.$tranche.'</td>';
}
print '</tr>';
foreach ($ap->Category as $cat) {
$amount = '';
if ( isset($cat->AmountCategory->LowerLimit) == true) {
$amount .= $cat->AmountCategory->LowerLimit->_;
}
$amount .= '-';
if ( isset($cat->AmountCategory->HigherLimit) == true) {
$amount .= $cat->AmountCategory->HigherLimit->_;
}
print '<tr>'.
'<td>'.$amount.'</td>'.
'<td>'.$cat->PercentageWithinTerms.' %</td>';
foreach ($tab as $tranche => $valeurs) {
if (isset($tab[$tranche][$amount]) == true) {
print '<td>'.$tab[$tranche][$amount].' %</td>';
} else {
print '<td>0 %</td>';
}
}
print '</tr>';
}
print '</table>';
}
}
// --------------------------------------------------------------------------- //
@ -719,8 +828,20 @@ print '<table>';
if (isset($c->CreditRecommendation->Date) == true) {
dRow('Date', pdate($c->CreditRecommendation->Date));
}
foreach (getArray($c->CreditRecommendation
->RiskClasses->ProviderRiskClass) as $t) {
if (isset($c->CreditRecommendation->RiskClasses) == true) {
foreach (getArray($c->CreditRecommendation
->RiskClasses->ProviderRiskClass) as $t) {
if (isset($t->Description->_) == true) {
$desc = '&nbsp;&nbsp;&nbsp;&nbsp;'.
'<img src="img/info.gif"'.
' style="vertical-align:middle;"'.
' title="'.$t->Description->_.'"/>';
} else {
$desc = '';
}
dRow($t->RatingName->_.$desc, $t->RatingValue);
}
$t = $c->CreditRecommendation->RiskClasses->CommonRiskClass;
if (isset($t->Description->_) == true) {
$desc = '&nbsp;&nbsp;&nbsp;&nbsp;'.
'<img src="img/info.gif"'.
@ -731,16 +852,6 @@ foreach (getArray($c->CreditRecommendation
}
dRow($t->RatingName->_.$desc, $t->RatingValue);
}
$t = $c->CreditRecommendation->RiskClasses->CommonRiskClass;
if (isset($t->Description->_) == true) {
$desc = '&nbsp;&nbsp;&nbsp;&nbsp;'.
'<img src="img/info.gif"'.
' style="vertical-align:middle;"'.
' title="'.$t->Description->_.'"/>';
} else {
$desc = '';
}
dRow($t->RatingName->_.$desc, $t->RatingValue);
dRow('AmountAdvised', $c->CreditRecommendation->AmountAdvised->_.' '.
$c->CreditRecommendation->AmountAdvised->currency);
print '</table>';