From 40093013721933672375644363657d31aca289d8 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 7 Feb 2012 10:10:26 +0000 Subject: [PATCH] =?UTF-8?q?Correction=20pour=20affichage=20des=20bilans=20?= =?UTF-8?q?Simplifi=C3=A9s=20en=20Normal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/FinanceController.php | 12 +- .../default/scripts/finance/liasse.phtml | 16 +- library/Finance/Liasse.php | 168 +++++++++++++++++- 3 files changed, 179 insertions(+), 17 deletions(-) diff --git a/application/controllers/FinanceController.php b/application/controllers/FinanceController.php index 6db79bfc5..60a591b3b 100644 --- a/application/controllers/FinanceController.php +++ b/application/controllers/FinanceController.php @@ -830,6 +830,16 @@ class FinanceController extends Zend_Controller_Action 'creancesDettes' => 'Créances, Dettes', 'affectation' => 'Affectation' ), + 'S' => array( + 'actif' => 'Actif', + 'passif' => 'Passif', + 'compteDeResultat' => 'Compte de résultat', + 'immobilisations' => 'Immobilisations', + 'amortissements' => 'Amortissements', + 'provisions' => 'Provisions', + 'creancesDettes' => 'Créances, Dettes', + 'affectation' => 'Affectation' + ), 'A' => array( 'actif' => 'Actif', 'passif' => 'Passif', @@ -875,7 +885,7 @@ class FinanceController extends Zend_Controller_Action $entreprise = new SessionEntreprise($this->siret, $this->id); - if($listBilan->nbReponses > 0) + if( $listBilan->nbReponses > 0 ) { $date = $request->getParam('date',$listBilan->result->item[0]->dateExercice.':'.$listBilan->result->item[0]->typeBilan); $dateFunction = new WDate(); diff --git a/application/views/default/scripts/finance/liasse.phtml b/application/views/default/scripts/finance/liasse.phtml index cda00d600..13e86d829 100644 --- a/application/views/default/scripts/finance/liasse.phtml +++ b/application/views/default/scripts/finance/liasse.phtml @@ -108,21 +108,7 @@ ancres as $id => $name):?>
- champType == 'S'):?> - -
- partial('finance/liassesPartials/simplifie/'.$id.'.partial.phtml', array( - 'liasse' => $this->liasse, - 'dateCloture' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloture), - 'dateCloturePre' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloturePre), - 'dureesMois' => $this->dureesMois, - 'dureesMoisPre'=> $this->dureesMoisPre, - 'unite'=> $this->unite, - ));?> -
- - champType == 'N' || $this->champType == 'C'):?> - + champType, array('S', 'N', 'C')) ):?>
partial('finance/liassesPartials/'.$id.'.partial.phtml', array( 'liasse' => $this->liasse, diff --git a/library/Finance/Liasse.php b/library/Finance/Liasse.php index b6acf0130..e54ccd073 100644 --- a/library/Finance/Liasse.php +++ b/library/Finance/Liasse.php @@ -31,11 +31,16 @@ class Liasse 'consolide' => $data->CONSOLIDE, 'source' => $data->SOURCE, ); - + //Affectaction des postes foreach ($data->POSTES->item as $element){ $this->postes[$element->id] = $this->dMontant($element->val); } + + //Transformation Simplifié en Normal + if ( $data->CONSOLIDE == 'S'){ + $this->postes = $this->bilanSimplifie2Normal($this->postes); + } } public function getInfo($key) @@ -52,4 +57,165 @@ class Liasse { return number_format($montant/$this->div, 0, '', ' '); } + + function bilanSimplifie2Normal($bilanRS) + { + $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', + ); + + $bilanRN=array(); + foreach ($tabBS2BN as $posteRN => $formule) { + if (preg_match('/\+|\-/', $formule)) { + $tabTmp=preg_split('/\+|\-/', $formule, -1, PREG_SPLIT_OFFSET_CAPTURE); + //$bilanRN[$posteRN]=0; + $scalc=''; + foreach ($tabTmp as $i=>$tab) { + if ($i==0) { + $bilanRN[$posteRN]=$bilanRS[$tab[0]]; + $scalc.=$bilanRS[$tab[0]]; + } + else { + $signe=$formule[$tab[1]-1]; + $scalc.=$signe; + if ($signe=='+') $bilanRN[$posteRN]+=$bilanRS[$tab[0]]; + elseif ($signe=='-') $bilanRN[$posteRN]-=$bilanRS[$tab[0]]; + $scalc.=$bilanRS[$tab[0]]; + } + } + $bilanRN[$posteRN]=$bilanRN[$posteRN]; + } + else $bilanRN[$posteRN]=$bilanRS[$formule]; + } + if ($bilanRS['240']<>0) { + $bilanRN['BL']=$bilanRS['050']; + $bilanRN['BM']=$bilanRS['052']; + } else { + $bilanRN['BN']=$bilanRS['050']; + $bilanRN['BO']=$bilanRS['052']; + } + + if ($bilanRS['070']<>0 || $bilanRS['074']<>0 || $bilanRS['052']<>0 || $bilanRS['062']<>0) + $bilanRN['GC']=$bilanRS['256']; + elseif ($bilanRS['070']==0 && $bilanRS['074']==0 && $bilanRS['052']==0 && $bilanRS['062']==0 && $bilanRS['254']<>0) + $bilanRN['GD']=$bilanRS['256']; + + if ($bilanRS['584']<>0) { + $bilanRN['HB']=$bilanRS['584']; + $bilanRN['HA']=$bilanRS['290']-$bilanRS['584']; + } else + $bilanRN['HA']=$bilanRS['290']; + + if ($bilanRS['582']<>0) { + $bilanRN['HF']=$bilanRS['582']; + $bilanRN['HE']=$bilanRS['582']-$bilanRS['300']; + } else + $bilanRN['HE']=$bilanRS['300']; + + return $bilanRN; + } } \ No newline at end of file