public function actionFunctionalities($id = 3)
 {
     $project = Project::findOne($id);
     $monthly = Functionality::find()->where("price > 1 AND project_id = " . $id . " AND monthly_costs = 1")->all();
     //All(['project_id' => $id, 'monthly_costs' => 1],['price','>',1]);
     $once = Functionality::find()->where("price > 1 AND project_id = " . $id . " AND monthly_costs = 0")->all();
     //(['project_id' => $id, 'monthly_costs' => 0],['price','>',1]);
     $solidCostsMonthly = new Functionality();
     $solidCostsMonthly->name = "Vaste Maandelijkse Kosten";
     $solidCostsMonthly->price = 39.95;
     array_push($monthly, $solidCostsMonthly);
     $solidCostOnce = new Functionality();
     $solidCostOnce->name = "Vaste maandelijkse kosten";
     $solidCostOnce->price = 250;
     array_push($once, $solidCostOnce);
     //            var_dump($monthly); exit;
     $oneOffDataProvider = new ArrayDataProvider(['allModels' => $once]);
     $monthlyDataProvider = new ArrayDataProvider(['allModels' => $monthly]);
     $this->layout = '@common/mail/layouts/html';
     $totalMonthly = 0;
     foreach ($monthlyDataProvider->allModels as $model) {
         $totalMonthly += $model->price;
     }
     $totalOnce = 0;
     foreach ($oneOffDataProvider->allModels as $model) {
         $totalOnce += $model->price;
     }
     return $this->render('@common/mail/overviewMail-html', ['oneOffDataProvider' => $oneOffDataProvider, 'monthlyDataProvider' => $monthlyDataProvider, 'totalMonthly' => $totalMonthly, 'totalOnce' => $totalOnce]);
 }
<div class="project-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('common', 'Update'), ['update', 'id' => $model->project_id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('common', 'Delete'), ['delete', 'id' => $model->project_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('common', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['description', 'datetime_added:datetime', 'deleted:boolean', ['label' => Yii::t('user', 'Creator'), 'value' => $model->creator->username], ['label' => Yii::t('customer', 'Client'), 'value' => $model->client->name], ['label' => Yii::t('user', 'Project manager'), 'value' => $model->projectmanager_id ? $model->projectmanager->username : $model->projectmanager_id], 'datetime_updated:datetime', ['label' => Yii::t('user', 'Updater'), 'value' => $model->updater->username]]]);
?>
    
    <h2><?php 
Yii::t('project', 'Functionalities for this project');
?>
</h2>
    
    <?php 
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => Functionality::find()->where(['project_id' => $model->project_id])->with('creator', 'updater')]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'project_id', 'name', 'description', 'datetime_added:datetime', ['label' => \Yii::t('project', 'Creator'), 'value' => 'creator.username'], 'datetime_updated:datetime', ['label' => \Yii::t('project', 'Updater'), 'value' => 'updater.username'], 'deleted:boolean', ['class' => 'yii\\grid\\ActionColumn', 'controller' => 'functionality']]]);
?>

</div>
 /**
  * Lists all Functionality models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Functionality::find()->with('creator', 'project', 'updater')]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
 private function setupOverviewMail($project)
 {
     $monthly = Functionality::find()->where("price > 1 AND project_id = " . $project->project_id . " AND monthly_costs = 1")->all();
     //All(['project_id' => $id, 'monthly_costs' => 1],['price','>',1]);
     $once = Functionality::find()->where("price > 1 AND project_id = " . $project->project_id . " AND monthly_costs = 0")->all();
     //(['project_id' => $id, 'monthly_costs' => 0],['price','>',1]);
     $solidCostsMonthly = new Functionality();
     $solidCostsMonthly->name = "Vaste maandelijkse kosten";
     $solidCostsMonthly->price = 39.95;
     array_push($monthly, $solidCostsMonthly);
     $solidCostOnce = new Functionality();
     $solidCostOnce->name = "Vaste eenmalige kosten";
     $solidCostOnce->price = 250;
     array_push($once, $solidCostOnce);
     $oneOffDataProvider = new ArrayDataProvider(['allModels' => $once]);
     $monthlyDataProvider = new ArrayDataProvider(['allModels' => $monthly]);
     $totalMonthly = 0;
     foreach ($monthlyDataProvider->allModels as $model) {
         $totalMonthly += $model->price;
     }
     $totalOnce = 0;
     foreach ($oneOffDataProvider->allModels as $model) {
         $totalOnce += $model->price;
     }
     $mail = Yii::$app->mailer->compose(['html' => 'overviewMail-html', 'text' => 'overviewMail-text'], ['oneOffDataProvider' => $oneOffDataProvider, 'monthlyDataProvider' => $monthlyDataProvider, 'totalMonthly' => $totalMonthly, 'totalOnce' => $totalOnce]);
     $mail->setTo($project->client->email_address);
     $mail->setFrom(['*****@*****.**' => 'Kees Online']);
     $mail->setSubject(Yii::t('mail', 'Your request has been noted'));
     return $mail;
 }
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'description')->textInput();
?>

    <?php 
echo $form->field($model, 'status_id')->textInput();
?>

    <?php 
echo $form->field($model, 'functionality_id')->dropdownList(ArrayHelper::map(Functionality::find()->all(), 'functionality_id', 'name'));
?>

    <?php 
echo $form->field($model, 'deleted')->checkBox(['label' => 'Deleted']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>