add payment method colum and money total to backend/transfer/index

This commit is contained in:
2016-03-02 08:07:33 +01:00
parent 055fc541ea
commit 11abfc54f4
7 changed files with 63 additions and 16 deletions

View File

@@ -40,10 +40,12 @@ class TransferSearch extends Transfer
public function rules()
{
return [
[[ 'id_account','id_user', 'type','status'], 'integer'],
[[ 'id_account','id_user', 'type','status','payment_method'], 'integer'],
// [[ 'searchObjectName' ], 'string'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
// [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
// [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
['types', 'each', 'rule' => ['integer']],
];
}
@@ -86,6 +88,9 @@ class TransferSearch extends Transfer
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
'defaultOrder' =>[
'created_at' => SORT_DESC
],
'attributes' =>[
'paid_at' =>[
'asc' => ['transfer.paid_at' => SORT_ASC ],
@@ -144,7 +149,8 @@ class TransferSearch extends Transfer
'transfer.id_account' => $this->id_account,
'transfer.type' => $this->type,
'transfer.id_user' => $this->id_user,
'transfer.status' => $this->status
'transfer.status' => $this->status,
'transfer.payment_method' => $this->payment_method,
]);
$query->andFilterWhere(['in' ,'transfer.type', $this->types]);
@@ -155,7 +161,7 @@ class TransferSearch extends Transfer
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
if (!RoleDefinition::isAdmin()){
Helper::restrictIfNotAdminTheStartDate($query, $this->timestampStart,['transfer.created_at','transfer.paid_at'],'date');
Helper::restrictIfNotAdminTheStartDate($query, $this->timestampStart,['transfer.created_at','transfer.paid_at']);
}
return $dataProvider;