public function actionReports() { $workTypes = WorkType::getAllWorkTypes(); $reportList = \Yii::$app->db->createCommand('SELECT SUM(sum) as sum, work_type FROM report GROUP BY work_type ORDER by id')->queryAll(); return $this->render('reports', ['reportList' => $reportList, 'workTypes' => $workTypes]); }
public function actionViewAllInfoOfReport($id) { $workType = WorkType::getAllWorkTypes()[$id]; $reportList = Report::find()->where(['work_type' => $id])->all(); return $this->render('view-all-info-of-report', ['reportList' => $reportList, 'workType' => $workType]); }