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