265 lines
9.2 KiB
PHP
265 lines
9.2 KiB
PHP
<?php
|
|
Class GiantFunction
|
|
{
|
|
public function randomColor()
|
|
{
|
|
mt_srand((double)microtime()*1000000);
|
|
$c = '';
|
|
while(strlen($c)<6){
|
|
$c .= sprintf("%02X", mt_rand(0, 255));
|
|
}
|
|
return '0x80'.$c;
|
|
}
|
|
|
|
public function setLimit($limit)
|
|
{
|
|
if($limit == $userLimit)
|
|
return (true);
|
|
return (false);
|
|
}
|
|
|
|
public function setDate($date, $format)
|
|
{
|
|
$date = new WDate();
|
|
switch($format) {
|
|
case 'YYYYMMDD':
|
|
$formatIn = 'Ymd';
|
|
$date = $date->dateT($formatIn, 'd/m/Y', $date);
|
|
return ($date);
|
|
case 'YYYY':
|
|
return ($date);
|
|
case 'YYYYMM':
|
|
return (substr($date, 0, 3).'/'.substr($date, 3));
|
|
}
|
|
}
|
|
|
|
public function getFormatDate($format)
|
|
{
|
|
switch($format) {
|
|
case 'YYYYMMDD':
|
|
return ('Ymd');
|
|
}
|
|
}
|
|
|
|
public function getPoundName($name)
|
|
{
|
|
switch ($name) {
|
|
case 'EUR':
|
|
return ('Euros');
|
|
case 'DOL':
|
|
return ('Dolards');
|
|
}
|
|
}
|
|
|
|
public function getModification($obj)
|
|
{
|
|
$reference = array('CREDIT_RECOMMENDATION_CHANGE' => 'Changement Avis de crédit',
|
|
'ADDRESS_CHANGE' => 'Changement d\'adresse',
|
|
'COMPANY_NAME_CHANGE' => 'Changement dénomination / RS',
|
|
'LEGALFORM_CHANGE' => 'Changement Forme juridique',
|
|
'ACQUISITION' => 'Acquisition sociétaire',
|
|
'NEWS' => 'Nouvelles',
|
|
'ANNUAL_ACCOUNT_FILED' => 'Dépot des comptes annuels',
|
|
'CAPITAL_CHANGE' => 'Changement Capital',
|
|
'BANKRUPTCY_OR_LIQUIDATION' => 'Faillite ou liquidation'
|
|
);
|
|
$array = array();
|
|
foreach($obj->Categories->Category as $Category) {
|
|
foreach($Category->EventCodes->EventCode as $code) {
|
|
$valeur = explode('.', $code);
|
|
$array[$valeur[0]][] = $valeur[1];
|
|
}
|
|
}
|
|
$html = '<fieldset><legend><center><b>Modifications au '.date('d/m/Y').'</b></center></legend><br />';
|
|
$html .= '<ol style="list-style:none">';
|
|
foreach($array as $name => $ar) {
|
|
$html .= '<li><b>'.$name.' :</b></li>';
|
|
foreach($ar as $a) {
|
|
$html .= '<li> <b>-</b> '.$reference[$a].'</li>';
|
|
}
|
|
$html .= '<br />';
|
|
}
|
|
$html .= '</ol></fieldset>';
|
|
return ($html);
|
|
}
|
|
|
|
public function getDescription()
|
|
{
|
|
$description = new stdClass();
|
|
|
|
$description->Full = "<table><tr><td><b>Information sur le rapport</b></td></tr><tr><td>Ce rapport est composés en plusieurs parties</td></tr><tr><td style='margin-left:5px'><ol><li>Identite et raison sociale</li><li>CreditRecommandation</li><li>Dirigeants</li><li>Les Bilans (actifs, Passifs, Compte de résultats)</li><li>Les Etablissements financiés</li><li>Comportement de paiement</li><li>Les partenaires financiés</li><li>Les actionnaires</li><li>Les annonces légales</li><li>Le Score</li></ol></td></tr></table>";
|
|
$description->Compact = '<table><tr><b>Information sur le rapport</b></tr><tr><td>Ce rapport est composés en plusieurs parties</td></tr><tr><td><ol><li>Identite et raison sociale</li><li>CreditRecommandation</li><li>Dirigeants</li><li>Les Bilans (actifs, Passifs, Compte de résultats)</li><li>Les Etablissements financiés</li><li>Comportement de paiement</li><li>Les partenaires financiés</li><li>Les actionnaires</li><li>Les annonces légales</li><li>Le Score</li></ol></td></tr></table>';
|
|
$description->CreditRecommendation = '<table><tr><b>Information sur le rapport</b></tr><tr><td>Ce rapport est composés en plusieurs parties</td></tr><tr><td><ol><li>Identite et raison sociale</li><li>CreditRecommandation</li><li>Dirigeants</li><li>Les Bilans (actifs, Passifs, Compte de résultats)</li><li>Les Etablissements financiés</li><li>Comportement de paiement</li><li>Les partenaires financiés</li><li>Les actionnaires</li><li>Les annonces légales</li><li>Le Score</li></ol></td></tr></table>';
|
|
$description->Flex = '<table><tr><b>Information sur le rapport</b></tr><tr><td>Ce rapport est composés en plusieurs parties</td></tr><tr><td><ol><li>Identite et raison sociale</li><li>CreditRecommandation</li><li>Dirigeants</li><li>Les Bilans (actifs, Passifs, Compte de résultats)</li><li>Les Etablissements financiés</li><li>Comportement de paiement</li><li>Les partenaires financiés</li><li>Les actionnaires</li><li>Les annonces légales</li><li>Le Score</li></ol></td></tr></table>';
|
|
|
|
return ($description);
|
|
}
|
|
|
|
public function getObjet()
|
|
{
|
|
return ($this->Search);
|
|
}
|
|
|
|
protected function getNumRows()
|
|
{
|
|
$user = new Scores_Utilisateur();
|
|
return ($user->getNbRep());
|
|
}
|
|
|
|
public function selectTypeSearch($form)
|
|
{
|
|
$type = array('siret','raisonSociale', 'numero', 'voie', 'cpVille', 'telFax', 'naf');
|
|
$i = 0;
|
|
|
|
foreach ($type as $key => $element) {
|
|
if($key == 'siret')
|
|
return (false);
|
|
if(!empty($form[$element]))
|
|
$i++;
|
|
}
|
|
|
|
return (($i == 1)?true:false);
|
|
}
|
|
|
|
public function getQueryLink($parametres)
|
|
{
|
|
if(!empty($_SESSION['recherche']['giant']['query'])) {
|
|
foreach(unserialize($_SESSION['recherche']['giant']['query']) as $name => $element) {
|
|
switch($name) {
|
|
case 'RegisteredName':
|
|
$parametres['raisonSociale'] = $element;
|
|
}
|
|
}
|
|
}
|
|
$url = '/recherche/entreprise/siret/'.(!empty($parametres['siret']))?$parametres['siret']:''.
|
|
'/raisonSociale/'.(!empty($parametres['raisonSociale']))?$parametres['raisonSociale']:''.
|
|
'/numero/'.(!empty($parametres['numero']))?$parametres['numero']:''.
|
|
'/voie/'.(!empty($parametres['voie']))?$parametres['voie']:''.
|
|
'/cpVille/'.(!empty($parametres['cpVille']))?$parametres['cpVille']:''.
|
|
'/telFax/'.(!empty($parametres['telFax']))?$parametres['telFax']:''.
|
|
'/naf/'.(!empty($parametres['naf']))?$parametres['naf']:''.
|
|
'/pays/'.(!empty($parametres['pays']))?$parametres['pays']:'';
|
|
return ($url);
|
|
}
|
|
|
|
protected function replaceAcronyme($result)
|
|
{
|
|
$type = array('AV' => 'Avenue', 'RUE' => 'Rue', 'BD' => 'Boulevard', ' R ' => 'Rue', 'RTE' => 'Route');
|
|
|
|
foreach($result->Results->Company as $societe) {
|
|
foreach ($type as $element => $val) {
|
|
$societe->Address->Street = str_replace($element, $val, $societe->Address->Street);
|
|
}
|
|
}
|
|
return ($result);
|
|
}
|
|
|
|
protected function setCountryCode($CountryCode, $listeAutorized)
|
|
{
|
|
if (array_key_exists($CountryCode, $listeAutorized)) {
|
|
return ($this->listAutorized[$CountryCode]);
|
|
}
|
|
return (false);
|
|
}
|
|
|
|
public function getPays($code)
|
|
{
|
|
return ($this->listAutorized[$code]);
|
|
}
|
|
|
|
public function divCommande($listeCommandes, &$total)
|
|
{
|
|
$i = 1;
|
|
$date = new WDate();
|
|
$liste .= '<b>Liste de vos commandes :</b><br /><br /><ul>';
|
|
foreach($listeCommandes as $commande) {
|
|
$total = $total + $commande['price'];
|
|
$liste .= '<li>';
|
|
$liste .= $i++.'- '. GiantFunction::getFlag($commande['pays']).' '.$date->dateT('Y-m-d', 'd/m/Y', $commande['date']).' '.$commande['typeReport'].' '.$commande['price'].' euros';
|
|
$liste .= '</li>';
|
|
}
|
|
$liste .= '</ul>';
|
|
return ($liste);
|
|
}
|
|
|
|
public function getFlag($flag)
|
|
{
|
|
return ('<img src="/themes/default/images/drapeaux/'.$flag.'.png" />');
|
|
}
|
|
|
|
public function getTypeReport($reportType)
|
|
{
|
|
switch($reportType) {
|
|
case 'Full':
|
|
return ('FU');
|
|
case 'Compact':
|
|
return ('CO');
|
|
case 'CreditRecommendation':
|
|
return (CR);
|
|
case 'Flex':
|
|
return ('FL');
|
|
default:
|
|
return (false);
|
|
}
|
|
}
|
|
|
|
public function getMethode($methode, $parametres)
|
|
{
|
|
foreach($this->methodes as $fonction) {
|
|
if ($methode == $fonction)
|
|
return (call_user_func_array(array($this, $fonction), $parametres));
|
|
}
|
|
}
|
|
|
|
public function checkValide($valeur)
|
|
{
|
|
if (!empty($valeur))
|
|
return ($valeur);
|
|
return (null);
|
|
}
|
|
|
|
public function checkVat($vatNumber, $countryCode)
|
|
{
|
|
try {
|
|
$client = new Zend_Soap_Client('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl',
|
|
array('compression' => SOAP_COMPRESSION_ACCEPT));
|
|
} catch (SoapFault $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
$parametres = new stdClass();
|
|
$parametres->countryCode = $countryCode;
|
|
$parametres->vatNumber = $vatNumber;
|
|
|
|
return ($client->checkVat($parametres)->valid);
|
|
}
|
|
|
|
public function setQuery($query)
|
|
{
|
|
$this->query = $query;
|
|
}
|
|
|
|
public function getQuery()
|
|
{
|
|
return ($this->query);
|
|
}
|
|
|
|
public function getLabelDesc()
|
|
{
|
|
return ($this->label);
|
|
}
|
|
|
|
public function getLabelResults()
|
|
{
|
|
return ($this->labelResults);
|
|
}
|
|
|
|
public function getCountryCode()
|
|
{
|
|
return ($this->Provider->Countrycode);
|
|
}
|
|
|
|
public function getCurrentPage()
|
|
{
|
|
return ($_SESSION['recherche']['giant']['page']);
|
|
}
|
|
} |