public function searchFC($params, $idF) { $query = Famille::find()->where(['codefamille' => $idF]); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['codefamille' => $this->codefamille, 'codecomptecomptable' => $this->codecomptecomptable]); $query->andFilterWhere(['like', 'designationfamille', $this->designationfamille]); return $dataProvider; }
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]); }