extranet/www/pages/international_identitec.php

347 lines
8.2 KiB
PHP
Raw Normal View History

2009-04-07 17:44:17 +00:00
<?php
session_start();
2009-04-07 17:44:17 +00:00
if (!$_SESSION['connected']) die();
$tabInfo = $_SESSION['tabInfo'];
2009-04-07 17:44:17 +00:00
$identifier = $_REQUEST['identifier'];
$CompanyProductIdentifier = $_REQUEST['pidentifier'];
require_once 'i18n/cleanchar.php';
2009-04-09 17:10:02 +00:00
require_once 'graydon/functions.php';
2009-04-07 17:44:17 +00:00
require_once 'graydon/graydonws.php';
function dVal($value){
if($value == '' || $value == NULL){
print 'NC';
}else{
print $value;
}
}
?>
<div id="center">
<?php
2009-04-09 17:10:02 +00:00
$path = PATH_DATA.'/graydon';
$fileName = strtolower(str_replace( array(':',' '), '-', $identifier).'.xml');
2009-04-07 17:44:17 +00:00
2009-04-09 17:10:02 +00:00
if(!file_exists($path.'/'.$fileName)){
/*
placeOrder
CompanyProductIdentifier
Language
CreditOpinionCurrency
Country
getCompanyReport
OrderReference
MimeType
*/
//placeOrder
2009-04-07 17:44:17 +00:00
$request = new StdClass();
$request->Authentication_Parameters = $authentication;
2009-04-09 17:10:02 +00:00
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
$request->CompanyProductIdentifier = $CompanyProductIdentifier;
$request->PartnerData = '';
2009-04-07 17:44:17 +00:00
$firephp->log($request,'requete');
try
{
2009-04-09 17:10:02 +00:00
$placeOrderResult = $graydon->placeOrder($request);
$firephp->log($placeOrderResult,'placeOrder');
}catch( SoapFault $fault ){
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
2009-04-07 17:44:17 +00:00
}
2009-04-09 17:10:02 +00:00
//On v<>rifie l'<27>tat de le demande
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed'){
//getCompanyReport
$request = new StdClass();
$request->Authentication_Parameters = $authentication;
$request->LanguageCode = 'E'; //Sp<53>cifier la langue du rapport
$request->OrderReference = $placeOrderResult->OrderStatus->OrderReference;
$request->MimeType = 'xml';
$firephp->log($request,'requete');
try
{
$reportResult = $graydon->getCompanyReport($request);
$firephp->log($reportResult,'reportResult');
$xml = $reportResult->ReportXML;
//Enregistrement du fichier xml
$xml = $reportResult->ReportXML->any;
file_put_contents($path.'/'.$fileName, $xml);
}catch( SoapFault $fault ){
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
2009-04-09 17:10:02 +00:00
}
}
//On prend les donn<6E>es du fichier
}else{
$firephp->log('Data depuis fichier XML');
$xml = file_get_contents($path.'/'.$fileName);
}
//========= Affichage des informations =========
if(isset($xml) && $xml!=''){
?>
<h1 class="titre">IDENTIT&Eacute; INTERNATIONALE DE L'ENTREPRISE</h1>
2009-04-09 17:10:02 +00:00
<table>
2009-04-09 17:10:02 +00:00
<?php
$tabCompany = array();
//Cr<43>ation du DOM
$doc = new DOMDocument;
$doc->preserveWhiteSpace = false;
$doc->loadxml($xml);
$xpath = new DOMXPath($doc);
$tabCompany['Identite']['Subject'] = parseCompany('Subject');
$tabCompany['Identite']['FormeLegale'] = parseLegal_Form();
$tabCompany['Identite']['Address'] = parseCompanyAddress();
$tabCompany['Identite']['Communication'] = parseCommunication();
$tabCompany['Identite']['Dirigeants'] = parseDirectorDetails();
$tabCompany['Identite']['Activite'] = parseTaxonomy('Nace');
$tabCompany['Identite']['Activite']['Text'] = parseFreeText('//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/FreeText[@Type="Activities"]');
$tabCompany['Identite']['Effectif'] = parseEmployees('Staff_Employed');
$tabCompany['Identite']['Capital'] = parseShare_Capital();
$tabCompany['Identite']['ResumeFinance'] = parseFinancial_Summary();
2009-04-23 06:53:26 +00:00
$tabCompany['Identite']['CreditRating'] = parseCredit_Rating();
require_once 'graydon/functions2.php';
$tabReport = parseReportXML($xml);
$firephp->log($tabReport, 'tabReport');
function utf8decode_deep($value)
{
$value = is_array($value) ?
array_map('utf8decode_deep', $value) :
cleanutf8($value);
return $value;
}
//$tabCompany = utf8decode_deep($tabCompany);
$firephp->log($tabCompany,'tabCompany');
?>
<?php foreach($tabCompany['Identite']['Subject']['CompanyId'] as $identifiant => $value){ ?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?php print $identifiant;?></td>
<td width="350" class="StyleInfoData"><?php print $value;?></td>
</tr>
<?php }?>
</table>
2009-04-09 17:10:02 +00:00
<h2>Raison sociale et coordonn<EFBFBD>es : </h2>
2009-04-09 17:10:02 +00:00
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale : </td>
<td width="350" class="StyleInfoData"><?php print $tabCompany['Identite']['Subject']['Name'];?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Forme l<EFBFBD>gale : </td>
<td width="350" class="StyleInfoData">
<?php
if(count($tabCompany['Identite']['FormeLegale'])==0){print 'NC';}
else{
foreach($tabCompany['Identite']['FormeLegale'] as $item => $value){
print $value.' - ('.$item.')<br/>';
}
}
?>
</td>
</tr>
2009-04-09 17:10:02 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Date de cr<EFBFBD>ation : </td>
<td width="350" class="StyleInfoData">
<?php
dVal($tabCompany['Identite']['Subject']['Date']['Age_of_Company']);
?>
</td>
</tr>
2009-04-09 17:10:02 +00:00
<?php
if(count($tabCompany['Identite']['Address'])==0){print 'Aucune adresse d<>finie';}
else{
foreach($tabCompany['Identite']['Address'] as $type => $elements){
?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?php print $type;?></td>
<td width="350" class="StyleInfoData"><?php print $elements['EntireAddress'];?></td>
</tr>
<?php
}
}
2009-04-23 06:53:26 +00:00
if(count($tabCompany['Identite']['Communication'])!=0){
foreach($tabCompany['Identite']['Communication'] as $type => $elements){
?>
2009-04-23 06:53:26 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?php print $type;?></td>
<td width="350" class="StyleInfoData"><?php print $elements;?></td>
</tr>
<?php
}
}
?>
</table>
2009-04-09 17:10:02 +00:00
<h2>Activit<EFBFBD>(s) et chiffre d'affaire de l'entreprise : </h2>
2009-04-09 17:10:02 +00:00
<table>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Activit<EFBFBD> : </td>
<td width="350" class="StyleInfoData">
<?php
foreach($tabCompany['Identite']['Activite'] as $item => $value){
if($item != 'Text'){
print $item.' : '.$value['Code'].' - '.$value['Value'];
}
}
if(count($tabCompany['Identite']['Activite']['Text'])!=0){
?>
<br/><br>
<u>Informations compl<EFBFBD>mentaires :</u><br/>
<?php
foreach($tabCompany['Identite']['Activite']['Text'] as $value){
print $value.'<br/>';
}
}
?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
2009-04-23 06:53:26 +00:00
<td width="200" class="StyleInfoLib">Effectif :</td>
<td width="350" class="StyleInfoData">
<?php dVal($tabCompany['Identite']['Effectif']);?>
</td>
</tr>
2009-04-09 17:10:02 +00:00
2009-04-07 17:44:17 +00:00
<tr>
<td width="30">&nbsp;</td>
2009-04-23 06:53:26 +00:00
<td width="200" class="StyleInfoLib">Capital :</td>
<td width="350" class="StyleInfoData">
2009-04-23 06:53:26 +00:00
Issued Capital : <?php dVal($tabCompany['Identite']['Capital']['Issued_Capital']);?><br/>
Nominal Capital : <?php dVal($tabCompany['Identite']['Capital']['Nominal_Capital']);?><br/>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
2009-04-23 06:53:26 +00:00
<td width="200" class="StyleInfoLib">Chiffre d'affaire :</td>
<td width="350" class="StyleInfoData">
2009-04-23 06:53:26 +00:00
<?php dVal($tabCompany['Identite']['ResumeFinance']['Working Capital']);?>
</td>
</tr>
2009-04-23 06:53:26 +00:00
<tr>
<td width="30">&nbsp;</td>
2009-04-23 06:53:26 +00:00
<td width="200" class="StyleInfoLib"></td>
<td width="350" class="StyleInfoData"></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Principaux Dirigeants :</td>
<td width="350" class="StyleInfoData">
2009-04-23 06:53:26 +00:00
<?php
foreach($tabCompany['Identite']['Dirigeants'] as $element){
print $element['Name'].' ('.$element['Type'].')'.'<br/>';
//Affichage de l'adresse
if (isset($element['Address']['EntireAddress'])) print '<br/><i>'.$element['Address']['EntireAddress'].'</i><br/>';
}
?>
</td>
</tr>
2009-04-23 06:53:26 +00:00
</table>
2009-04-23 06:53:26 +00:00
<h2> Financial Summary : </h2>
<table>
<?php
foreach($tabCompany['Identite']['ResumeFinance'] as $key => $value){
?>
<tr>
<td width="30">&nbsp;</td>
2009-04-23 06:53:26 +00:00
<td width="200" class="StyleInfoLib"><?php print $key; ?> :</td>
<td width="350" class="StyleInfoData">
2009-04-23 06:53:26 +00:00
<?php dVal($value);?>
</td>
</tr>
2009-04-23 06:53:26 +00:00
<?php
}
?>
</table>
<h2> Credit Rating : </h2>
<table>
<?php
foreach($tabCompany['Identite']['CreditRating'] as $key => $element){
?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib"><?php print $key; ?> :</td>
<td width="350" class="StyleInfoData">
<?php
dVal($element['value']);
if (isset($element['text'])){
print '<br/>';
foreach($element['text'] as $text){
print $text;
}
}
?>
</td>
</tr>
<?php
}
?>
</table>
2009-04-07 17:44:17 +00:00
<?php
}else{
?>
<table>
2009-04-07 17:44:17 +00:00
<tr>
<td width="30">&nbsp;</td>
<td width="500" class="StyleInfoLib">Aucune information disponible.</td>
</tr>
</table>
<?php
}
?>
</table>
</div>
2009-04-07 17:44:17 +00:00