bakance_filter

This commit is contained in:
SoHardKI
2019-06-26 14:03:42 +03:00
parent b2312730c3
commit 91e3608c47
7 changed files with 76 additions and 12 deletions

View File

@ -24,6 +24,11 @@ class BalanceController extends Controller
$searchModel->dt_from = date('Y-m-01');
$searchModel->dt_to = date('Y-m-t');
}
if(\Yii::$app->request->get('previous_month'))
{
$searchModel->dt_from = date('Y-m-d', strtotime('first day of previous month'));
$searchModel->dt_to = date('Y-m-d', strtotime('last day of previous month'));
}
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index',[
@ -34,10 +39,6 @@ class BalanceController extends Controller
public function actionView($id)
{
$model = Balance::find()
->where(['id' => $id])
->with('fieldsValues')
->one();
$dataProviderF = new ActiveDataProvider([
'query' => FieldsValueNew::find()
->where(['item_id' => $id, 'item_type' => FieldsValueNew::TYPE_BALANCE])
@ -73,7 +74,7 @@ class BalanceController extends Controller
public function actionUpdate($id)
{
$model = $this->findModel($id);
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post())) {
$model->dt_add = strtotime($model->dt_add);
@ -81,7 +82,7 @@ class BalanceController extends Controller
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update',[
return $this->render('update', [
'model' => $model,
]);
}