public function actionReportItem($id) { if (\Yii::$app->request->isAjax) { $workType = WorkType::getAllWorkTypes()[$id]; $reportList = Report::find()->where(['work_type' => $id])->all(); $report = []; $i = 0; foreach ($reportList as $index => $report) { $report[] = ['num' => ++$i, 'date' => $report->date, 'sum' => $report->sum, 'comm' => $report->comm]; } return json_encode($report); } return false; }
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]); }