Ejemplo n.º 1
0
 public function actionStatinvest()
 {
     $stru = new Structure();
     //$debut= new Dat; $fin = new Dat;
     $MaterielInformatique = null;
     $TerrainsDeConstruction = null;
     $MaterielAutomobile = null;
     $MobilierDeBureau = null;
     $total = 0;
     $prix = 0;
     $MaterielInformatique = 0;
     //	if  (($stru->load(Yii::$app->request->post())) &&   ($debut->load(Yii::$app->request->post()))
     //	  &&    ($fin->load(Yii::$app->request->post()))     ) {
     if ($stru->load(Yii::$app->request->post())) {
         $Fami452 = Famille::find()->where(['codecomptecomptable' => "218452"])->all();
         foreach ($Fami452 as $f452) {
             $codfam = $f452->codefamille;
             $SousFam = Sousfamille::find()->where(['codefamille' => $codfam])->all();
             foreach ($SousFam as $souFamillle) {
                 $codSouFam = $souFamillle->codesousfamille;
                 $biens = Bien::find()->where(['codesousfamille' => $codSouFam])->all();
                 foreach ($biens as $bien) {
                     $prix = $bien->prixachat;
                     $MaterielInformatique = $MaterielInformatique + $prix;
                 }
             }
         }
         //traiter 2eme compte
         $Fami2110 = Famille::find()->where(['codecomptecomptable' => "2110"])->all();
         foreach ($Fami2110 as $f2110) {
             $codfam = $f2110->codefamille;
             $SousFam = Sousfamille::find()->where(['codefamille' => $codfam])->all();
             foreach ($SousFam as $souFamillle) {
                 $codSouFam = $souFamillle->codesousfamille;
                 $biens = Bien::find()->where(['codesousfamille' => $codSouFam])->all();
                 foreach ($biens as $bien) {
                     $prix = $bien->prixachat;
                     $TerrainsDeConstruction = $TerrainsDeConstruction + $prix;
                 }
             }
         }
         //traiter 3eme compte
         $Fami218440 = Famille::find()->where(['codecomptecomptable' => "218440"])->all();
         foreach ($Fami218440 as $f218440) {
             $codfam = $f218440->codefamille;
             $SousFam = Sousfamille::find()->where(['codefamille' => $codfam])->all();
             foreach ($SousFam as $souFamillle) {
                 $codSouFam = $souFamillle->codesousfamille;
                 $biens = Bien::find()->where(['codesousfamille' => $codSouFam])->all();
                 foreach ($biens as $bien) {
                     $prix = $bien->prixachat;
                     $MaterielAutomobile = $MaterielAutomobile + $prix;
                 }
             }
         }
         //traiter 4eme compte
         $Fami218450 = Famille::find()->where(['codecomptecomptable' => "218450"])->all();
         foreach ($Fami218450 as $f218450) {
             $codfam = $f218450->codefamille;
             $SousFam = Sousfamille::find()->where(['codefamille' => $codfam])->all();
             foreach ($SousFam as $souFamillle) {
                 $codSouFam = $souFamillle->codesousfamille;
                 $biens = Bien::find()->where(['codesousfamille' => $codSouFam])->all();
                 foreach ($biens as $bien) {
                     $prix = $bien->prixachat;
                     $MobilierDeBureau = $MobilierDeBureau + $prix;
                 }
             }
         }
         $total = $MaterielInformatique + $TerrainsDeConstruction + $MaterielAutomobile + $MobilierDeBureau;
     }
     return $this->render('statInvest', ['stru' => $stru, 'MaterielInformatique' => $MaterielInformatique, 'TerrainsDeConstruction' => $TerrainsDeConstruction, 'MaterielAutomobile' => $MaterielAutomobile, 'MobilierDeBureau' => $MobilierDeBureau, 'total' => $total]);
 }