add changes procurement

This commit is contained in:
2015-09-25 18:43:23 +02:00
parent 5c9db98110
commit fe61803670
5 changed files with 42 additions and 28 deletions

View File

@@ -41,6 +41,14 @@ class ProcurementController extends Controller
$users = User::read(null);
$searchModel = new ProcurementSearch();
$today = time();
$tomorrow = time()+86400;
$searchModel->timestampStart = date("Y-m-d" , $today );
$searchModel->timestampEnd = date("Y-m-d" , $tomorrow );
$searchModel->date_start = Yii::$app->formatter->asDate($today);
$searchModel->date_end = Yii::$app->formatter->asDate($tomorrow);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
@@ -108,7 +116,7 @@ class ProcurementController extends Controller
}
return $this->redirect(['view', 'id' => $model->id_procurement]);
return $this->redirect(['index' ]);
} else {
return $this->render('create', [
'model' => $model,

View File

@@ -26,7 +26,7 @@ class ProcurementSearch extends Procurement
{
return [
[[ 'id_warehouse', 'id_user', 'id_product', ], 'integer'],
[[ 'date_start', ], 'date' , 'timestampAttribute' => 'timestampStart' ],
[[ 'date_start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'date_end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
];
}
@@ -63,6 +63,14 @@ class ProcurementSearch extends Procurement
return $dataProvider;
}
if ( empty($this->date_start) ){
$this->timestampStart = '';
}
if ( empty($this->date_end) ){
$this->timestampEnd = '';
}
$query->andFilterWhere([
'id_warehouse' => $this->id_warehouse,
'id_user' => $this->id_user,

View File

@@ -17,8 +17,6 @@ function mkOptions($options){
$all = ['' => Yii::t('common/product','All' ) ];
// $o[''] = Yii::t('common/product','All' ) ;
$o = $all + $options;
return $o;

View File

@@ -48,13 +48,13 @@ $this->params['breadcrumbs'][] = $this->title;
'template' => '{view} {update} {procurement}',
'buttons' =>[
'view' => function ($url, $model, $key) {
return Html::a( Yii::t('common/product', 'Details' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ;
return Html::a( Yii::t('common/product', 'Details' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
},
'update' => function ($url, $model, $key) {
return Html::a( Yii::t('common/product', 'Update' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ;
return Html::a( Yii::t('common/product', 'Update' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
},
'procurement' => function ($url, $model, $key) {
return Html::a( Yii::t('common/product', 'Procurement' ), $url,[ 'class' => 'btn btn-xs btn-success' ]) ;
return Html::a( Yii::t('common/product', 'Procurement' ), $url,[ 'class' => 'btn btn-xs btn-primary' ]) ;
},
],
'urlCreator' => function ( $action, $model, $key, $index ){