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]);
 }
 public function actionDelete()
 {
     $date = Yii::$app->request->get('date');
     if ($date) {
         $date = date('Y-m', strtotime($date));
         $cnum = YII::$app->user->identity->cnum;
         Profit::deleteAll('date = :date AND cnum = :cnum', [':date' => $date, ':cnum' => $cnum]);
         Yii::$app->cache->delete('profit_' . $date);
     }
     return $this->redirect('index?date=' . $date);
 }