Remove use of WDate static

This commit is contained in:
Michael RICOIS 2013-09-05 08:29:01 +00:00
parent 20395552e5
commit af451f02d6

View File

@ -178,7 +178,8 @@ class MBilans {
public $dernierExerciceDeposeLe=0;
// public $rncs;
public $igreffe;
private $tabBS2BN=array('AH'=>'010',
private $tabBS2BN=array(
'AH'=>'010',
'AI'=>'012',
'AI1'=>'013',
'AJ'=>'014',
@ -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');
$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 ( count($ret2)>0 ) {
$dateDerDepot=$classWDate->dateT('Y-m-d','Ymd',$ret2[0]['dateEffet'])*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']);
$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,19 +367,22 @@ class MBilans {
}
$tabTri=array();
if ( count($tabRet)>0 ) {
foreach ($tabRet as $millesime=>$bil) {
$typeBilan = substr($millesime,0,1);
$dateExercice=WDate::dateT('d/m/Y','Ymd',substr($millesime,1,10));
$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) {
$millesime=WDate::dateT('Ymd','d/m/Y',$bil['dateExercice']);
$millesime=$classWDate->dateT('Ymd','d/m/Y',$bil['dateExercice']);
$tabRet[''.$bil['typeBilan'].$millesime] = array(
'dateProvPartenaire' => $bil['dateProvPartenaire'],
'dateInsert' =>strtr($bil['dateInsert'],
array(' '=>'',':'=>'','-'=>'')),
'dateInsert' => strtr($bil['dateInsert'], array(' '=>'',':'=>'','-'=>'')),
'typeBilan' => $bil['typeBilan'], // NEW
'dureeExercice' => $bil['dureeExercice'],// NEW
'dateExercice' => $bil['dateExercice'],
@ -378,7 +395,9 @@ class MBilans {
$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='';
@ -411,6 +430,7 @@ class MBilans {
$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'],