Remove use of WDate static
This commit is contained in:
parent
20395552e5
commit
af451f02d6
@ -178,112 +178,113 @@ class MBilans {
|
||||
public $dernierExerciceDeposeLe=0;
|
||||
// public $rncs;
|
||||
public $igreffe;
|
||||
private $tabBS2BN=array('AH'=>'010',
|
||||
'AI'=>'012',
|
||||
'AI1'=>'013',
|
||||
'AJ'=>'014',
|
||||
'AK'=>'016',
|
||||
'AK1'=>'017',
|
||||
'AT'=>'028',
|
||||
'AU'=>'030',
|
||||
'AU1'=>'031',
|
||||
'BH'=>'040',
|
||||
'BI'=>'042',
|
||||
'BI1'=>'043',
|
||||
'BJ'=>'044',
|
||||
'BK'=>'048',
|
||||
'BK1'=>'049',
|
||||
'BL'=>'050',
|
||||
'BM'=>'052',
|
||||
'BM1'=>'053',
|
||||
'BT'=>'060',
|
||||
'BU'=>'062',
|
||||
'BU1'=>'063',
|
||||
'BV'=>'064',
|
||||
'BW'=>'066',
|
||||
'BW1'=>'067',
|
||||
'BX'=>'068',
|
||||
'BY'=>'070',
|
||||
'BY1'=>'071',
|
||||
'BZ'=>'072',
|
||||
'CA'=>'074',
|
||||
'CA1'=>'075',
|
||||
'CD'=>'080',
|
||||
'CE'=>'082',
|
||||
'CE1'=>'083',
|
||||
'CF'=>'084',
|
||||
'CG'=>'086',
|
||||
'CG1'=>'087',
|
||||
'CH'=>'092',
|
||||
'CI'=>'094',
|
||||
'CI1'=>'095',
|
||||
'CJ'=>'096',
|
||||
'CK'=>'098',
|
||||
'CK1'=>'099',
|
||||
'CO'=>'110',
|
||||
'1A'=>'112',
|
||||
'1A1'=>'113',
|
||||
'DA'=>'120',
|
||||
'DC'=>'124',
|
||||
'DD'=>'126',
|
||||
'DF'=>'130',
|
||||
'DG'=>'132',
|
||||
'DH'=>'134',
|
||||
'DI'=>'136',
|
||||
'DK'=>'140',
|
||||
'DL'=>'142',
|
||||
'DR'=>'154',
|
||||
'DP'=>'154',
|
||||
'DU'=>'156',
|
||||
'DV'=>'169',
|
||||
'DW'=>'164',
|
||||
'DX'=>'166',
|
||||
'EA'=>'172-169',
|
||||
'EB'=>'174',
|
||||
'EC'=>'176',
|
||||
'EE'=>'180',
|
||||
'EH'=>'156-195',
|
||||
'FA'=>'210-209',
|
||||
'FB'=>'209',
|
||||
'FC'=>'210',
|
||||
'FD'=>'214-215',
|
||||
'FE'=>'215',
|
||||
'FF'=>'214',
|
||||
'FH'=>'217',
|
||||
'FI'=>'218',
|
||||
'FK'=>'209+215+217',
|
||||
'FL'=>'210+214+218',
|
||||
'FM'=>'222',
|
||||
'FN'=>'224',
|
||||
'FO'=>'226',
|
||||
'FQ'=>'230',
|
||||
'FR'=>'232',
|
||||
'FS'=>'234',
|
||||
'FT'=>'236',
|
||||
'FU'=>'238',
|
||||
'FV'=>'240',
|
||||
'FW'=>'242',
|
||||
'FX'=>'244',
|
||||
'FY'=>'250',
|
||||
'FZ'=>'252',
|
||||
'GA'=>'254',
|
||||
'GE'=>'262',
|
||||
'GF'=>'264',
|
||||
'GG'=>'270',
|
||||
'GP'=>'280',
|
||||
'GU'=>'294',
|
||||
'GW'=>'270+280+294',
|
||||
'HD'=>'290',
|
||||
'HH'=>'300',
|
||||
'HI'=>'290-300',
|
||||
'HK'=>'306',
|
||||
'HL'=>'232+280+290',
|
||||
'HM'=>'264+294+300+306',
|
||||
'HN'=>'310',
|
||||
'YY'=>'374',
|
||||
'YZ'=>'378',
|
||||
'YP'=>'376',
|
||||
);
|
||||
private $tabBS2BN=array(
|
||||
'AH'=>'010',
|
||||
'AI'=>'012',
|
||||
'AI1'=>'013',
|
||||
'AJ'=>'014',
|
||||
'AK'=>'016',
|
||||
'AK1'=>'017',
|
||||
'AT'=>'028',
|
||||
'AU'=>'030',
|
||||
'AU1'=>'031',
|
||||
'BH'=>'040',
|
||||
'BI'=>'042',
|
||||
'BI1'=>'043',
|
||||
'BJ'=>'044',
|
||||
'BK'=>'048',
|
||||
'BK1'=>'049',
|
||||
'BL'=>'050',
|
||||
'BM'=>'052',
|
||||
'BM1'=>'053',
|
||||
'BT'=>'060',
|
||||
'BU'=>'062',
|
||||
'BU1'=>'063',
|
||||
'BV'=>'064',
|
||||
'BW'=>'066',
|
||||
'BW1'=>'067',
|
||||
'BX'=>'068',
|
||||
'BY'=>'070',
|
||||
'BY1'=>'071',
|
||||
'BZ'=>'072',
|
||||
'CA'=>'074',
|
||||
'CA1'=>'075',
|
||||
'CD'=>'080',
|
||||
'CE'=>'082',
|
||||
'CE1'=>'083',
|
||||
'CF'=>'084',
|
||||
'CG'=>'086',
|
||||
'CG1'=>'087',
|
||||
'CH'=>'092',
|
||||
'CI'=>'094',
|
||||
'CI1'=>'095',
|
||||
'CJ'=>'096',
|
||||
'CK'=>'098',
|
||||
'CK1'=>'099',
|
||||
'CO'=>'110',
|
||||
'1A'=>'112',
|
||||
'1A1'=>'113',
|
||||
'DA'=>'120',
|
||||
'DC'=>'124',
|
||||
'DD'=>'126',
|
||||
'DF'=>'130',
|
||||
'DG'=>'132',
|
||||
'DH'=>'134',
|
||||
'DI'=>'136',
|
||||
'DK'=>'140',
|
||||
'DL'=>'142',
|
||||
'DR'=>'154',
|
||||
'DP'=>'154',
|
||||
'DU'=>'156',
|
||||
'DV'=>'169',
|
||||
'DW'=>'164',
|
||||
'DX'=>'166',
|
||||
'EA'=>'172-169',
|
||||
'EB'=>'174',
|
||||
'EC'=>'176',
|
||||
'EE'=>'180',
|
||||
'EH'=>'156-195',
|
||||
'FA'=>'210-209',
|
||||
'FB'=>'209',
|
||||
'FC'=>'210',
|
||||
'FD'=>'214-215',
|
||||
'FE'=>'215',
|
||||
'FF'=>'214',
|
||||
'FH'=>'217',
|
||||
'FI'=>'218',
|
||||
'FK'=>'209+215+217',
|
||||
'FL'=>'210+214+218',
|
||||
'FM'=>'222',
|
||||
'FN'=>'224',
|
||||
'FO'=>'226',
|
||||
'FQ'=>'230',
|
||||
'FR'=>'232',
|
||||
'FS'=>'234',
|
||||
'FT'=>'236',
|
||||
'FU'=>'238',
|
||||
'FV'=>'240',
|
||||
'FW'=>'242',
|
||||
'FX'=>'244',
|
||||
'FY'=>'250',
|
||||
'FZ'=>'252',
|
||||
'GA'=>'254',
|
||||
'GE'=>'262',
|
||||
'GF'=>'264',
|
||||
'GG'=>'270',
|
||||
'GP'=>'280',
|
||||
'GU'=>'294',
|
||||
'GW'=>'270+280+294',
|
||||
'HD'=>'290',
|
||||
'HH'=>'300',
|
||||
'HI'=>'290-300',
|
||||
'HK'=>'306',
|
||||
'HL'=>'232+280+290',
|
||||
'HM'=>'264+294+300+306',
|
||||
'HN'=>'310',
|
||||
'YY'=>'374',
|
||||
'YZ'=>'378',
|
||||
'YP'=>'376',
|
||||
);
|
||||
|
||||
function __construct($siren) {
|
||||
$this->siren=$siren;
|
||||
@ -291,32 +292,45 @@ class MBilans {
|
||||
$this->igreffe=new MGreffes();
|
||||
}
|
||||
|
||||
function __destruct() {}
|
||||
/**
|
||||
* Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise
|
||||
* @param boolean $accesPartenaire
|
||||
* Accès autorisé aux partenaires distant si le bilan est absenr
|
||||
* @param number $nbMaxBilans
|
||||
* Nombre de bilans maximums retournés
|
||||
* @return array
|
||||
*/
|
||||
function listeBilans($accesPartenaire=false, $nbMaxBilans=0)
|
||||
{
|
||||
$classWDate = new WDate();
|
||||
$dateDerDepot = 0;
|
||||
$tabRet = $tabRet3 = array();
|
||||
|
||||
/** Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise
|
||||
**
|
||||
** @param $accesPartenaire bool Accès autorisé aux partenaires distant si le bilan est absenr
|
||||
** @param $nbMaxBilans int Nombre de bilans maximums retournés
|
||||
**/
|
||||
function listeBilans($accesPartenaire=false, $nbMaxBilans=0) {
|
||||
$iDb2=new WDB();
|
||||
if ($nbMaxBilans>0) $limit="LIMIT 0, $nbMaxBilans";
|
||||
else $limit='';
|
||||
|
||||
$iDb2=new WDB();
|
||||
$ret=$iDb2->select( 'bilans',
|
||||
'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire',
|
||||
"siren='$this->siren' ORDER BY dateExercice DESC $limit",false, MYSQL_ASSOC);
|
||||
if ( count($ret)>0 ) {
|
||||
$dateDerExercice=$ret[0]['dateExercice']*1;
|
||||
}
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren en base", print_r($ret, true));
|
||||
$tabRet=array();
|
||||
$iDb=new WDB('jo');
|
||||
|
||||
$iDb = new WDB('jo');
|
||||
$ret2=$iDb->select( 'bodacc_detail',
|
||||
'Bodacc_Date_Parution, dateEffet, typeEven',
|
||||
"siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC",false, MYSQL_ASSOC);
|
||||
$dateDerDepot=WDate::dateT('Y-m-d','Ymd',@$ret2[0]['dateEffet'])*1;
|
||||
$dateDerExercice=$ret[0]['dateExercice']*1;
|
||||
if ($dateDerDepot<>0) {
|
||||
$this->dernierExerciceDepose = WDate::dateT('Y-m-d','d/m/Y',@$ret2[0]['dateEffet']);
|
||||
$this->dernierExerciceDeposeLe = WDate::dateT('Y-m-d','d/m/Y',@$ret2[0]['Bodacc_Date_Parution']);
|
||||
if ( count($ret2)>0 ) {
|
||||
$dateDerDepot=$classWDate->dateT('Y-m-d','Ymd',$ret2[0]['dateEffet'])*1;
|
||||
if ($dateDerDepot<>0) {
|
||||
$this->dernierExerciceDepose = $classWDate->dateT('Y-m-d','d/m/Y',$ret2[0]['dateEffet']);
|
||||
$this->dernierExerciceDeposeLe = $classWDate->dateT('Y-m-d','d/m/Y',$ret2[0]['Bodacc_Date_Parution']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($accesPartenaire)
|
||||
$tabRet=$tabRet2=$this->igreffe->getListeBilans($this->siren);
|
||||
else
|
||||
@ -353,64 +367,70 @@ class MBilans {
|
||||
}
|
||||
|
||||
$tabTri=array();
|
||||
foreach ($tabRet as $millesime=>$bil) {
|
||||
$typeBilan=substr($millesime,0,1);
|
||||
$dateExercice=WDate::dateT('d/m/Y','Ymd',substr($millesime,1,10));
|
||||
$tabTri[''.$dateExercice.'-'.$typeBilan]=$millesime;
|
||||
|
||||
if ( count($tabRet)>0 ) {
|
||||
foreach ($tabRet as $millesime=>$bil) {
|
||||
$typeBilan = substr($millesime,0,1);
|
||||
$dateExercice = $classWDate->dateT('d/m/Y','Ymd',substr($millesime,1,10));
|
||||
$tabTri[''.$dateExercice.'-'.$typeBilan]=$millesime;
|
||||
}
|
||||
}
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après accès partenaire", print_r($tabRet2, true));
|
||||
|
||||
foreach ($ret as $i=>$bil) {
|
||||
$millesime=WDate::dateT('Ymd','d/m/Y',$bil['dateExercice']);
|
||||
$tabRet[''.$bil['typeBilan'].$millesime]=array(
|
||||
'dateProvPartenaire'=>$bil['dateProvPartenaire'],
|
||||
'dateInsert' =>strtr($bil['dateInsert'],
|
||||
array(' '=>'',':'=>'','-'=>'')),
|
||||
'typeBilan' =>$bil['typeBilan'], // NEW
|
||||
'dureeExercice' =>$bil['dureeExercice'],// NEW
|
||||
'dateExercice' =>$bil['dateExercice'],
|
||||
'millesime' =>substr($bil['dateExercice'],0,4),
|
||||
'dateExercicePre' =>$bil['dateExercicePre'],
|
||||
'dureeExercicePre' =>$bil['dureeExercicePre'],
|
||||
'monnaie' =>$bil['monnaieOrigine'],
|
||||
'source' =>$bil['partenaire'],
|
||||
);
|
||||
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']]=$bil['typeBilan'].$millesime;
|
||||
}
|
||||
krsort($tabTri);
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren avant le tri", print_r($tabTri, true));
|
||||
$exercicePre=$typePre=$tmpPre=false;
|
||||
$refPre='';
|
||||
$strInfos='';
|
||||
foreach ($tabTri as $tmp=>$typeMillesime) {
|
||||
$exercice=substr($tmp,0,8);
|
||||
$type=substr($tmp,9,1);
|
||||
$ref=$tabRet[''.$typeMillesime]['ref'];
|
||||
if ($exercice==$exercicePre && $type=='N' && $typePre=='S' && $refPre=='') {
|
||||
// Suppression du bilan RN de la liste si Réel Normal et Réel Simplifiés présents en base
|
||||
unset($tabTri[$tmp]);
|
||||
$strInfos.="Suppression de '$tmp'".EOL;
|
||||
if ( count($ret)>0 ) {
|
||||
foreach ($ret as $i=>$bil) {
|
||||
$millesime=$classWDate->dateT('Ymd','d/m/Y',$bil['dateExercice']);
|
||||
$tabRet[''.$bil['typeBilan'].$millesime] = array(
|
||||
'dateProvPartenaire' => $bil['dateProvPartenaire'],
|
||||
'dateInsert' => strtr($bil['dateInsert'], array(' '=>'',':'=>'','-'=>'')),
|
||||
'typeBilan' => $bil['typeBilan'], // NEW
|
||||
'dureeExercice' => $bil['dureeExercice'],// NEW
|
||||
'dateExercice' => $bil['dateExercice'],
|
||||
'millesime' => substr($bil['dateExercice'],0,4),
|
||||
'dateExercicePre' => $bil['dateExercicePre'],
|
||||
'dureeExercicePre' => $bil['dureeExercicePre'],
|
||||
'monnaie' => $bil['monnaieOrigine'],
|
||||
'source' => $bil['partenaire'],
|
||||
);
|
||||
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']]=$bil['typeBilan'].$millesime;
|
||||
}
|
||||
elseif ($exercice==$exercicePre && $type=='N' && $typePre=='S' && $refPre<>'') {
|
||||
// Suppression du bilan RS de la liste si Réel Normal Présent en base et réel simplifié non encore en base
|
||||
if ($tmpPre<>false) {
|
||||
unset($tabTri[$tmpPre]);
|
||||
$strInfos.="Suppression de '$tmpPre'".EOL;
|
||||
krsort($tabTri);
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren avant le tri", print_r($tabTri, true));
|
||||
|
||||
$exercicePre=$typePre=$tmpPre=false;
|
||||
$refPre='';
|
||||
$strInfos='';
|
||||
foreach ($tabTri as $tmp=>$typeMillesime) {
|
||||
$exercice=substr($tmp,0,8);
|
||||
$type=substr($tmp,9,1);
|
||||
$ref=$tabRet[''.$typeMillesime]['ref'];
|
||||
if ($exercice==$exercicePre && $type=='N' && $typePre=='S' && $refPre=='') {
|
||||
// Suppression du bilan RN de la liste si Réel Normal et Réel Simplifiés présents en base
|
||||
unset($tabTri[$tmp]);
|
||||
$strInfos.="Suppression de '$tmp'".EOL;
|
||||
}
|
||||
elseif ($exercice==$exercicePre && $type=='N' && $typePre=='S' && $refPre<>'') {
|
||||
// Suppression du bilan RS de la liste si Réel Normal Présent en base et réel simplifié non encore en base
|
||||
if ($tmpPre<>false) {
|
||||
unset($tabTri[$tmpPre]);
|
||||
$strInfos.="Suppression de '$tmpPre'".EOL;
|
||||
}
|
||||
}
|
||||
$exercicePre=$exercice;
|
||||
$typePre=$type;
|
||||
$refPre=@trim($ref);
|
||||
$tmpPre=$tmp;
|
||||
}
|
||||
$exercicePre=$exercice;
|
||||
$typePre=$type;
|
||||
$refPre=@trim($ref);
|
||||
$tmpPre=$tmp;
|
||||
krsort($tabTri);
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri", print_r($tabTri, true).EOL.$strInfos.EOL);
|
||||
$tabRet3=array();
|
||||
foreach ($tabTri as $tmp=>$typeMillesime)
|
||||
$tabRet3[''.$typeMillesime]=$tabRet[''.$typeMillesime];
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri / retour", print_r($tabRet3, true));
|
||||
}
|
||||
krsort($tabTri);
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri", print_r($tabTri, true).EOL.$strInfos.EOL);
|
||||
$tabRet3=array();
|
||||
foreach ($tabTri as $tmp=>$typeMillesime)
|
||||
$tabRet3[''.$typeMillesime]=$tabRet[''.$typeMillesime];
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri / retour", print_r($tabRet3, true));
|
||||
|
||||
return $tabRet3;
|
||||
}
|
||||
@ -424,7 +444,9 @@ class MBilans {
|
||||
**/
|
||||
function getBilan($millesime='', $typeBilan='N', $refPart=0, $accesPartenaire=false)
|
||||
{
|
||||
$millesimeDB=WDate::dateT('d/m/Y','Ymd',$millesime);
|
||||
$classWDate = new WDate();
|
||||
|
||||
$millesimeDB=$classWDate->dateT('d/m/Y','Ymd',$millesime);
|
||||
$iDb2=new WDB();
|
||||
if ($accesPartenaire)
|
||||
// On ne veut pas de bilans "Téléchargés" directement sur Internet
|
||||
@ -458,8 +480,8 @@ class MBilans {
|
||||
$tabInsert=array(
|
||||
'siren' =>$this->siren,
|
||||
'dateProvPartenaire'=>$tabBilan['DATE_FRAICHE_BILAN'],
|
||||
'dateExercice' =>WDate::dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']),
|
||||
'dateExercicePre' =>WDate::dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']),
|
||||
'dateExercice' =>$classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']),
|
||||
'dateExercicePre' =>$classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']),
|
||||
'dureeExercice' =>$tabBilan['DUREE_MOIS'],
|
||||
'dureeExercicePre' =>$tabBilan['DUREE_MOIS_PRE'],
|
||||
'monnaie' =>$tabBilan['MONNAIE'],
|
||||
|
Loading…
Reference in New Issue
Block a user