add reception account state view and pdf export

This commit is contained in:
2016-01-08 14:06:55 +01:00
parent da29702a79
commit e8df61f123
30 changed files with 1190 additions and 288 deletions

View File

@@ -12,12 +12,25 @@ use common\models\AccountState;
*/
class AccountstateSearch extends AccountState
{
public $start;
public $end;
public $timestampStart;
public $timestampEnd;
public $accounts;
public $users;
/**
* @inheritdoc
*/
public function rules()
{
return [
return [
[[ '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' ],
[ [ 'id_account','id_user' ,'type' ] , 'integer'],
];
}
@@ -54,9 +67,19 @@ class AccountstateSearch extends AccountState
return $dataProvider;
}
$query->innerJoinWith('account');
$query->innerJoinWith('account.userAccountAssignments');
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
$query->andFilterWhere([
'account_state.id_user' => $this->id_user,
'account_state.type' => $this->type,
'account_state.id_account' => $this->id_account,
]);
$query->andFilterWhere([ '>=', 'account_state.created_at', $this->timestampStart ] );
$query->andFilterWhere([ '<', 'account_state.created_at', $this->timestampEnd ] );
$query->orderBy( 'created_at desc' );
$query->limit = 20;