Merge branch 'develop' of https://gitlab.com/feat_hbence/fitness-web into develop
This commit is contained in:
commit
1671b1afff
@ -36,6 +36,10 @@ class AdminMenuStructure{
|
|||||||
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
||||||
$tomorrow = \Yii::$app->formatter->asDate( ( 60 *60 *24 + time()));
|
$tomorrow = \Yii::$app->formatter->asDate( ( 60 *60 *24 + time()));
|
||||||
|
|
||||||
|
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
|
||||||
|
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
||||||
|
|
||||||
|
|
||||||
// if ( $this->can('backend.user.index')){
|
// if ( $this->can('backend.user.index')){
|
||||||
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
|
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
|
||||||
// }
|
// }
|
||||||
@ -53,7 +57,7 @@ class AdminMenuStructure{
|
|||||||
|
|
||||||
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
|
||||||
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||||
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$today,'CollectionSearch[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
||||||
|
|
||||||
if ( count($items) > 0 ){
|
if ( count($items) > 0 ){
|
||||||
$userMainMenu = ['label' => 'Beállítások', 'url' => null,
|
$userMainMenu = ['label' => 'Beállítások', 'url' => null,
|
||||||
|
|||||||
@ -8,6 +8,9 @@ use backend\models\CollectionSearch;
|
|||||||
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 common\models\Account;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use common\models\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CollectionController implements the CRUD actions for Collection model.
|
* CollectionController implements the CRUD actions for Collection model.
|
||||||
@ -15,6 +18,25 @@ use yii\filters\VerbFilter;
|
|||||||
class CollectionController extends \backend\controllers\BackendController
|
class CollectionController extends \backend\controllers\BackendController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'actions' => [ 'index','view' ],
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Collection models.
|
* Lists all Collection models.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@ -22,7 +44,13 @@ class CollectionController extends \backend\controllers\BackendController
|
|||||||
public function actionIndex()
|
public function actionIndex()
|
||||||
{
|
{
|
||||||
$searchModel = new CollectionSearch();
|
$searchModel = new CollectionSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->accountMap = Account::toAccaountMap($searchModel->accounts);
|
||||||
|
|
||||||
|
$searchModel->users = User::find()->all( );
|
||||||
|
|
||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
$searchModel->searchTotal();
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
@ -37,60 +65,19 @@ class CollectionController extends \backend\controllers\BackendController
|
|||||||
*/
|
*/
|
||||||
public function actionView($id)
|
public function actionView($id)
|
||||||
{
|
{
|
||||||
return $this->render('view', [
|
|
||||||
'model' => $this->findModel($id),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new Collection model.
|
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function actionCreate()
|
|
||||||
{
|
|
||||||
$model = new Collection();
|
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
|
||||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
|
||||||
} else {
|
|
||||||
return $this->render('create', [
|
|
||||||
'model' => $model,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates an existing Collection model.
|
|
||||||
* If update is successful, the browser will be redirected to the 'view' page.
|
|
||||||
* @param integer $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function actionUpdate($id)
|
|
||||||
{
|
|
||||||
$model = $this->findModel($id);
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
$accounts = Account::read();
|
||||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
$accountMap = Account::toAccaountMap($accounts);
|
||||||
} else {
|
|
||||||
return $this->render('update', [
|
$totals = Transfer::mkTotals($model->start, $model->end, $model->id_user, null, $model->id_account, $accounts, $accountMap);
|
||||||
|
return $this->render('view', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
|
'totals' => $totals,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes an existing Collection model.
|
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
|
||||||
* @param integer $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function actionDelete($id)
|
|
||||||
{
|
|
||||||
$this->findModel($id)->delete();
|
|
||||||
|
|
||||||
return $this->redirect(['index']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Collection model based on its primary key value.
|
* Finds the Collection model based on its primary key value.
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace backend\controllers;
|
namespace backend\controllers;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
@ -45,12 +44,11 @@ class TransferController extends \backend\controllers\BackendController
|
|||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
$accounts = Account::readAccounts();
|
$accounts = Account::readAccounts();
|
||||||
|
|
||||||
|
$searchModel->totalsTransfers();
|
||||||
|
|
||||||
$users = User::read();
|
$users = User::read();
|
||||||
|
|
||||||
$searchModel->totals(Yii::$app->request->queryParams);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
|
|||||||
@ -6,20 +6,33 @@ use Yii;
|
|||||||
use yii\base\Model;
|
use yii\base\Model;
|
||||||
use yii\data\ActiveDataProvider;
|
use yii\data\ActiveDataProvider;
|
||||||
use common\models\Collection;
|
use common\models\Collection;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CollectionSearch represents the model behind the search form about `common\models\Collection`.
|
* CollectionSearch represents the model behind the search form about `common\models\Collection`.
|
||||||
*/
|
*/
|
||||||
class CollectionSearch extends Collection
|
class CollectionSearch extends Collection
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $accounts;
|
||||||
|
public $accountMap;
|
||||||
|
|
||||||
|
public $users;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['id_collection', 'id_user', 'created_by', 'id_account', 'money', 'type'], 'integer'],
|
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
[['start', 'end', 'created_at', 'updated_at'], 'safe'],
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
[['id_account','id_user'],'integer']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,18 +69,17 @@ class CollectionSearch extends Collection
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id_collection' => $this->id_collection,
|
|
||||||
'id_user' => $this->id_user,
|
'id_user' => $this->id_user,
|
||||||
'created_by' => $this->created_by,
|
|
||||||
'id_account' => $this->id_account,
|
'id_account' => $this->id_account,
|
||||||
'money' => $this->money,
|
|
||||||
'start' => $this->start,
|
|
||||||
'end' => $this->end,
|
|
||||||
'type' => $this->type,
|
|
||||||
'created_at' => $this->created_at,
|
|
||||||
'updated_at' => $this->updated_at,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Helper::inInterval($query, 'collection.end', $this->timestampStart, $this->timestampEnd);
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function searchTotal(){
|
||||||
|
$this->totals = Collection::mkReceptionTotal($this->timestampStart, $this->timestampEnd , Yii::$app->user->id, [Collection::TYPE_RECEPTION], $this->id_account, $this->accounts, $this->accountMap);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ use yii\base\Object;
|
|||||||
use yii\db\Query;
|
use yii\db\Query;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
@ -29,6 +30,9 @@ class TransferSearch extends Transfer
|
|||||||
public $accountTotals;
|
public $accountTotals;
|
||||||
public $fullTotal;
|
public $fullTotal;
|
||||||
|
|
||||||
|
public $types;
|
||||||
|
public $totals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -39,6 +43,7 @@ class TransferSearch extends Transfer
|
|||||||
// [[ 'searchObjectName' ], 'string'],
|
// [[ 'searchObjectName' ], 'string'],
|
||||||
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||||
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||||
|
['types', 'each', 'rule' => ['integer']],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,17 +71,8 @@ class TransferSearch extends Transfer
|
|||||||
'query' => $query,
|
'query' => $query,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// $selectObjectName = "";
|
|
||||||
// $selectObjectName .= " case when transfer.type = " .self::TYPE_PRODUCT ." then product.name ";
|
|
||||||
// $selectObjectName .= " when transfer.type = " .self::TYPE_TICKET ." then ticket_type.name ";
|
|
||||||
// $selectObjectName .= " when transfer.type = " .self::TYPE_MONEY_MOVEMENT_OUT ." then 'Pénzmozgás' ";
|
|
||||||
// $selectObjectName .= " else '' ";
|
|
||||||
// $selectObjectName .= " end as object_name";
|
|
||||||
|
|
||||||
$query->addSelect( ['*' ]);
|
$query->addSelect( ['*' ]);
|
||||||
// $query->joinWith('ticket');
|
|
||||||
// $query->joinWith('ticketType');
|
|
||||||
// $query->joinWith('product');
|
|
||||||
|
|
||||||
$this->load($params);
|
$this->load($params);
|
||||||
|
|
||||||
@ -92,94 +88,33 @@ class TransferSearch extends Transfer
|
|||||||
'transfer.id_user' => $this->id_user,
|
'transfer.id_user' => $this->id_user,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at' , $this->timestampStart ] );
|
$created_condition = ['and',[ '>=', 'transfer.created_at', $this->timestampStart ] ,[ '<', 'transfer.created_at', $this->timestampEnd ] ];
|
||||||
$query->andFilterWhere([ '<' , 'transfer.created_at' , $this->timestampEnd ] );
|
$paid_condition = ['and',[ '>=', 'transfer.paid_at', $this->timestampStart ] ,[ '<', 'transfer.paid_at', $this->timestampEnd ] ];
|
||||||
|
|
||||||
// if ( isset($this->searchObjectName))
|
|
||||||
// $query->andWhere( new Expression(" case when transfer.type = " .self::TYPE_PRODUCT ." then product.name else ticket_type.name end like '%" . $this->searchObjectName ."%'"));
|
|
||||||
|
|
||||||
|
|
||||||
|
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function search2(){
|
public function totalsTransfers( ){
|
||||||
$query = new Query() ;
|
|
||||||
$query->select('*');
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function totals($params){
|
|
||||||
$query = new Query();
|
|
||||||
|
|
||||||
$result = [ ];
|
|
||||||
|
|
||||||
$accountTotals = [];
|
$accountTotals = [];
|
||||||
$fullTotal = [
|
$fullTotal = [
|
||||||
'label' => Yii::t('common/transfer', 'Total'),
|
'label' => Yii::t('common/transfer', 'Total'),
|
||||||
'money' => 0
|
'money' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
$query->addSelect( [ new Expression( 'transfer.id_account as account'), new Expression( ' COALESCE(sum( ( case when direction = '.Transfer::DIRECTION_OUT.' then -1 else 1 end )* transfer.money ),0) as money' )]);
|
|
||||||
$query->from('transfer');
|
|
||||||
// $query->leftJoin('ticket', 'transfer.type = ' .self::TYPE_TICKET .' and transfer.id_object = ticket.id_ticket ' );
|
|
||||||
// $query->leftJoin('ticket_type', 'ticket.id_ticket_type = ticket_type.id_ticket_type ' );
|
|
||||||
// $query->leftJoin('product', 'product.id_product = ' .self::TYPE_TICKET .' and transfer.id_object = ticket.id_ticket ' );
|
|
||||||
|
|
||||||
$this->load($params);
|
|
||||||
|
|
||||||
if (!$this->validate()) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query->andFilterWhere([
|
|
||||||
'transfer.id_account' => $this->id_account,
|
|
||||||
'transfer.type' => $this->type,
|
|
||||||
'transfer.id_user' => $this->id_user,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$query->andFilterWhere([ '>=', 'transfer.created_at', $this->timestampStart ] );
|
|
||||||
$query->andFilterWhere([ '<', 'transfer.created_at', $this->timestampEnd ] );
|
|
||||||
|
|
||||||
|
|
||||||
// if ( isset($this->searchObjectName) && !empty($this->searchObjectName)){
|
|
||||||
// $query->andWhere( new Expression(" case when transfer.type = " .self::TYPE_PRODUCT ." then product.name else ticket_type.name end like '%" . $this->searchObjectName ."%'"));
|
|
||||||
// }
|
|
||||||
|
|
||||||
$query->groupBy('transfer.id_account');
|
|
||||||
|
|
||||||
$command = $query->createCommand();
|
|
||||||
// $command->sql returns the actual SQL
|
|
||||||
$result = $command->queryAll();
|
|
||||||
|
|
||||||
|
|
||||||
$accounts = Account::find()->orderBy("name asc")->all();
|
$accounts = Account::find()->orderBy("name asc")->all();
|
||||||
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
||||||
|
$idUser = Yii::$app->user->id;
|
||||||
|
|
||||||
|
$this->totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($result as $item){
|
|
||||||
$account = "";
|
|
||||||
if ( array_key_exists($item['account'], $accountMap)){
|
|
||||||
$account = $accountMap[$item['account']];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$accountTotal = [
|
|
||||||
'label' => $account,
|
|
||||||
'money' => $item['money']
|
|
||||||
];
|
|
||||||
|
|
||||||
$accountTotals[] = $accountTotal;
|
|
||||||
|
|
||||||
$fullTotal['money'] += $item['money'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->accountTotals = $accountTotals;
|
|
||||||
$this->fullTotal = $fullTotal;
|
|
||||||
|
|
||||||
// return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,22 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model backend\models\CollectionSearch */
|
/* @var $model backend\models\CollectionSearch */
|
||||||
/* @var $form yii\widgets\ActiveForm */
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$accountOptions = ['' =>Yii::t('frontend/collection','All')]+ HtmlHelper::mkAccountOptions($model->accounts);
|
||||||
|
$userOptions = ['' =>Yii::t('frontend/collection','All')]+ ArrayHelper::map($model->users,'id','username');
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="collection-search">
|
<div class="collection-search">
|
||||||
|
|
||||||
<?php $form = ActiveForm::begin([
|
<?php $form = ActiveForm::begin([
|
||||||
@ -15,29 +25,35 @@ use yii\widgets\ActiveForm;
|
|||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_collection') ?>
|
|
||||||
|
|
||||||
<?= $form->field($model, 'id_user') ?>
|
<div class='row'>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?= $form->field($model, 'id_account')->dropDownList( $accountOptions ) ?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?= $form->field($model, 'id_user')->dropDownList( $userOptions ) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?= $form->field($model, 'created_by') ?>
|
</div>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_account') ?>
|
|
||||||
|
|
||||||
<?= $form->field($model, 'money') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'start') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'end') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'type') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'created_at') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'updated_at') ?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton(Yii::t('backend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
|
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
<?= Html::resetButton(Yii::t('backend/collection', 'Reset'), ['class' => 'btn btn-default']) ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\grid\GridView;
|
use yii\grid\GridView;
|
||||||
|
use common\components\AccountTotalWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $searchModel backend\models\CollectionSearch */
|
/* @var $searchModel backend\models\CollectionSearch */
|
||||||
@ -15,27 +16,47 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
<p>
|
|
||||||
<?= Html::a(Yii::t('backend/collection', 'Create Collection'), ['create'], ['class' => 'btn btn-success']) ?>
|
<div class="row">
|
||||||
</p>
|
<div class="col-md-4 ">
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $searchModel->totals
|
||||||
|
])?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?= GridView::widget([
|
<?= GridView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
'columns' => [
|
'columns' => [
|
||||||
['class' => 'yii\grid\SerialColumn'],
|
|
||||||
|
|
||||||
'id_collection',
|
'id_collection',
|
||||||
'id_user',
|
[
|
||||||
'created_by',
|
'attribute' => 'id_user',
|
||||||
'id_account',
|
'value' => 'userName',
|
||||||
'money',
|
],
|
||||||
// 'start',
|
[
|
||||||
// 'end',
|
'attribute' => 'id_account',
|
||||||
// 'type',
|
'value' => 'accountName',
|
||||||
// 'created_at',
|
],
|
||||||
// 'updated_at',
|
'money:integer',
|
||||||
|
[
|
||||||
|
'attribute' => 'start',
|
||||||
|
'value' => function($model){
|
||||||
|
return Yii::$app->formatter->asDatetime($model->start,'yyyy-MM-dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'end',
|
||||||
|
'value' => function($model){
|
||||||
|
return Yii::$app->formatter->asDatetime($model->end,'yyyy-MM-dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'created_at:datetime',
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn'],
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view}'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\DetailView;
|
use yii\widgets\DetailView;
|
||||||
|
use common\components\AccountStatisticWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Collection */
|
/* @var $model common\models\Collection */
|
||||||
@ -14,31 +15,30 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
<p>
|
|
||||||
<?= Html::a(Yii::t('backend/collection', 'Update'), ['update', 'id' => $model->id_collection], ['class' => 'btn btn-primary']) ?>
|
|
||||||
<?= Html::a(Yii::t('backend/collection', 'Delete'), ['delete', 'id' => $model->id_collection], [
|
|
||||||
'class' => 'btn btn-danger',
|
|
||||||
'data' => [
|
|
||||||
'confirm' => Yii::t('backend/collection', 'Are you sure you want to delete this item?'),
|
|
||||||
'method' => 'post',
|
|
||||||
],
|
|
||||||
]) ?>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?= DetailView::widget([
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'id_collection',
|
'id_collection',
|
||||||
'id_user',
|
[
|
||||||
'created_by',
|
'attribute' =>'id_user',
|
||||||
'id_account',
|
'value' => $model->userName
|
||||||
'money',
|
],
|
||||||
'start',
|
[
|
||||||
'end',
|
'attribute' =>'id_account',
|
||||||
'type',
|
'value' => $model->accountName
|
||||||
'created_at',
|
],
|
||||||
'updated_at',
|
'money:integer',
|
||||||
|
'start:datetime',
|
||||||
|
'end:datetime',
|
||||||
|
'created_at:datetime',
|
||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo AccountStatisticWidget::widget([
|
||||||
|
'totals' => $totals
|
||||||
|
]);
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -26,7 +26,7 @@ use kartik\widgets\DatePicker;
|
|||||||
<?= $form->field($model, 'id_account')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +HtmlHelper::mkAccountOptions($accounts) ) ?>
|
<?= $form->field($model, 'id_account')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +HtmlHelper::mkAccountOptions($accounts) ) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?= $form->field($model, 'type')->dropDownList( ['' => Yii::t('common/transfer', 'All')] + Transfer::types() ) ?>
|
<?php echo $form->field($model, 'types')->checkboxList( Transfer::types()) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?= $form->field($model, 'id_user')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +ArrayHelper::map($users,'id' , 'username') ) ?>
|
<?= $form->field($model, 'id_user')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +ArrayHelper::map($users,'id' , 'username') ) ?>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use yii\widgets\DetailView;
|
|||||||
use yii\base\Widget;
|
use yii\base\Widget;
|
||||||
use yii\base\Object;
|
use yii\base\Object;
|
||||||
use yii\data\ArrayDataProvider;
|
use yii\data\ArrayDataProvider;
|
||||||
|
use common\components\AccountStatisticWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $searchModel backend\models\TransferSearch */
|
/* @var $searchModel backend\models\TransferSearch */
|
||||||
@ -28,42 +29,15 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
<?php echo $this->render('_search', ['model' => $searchModel, 'accounts' => $accounts,'users' => $users,]); ?>
|
<?php echo $this->render('_search', ['model' => $searchModel, 'accounts' => $accounts,'users' => $users,]); ?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
echo AccountStatisticWidget::widget([
|
||||||
|
'totals' => $searchModel->totals
|
||||||
|
]);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<h2>Összesen</h2>
|
|
||||||
<?php
|
<h2>Tranzakciók</h2>
|
||||||
echo DetailView::widget([
|
|
||||||
'model' => $searchModel->fullTotal,
|
|
||||||
'attributes' => [
|
|
||||||
[
|
|
||||||
'value' => $searchModel->fullTotal['money'],
|
|
||||||
'label' => $searchModel->fullTotal['label'],
|
|
||||||
],
|
|
||||||
]
|
|
||||||
])
|
|
||||||
?>
|
|
||||||
<h2>Kasszák összesen</h2>
|
|
||||||
<?php
|
|
||||||
echo GridView::widget([
|
|
||||||
'dataProvider' => new ArrayDataProvider([
|
|
||||||
'allModels' => $searchModel->accountTotals,
|
|
||||||
'sort' => false,
|
|
||||||
'pagination' => false,
|
|
||||||
]) ,
|
|
||||||
'columns' => [
|
|
||||||
[
|
|
||||||
'label' => Yii::t('common/transfer','Account'),
|
|
||||||
'value' => 'label'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => Yii::t('common/transfer','Money total'),
|
|
||||||
'value' => 'money'
|
|
||||||
],
|
|
||||||
]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
<h2>Pénzmozgások</h2>
|
|
||||||
<?= GridView::widget([
|
<?= GridView::widget([
|
||||||
'tableOptions' => ['class' => 'table table-striped table-bordered table-transfer'],
|
'tableOptions' => ['class' => 'table table-striped table-bordered table-transfer'],
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
|
|||||||
23
common/components/AccountStatisticWidget.php
Normal file
23
common/components/AccountStatisticWidget.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components;
|
||||||
|
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
class AccountStatisticWidget extends Widget{
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
|
|
||||||
|
public $viewFile = '@common/views/common/_account_statistic';
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
echo $this->render($this->viewFile,[ 'model' => $this ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
26
common/components/AccountTotalWidget.php
Normal file
26
common/components/AccountTotalWidget.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components;
|
||||||
|
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
class AccountTotalWidget extends Widget{
|
||||||
|
|
||||||
|
public $totalHeading = 'Össesen';
|
||||||
|
public $panelHeading = 'Össesen';
|
||||||
|
public $panelType = 'panel-info';
|
||||||
|
|
||||||
|
public $statistic = ['total' => 0, 'accounts' => [] ];
|
||||||
|
|
||||||
|
|
||||||
|
public $viewFile = '@common/views/common/_account_total';
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
echo $this->render($this->viewFile,[ 'model' => $this ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -13,4 +13,18 @@ class Helper
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function notInInterval($query ,$field , $start,$end ){
|
||||||
|
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function notPaid($query ,$field , $start,$end ){
|
||||||
|
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ,[ "transfer.status" => Transfer::STATUS_NOT_PAID ] ] );
|
||||||
|
}
|
||||||
|
public static function inInterval($query ,$field , $start,$end ){
|
||||||
|
$query->andFilterWhere([ '>=', $field , $start ] );
|
||||||
|
$query->andFilterWhere([ '<' , $field , $end ] );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -17,12 +17,10 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
'It is recommended you use an upgraded browser to display the {type} control properly.' => 'Ajánlott újabb böngésző verziót használni!',
|
|
||||||
'Aktív' => 'Aktív',
|
'Aktív' => 'Aktív',
|
||||||
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné ezt az element?',
|
|
||||||
'Delete' => 'Törlés',
|
|
||||||
'Felhasználók' => 'Felhasználók',
|
'Felhasználók' => 'Felhasználók',
|
||||||
'Inaktív' => 'Inaktív',
|
'Inaktív' => 'Inaktív',
|
||||||
|
'It is recommended you use an upgraded browser to display the {type} control properly.' => 'Ajánlott újabb böngésző verziót használni!',
|
||||||
'Jelszó' => 'Jelszó',
|
'Jelszó' => 'Jelszó',
|
||||||
'Jelszó és jelszó újra nem egyezik!' => 'Jelszó és jelszó újra nem egyezik!',
|
'Jelszó és jelszó újra nem egyezik!' => 'Jelszó és jelszó újra nem egyezik!',
|
||||||
'Jelszó újra' => 'Jelszó újra',
|
'Jelszó újra' => 'Jelszó újra',
|
||||||
|
|||||||
25
common/messages/hu/backend/collection.php
Normal file
25
common/messages/hu/backend/collection.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Collections' => 'Zárás',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Create Collection' => 'Új zárás',
|
||||||
|
'Update' => 'Módosítás',
|
||||||
|
'Update {modelClass}: ' => '{modelClass} módosítása: ',
|
||||||
|
];
|
||||||
23
common/messages/hu/backend/user.php
Normal file
23
common/messages/hu/backend/user.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Created at' => 'Létrehozás ideje',
|
||||||
|
'E-Mail' => 'E-Mail',
|
||||||
|
'Username' => 'Felhasználónév',
|
||||||
|
];
|
||||||
@ -17,6 +17,7 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
|
'Create/Next' => 'Mentés/Következő',
|
||||||
'Active' => 'Aktív',
|
'Active' => 'Aktív',
|
||||||
'BARCODE' => 'VONALKÓD',
|
'BARCODE' => 'VONALKÓD',
|
||||||
'Card: ' => 'Bérletkártya: ',
|
'Card: ' => 'Bérletkártya: ',
|
||||||
|
|||||||
30
common/messages/hu/common/collection.php
Normal file
30
common/messages/hu/common/collection.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Created At' => 'Létrehozás ideje',
|
||||||
|
'Created By' => 'Létrehozta',
|
||||||
|
'End' => 'Időszak vége',
|
||||||
|
'Id Account' => 'Kassza',
|
||||||
|
'Id Collection' => 'Zárás azonosító',
|
||||||
|
'Id User' => 'Felhasználó',
|
||||||
|
'Money' => 'Összeg',
|
||||||
|
'Start' => 'Időszak kezdete',
|
||||||
|
'Type' => 'Típus',
|
||||||
|
'Updated At' => 'Módosítás ideje',
|
||||||
|
];
|
||||||
@ -17,11 +17,11 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
|
'Reset' => 'Reset',
|
||||||
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné a bérletet?',
|
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné a bérletet?',
|
||||||
'Comment' => 'Megjegyzés',
|
'Comment' => 'Megjegyzés',
|
||||||
'Create' => 'Mentés',
|
'Create' => 'Mentés',
|
||||||
'Create Ticket' => 'Új bérlet',
|
'Create Ticket' => 'Új bérlet',
|
||||||
'Create and add to cart' => 'Mentés és kosárba helyezés',
|
|
||||||
'Created At' => 'Hozzáadva',
|
'Created At' => 'Hozzáadva',
|
||||||
'Delete' => 'Törlés',
|
'Delete' => 'Törlés',
|
||||||
'End' => 'Érvényesség vége',
|
'End' => 'Érvényesség vége',
|
||||||
@ -32,7 +32,6 @@ return [
|
|||||||
'Id User' => 'Felhasználó',
|
'Id User' => 'Felhasználó',
|
||||||
'Max Usage Count' => 'Max alkalmak',
|
'Max Usage Count' => 'Max alkalmak',
|
||||||
'Price Brutto' => 'Bruttó ár',
|
'Price Brutto' => 'Bruttó ár',
|
||||||
'Reset' => '',
|
|
||||||
'Search' => 'Keresés',
|
'Search' => 'Keresés',
|
||||||
'Start' => 'Érvényesség kezdete',
|
'Start' => 'Érvényesség kezdete',
|
||||||
'Status' => 'Státusz',
|
'Status' => 'Státusz',
|
||||||
|
|||||||
@ -17,8 +17,13 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
'Money movement' => 'Pénzmozgás',
|
'Customer' => 'Vendég',
|
||||||
'Pénzmozgás' => 'Pénzmozgás',
|
'End' => 'Időszak vége',
|
||||||
|
'Fizetve' => 'Fizetve',
|
||||||
|
'Nincs fizetve' => 'Nincs fizetve',
|
||||||
|
'Paid At' => 'Fizetés ideje',
|
||||||
|
'Start' => 'Időszak kezdete',
|
||||||
|
'Types' => 'Típusok',
|
||||||
'Account' => 'Kassza',
|
'Account' => 'Kassza',
|
||||||
'All' => 'Mind',
|
'All' => 'Mind',
|
||||||
'Comment' => 'Megjegyzés',
|
'Comment' => 'Megjegyzés',
|
||||||
@ -32,8 +37,9 @@ return [
|
|||||||
'Item Price' => 'Termék ár',
|
'Item Price' => 'Termék ár',
|
||||||
'Money' => 'Összeg',
|
'Money' => 'Összeg',
|
||||||
'Money Currency' => 'Ár valuta',
|
'Money Currency' => 'Ár valuta',
|
||||||
'Money total' => 'Összesen',
|
'Money movement' => 'Pénzmozgás',
|
||||||
'Product' => 'Termék',
|
'Product' => 'Termék',
|
||||||
|
'Pénzmozgás' => 'Pénzmozgás',
|
||||||
'Rate' => 'Árfolyam',
|
'Rate' => 'Árfolyam',
|
||||||
'Status' => 'Státusz',
|
'Status' => 'Státusz',
|
||||||
'Ticket' => 'Bérlet',
|
'Ticket' => 'Bérlet',
|
||||||
|
|||||||
21
common/messages/hu/customer/backend.php
Normal file
21
common/messages/hu/customer/backend.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'E-mail or phone number required!' => 'E-mail vagy telefonszám megadása kötelező!',
|
||||||
|
];
|
||||||
@ -17,6 +17,8 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
|
'Account' => 'Kassza',
|
||||||
|
'Select account!' => 'Válasszon kasszát!',
|
||||||
'Accounts' => 'Kasszák',
|
'Accounts' => 'Kasszák',
|
||||||
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné ezt az element?',
|
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné ezt az element?',
|
||||||
'Create' => 'Mentés',
|
'Create' => 'Mentés',
|
||||||
|
|||||||
39
common/messages/hu/frontend/collection.php
Normal file
39
common/messages/hu/frontend/collection.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Account' => 'Kassza',
|
||||||
|
'All' => 'Mind',
|
||||||
|
'Collections' => 'Zárások',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Create Collection' => 'Új zárás',
|
||||||
|
'Create Collection - Select Account' => 'Új zárás - kassza választás',
|
||||||
|
'End date is invalid' => 'Idészak vége dátum érvénytelen',
|
||||||
|
'End of interval' => 'Időszak vége',
|
||||||
|
'Invalid transfer!' => 'Érvénytelen tranzakció!',
|
||||||
|
'Last collection' => 'Utolsó zárás',
|
||||||
|
'Next' => 'Következő',
|
||||||
|
'No collection found' => 'Nem találtam zárást',
|
||||||
|
'Reception collection' => 'Recepció zárás',
|
||||||
|
'Refresh' => 'Frissítés',
|
||||||
|
'Search' => 'Keresés',
|
||||||
|
'Select another account' => 'Másik kassza választása',
|
||||||
|
'Start of interval' => 'Időszak kezdete',
|
||||||
|
'Update' => 'Módosítás',
|
||||||
|
'Update {modelClass}: ' => '{modelClass} módosítása: ',
|
||||||
|
];
|
||||||
@ -17,11 +17,7 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
'Customer cart' => 'Vendég kosár',
|
'Sale' => 'Eladás',
|
||||||
'Fizetve' => 'Fizetve',
|
|
||||||
'To cart' => 'Kosárba',
|
|
||||||
'User Cart' => 'Recepció kosár',
|
|
||||||
'Write up' => 'Felír',
|
|
||||||
'Account' => 'Kassza',
|
'Account' => 'Kassza',
|
||||||
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné ezt a vendéget?',
|
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné ezt a vendéget?',
|
||||||
'Barcode' => 'Vonalkód',
|
'Barcode' => 'Vonalkód',
|
||||||
@ -32,6 +28,7 @@ return [
|
|||||||
'Create Product' => 'Új termék',
|
'Create Product' => 'Új termék',
|
||||||
'Currency' => 'Valuta',
|
'Currency' => 'Valuta',
|
||||||
'Currency not found' => 'Valuta nem található',
|
'Currency not found' => 'Valuta nem található',
|
||||||
|
'Customer cart' => 'Vendég kosár',
|
||||||
'Delete' => 'Törlés',
|
'Delete' => 'Törlés',
|
||||||
'Discount' => 'Kedvezmény',
|
'Discount' => 'Kedvezmény',
|
||||||
'Discount not found' => 'Kedvezmény nem található',
|
'Discount not found' => 'Kedvezmény nem található',
|
||||||
@ -50,7 +47,10 @@ return [
|
|||||||
'Sell product' => 'Termék eladás',
|
'Sell product' => 'Termék eladás',
|
||||||
'Stock' => 'Raktáron',
|
'Stock' => 'Raktáron',
|
||||||
'Stock {stock} lower then {count}!' => 'Raktáron {stock} kevesebb mint {count}!',
|
'Stock {stock} lower then {count}!' => 'Raktáron {stock} kevesebb mint {count}!',
|
||||||
|
'To cart' => 'Kosárba',
|
||||||
'Total Price' => 'Összesen',
|
'Total Price' => 'Összesen',
|
||||||
'Update' => 'Módosítás',
|
'Update' => 'Módosítás',
|
||||||
'Update {modelClass}: ' => 'Módosítás {modelClass}: ',
|
'Update {modelClass}: ' => 'Módosítás {modelClass}: ',
|
||||||
|
'User Cart' => 'Recepció kosár',
|
||||||
|
'Write up' => 'Felír',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -17,8 +17,11 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
|
'Customer cart paid!' => 'Vendég kosrá fizetve!',
|
||||||
|
'To cart' => 'Kosárba',
|
||||||
|
'User cart paid!' => 'Recepció kosár fizetve!',
|
||||||
|
'Write up' => 'Felír',
|
||||||
'Default account is set!' => 'Alapértelmezett kassza beállítva!',
|
'Default account is set!' => 'Alapértelmezett kassza beállítva!',
|
||||||
'Cart' => 'Kosár',
|
|
||||||
'Invalid discount' => 'Érvénytelen kedvezmény',
|
'Invalid discount' => 'Érvénytelen kedvezmény',
|
||||||
'Invalid ticket type' => 'Érvénytelen bérlet típus',
|
'Invalid ticket type' => 'Érvénytelen bérlet típus',
|
||||||
'Invalid transfer' => 'Érvénytelen transfer',
|
'Invalid transfer' => 'Érvénytelen transfer',
|
||||||
|
|||||||
@ -17,12 +17,9 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
'Create Money Movement' => 'Új pénzmozgás',
|
|
||||||
'Reset' => 'Reset',
|
|
||||||
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné a bérletet?',
|
|
||||||
'Create' => 'Mentés',
|
'Create' => 'Mentés',
|
||||||
|
'Create Money Movement' => 'Új pénzmozgás',
|
||||||
'Create Transfer' => 'Új pénzmozgás',
|
'Create Transfer' => 'Új pénzmozgás',
|
||||||
'Delete' => 'Törlés',
|
|
||||||
'Search' => 'Keresés',
|
'Search' => 'Keresés',
|
||||||
'Termékeladás' => 'Termékeladás',
|
'Termékeladás' => 'Termékeladás',
|
||||||
'Ticket' => 'Bérlet',
|
'Ticket' => 'Bérlet',
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace common\models;
|
|||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\behaviors\TimestampBehavior;
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "account".
|
* This is the model class for table "account".
|
||||||
@ -174,4 +175,8 @@ class Account extends \yii\db\ActiveRecord
|
|||||||
return $accounts;
|
return $accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function toAccaountMap($accounts){
|
||||||
|
return ArrayHelper::map( $accounts,'id_account','name' );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,8 @@ use common\components\AccountAwareBehavior;
|
|||||||
use common\components\UserAwareBehavior;
|
use common\components\UserAwareBehavior;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
use yii\behaviors\TimestampBehavior;
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "collection".
|
* This is the model class for table "collection".
|
||||||
@ -104,4 +106,98 @@ class Collection extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$types,$idAccount){
|
||||||
|
|
||||||
|
$query = new Query();
|
||||||
|
|
||||||
|
$query->addSelect( [
|
||||||
|
new Expression( ' collection.id_account as account'),
|
||||||
|
new Expression( ' COALESCE(sum( collection.money ) ,0) as money /** collections total money */' )
|
||||||
|
|
||||||
|
]);
|
||||||
|
$query->from('collection');
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id_account' => $idAccount,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['id_user' => $idUser]);
|
||||||
|
$query->andFilterWhere(['in' ,'type', $types]);
|
||||||
|
self::inInterval($query, 'collection.end' , $start, $end);
|
||||||
|
|
||||||
|
$query->groupBy('collection.id_account');
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function mkTotalsResultWithAllAvailableAccount($queryResult,$accounts,$accountMap,$idAccount){
|
||||||
|
|
||||||
|
$totals = [];
|
||||||
|
$totals['total'] = 0;
|
||||||
|
|
||||||
|
$totals['accounts'] = [];
|
||||||
|
|
||||||
|
foreach ($accounts as $account){
|
||||||
|
if ( isset($idAccount) && is_numeric($idAccount) && $idAccount != $account->id_account ){
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$accountTotal = [
|
||||||
|
'id_account' => $account->id_account,
|
||||||
|
'label' => $account->name,
|
||||||
|
'money' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
$item = self::findByAccountInQueryResult($queryResult, $account);
|
||||||
|
|
||||||
|
if ( isset($item)){
|
||||||
|
$accountTotal['money'] = $item['money'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$totals['accounts'][] = $accountTotal;
|
||||||
|
$totals['total'] += $accountTotal['money'];
|
||||||
|
}
|
||||||
|
return $totals;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findByAccountInQueryResult( $queryResult, $account ){
|
||||||
|
$result = null;
|
||||||
|
foreach ($queryResult as $item){
|
||||||
|
if( $item['account'] == $account->id_account ){
|
||||||
|
$result = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function inInterval($query ,$field , $start,$end ){
|
||||||
|
$query->andFilterWhere([ '>=', $field , $start ] );
|
||||||
|
$query->andFilterWhere([ '<' , $field , $end ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**create and execute a "total" query*/
|
||||||
|
public static function exTotalQuery($mode,$start,$end,$idUser,$types,$idAccount){
|
||||||
|
$query = self::mkTotalQuery($mode, $start, $end, $idUser, $types, $idAccount );
|
||||||
|
$command = $query->createCommand();
|
||||||
|
$result = $command->queryAll();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*find all transfers which were paid in the period
|
||||||
|
* */
|
||||||
|
public static function mkReceptionTotal( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap){
|
||||||
|
$result = [];
|
||||||
|
$queryResult = self::exTotalQuery('reception', $start, $end, $idUser, $types, $idAccount );
|
||||||
|
$result = self::mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ class CollectionCreate extends \common\models\Collection
|
|||||||
public $accountMap;
|
public $accountMap;
|
||||||
public $account;
|
public $account;
|
||||||
public $totals;
|
public $totals;
|
||||||
|
public $userCartTotal;
|
||||||
|
|
||||||
public $timestampEnd;
|
public $timestampEnd;
|
||||||
public $timestampStart;
|
public $timestampStart;
|
||||||
@ -38,7 +39,10 @@ class CollectionCreate extends \common\models\Collection
|
|||||||
public function rules(){
|
public function rules(){
|
||||||
return [
|
return [
|
||||||
['end','required'],
|
['end','required'],
|
||||||
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
/**enable seconds*/
|
||||||
|
[[ 'end' , ], 'date' ,'format' => 'yyyy-MM-dd HH:mm:ss' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm:ss' ,'timeZone' => 'UTC' ],
|
||||||
|
/*enable only minutes*/
|
||||||
|
// [[ 'end' , ], 'date' ,'format' => 'yyyy-MM-dd HH:mm' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
[[ 'end' ], 'validateEndDate' ]
|
[[ 'end' ], 'validateEndDate' ]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,6 +114,9 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
'created_at' => Yii::t('common/transfer', 'Created At'),
|
'created_at' => Yii::t('common/transfer', 'Created At'),
|
||||||
'updated_at' => Yii::t('common/transfer', 'Updated At'),
|
'updated_at' => Yii::t('common/transfer', 'Updated At'),
|
||||||
'paid_at' => Yii::t('common/transfer', 'Paid At'),
|
'paid_at' => Yii::t('common/transfer', 'Paid At'),
|
||||||
|
'types' => Yii::t('common/transfer', 'Types'),
|
||||||
|
'start' => Yii::t('common/transfer', 'Start'),
|
||||||
|
'end' => Yii::t('common/transfer', 'End'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,9 +147,6 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
return $this->hasOne( Currency::className(), ["id_currency" =>"id_currency" ] );
|
return $this->hasOne( Currency::className(), ["id_currency" =>"id_currency" ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function getDiscount(){
|
|
||||||
// return $this->hasOne( Discount::className(), ["id_discount" =>"id_discount" ] );
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function getUserSoldItem(){
|
public function getUserSoldItem(){
|
||||||
return $this->hasOne( UserSoldItem::className(), ["id_transfer" =>"id_transfer" ] );
|
return $this->hasOne( UserSoldItem::className(), ["id_transfer" =>"id_transfer" ] );
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "user_sold_item".
|
* This is the model class for table "user_sold_item".
|
||||||
@ -60,6 +62,29 @@ class UserSoldItem extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function readTotalForAccount($idUser,$idAccount){
|
||||||
|
|
||||||
|
$query = new Query();
|
||||||
|
|
||||||
|
$query->addSelect( [
|
||||||
|
new Expression( ' COALESCE(sum( transfer.money ) ,0) as money /** total unpaid reception cart */' )
|
||||||
|
|
||||||
|
]);
|
||||||
|
$query->innerJoin('transfer',['user_sold_item.id_transfer' =>'transfer.id_transfer']);
|
||||||
|
|
||||||
|
$query->from('user_sold_item');
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'transfer.id_account' => $idAccount,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['user_sold_item.id_user' => $idUser]);
|
||||||
|
|
||||||
|
|
||||||
|
return $query->scalar();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param common\models\User $user
|
* @param common\models\User $user
|
||||||
|
|||||||
64
common/views/common/_account_statistic.php
Normal file
64
common/views/common/_account_statistic.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
use common\components\AccountTotalWidget;
|
||||||
|
?>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $model->totals['created_at'],
|
||||||
|
'panelHeading' => 'Kiadva',
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $model->totals['created_at_paid'],
|
||||||
|
'panelHeading' => 'Kiadva/fizetve',
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $model->totals['created_at_not_paid'],
|
||||||
|
'panelHeading' => 'Kiadva/nem fizetve (Hitel)',
|
||||||
|
'panelType' => 'panel-danger'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $model->totals['paid_at_not_created_at'],
|
||||||
|
'panelHeading' => 'Adósság (Hitel)/Fizetve' ,
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $model->totals['paid_at'],
|
||||||
|
'panelHeading' => 'Fizetve' ,
|
||||||
|
'panelType' => 'panel-success'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
17
common/views/common/_account_total.php
Normal file
17
common/views/common/_account_total.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<div class="panel <?=$model->panelType ?>">
|
||||||
|
<div class="panel-heading"><?php echo $model->panelHeading?></div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<dl class="dl-horizontal dl-totals">
|
||||||
|
<?php
|
||||||
|
foreach ($model->statistic['accounts'] as $acc ){
|
||||||
|
?>
|
||||||
|
<dt><?php echo $acc['label'] ?></dt>
|
||||||
|
<dd class="text-right"><?php echo $acc['money'] ?></dd>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<dt><?php echo $model->totalHeading ?></dt>
|
||||||
|
<dd class="text-right"><?php echo $model->statistic['total'] ?></dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -36,9 +36,6 @@ class FrontendMenuStructure{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_r($this->start);
|
|
||||||
// print_r($this->tomorrow);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,9 +56,7 @@ class FrontendMenuStructure{
|
|||||||
|
|
||||||
protected function addRecepcio(){
|
protected function addRecepcio(){
|
||||||
if ( $this->isLogged() ){
|
if ( $this->isLogged() ){
|
||||||
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
$this->menuItems[] = ['label' => 'Recepció', 'url' => ['/customer/reception'] ];
|
||||||
// , 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow
|
|
||||||
// $this->menuItems[] = ['label' => 'Pénzmozgások', 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ];
|
|
||||||
$this->menuItems[] = ['label' => 'Kassza',
|
$this->menuItems[] = ['label' => 'Kassza',
|
||||||
'items' => [
|
'items' => [
|
||||||
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
||||||
@ -72,7 +67,6 @@ class FrontendMenuStructure{
|
|||||||
['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ],
|
['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ],
|
||||||
['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]
|
['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]
|
||||||
]
|
]
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use common\models\CollectionCreate;
|
|||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
use frontend\models\CreateAccountSelectForm;
|
use frontend\models\CreateAccountSelectForm;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\UserSoldItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CollectionController implements the CRUD actions for Collection model.
|
* CollectionController implements the CRUD actions for Collection model.
|
||||||
@ -41,8 +42,11 @@ class CollectionController extends Controller
|
|||||||
$searchModel = new CollectionSearch();
|
$searchModel = new CollectionSearch();
|
||||||
|
|
||||||
$searchModel->accounts = Account::read();
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->accountMap = Account::toAccaountMap($searchModel->accounts);
|
||||||
|
|
||||||
|
|
||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
$searchModel->searchTotal();
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
@ -57,8 +61,16 @@ class CollectionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function actionView($id)
|
public function actionView($id)
|
||||||
{
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
$accounts = Account::read();
|
||||||
|
$accountMap = Account::toAccaountMap($accounts);
|
||||||
|
|
||||||
|
$totals = Transfer::mkTotals($model->start, $model->end, $model->id_user, null, $model->id_account, $accounts, $accountMap);
|
||||||
|
|
||||||
return $this->render('view', [
|
return $this->render('view', [
|
||||||
'model' => $this->findModel($id),
|
'model' => $model,
|
||||||
|
'totals' => $totals,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,12 +95,14 @@ class CollectionController extends Controller
|
|||||||
$model->timestampStart = isset($model->lastCollection) ? $model->lastCollection->end :null;
|
$model->timestampStart = isset($model->lastCollection) ? $model->lastCollection->end :null;
|
||||||
$model->timestampEnd = date("Y-m-d H:i:s");
|
$model->timestampEnd = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
$model->start = isset($model->timestampStart) ? Yii::$app->formatter->asDatetime( $model->timestampStart ) : '';
|
$model->start = isset($model->timestampStart) ? Yii::$app->formatter->asDatetime( $model->timestampStart ,'yyyy-MM-dd HH:mm:ss') : '';
|
||||||
$model->end = isset($model->timestampEnd) ? Yii::$app->formatter->asDatetime( $model->timestampEnd ): '';
|
$model->end = isset($model->timestampEnd) ? Yii::$app->formatter->asDatetime( $model->timestampEnd ,'yyyy-MM-dd HH:mm:ss'): '';
|
||||||
|
|
||||||
$model->type = Collection::TYPE_RECEPTION;
|
$model->type = Collection::TYPE_RECEPTION;
|
||||||
|
|
||||||
|
|
||||||
|
$model->userCartTotal = UserSoldItem::readTotalForAccount($model->id_user, $model->id_account);
|
||||||
|
|
||||||
if ( $model->load(Yii::$app->request->post()) && $model->save() ) {
|
if ( $model->load(Yii::$app->request->post()) && $model->save() ) {
|
||||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
return $this->redirect(['view', 'id' => $model->id_collection]);
|
||||||
} else {
|
} else {
|
||||||
@ -119,37 +133,7 @@ class CollectionController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates an existing Collection model.
|
|
||||||
* If update is successful, the browser will be redirected to the 'view' page.
|
|
||||||
* @param integer $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function actionUpdate($id)
|
|
||||||
{
|
|
||||||
$model = $this->findModel($id);
|
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
|
||||||
return $this->redirect(['view', 'id' => $model->id_collection]);
|
|
||||||
} else {
|
|
||||||
return $this->render('update', [
|
|
||||||
'model' => $model,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes an existing Collection model.
|
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
|
||||||
* @param integer $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function actionDelete($id)
|
|
||||||
{
|
|
||||||
$this->findModel($id)->delete();
|
|
||||||
|
|
||||||
return $this->redirect(['index']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Collection model based on its primary key value.
|
* Finds the Collection model based on its primary key value.
|
||||||
|
|||||||
@ -13,10 +13,14 @@ use common\models\Collection;
|
|||||||
class CollectionSearch extends Collection
|
class CollectionSearch extends Collection
|
||||||
{
|
{
|
||||||
public $accounts;
|
public $accounts;
|
||||||
|
public $accountMap;
|
||||||
|
public $users;
|
||||||
|
|
||||||
public $timestampStart;
|
public $timestampStart;
|
||||||
public $timestampEnd;
|
public $timestampEnd;
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -25,7 +29,8 @@ class CollectionSearch extends Collection
|
|||||||
return [
|
return [
|
||||||
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
[[ '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' ],
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
];
|
[['id_account'],'integer']
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,12 +59,15 @@ class CollectionSearch extends Collection
|
|||||||
|
|
||||||
$this->load($params);
|
$this->load($params);
|
||||||
|
|
||||||
|
$this->id_user = Yii::$app->user->id;
|
||||||
|
|
||||||
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
|
||||||
// $query->where('0=1');
|
// $query->where('0=1');
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id_account' => $this->id_account,
|
'id_account' => $this->id_account,
|
||||||
]);
|
]);
|
||||||
@ -69,4 +77,8 @@ class CollectionSearch extends Collection
|
|||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function searchTotal(){
|
||||||
|
$this->totals = Collection::mkReceptionTotal($this->timestampStart, $this->timestampEnd , Yii::$app->user->id, [Collection::TYPE_RECEPTION], $this->id_account, $this->accounts, $this->accountMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,13 +24,15 @@ class TransferSearch extends Transfer
|
|||||||
public $timestampStart;
|
public $timestampStart;
|
||||||
public $timestampEnd;
|
public $timestampEnd;
|
||||||
|
|
||||||
public $totalsCreatedAt = ['total' => 0, 'accounts' =>[] ];
|
// public $totalsCreatedAt = ['total' => 0, 'accounts' =>[] ];
|
||||||
public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
// public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
// public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
public $totalsPaidAt= ['total' => 0, 'accounts' =>[]];
|
// public $totalsPaidAt= ['total' => 0, 'accounts' =>[]];
|
||||||
public $totalsPaidAtNotCreatedAt= ['total' => 0, 'accounts' =>[]];
|
// public $totalsPaidAtNotCreatedAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
public $accounts;
|
public $accounts;
|
||||||
|
|
||||||
public $types;
|
public $types;
|
||||||
@ -41,19 +43,12 @@ class TransferSearch extends Transfer
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
// [[ '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' ],
|
[[ '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' ],
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
|
||||||
[ [ 'id_account' ] , 'integer'],
|
[ [ 'id_account' ] , 'integer'],
|
||||||
['types', 'each', 'rule' => ['integer']],
|
['types', 'each', 'rule' => ['integer']],
|
||||||
// [ [ 'types' ], function ($attribute, $params) {
|
|
||||||
// if (!is_array($this->$attribute)) {
|
|
||||||
// $this->addError($attribute, 'Invalid array');
|
|
||||||
// }
|
|
||||||
// }],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +68,16 @@ class TransferSearch extends Transfer
|
|||||||
'query' => $query,
|
'query' => $query,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->load($params);
|
$this->load($params);
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
// $query->where('0=1');
|
$query->where('0=1');
|
||||||
return $dataProvider;
|
|
||||||
}
|
}
|
||||||
|
$query->andWhere(['id_user' => Yii::$app->user->id ] );
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id_account' => $this->id_account,
|
'id_account' => $this->id_account,
|
||||||
@ -103,23 +101,13 @@ class TransferSearch extends Transfer
|
|||||||
'money' => 0
|
'money' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( $this->hasErrors() ){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$accounts = Account::find()->orderBy("name asc")->all();
|
$accounts = Account::find()->orderBy("name asc")->all();
|
||||||
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
$accountMap = ArrayHelper::map( $accounts ,'id_account','name' );
|
||||||
$idUser = Yii::$app->user->id;
|
$idUser = Yii::$app->user->id;
|
||||||
|
|
||||||
$totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
$this->totals = Transfer::mkTotals($this->timestampStart, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
||||||
|
|
||||||
$this->totalsCreatedAt = $totals['created_at'];
|
|
||||||
$this->totalsPaidAt = $totals['paid_at'];
|
|
||||||
$this->totalsCreatedAtPaid = $totals['created_at_paid'];
|
|
||||||
$this->totalsCreatedAtNotPaid = $totals['created_at_not_paid'];
|
|
||||||
$this->totalsPaidAtNotCreatedAt = $totals['paid_at_not_created_at'];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
use kartik\widgets\DateTimePicker;
|
|
||||||
use frontend\components\HtmlHelper;
|
use frontend\components\HtmlHelper;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\models\CollectionSearch */
|
/* @var $model frontend\models\CollectionSearch */
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use frontend\components\TransferTotalWidget;
|
use frontend\components\TransferTotalWidget;
|
||||||
|
use common\components\AccountStatisticWidget;
|
||||||
|
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
@ -20,10 +21,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<dd><?php echo isset($model->lastCollection) ? Yii::$app->formatter->asDatetime($model->lastCollection->end) : Yii::t('frontend/collection', "No collection found") ?></dd>
|
<dd><?php echo isset($model->lastCollection) ? Yii::$app->formatter->asDatetime($model->lastCollection->end) : Yii::t('frontend/collection', "No collection found") ?></dd>
|
||||||
|
|
||||||
<dt><?= Yii::t('frontend/collection', "Start of interval")?></dt>
|
<dt><?= Yii::t('frontend/collection', "Start of interval")?></dt>
|
||||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampStart) ?></dd>
|
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampStart,'yyyy-MM-dd HH:mm:ss') ?> (inkluzív)</dd>
|
||||||
|
|
||||||
<dt><?= Yii::t('frontend/collection', "End of interval")?></dt>
|
<dt><?= Yii::t('frontend/collection', "End of interval")?></dt>
|
||||||
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampEnd) ?></dd>
|
<dd><?php echo Yii::$app->formatter->asDatetime($model->timestampEnd,'yyyy-MM-dd HH:mm:ss') ?> (exkluzív)</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -31,78 +32,23 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<?= Html::a(Yii::t('frontend/collection', 'Select another account'), ['select-account' ], ['class' => 'btn btn-primary']) ?>
|
<?= Html::a(Yii::t('frontend/collection', 'Select another account'), ['select-account' ], ['class' => 'btn btn-primary']) ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class='row'>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
<?php
|
<?php
|
||||||
echo TransferTotalWidget::widget([
|
if ( $model->userCartTotal > 0){
|
||||||
'options' => [
|
?>
|
||||||
'statistic' => $model->totals['created_at'],
|
<p class="bg-danger">
|
||||||
'panelHeading' => 'Kiadva',
|
Figyelem! A recepció kassza tartalmaz még fizetetlen elemeket!
|
||||||
]
|
</p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo AccountStatisticWidget::widget([
|
||||||
|
'totals' => $model->totals
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
<?php
|
|
||||||
echo TransferTotalWidget::widget([
|
|
||||||
'options' => [
|
|
||||||
'statistic' => $model->totals['created_at_paid'],
|
|
||||||
'panelHeading' => 'Kiadva/fizetve',
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
<?php
|
|
||||||
echo TransferTotalWidget::widget([
|
|
||||||
'options' => [
|
|
||||||
'statistic' => $model->totals['created_at_not_paid'],
|
|
||||||
'panelHeading' => 'Kiadva/nem fizetve (Hitel)',
|
|
||||||
'panel-type' => 'panel-danger'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='row'>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
<?php
|
|
||||||
echo TransferTotalWidget::widget([
|
|
||||||
'options' => [
|
|
||||||
'statistic' => $model->totals['paid_at_not_created_at'],
|
|
||||||
'panelHeading' => 'Adósság (Hitel)/Fizetve' ,
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='row'>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
<?php
|
|
||||||
echo TransferTotalWidget::widget([
|
|
||||||
'options' => [
|
|
||||||
'statistic' => $model->totals['paid_at'],
|
|
||||||
'panelHeading' => 'Fizetve' ,
|
|
||||||
'panel-type' => 'panel-success'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class='col-md-4'>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?= $this->render('_form', [
|
<?= $this->render('_form', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\grid\GridView;
|
use yii\grid\GridView;
|
||||||
|
use common\components\AccountTotalWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $searchModel frontend\models\CollectionSearch */
|
/* @var $searchModel frontend\models\CollectionSearch */
|
||||||
@ -19,15 +20,42 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<?= Html::a(Yii::t('frontend/collection', 'Create Collection'), ['select-account'], ['class' => 'btn btn-success']) ?>
|
<?= Html::a(Yii::t('frontend/collection', 'Create Collection'), ['select-account'], ['class' => 'btn btn-success']) ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 ">
|
||||||
|
<?php
|
||||||
|
echo AccountTotalWidget::widget([
|
||||||
|
'statistic' => $searchModel->totals
|
||||||
|
])?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?= GridView::widget([
|
<?= GridView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'id_collection',
|
'id_collection',
|
||||||
'id_user',
|
[
|
||||||
'id_account',
|
'attribute' => 'id_user',
|
||||||
'money',
|
'value' => 'userName',
|
||||||
'start:datetime',
|
],
|
||||||
'end:datetime',
|
[
|
||||||
|
'attribute' => 'id_account',
|
||||||
|
'value' => 'accountName',
|
||||||
|
],
|
||||||
|
'money:integer',
|
||||||
|
[
|
||||||
|
'attribute' => 'start',
|
||||||
|
'value' => function($model){
|
||||||
|
return Yii::$app->formatter->asDatetime($model->start,'yyyy-MM-dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'end',
|
||||||
|
'value' => function($model){
|
||||||
|
return Yii::$app->formatter->asDatetime($model->end,'yyyy-MM-dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
],
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn',
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
|||||||
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\DetailView;
|
use yii\widgets\DetailView;
|
||||||
|
use common\components\AccountStatisticWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Collection */
|
/* @var $model common\models\Collection */
|
||||||
|
|
||||||
$this->title = $model->id_collection;
|
$this->title = Yii::t('frontend/collection','Reception collection') . ' #'. $model->id_collection;
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/collection', 'Collections'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
@ -34,4 +35,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo AccountStatisticWidget::widget([
|
||||||
|
'totals' => $totals
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,57 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use frontend\components\TransferTotalWidget;
|
use common\components\AccountStatisticWidget;
|
||||||
?>
|
?>
|
||||||
<div>
|
<?php
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<?php echo TransferTotalWidget::widget([
|
|
||||||
'options'=>[
|
|
||||||
'statistic' => $searchModel->totalsCreatedAt,
|
|
||||||
'panelHeading' => 'Kiadva az adott időszakban'
|
|
||||||
]
|
|
||||||
]);?>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 ">
|
|
||||||
<?php echo TransferTotalWidget::widget([
|
|
||||||
'options'=>[
|
|
||||||
'statistic' => $searchModel->totalsCreatedAtPaid,
|
|
||||||
'panelHeading' => 'Kiadva/fizetve az adott időszakban'
|
|
||||||
]
|
|
||||||
]);?>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 ">
|
|
||||||
<?php echo TransferTotalWidget::widget([
|
|
||||||
'options'=>[
|
|
||||||
'statistic' => $searchModel->totalsCreatedAtNotPaid,
|
|
||||||
'panelHeading' => 'Kiadva/nem fizetve az adott időszakban'
|
|
||||||
]
|
|
||||||
]);?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4 ">
|
|
||||||
|
|
||||||
</div>
|
echo AccountStatisticWidget::widget([
|
||||||
<div class="col-md-4 ">
|
'totals' => $model->totals
|
||||||
<?php echo TransferTotalWidget::widget([
|
]);
|
||||||
'options'=>[
|
|
||||||
'statistic' => $searchModel->totalsPaidAtNotCreatedAt,
|
?>
|
||||||
'panelHeading' => 'Adósságok fizetve az adott időszakban'
|
|
||||||
]
|
|
||||||
]);?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4 ">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 ">
|
|
||||||
<?php echo TransferTotalWidget::widget([
|
|
||||||
'options'=>[
|
|
||||||
'statistic' => $searchModel->totalsPaidAt,
|
|
||||||
'panelHeading' => 'Kiadva fizetve/adósság fizetve az adott időszakban'
|
|
||||||
]
|
|
||||||
]);?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -48,7 +48,6 @@ use kartik\widgets\DateTimePicker;
|
|||||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<?php //echo $form->field($model, 'type')->dropDownList( ['' =>'Mind']+ Transfer::types()) ?>
|
|
||||||
<?php echo $form->field($model, 'types')->checkboxList( Transfer::types()) ?>
|
<?php echo $form->field($model, 'types')->checkboxList( Transfer::types()) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
<?php echo $this->render('_index_stat', ['searchModel' => $searchModel]); ?>
|
<?php echo $this->render('_index_stat', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user