webservice/includes/partenaires/classMBanques.php

135 lines
6.8 KiB
PHP
Raw Normal View History

2010-11-04 11:05:01 +00:00
<?
include_once(FWK_PATH.'common/dates.php');
class MBanques {
public $tabActivite=array( 0=>'<27>tablissements et services autoris<69>s <20> effectuer des op<6F>rations de banque',
2010-11-04 11:05:01 +00:00
1=>'banques',
2=>'banques mutualistes ou coop<6F>ratives',
4=>'caisses de cr<63>dit municipal',
5=>'soci<63>t<EFBFBD>s financi<63>res 5', // la distinction entre les codes 5 et 6 ne concerne que les
6=>'soci<63>t<EFBFBD>s financi<63>res 6', // applications internes <20> la Banque de France
7=>'institutions financi<63>res sp<73>cialis<69>es',
2010-11-04 11:05:01 +00:00
9=>'entreprises d\'investissement');
public $tabNatureGuichet=array( 1=>'Guichet permanent de plein exercice domiciliataire (ouvert au public)',
2=>'Identifiant de domiciliation (adresse active 5 jours par semaine)',
3=>'Guichet permanent non domiciliataire (ouvert au public)',
4=>'Libre Prestation de services (LPS)',
'A'=>'Guichet fictif',
'P'=>'Guichet fictif');
public $tabOrgane=array( 0=>'Association fran<61>aise des <20>tablissements de cr<63>dit et des entreprises d\'investissement',
11=>'Association fran<61>aise des soci<63>t<EFBFBD>s financi<63>res',
12=>'Groupement des institutions financi<63>res sp<73>cialis<69>es',
13=>'Conf<6E>rence permanente des caisses de cr<63>dit municipal',
14=>'Association fran<61>aise des entreprises d\'investissement',
15=>'Association fran<61>aise des entreprises d\'investissement-courtiers',
16=>'Association fran<61>aise des fonds et soci<63>t<EFBFBD>s d\'investissements et de gestion d\'actifs financiers',
17=>'Association fran<61>aise des interm<72>diaires transmetteurs d\'ordres ',
18=>'F<>d<EFBFBD>ration bancaire fran<61>aise',
19=>'Ass Franc March<63>s Financiers',
20=>'Caisse nationale de cr<63>dit agricole',
2010-11-04 11:05:01 +00:00
21=>'Chambre syndicale des banques populaires',
22=>'Conf<6E>d<EFBFBD>ration nationale du cr<63>dit mutuel',
23=>'Caisse centrale de cr<63>dit coop<6F>ratif',
25=>'Caisse nationale des caisses d\'<27>pargne et de pr<70>voyance',
2010-11-04 11:05:01 +00:00
27=>'Chambre syndicale des SACI',
28=>'Double affiliation CNCE-BFBP',
29=>'Cr<43>dit Immobilier France D<>veloppement',
2010-11-04 11:05:01 +00:00
30=>'BPCE',
98=>'non concern<72>',
99=>'en instance d\'adh<64>sion');
2010-11-04 11:05:01 +00:00
private $iDb;
function __construct() {
$this->iDb=new WDB('insee');
}
function __destruct() {}
function getInfoBanque($codeBanque) {
$ret=$this->iDb->select( 'BDF_Etabs',
'bdfFibCodeEtab, bdfFibCodeSituation, bdfFibDenom40, bdfFibDenom10, bdfFibCodeActivite, bdfFibCodeOrganeRepr, bdfFibDateAgrement, bdfFibDateRetraitAgr, bdfFibDateFinDiffus, bdfFibAdresse1, bdfFibAdresse2, bdfFibAdresse3, CP, Ville, bdfFibCodeEtabAbsorb, bdfFibOptionIdInvar, bdfFibDateOptIdInvar',
"bdfFibCodeEtab=$codeBanque",false, MYSQL_ASSOC);
//echo mysql_error();
$tabRet=$ret[0];
return $tabRet;
}
function getInfoGuichet($codeBanque, $codeGuichet) {
$tabBanque=$this->getInfoBanque($codeBanque);
$tabTel=$this->getTelGuichet($codeBanque,$codeGuichet);
$ret=$this->iDb->select( 'BDF_Guichets',
'bdfFibCodeEtab, bdfFibCodeGuichet, bdfFibCodeSituation AS guichetCodeSituation, bdfFibDenom40 AS guichetDenom40, bdfFibDenom20 AS guichetDenom20, bdfFibCodeEtabCible, bdfFibCodeGuichetRepr, bdfFibCodeGeoInsee, bdfFibCodeLocalite1, bdfFibCodeLocalite2, bdfFibComptoirBDF, bdfFibAdresse1 AS guichetAdresse1, bdfFibAdresse2 AS guichetAdresse2, bdfFibAdresse3 AS guichetAdresse3, CP AS guichetCP, Ville AS guichetVille, bdfFibAdresseSWIFT, bdfFibDateOuverture, bdfFibDateFermeture, bdfFibDateFinDiffus, bdfFibCodeRoutage, bdfFibLibelleRIB, bdfFibNatureGuichet, bdfFibCodeAchOperBDF, bdfFibNomComptoirBDF',
"bdfFibCodeEtab=$codeBanque AND bdfFibCodeGuichet=$codeGuichet",false, MYSQL_ASSOC);
//echo mysql_error();
if (isset($ret[0]))
$tabRet=@$ret[0];
else
$tabRet=array();
return array_merge($tabRet, $tabBanque, $tabTel);
}
function getTelGuichet($codeBanque, $codeGuichet) {
$ret=$this->iDb->select( 'Mandel_banques',
'Tel, Fax',
"CodeB=$codeBanque AND CodeG=$codeGuichet",false, MYSQL_ASSOC);
if (isset($ret[0]))
return $ret[0];
else
return array();
}
function getListeBanques($siren) {
$tabRet=array();
if ($siren*1>1000) {
$res=$this->iDb->select('banques', 'codeBanque, codeGuichet, libBanqueGuichet, precis, dateSource*1 AS dateSource', "siren=$siren", false, MYSQL_ASSOC);
$tmp=$this->iDb->select('fedRib', "codeBanque, codeGuichet, CONCAT(libBanque,' ',libGuichet) AS libBanqueGuichet, 0 AS precis, IF (dateInfo='0000-00-00', dateDispo*1, dateInfo*1) AS dateSource", "siren=$siren", false, MYSQL_ASSOC);
$res=array_merge($res, $tmp);
foreach ($res as $tabBanque) {
$dateSource=$tabBanque['dateSource'];
$codBanque=$tabBanque['codeBanque'];
$codGuichet=$tabBanque['codeGuichet'];
$libBanque=trim($tabBanque['libBanqueGuichet']);
$found=false;
$adrBanque1=$adrBanque2=$adrBanqueCP=$adrBanqueVille='';
if ($codBanque>0 && $codGuichet>0 && $dateSource>(date('Y')-4)*10000+101 && $dateSource<date('Ymd')) {
$tmp=$this->iDb->select('insee.BDF_Etabs b, insee.BDF_Guichets g', 'g.bdfFibCodeEtab AS banque, g.bdfFibCodeGuichet AS guichet, b.bdfFibDenom40 AS nomBanque, b.bdfFibDenom10 AS sigleBanque, g.bdfFibDenom20 AS nomGuichet, g.bdfFibAdresse1 AS adresse1, g.bdfFibAdresse2 AS adresse2, g.bdfFibAdresse3 AS adresse3, g.CP, g.Ville', "g.bdfFibCodeEtab=$codBanque AND g.bdfFibCodeGuichet=$codGuichet AND b.bdfFibCodeEtab=g.bdfFibCodeEtab", false, MYSQL_ASSOC);
if (isset($tmp[0])) {
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
$found=true;
};
}
if (!$found && $codBanque>0 && $dateSource>(date('Y')-4)*10000+101 && $dateSource<date('Ymd')) {
$tmp=$this->iDb->select('insee.BDF_Etabs', "bdfFibCodeEtab AS banque, '' AS guichet, bdfFibDenom40 AS nomBanque, '' AS nomGuichet, '' AS adresse1, '' AS adresse2, '' AS adresse3, '' AS CP, '' AS Ville", "bdfFibCodeEtab=$codBanque", false, MYSQL_ASSOC);
if (isset($tmp[0])) {
$libBanque=trim($tmp[0]['nomBanque'].' '.$tmp[0]['nomGuichet']);
$adrBanque1=$tmp[0]['adresse1'];
$adrBanque2=trim($tmp[0]['adresse2'].' '.$tmp[0]['adresse3']);
$adrBanqueCP=$tmp[0]['CP'];
$adrBanqueVille=$tmp[0]['Ville'];
} else continue;
} else continue;
$tabRet[]=array('codeBanque' => $codBanque,
'codeGuichet' => $codGuichet,
'libBanque' => $libBanque,
'adresse1' => $adrBanque1,
'adresse2' => $adrBanque2,
'cp' => $adrBanqueCP,
'ville' => $adrBanqueVille,
);
}
}
return $tabRet;
}
2010-11-04 11:05:01 +00:00
}
?>