public function actionBalance() { $cache = Yii::$app->cache; $date = isset($_REQUEST['date']) ? $_REQUEST['date'] : date('Y-m', time()); $Balance = new Balance(); $balance = $Balance->getMonth($date); $Profit = new Profit(); $profit = $Profit->getMonth($date); if (!$profit || !$balance) { Yii::$app->getSession()->setFlash('error', '请先导入该月基础报表数据'); } $Measure = new Measure(); $measure = $Measure->getMonth($date); for ($i = 1; $i < 6; $i++) { $measure[0][$i] = isset($measure[0][$i]) ? $measure[0][$i] : 0; } return $this->render('balance', ['balance' => $balance, 'profit' => $profit, 'date' => $date, 'measure' => $measure]); }