Traitement des bilans simplifiés
This commit is contained in:
parent
0584854fea
commit
99253dad29
@ -270,22 +270,23 @@ function countBilans($bilansInfos, $typeBilan='')
|
||||
{
|
||||
$numBilanC = 0;
|
||||
$numBilanN = 0;
|
||||
$numBilanS = 0;
|
||||
if(count($bilansInfos)>0)
|
||||
{
|
||||
foreach($bilansInfos as $key => $item)
|
||||
{
|
||||
if($item['typeBilan']=='C') { $numBilanC++; }
|
||||
if($item['typeBilan']=='N') { $numBilanN++; }
|
||||
if($item['typeBilan']=='S') { $numBilanS++; }
|
||||
}
|
||||
}
|
||||
$numBilanN = $numBilanN+$numBilanS;
|
||||
if($typeBilan=='')
|
||||
{
|
||||
if($numBilanN>0){ $typeBilan = 'N'; }
|
||||
if($numBilanN==0 && $numBilanC>0){ $typeBilan = 'C'; }
|
||||
}
|
||||
|
||||
$numBilan = array( 'N'=>$numBilanN , 'C'=>$numBilanC);
|
||||
|
||||
return array($typeBilan, $numBilan);
|
||||
}
|
||||
|
||||
@ -302,8 +303,41 @@ function countBilans($bilansInfos, $typeBilan='')
|
||||
*/
|
||||
function filtreTypeBilans($bilansInfos, $ratiosEntrep, $ratiosEntrepEvol, $dataActif, $dataPassif, $dataSIG, $typeBilan)
|
||||
{
|
||||
global $firephp;
|
||||
if(count($bilansInfos)>0)
|
||||
{
|
||||
//Eliminer les doublons, on garde en priorités les bilans de type S
|
||||
$tabBilanS = array();
|
||||
$tabBilanN = array();
|
||||
foreach($bilansInfos as $key => $item)
|
||||
{
|
||||
if($item['typeBilan']=='S'){ $tabBilanS[$item['dateCloture']] = 1; }
|
||||
}
|
||||
//Suppression des doublons + les types S deviennent des types N
|
||||
$index = 0;
|
||||
foreach($bilansInfos as $key => $item)
|
||||
{
|
||||
$date = $item['dateCloture'];
|
||||
$type = $item['typeBilan'];
|
||||
if($type=='N' && array_key_exists($date,$tabBilanS))
|
||||
{
|
||||
array_splice($bilansInfos, $index, 1);
|
||||
array_splice($ratiosEntrep, $index, 1);
|
||||
array_splice($ratiosEntrepEvol, $index, 1);
|
||||
if(count($dataActif)>0) array_splice($dataActif, $index, 1);
|
||||
if(count($dataPassif)>0) array_splice($dataPassif, $index, 1);
|
||||
if(count($dataSIG)>0) array_splice($dataSIG, $index, 1);
|
||||
$index--;
|
||||
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$index=0;
|
||||
foreach($bilansInfos as $key => $item)
|
||||
{
|
||||
if($item['typeBilan']=='S'){ $bilansInfos[$index]['typeBilan']='N'; }
|
||||
$index++;
|
||||
}
|
||||
//En fonction du type de bilan sélectionné
|
||||
//on filtre les bilans avant de les envoyer sur l'affichage
|
||||
$index = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user