чистка мусора
This commit is contained in:
parent
1fc92ac773
commit
1875dacfbb
@ -21,8 +21,6 @@ class AjaxController extends \yii\web\Controller
|
|||||||
|
|
||||||
$searchModel = new ReportsSearch();
|
$searchModel = new ReportsSearch();
|
||||||
$searchModel->id = $id;
|
$searchModel->id = $id;
|
||||||
$searchModel->month = $month;
|
|
||||||
$searchModel->year = $year;
|
|
||||||
|
|
||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
@ -4,16 +4,13 @@ namespace backend\modules\reports\controllers;
|
|||||||
|
|
||||||
use backend\modules\card\models\UserCardSearch;
|
use backend\modules\card\models\UserCardSearch;
|
||||||
use backend\modules\reports\models\Month;
|
use backend\modules\reports\models\Month;
|
||||||
use common\classes\Debug;
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use common\models\Reports;
|
use common\models\Reports;
|
||||||
use backend\modules\reports\models\ReportsSearch;
|
use backend\modules\reports\models\ReportsSearch;
|
||||||
use yii\base\Model;
|
|
||||||
use yii\filters\AccessControl;
|
use yii\filters\AccessControl;
|
||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
use yii\web\NotFoundHttpException;
|
use yii\web\NotFoundHttpException;
|
||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
use yii\web\Response;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReportsController implements the CRUD actions for Reports model.
|
* ReportsController implements the CRUD actions for Reports model.
|
||||||
@ -63,7 +60,6 @@ class ReportsController extends Controller
|
|||||||
public function actionUser($id, $date = null)
|
public function actionUser($id, $date = null)
|
||||||
{
|
{
|
||||||
if (!(isset($date) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $date))) {
|
if (!(isset($date) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $date))) {
|
||||||
// Debug::dd('неверный формат даты');
|
|
||||||
$date = date('Y-m-01');
|
$date = date('Y-m-01');
|
||||||
}
|
}
|
||||||
$date = date('Y-m-01', strtotime($date));
|
$date = date('Y-m-01', strtotime($date));
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace backend\modules\reports\models;
|
namespace backend\modules\reports\models;
|
||||||
|
|
||||||
use common\classes\Debug;
|
|
||||||
use yii\base\Model;
|
use yii\base\Model;
|
||||||
use yii\data\ActiveDataProvider;
|
use yii\data\ActiveDataProvider;
|
||||||
use common\models\Reports;
|
use common\models\Reports;
|
||||||
@ -14,8 +13,6 @@ use common\models\Reports;
|
|||||||
class ReportsSearch extends Reports
|
class ReportsSearch extends Reports
|
||||||
{
|
{
|
||||||
public $fio;
|
public $fio;
|
||||||
public $month;
|
|
||||||
public $year;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -66,6 +63,12 @@ class ReportsSearch extends Reports
|
|||||||
if (isset($params['date']) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $params['date']) and !isset($params['id'])) {
|
if (isset($params['date']) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $params['date']) and !isset($params['id'])) {
|
||||||
$this->created_at = $params['date'];
|
$this->created_at = $params['date'];
|
||||||
}
|
}
|
||||||
|
if (isset($params['year'])) {
|
||||||
|
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);
|
||||||
|
}
|
||||||
|
if (isset($params['month'])) {
|
||||||
|
$query->andFilterWhere(['=', 'MONTH(reports.created_at)', $params['month']]);
|
||||||
|
}
|
||||||
|
|
||||||
// if (!$this->validate()) {
|
// if (!$this->validate()) {
|
||||||
// // uncomment the following line if you do not want to return any records when validation fails
|
// // uncomment the following line if you do not want to return any records when validation fails
|
||||||
@ -77,7 +80,6 @@ class ReportsSearch extends Reports
|
|||||||
// grid filtering conditions
|
// grid filtering conditions
|
||||||
|
|
||||||
|
|
||||||
// Debug::dd($params['date']);
|
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'user_card.id' => $this->id,
|
'user_card.id' => $this->id,
|
||||||
@ -88,9 +90,7 @@ class ReportsSearch extends Reports
|
|||||||
$query->andFilterWhere(['like', 'today', $this->today])
|
$query->andFilterWhere(['like', 'today', $this->today])
|
||||||
->andFilterWhere(['like', 'difficulties', $this->difficulties])
|
->andFilterWhere(['like', 'difficulties', $this->difficulties])
|
||||||
->andFilterWhere(['like', 'tomorrow', $this->tomorrow])
|
->andFilterWhere(['like', 'tomorrow', $this->tomorrow])
|
||||||
->andFilterWhere(['like', 'user_card.fio', $this->fio])
|
->andFilterWhere(['like', 'user_card.fio', $this->fio]);
|
||||||
->andFilterWhere(['=', 'YEAR(reports.created_at)', $this->year])
|
|
||||||
->andFilterWhere(['=', 'MONTH(reports.created_at)', $this->month]);
|
|
||||||
|
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
|
Loading…
Reference in New Issue
Block a user