fix account_state ( collection_money ), display product/ticket on reception only for selected account, add daily transfers (reception/admin)
This commit is contained in:
@@ -36,8 +36,8 @@ class AdminMenuStructure{
|
||||
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
||||
$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') );
|
||||
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today') );
|
||||
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
@@ -89,7 +89,8 @@ class AdminMenuStructure{
|
||||
/////////////////////////////
|
||||
$items = [];
|
||||
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
|
||||
$items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
|
||||
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
|
||||
$items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
|
||||
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
||||
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
|
||||
|
||||
@@ -10,6 +10,7 @@ use yii\filters\VerbFilter;
|
||||
use common\models\Account;
|
||||
use common\models\User;
|
||||
use backend\models\TransferSummarySearch;
|
||||
use backend\models\TransferListSearch;
|
||||
|
||||
/**
|
||||
* TransferController implements the CRUD actions for Transfer model.
|
||||
@@ -24,7 +25,7 @@ class TransferController extends \backend\controllers\BackendController
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => [ 'index','view','summary' ],
|
||||
'actions' => [ 'index','view','summary','list' ],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee','reception'],
|
||||
],
|
||||
@@ -58,7 +59,24 @@ class TransferController extends \backend\controllers\BackendController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Transfer models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionList()
|
||||
{
|
||||
$searchModel = new TransferListSearch();
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->users = User::read();
|
||||
|
||||
$searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
return $this->render('list', [
|
||||
'searchModel' => $searchModel,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Transfer models.
|
||||
|
||||
21
backend/models/TransferListSearch.php
Normal file
21
backend/models/TransferListSearch.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace backend\models;
|
||||
|
||||
use Yii;
|
||||
use common\models\Transfer;
|
||||
use common\components\RoleDefinition;
|
||||
/**
|
||||
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||
*/
|
||||
class TransferListSearch extends \common\models\TransferListSearch
|
||||
{
|
||||
|
||||
protected function addAccountConstraint($query){
|
||||
if ( !RoleDefinition::isAdmin() ){
|
||||
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,5 +22,10 @@ use dmstr\widgets\Alert;
|
||||
|
||||
<footer class="main-footer">
|
||||
© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?>
|
||||
|
||||
<div>
|
||||
Az oldalon szereplő adatok csak tájékoztató jellegűek.
|
||||
Az adatok helyességéért és igazságtartalmáért felelősséget nem vállalunk.
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
63
backend/views/transfer/_search_list.php
Normal file
63
backend/views/transfer/_search_list.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use kartik\widgets\DatePicker;
|
||||
use frontend\components\HtmlHelper;
|
||||
use common\models\Transfer;
|
||||
use kartik\widgets\DateTimePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\TransferSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<?php
|
||||
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
|
||||
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
|
||||
?>
|
||||
|
||||
<div class="transfer-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['list'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd hh:ii'
|
||||
]
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd hh:ii'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
399
backend/views/transfer/list.php
Normal file
399
backend/views/transfer/list.php
Normal file
@@ -0,0 +1,399 @@
|
||||
<?php
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\ListView;
|
||||
use yii\base\Widget;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel common\models\TransferSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t ( 'frontend/transfer', 'Daily transfers' );
|
||||
$this->params ['breadcrumbs'] [] = $this->title;
|
||||
?>
|
||||
<style>
|
||||
.dl-transfer {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.item-transfer {
|
||||
border: 1px solid #b4b4b4;
|
||||
margin-top: 12px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
td.count, td.money{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
td.name{
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.table-category-product td.name{
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.table-category-product td.count{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.table-category-product td.money{
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="transfer-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search_list', ['model' => $searchModel]); ?>
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#big"
|
||||
aria-controls="big" role="tab" data-toggle="tab">Egyszerű összesítő</a></li>
|
||||
<li role="presentation"><a href="#medium" aria-controls="medium"
|
||||
role="tab" data-toggle="tab">Közepes összesítő</a></li>
|
||||
<li role="presentation"><a href="#detailed" aria-controls="detailed"
|
||||
role="tab" data-toggle="tab">Részletes összesítő</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="big">
|
||||
<h2>Egyszerű összesítés</h2>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Bérletek</th>
|
||||
<td class="money"><?php echo $searchModel->ticketMoney?> FT</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Termékek</th>
|
||||
<td class="money"><?php echo $searchModel->productMoney?> FT</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pénzmozgások</th>
|
||||
<td class="money"><?php echo $searchModel->moneyMovementMoneis?> FT</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Végösszeg</th>
|
||||
<td class="money"><span style='border-bottom: 1px solid black'><?php echo $searchModel->total?> FT</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="medium">
|
||||
<h2>Közepes összesítés</h2>
|
||||
|
||||
<h3>Bérletek típus szerint</h3>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bérlet típus</th>
|
||||
<th>Mennyiség</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $searchModel->ticketStats as $ticketStat ) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="name"><?php echo $ticketStat['ticket_type_name'] ?></td>
|
||||
<td class="count"><?php echo $ticketStat['ticket_count']?> Db</td>
|
||||
<td class="money"><?php echo $ticketStat['ticket_money']?> FT</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<h3>Termékek kategória szerint</h3>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Termék kategória</th>
|
||||
<th>Mennyiség</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $searchModel->productMoneies as $pm ) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="name"><?php echo $pm['category_name'] ?></td>
|
||||
<td class="count"><?php echo $pm['category_count']?> Db</td>
|
||||
<td class="money"><?php echo $pm['product_money']?> FT</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen: <?php echo $searchModel->productMoney; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Termékek kategória szerint részletes</h3>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
foreach($searchModel->productsByCategory['categories'] as $categoryHolder ){
|
||||
|
||||
$products = $categoryHolder['products'];
|
||||
?>
|
||||
<h4><?php echo $categoryHolder['category']['name']?></h4>
|
||||
|
||||
<table class="table table-bordered table-striped table-summary table-category-product">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Termék</th>
|
||||
<th>Mennyiség</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $products as $p){?>
|
||||
|
||||
<tr>
|
||||
<td class='name'><?php echo $p['product_name'] ?></td>
|
||||
<td class='count'><?php echo $p['product_count'] ?> Db</td>
|
||||
<td class='money'><?php echo $p['product_money']?> FT</td>
|
||||
</tr>
|
||||
|
||||
<?php }?>
|
||||
<tr class="warning">
|
||||
<td><?php echo "Összesen" ?></td>
|
||||
<td><?php ?></td>
|
||||
<td class='money'><?php echo $categoryHolder['total']?> FT</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen:
|
||||
<?php
|
||||
echo $searchModel->productsByCategory['total'];
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Pénzmozgások típus szerint</h3>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pénzmozgás típus</th>
|
||||
<th>Mennyiség</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $searchModel->moneyMovementsByType as $mmStat ) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="name"><?php echo $mmStat['name'] ?></td>
|
||||
<td class="count"><?php echo $mmStat['money_movement_count']?> Db</td>
|
||||
<td class="money"><?php echo $mmStat['money_movement_money']?> FT</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen: <?php echo $searchModel->moneyMovementMoneis; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline; font-weight: bold;">
|
||||
Végösszeg: <?php echo $searchModel->total; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="detailed">
|
||||
<h2>Részletes összesítés</h2>
|
||||
<?php
|
||||
//////////////////////////
|
||||
// Bérletek
|
||||
////////////////////////
|
||||
?>
|
||||
<h3>Bérletek</h3>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Kiadva</th>
|
||||
<th>Fizetve</th>
|
||||
<th>Kassza</th>
|
||||
<th>Felhasználó</th>
|
||||
<th>Bérlet típus</th>
|
||||
<th>Egység ár</th>
|
||||
<th>Mennyiség</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($searchModel->tickets as $t ){?>
|
||||
<tr>
|
||||
<td><?php echo $t['ticket_created_at']?> </td>
|
||||
<td><?php echo $t['ticket_paid_at']?> </td>
|
||||
<td><?php echo $t['account_name']?> </td>
|
||||
<td><?php echo $t['user_name']?> </td>
|
||||
<td><?php echo $t['ticket_type_name'] ?></td>
|
||||
<td class='money'><?php echo $t['ticket_item_price']?> Ft</td>
|
||||
<td class='count'><?php echo $t['ticket_count']?> Db</td>
|
||||
<td class='money'><?php echo $t['ticket_money']?> FT</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if ( count($searchModel->tickets ) == 0 ) {
|
||||
?>
|
||||
Nincs találat
|
||||
<?php
|
||||
}else{?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen: <?php echo $searchModel->ticketMoney; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
//////////////////////////
|
||||
// Termék eladás
|
||||
////////////////////////
|
||||
?>
|
||||
<h3>Termék eladások</h3>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Kiadva</th>
|
||||
<th>Fizetve</th>
|
||||
<th>Kassza</th>
|
||||
<th>Felhasználó</th>
|
||||
<th>Kategória</th>
|
||||
<th>Termék</th>
|
||||
<th>Egység ár</th>
|
||||
<th>Mennyiség</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($searchModel->products as $p ){?>
|
||||
<tr>
|
||||
<td><?php echo $p['product_created_at']?> </td>
|
||||
<td><?php echo $p['product_paid_at']?> </td>
|
||||
<td><?php echo $p['account_name']?> </td>
|
||||
<td><?php echo $p['user_name']?> </td>
|
||||
<td><?php echo $p['product_category_name'] ?></td>
|
||||
<td><?php echo $p['product_name'] ?></td>
|
||||
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
|
||||
<td class='count'><?php echo $p['product_count']?> Db</td>
|
||||
<td class='money'><?php echo $p['product_money']?> FT</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if ( count($searchModel->products ) == 0 ) {
|
||||
?>
|
||||
Nincs találat
|
||||
<?php
|
||||
}else{?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen: <?php echo $searchModel->productMoney; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
//////////////////////////
|
||||
// Pénzmozgások
|
||||
////////////////////////
|
||||
?>
|
||||
<h3>Pénzmozgások</h3>
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dátum</th>
|
||||
<th>Kassza</th>
|
||||
<th>Felhasználó</th>
|
||||
<th>Név</th>
|
||||
<th>Típus</th>
|
||||
<th>Összeg</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($searchModel->moneyMovements as $p ){?>
|
||||
<tr>
|
||||
<td><?php echo $p['money_movement_created_at']?> </td>
|
||||
<td><?php echo $p['account_name']?> </td>
|
||||
<td><?php echo $p['user_name']?> </td>
|
||||
<td><?php echo $p['money_movement_name'] ?></td>
|
||||
<td><?php echo $p['money_movement_type_name'] ?></td>
|
||||
<td class='money'><?php echo $p['signed_money']?> Ft</td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if ( count($searchModel->moneyMovements ) == 0 ) {
|
||||
?>
|
||||
Nincs találat
|
||||
<?php
|
||||
}else{?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||
Összesen: <?php echo $searchModel->moneyMovementMoneis; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right" style="text-decoration: underline; font-weight: bold;">
|
||||
Végösszeg: <?php echo $searchModel->total; ?> Ft
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user