Finish version/v.0.0.11
This commit is contained in:
commit
0a4cd9c98d
@ -36,8 +36,8 @@ 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') );
|
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today') );
|
||||||
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@ -89,7 +89,8 @@ class AdminMenuStructure{
|
|||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$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' => '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' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||||
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
||||||
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ use yii\filters\VerbFilter;
|
|||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use common\models\User;
|
use common\models\User;
|
||||||
use backend\models\TransferSummarySearch;
|
use backend\models\TransferSummarySearch;
|
||||||
|
use backend\models\TransferListSearch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferController implements the CRUD actions for Transfer model.
|
* TransferController implements the CRUD actions for Transfer model.
|
||||||
@ -24,7 +25,7 @@ class TransferController extends \backend\controllers\BackendController
|
|||||||
'rules' => [
|
'rules' => [
|
||||||
// allow authenticated users
|
// allow authenticated users
|
||||||
[
|
[
|
||||||
'actions' => [ 'index','view','summary' ],
|
'actions' => [ 'index','view','summary','list' ],
|
||||||
'allow' => true,
|
'allow' => true,
|
||||||
'roles' => ['admin','employee','reception'],
|
'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.
|
* 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">
|
<footer class="main-footer">
|
||||||
© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?>
|
© <?= 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>
|
</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>
|
||||||
@ -1,3 +1,12 @@
|
|||||||
|
-0.0.11
|
||||||
|
- add daily transfers
|
||||||
|
- add global reception word listener
|
||||||
|
- allow delete transfer
|
||||||
|
- allow delete account_state
|
||||||
|
- fix account_state
|
||||||
|
-0.0.10
|
||||||
|
add webcam to customer create/update
|
||||||
|
display customer photo in reception panel
|
||||||
-0.0.9
|
-0.0.9
|
||||||
add rfid_key to card and key
|
add rfid_key to card and key
|
||||||
add typeahead to reception product/sale
|
add typeahead to reception product/sale
|
||||||
|
|||||||
16
common/assets/WebcamjsAsset.php
Normal file
16
common/assets/WebcamjsAsset.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\assets;
|
||||||
|
|
||||||
|
use yii\web\AssetBundle;
|
||||||
|
|
||||||
|
class WebcamjsAsset extends AssetBundle
|
||||||
|
{
|
||||||
|
public $sourcePath = '@bower';
|
||||||
|
|
||||||
|
public $js = [
|
||||||
|
'webcamjs/webcam.min.js'
|
||||||
|
];
|
||||||
|
|
||||||
|
public $depends = [
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -31,7 +31,21 @@ class Image
|
|||||||
|
|
||||||
return Upload::getLink($fileName);
|
return Upload::getLink($fileName);
|
||||||
}
|
}
|
||||||
|
public static function saveBinary($binary_data, $dir = '')
|
||||||
|
{
|
||||||
|
$fileName = Upload::getUploadPath($dir) . DIRECTORY_SEPARATOR . Upload::genFileName("jpg");
|
||||||
|
|
||||||
|
$uploaded = file_put_contents( $fileName, $binary_data );
|
||||||
|
|
||||||
|
if(!$uploaded){
|
||||||
|
throw new HttpException(500, 'Cannot upload file "'.$fileName.'". Please check write permissions.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Upload::getLink($fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param unknown $filename
|
* @param unknown $filename
|
||||||
|
|||||||
@ -47,4 +47,17 @@ class Upload
|
|||||||
|
|
||||||
return $fileName;
|
return $fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function genFileName($extension, $namePostfix = true)
|
||||||
|
{
|
||||||
|
$baseName = "image";
|
||||||
|
$fileName = StringHelper::truncate(Inflector::slug($baseName), 32, '');
|
||||||
|
if($namePostfix || !$fileName) {
|
||||||
|
$fileName .= ($fileName ? '-' : '') . substr(uniqid(md5(rand()), true), 0, 10);
|
||||||
|
}
|
||||||
|
$fileName .= '.' . $extension;
|
||||||
|
|
||||||
|
return $fileName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
|
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
|
||||||
// 'language' => 'hu-HU',
|
// 'language' => 'hu-HU',
|
||||||
|
'timezone' => 'Europe/Budapest',
|
||||||
'language' => 'hu',
|
'language' => 'hu',
|
||||||
'components' => [
|
'components' => [
|
||||||
'cache' => [
|
'cache' => [
|
||||||
@ -21,8 +24,8 @@ return [
|
|||||||
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
|
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
|
||||||
'timeFormat' => 'HH:mm',
|
'timeFormat' => 'HH:mm',
|
||||||
'locale' => 'hu-Hu',
|
'locale' => 'hu-Hu',
|
||||||
'timeZone' => 'UTC',
|
'timeZone' => 'EUROPE/BUDAPEST',
|
||||||
'defaultTimeZone' => 'UTC' ,
|
'defaultTimeZone' => 'EUROPE/BUDAPEST',
|
||||||
'nullDisplay' => "-",
|
'nullDisplay' => "-",
|
||||||
],
|
],
|
||||||
'authManager' => [
|
'authManager' => [
|
||||||
|
|||||||
@ -3,5 +3,5 @@ return [
|
|||||||
'adminEmail' => 'rocho02@gmail.com',
|
'adminEmail' => 'rocho02@gmail.com',
|
||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.0.9'
|
'version' => 'v0.0.11'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -28,5 +28,6 @@ return [
|
|||||||
'Update' => 'Módosítás',
|
'Update' => 'Módosítás',
|
||||||
'Update {modelClass}: ' => '{modelClass} módosítás: ',
|
'Update {modelClass}: ' => '{modelClass} módosítás: ',
|
||||||
'pieces' => 'db',
|
'pieces' => 'db',
|
||||||
'Transfers Summary' => 'Bevétel'
|
'Transfers Summary' => 'Bevétel',
|
||||||
|
'Daily transfers' => 'Napi bevételek'
|
||||||
];
|
];
|
||||||
|
|||||||
@ -26,6 +26,7 @@ use yii\helpers\ArrayHelper;
|
|||||||
* @property integer $banknote_10000_ft
|
* @property integer $banknote_10000_ft
|
||||||
* @property integer $banknote_20000_ft
|
* @property integer $banknote_20000_ft
|
||||||
* @property integer $id_user
|
* @property integer $id_user
|
||||||
|
* @property integer $collection_money
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
*/
|
*/
|
||||||
@ -53,6 +54,7 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
[['id_account', 'type', 'money', 'banknote_5_ft', 'banknote_10_ft', 'banknote_20_ft', 'banknote_50_ft', 'banknote_100_ft', 'banknote_200_ft', 'banknote_500_ft', 'banknote_1000_ft', 'banknote_2000_ft', 'banknote_5000_ft', 'banknote_10000_ft', 'banknote_20000_ft' ], 'integer'],
|
[['id_account', 'type', 'money', 'banknote_5_ft', 'banknote_10_ft', 'banknote_20_ft', 'banknote_50_ft', 'banknote_100_ft', 'banknote_200_ft', 'banknote_500_ft', 'banknote_1000_ft', 'banknote_2000_ft', 'banknote_5000_ft', 'banknote_10000_ft', 'banknote_20000_ft' ], 'integer'],
|
||||||
[['comment' ], 'string' ,'max' => 255],
|
[['comment' ], 'string' ,'max' => 255],
|
||||||
[['prev_state' ], 'integer'],
|
[['prev_state' ], 'integer'],
|
||||||
|
[['id_account'] , 'validatePrevState'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +89,11 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validatePrevState($attribute,$params){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static function banknoteValues()
|
public static function banknoteValues()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -124,6 +131,10 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
|
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPrevObject(){
|
||||||
|
return $this->hasOne( AccountState::className(), ["id_account_state" =>"prev_state" ] );
|
||||||
|
}
|
||||||
|
|
||||||
public function getUserName(){
|
public function getUserName(){
|
||||||
$result = "";
|
$result = "";
|
||||||
$user = $this->user;
|
$user = $this->user;
|
||||||
@ -164,40 +175,45 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
* @param $type int the type of accountstate to load
|
* @param $type int the type of accountstate to load
|
||||||
* @param $user $id of user to load the account
|
* @param $user $id of user to load the account
|
||||||
* */
|
* */
|
||||||
public static function readLast($type, $user = null){
|
public static function readLast($type, $user = null,$account = null){
|
||||||
$result = null;
|
$result = null;
|
||||||
$query = AccountState::find();
|
$query = AccountState::find();
|
||||||
//filter user
|
|
||||||
if ( isset($user)){
|
|
||||||
$query->innerJoinWith("account");
|
|
||||||
$query->innerJoinWith("account.userAccountAssignments");
|
|
||||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
|
|
||||||
}
|
|
||||||
//filter type
|
//filter type
|
||||||
if ( isset($type)){
|
if ( isset($type)){
|
||||||
$query->andWhere(['account_state.type' => $type]);
|
$query->andWhere(['account_state.type' => $type]);
|
||||||
}
|
}
|
||||||
//filter last
|
if ( $account ){
|
||||||
$query->join("INNER JOIN ",
|
$query->andWhere(["account_state.id_account" => $account ]);
|
||||||
"(select max(created_at) as cdate, id_account from account_state group by id_account) as sq1"
|
}
|
||||||
,"sq1.cdate = account_state.created_at and sq1.id_account = account_state.id_account");
|
|
||||||
|
$query->limit(1);
|
||||||
|
|
||||||
$query->orderBy(['created_at' => SORT_DESC]);
|
$query->orderBy(['created_at' => SORT_DESC]);
|
||||||
$result = $query->all();
|
$result = $query->one();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeSave($insert){
|
function beforeSave($insert){
|
||||||
$result = parent::beforeSave($insert);
|
$result = parent::beforeSave($insert);
|
||||||
if ( $result ){
|
if ( $result ){
|
||||||
|
$start = null;
|
||||||
|
$end = null;
|
||||||
$prev = null;
|
$prev = null;
|
||||||
|
$this->prev_money = 0;
|
||||||
|
|
||||||
if ( isset($this->prev_state) ){
|
if ( $this->type == AccountState::TYPE_CLOSE){
|
||||||
$prev = AccountState::findOne($this->prev_state);
|
$lastOpen = AccountState::readLast(AccountState::TYPE_OPEN,null, $this->id_account);
|
||||||
|
if ( $lastOpen != null ){
|
||||||
|
$start = $lastOpen->created_at;
|
||||||
|
$this->prev_state = $lastOpen->id_account_state;
|
||||||
|
$this->prev_money = $lastOpen->money;
|
||||||
|
}
|
||||||
|
$end = date("Y-m-d H:i:s");
|
||||||
|
$this->collection_money = Transfer::readPaid($start, $end, Yii::$app->user->id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $prev != null){
|
|
||||||
$this->prev_money = $prev->money;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
@ -205,12 +221,39 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
public function hasDifferenceToPrevState(){
|
public function hasDifferenceToPrevState(){
|
||||||
$result = false;
|
$result = false;
|
||||||
if ( isset( $this->prev_state ) && $this->type == self::TYPE_OPEN){
|
if ( $this->type == self::TYPE_CLOSE){
|
||||||
$result = $this->prev_money != $this->money;
|
$result = ( $this->prev_money + $this->collection_money) != $this->money;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasPlus(){
|
||||||
|
$result = false;
|
||||||
|
if ( $this->type == self::TYPE_CLOSE){
|
||||||
|
$result = ( $this->prev_money + $this->collection_money) < $this->money;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasMinus(){
|
||||||
|
$result = false;
|
||||||
|
if ( $this->type == self::TYPE_CLOSE){
|
||||||
|
$result =( $this->prev_money + $this->collection_money) > $this->money;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSignedDiff(){
|
||||||
|
$result = $this->money - ( $this->prev_money + $this->collection_money);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExpected(){
|
||||||
|
$result = $this->prev_money + $this->collection_money ;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function readLastForUser($type){
|
public static function readLastForUser($type){
|
||||||
return static::readLast($type, Yii::$app->user->id);
|
return static::readLast($type, Yii::$app->user->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,9 @@ class Customer extends \yii\db\ActiveRecord
|
|||||||
const SEX_MAN = 10;
|
const SEX_MAN = 10;
|
||||||
const SEX_WOMAN = 20;
|
const SEX_WOMAN = 20;
|
||||||
|
|
||||||
|
|
||||||
|
public $photo_data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -146,6 +149,11 @@ class Customer extends \yii\db\ActiveRecord
|
|||||||
'id' => 'id_user'
|
'id' => 'id_user'
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
public function getImage1(){
|
||||||
|
return $this->hasOne ( Image::className (), [
|
||||||
|
'id_image' => 'id_image'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
public function getCustomerCardNumber(){
|
public function getCustomerCardNumber(){
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|||||||
@ -27,6 +27,7 @@ class MoneyMovement extends \yii\db\ActiveRecord
|
|||||||
{
|
{
|
||||||
|
|
||||||
const TYPE_OUT = 10;
|
const TYPE_OUT = 10;
|
||||||
|
const TYPE_IN = 20;
|
||||||
|
|
||||||
public $_account;
|
public $_account;
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ class MoneyMovement extends \yii\db\ActiveRecord
|
|||||||
return ArrayHelper::merge( [
|
return ArrayHelper::merge( [
|
||||||
[
|
[
|
||||||
'class' => TimestampBehavior::className(),
|
'class' => TimestampBehavior::className(),
|
||||||
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
'value' => function(){ return date('Y-m-d H:i:s' , time()); }
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => AccountAwareBehavior::className(),
|
'class' => AccountAwareBehavior::className(),
|
||||||
@ -65,10 +66,11 @@ class MoneyMovement extends \yii\db\ActiveRecord
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['id_account', 'name', 'money'], 'required'],
|
[['id_account', 'name', 'money'], 'required'],
|
||||||
[['id_account' , 'money'], 'integer'],
|
[['id_account' , 'money'], 'integer' , 'min' => 0],
|
||||||
[['name'], 'string', 'max' => 64],
|
[['name'], 'string', 'max' => 64],
|
||||||
[['comment'], 'string', 'max' => 255],
|
[['comment'], 'string', 'max' => 255],
|
||||||
[['id_account'], 'validateAccount'],
|
[['id_account'], 'validateAccount'],
|
||||||
|
[['type'] , 'in','range' => array_keys(MoneyMovement::types())],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +93,7 @@ class MoneyMovement extends \yii\db\ActiveRecord
|
|||||||
'id_user' => Yii::t('common/money-movement', 'Id User'),
|
'id_user' => Yii::t('common/money-movement', 'Id User'),
|
||||||
'name' => Yii::t('common/money-movement', 'Name'),
|
'name' => Yii::t('common/money-movement', 'Name'),
|
||||||
'type' => Yii::t('common/money-movement', 'Type'),
|
'type' => Yii::t('common/money-movement', 'Type'),
|
||||||
|
'humanType' => Yii::t('common/money-movement', 'Type'),
|
||||||
'money' => Yii::t('common/money-movement', 'Money'),
|
'money' => Yii::t('common/money-movement', 'Money'),
|
||||||
'comment' => Yii::t('common/money-movement', 'Comment'),
|
'comment' => Yii::t('common/money-movement', 'Comment'),
|
||||||
'created_at' => Yii::t('common/money-movement', 'Created At'),
|
'created_at' => Yii::t('common/money-movement', 'Created At'),
|
||||||
@ -100,6 +103,7 @@ class MoneyMovement extends \yii\db\ActiveRecord
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function afterSave($insert, $changedAttributes){
|
public function afterSave($insert, $changedAttributes){
|
||||||
parent::afterSave($insert, $changedAttributes);
|
parent::afterSave($insert, $changedAttributes);
|
||||||
if ( $insert) {
|
if ( $insert) {
|
||||||
@ -114,4 +118,26 @@ class MoneyMovement extends \yii\db\ActiveRecord
|
|||||||
$transfer->save();
|
$transfer->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function types(){
|
||||||
|
return [
|
||||||
|
self::TYPE_IN => "Betét",
|
||||||
|
self::TYPE_OUT => "Kivét",
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function typeName($type){
|
||||||
|
$types = MoneyMovement::types();
|
||||||
|
$result = "";
|
||||||
|
if ( array_key_exists($type, $types)){
|
||||||
|
$result = $types[$type];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getHumanType(){
|
||||||
|
return self::typeName($this->type);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,15 +118,41 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
|||||||
$warehouses = null;
|
$warehouses = null;
|
||||||
|
|
||||||
if ( $forceIncludeObjectWithId == null){
|
if ( $forceIncludeObjectWithId == null){
|
||||||
$warehouses = Product::find()->andWhere(['status' => Product::STATUS_ACTIVE])->all();
|
$warehouses = Product::find()->andWhere(['status' => Product::STATUS_ACTIVE])->orderBy(['product.name' => SORT_ASC])->all();
|
||||||
}else{
|
}else{
|
||||||
$warehouses = Product::find()->andWhere( ['or', ['status' => Product::STATUS_ACTIVE], ['id_product' => $forceIncludeObjectWithId ] ])->all();
|
$warehouses = Product::find()->andWhere( ['or', ['status' => Product::STATUS_ACTIVE], ['id_product' => $forceIncludeObjectWithId ] ])->orderBy(['product.name' => SORT_ASC])->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $warehouses;
|
return $warehouses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function findProduct($query){
|
/**
|
||||||
|
* $param int $forceIncludeAccount id warehouse, that should be included in list, even if it is inactive
|
||||||
|
* */
|
||||||
|
public static function readForDefaultAccount($forceIncludeObjectWithId = null){
|
||||||
|
$result = null;
|
||||||
|
|
||||||
|
$account = Account::readDefault();
|
||||||
|
|
||||||
|
if ( $forceIncludeObjectWithId == null){
|
||||||
|
$query = Product::find()->andWhere(['status' => Product::STATUS_ACTIVE])->orderBy(['product.name' => SORT_ASC]);
|
||||||
|
if ( $account )
|
||||||
|
$query->andWhere(["product.id_account" => $account]);
|
||||||
|
|
||||||
|
$result = $query->all();
|
||||||
|
}else{
|
||||||
|
$query = Product::find()->andWhere( ['or', ['status' => Product::STATUS_ACTIVE], ['id_product' => $forceIncludeObjectWithId ] ])->orderBy(['product.name' => SORT_ASC]);
|
||||||
|
if ( $account )
|
||||||
|
$query->andWhere(["product.id_account" => $account]);
|
||||||
|
|
||||||
|
$result = $query->all();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findProduct($query, $account = null){
|
||||||
$result = [];
|
$result = [];
|
||||||
$product = null;
|
$product = null;
|
||||||
|
|
||||||
@ -137,6 +163,7 @@ class Product extends \common\models\BaseFitnessActiveRecord {
|
|||||||
['barcode' => $query ],
|
['barcode' => $query ],
|
||||||
]
|
]
|
||||||
)->andWhere(['status' =>Product::STATUS_ACTIVE])
|
)->andWhere(['status' =>Product::STATUS_ACTIVE])
|
||||||
|
->andFilterWhere(['product.id_account' => $account])
|
||||||
->all();
|
->all();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -198,13 +198,13 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
/**
|
/**
|
||||||
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
|
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
|
||||||
* */
|
* */
|
||||||
public static function read($forceIncludeObjectWithId = null){
|
public static function read($forceIncludeObjectWithId = null, $account = null){
|
||||||
$ticketTypes = null;
|
$ticketTypes = null;
|
||||||
|
|
||||||
if ( $forceIncludeObjectWithId == null){
|
if ( $forceIncludeObjectWithId == null){
|
||||||
$ticketTypes = TicketType::find()->andWhere(['status' => self::STATUS_ACTIVE])->all();
|
$ticketTypes = TicketType::find()->andWhere(['status' => self::STATUS_ACTIVE])->andFilterWhere(['ticket_type.id_account' => $account])->all();
|
||||||
}else{
|
}else{
|
||||||
$ticketTypes = TicketType::find()->andWhere( ['or', ['status' => self::STATUS_ACTIVE], ['id_ticket_type' => $forceIncludeObjectWithId ] ])->all();
|
$ticketTypes = TicketType::find()->andWhere( ['or', ['status' => self::STATUS_ACTIVE], ['id_ticket_type' => $forceIncludeObjectWithId ] ])->andFilterWhere(['ticket_type.id_account' => $account])->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ticketTypes;
|
return $ticketTypes;
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
return ArrayHelper::merge( [
|
return ArrayHelper::merge( [
|
||||||
[
|
[
|
||||||
'class' => TimestampBehavior::className(),
|
'class' => TimestampBehavior::className(),
|
||||||
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => DiscountAwareBehavior::className(),
|
'class' => DiscountAwareBehavior::className(),
|
||||||
@ -168,7 +168,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
}else if ( $this->type == Transfer::TYPE_PRODUCT ){
|
}else if ( $this->type == Transfer::TYPE_PRODUCT ){
|
||||||
$result = $this->productName;
|
$result = $this->productName;
|
||||||
}else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){
|
}else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){
|
||||||
$result = "Pénz kivétel - " . $this->moneyMovement->name;
|
$result = $this->moneyMovement->humanType;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -247,6 +247,19 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function toSignedMoney($dir,$money){
|
||||||
|
$m = 1;
|
||||||
|
$result = $money;
|
||||||
|
if ( $dir == Transfer::DIRECTION_OUT ){
|
||||||
|
$m = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $result * $m;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function toProductSoldString(){
|
public function toProductSoldString(){
|
||||||
$s = "";
|
$s = "";
|
||||||
@ -315,7 +328,11 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
$transfer->type = Transfer::TYPE_MONEY_MOVEMENT_OUT;
|
$transfer->type = Transfer::TYPE_MONEY_MOVEMENT_OUT;
|
||||||
$transfer->status = Transfer::STATUS_PAID;
|
$transfer->status = Transfer::STATUS_PAID;
|
||||||
$transfer->direction = Transfer::DIRECTION_OUT;
|
if ( $moneyMovement->type == MoneyMovement::TYPE_OUT){
|
||||||
|
$transfer->direction = Transfer::DIRECTION_OUT;
|
||||||
|
}else if ( $moneyMovement->type == MoneyMovement::TYPE_IN ){
|
||||||
|
$transfer->direction = Transfer::DIRECTION_IN;
|
||||||
|
}
|
||||||
$transfer->count = null;
|
$transfer->count = null;
|
||||||
|
|
||||||
$transfer->id_object = $moneyMovement->id_money_movement;
|
$transfer->id_object = $moneyMovement->id_money_movement;
|
||||||
@ -454,6 +471,32 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function beforeDelete(){
|
||||||
|
parent::beforeDelete();
|
||||||
|
if ( $this->type == Transfer::TYPE_TICKET){
|
||||||
|
$ticket = $this->ticket;
|
||||||
|
if ( $ticket != null ){
|
||||||
|
$ticket->delete();
|
||||||
|
}
|
||||||
|
}else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT){
|
||||||
|
$mm = $this->moneyMovement;
|
||||||
|
$mm->delete();
|
||||||
|
}else if ($this->type == Transfer::TYPE_PRODUCT){
|
||||||
|
$sale = $this->sale;
|
||||||
|
$product = $this->product;
|
||||||
|
|
||||||
|
$product->stock = $product->stock + $this->count;
|
||||||
|
|
||||||
|
$product->save();
|
||||||
|
$sale->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
ShoppingCart::deleteAll(['id_transfer' =>$this->id_transfer]);
|
||||||
|
UserSoldItem::deleteAll(['id_transfer' =>$this->id_transfer]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $mode The mode to load
|
* @param string $mode The mode to load
|
||||||
* Available modes
|
* Available modes
|
||||||
@ -660,4 +703,19 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function readPaid($start,$end,$idUser){
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN. ' then transfer.money else -1 * transfer.money end ),0) AS transfer_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.id_user' => $idUser ]);
|
||||||
|
|
||||||
|
$created_condition = ['and',[ '>=', 'transfer.created_at', $start ] ,[ '<', 'transfer.created_at', $end ] ];
|
||||||
|
$paid_condition = ['and',[ '>=', 'transfer.paid_at', $start] ,[ '<', 'transfer.paid_at', $end ] ];
|
||||||
|
|
||||||
|
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
|
||||||
|
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
|
||||||
|
|
||||||
|
return $query->scalar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
390
common/models/TransferListSearch.php
Normal file
390
common/models/TransferListSearch.php
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\base\Object;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
/**
|
||||||
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
|
*/
|
||||||
|
class TransferListSearch extends Transfer
|
||||||
|
{
|
||||||
|
|
||||||
|
public $start;
|
||||||
|
public $end;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public $totalsCreatedAt = ['total' => 0, 'accounts' =>[] ];
|
||||||
|
// public $totalsCreatedAtNotPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
|
// public $totalsCreatedAtPaid= ['total' => 0, 'accounts' =>[]];
|
||||||
|
// public $totalsPaidAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
// public $totalsPaidAtNotCreatedAt= ['total' => 0, 'accounts' =>[]];
|
||||||
|
|
||||||
|
|
||||||
|
public $totals;
|
||||||
|
|
||||||
|
public $accounts;
|
||||||
|
|
||||||
|
public $types;
|
||||||
|
|
||||||
|
public $users;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all money gained with ticket sell
|
||||||
|
* */
|
||||||
|
public $ticketMoney;
|
||||||
|
/**
|
||||||
|
* all money gained with product sell
|
||||||
|
* */
|
||||||
|
public $productMoney;
|
||||||
|
/**
|
||||||
|
* all money gained with product sell grouped by category
|
||||||
|
* */
|
||||||
|
public $productMoneies;
|
||||||
|
/**
|
||||||
|
* all money lost by money movement
|
||||||
|
* */
|
||||||
|
public $moneyMovementMoneis;
|
||||||
|
public $moneyMovementMoney;
|
||||||
|
/**
|
||||||
|
* total gained money
|
||||||
|
* */
|
||||||
|
public $total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ticket sale statisitc
|
||||||
|
* */
|
||||||
|
public $ticketStats;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* money movements by type
|
||||||
|
* */
|
||||||
|
public $moneyMovementsByType;
|
||||||
|
|
||||||
|
public $tickets;
|
||||||
|
/**
|
||||||
|
* all product transfer
|
||||||
|
* */
|
||||||
|
public $products;
|
||||||
|
public $moneyMovements;
|
||||||
|
|
||||||
|
public $productsByCategory;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
|
||||||
|
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
|
||||||
|
|
||||||
|
[ [ 'id_account','id_user' ] , 'integer'],
|
||||||
|
['types', 'each', 'rule' => ['integer']],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Transfer::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->readTicketMoney();
|
||||||
|
$this->readProductsMoney();
|
||||||
|
$this->readMoneyMovementMoney();
|
||||||
|
$this->calcTotal();
|
||||||
|
|
||||||
|
$this->readProductsByCategory();
|
||||||
|
$this->readProductsByCategoryDetailed();
|
||||||
|
$this->readTicketStas();
|
||||||
|
$this->readMoneyMovementsStats();
|
||||||
|
|
||||||
|
|
||||||
|
$this->readTickets();
|
||||||
|
$this->readProducts();
|
||||||
|
$this->readMoneyMovements();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function calcTotal(){
|
||||||
|
$this->total = 0;
|
||||||
|
$this->total += $this->ticketMoney;
|
||||||
|
$this->total += $this->productMoney;
|
||||||
|
$this->total += $this->moneyMovementMoneis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function addAccountConstraint($query){
|
||||||
|
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
||||||
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addQueryFilters($query){
|
||||||
|
|
||||||
|
$this->addAccountConstraint($query);
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'transfer.id_account' => $this->id_account,
|
||||||
|
'transfer.id_user' => $this->id_user,
|
||||||
|
'transfer.type' => $this->type,
|
||||||
|
'transfer.id_user' => $this->id_user,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$created_condition = ['and',[ '>=', 'transfer.created_at', $this->timestampStart ] ,[ '<', 'transfer.created_at', $this->timestampEnd ] ];
|
||||||
|
$paid_condition = ['and',[ '>=', 'transfer.paid_at', $this->timestampStart ] ,[ '<', 'transfer.paid_at', $this->timestampEnd ] ];
|
||||||
|
|
||||||
|
|
||||||
|
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
|
||||||
|
|
||||||
|
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readTicketStas(){
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['ticket_type.name as ticket_type_name' , 'coalesce(sum(abs(transfer.count)),0) AS ticket_count', 'coalesce(sum(abs(transfer.money)),0) AS ticket_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
||||||
|
|
||||||
|
$query->groupBy(['ticket_type.id_ticket_type','ticket_type.name']);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
|
||||||
|
$this->ticketStats = $query->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readTicketMoney(){
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([' coalesce(sum(abs(transfer.money)),0) AS ticket_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
$this->ticketMoney = $query->scalar();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readProductsByCategory(){
|
||||||
|
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['coalesce(sum(transfer.money),0) AS product_money', 'coalesce(sum(transfer.count),0) as category_count', 'product_category.name as category_name']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->groupBy(['product_category.id_product_category','product_category.name']);
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->productMoneies = $query->all();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readProductsByCategoryDetailed(){
|
||||||
|
|
||||||
|
$formatted = [];
|
||||||
|
$formatted['categories'] = [];
|
||||||
|
$formatted['total'] = 0;
|
||||||
|
$prevCategory = null;
|
||||||
|
$curCategory = null;
|
||||||
|
|
||||||
|
$category = null;
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['product_category.id_product_category as product_category_id','product_category.name as product_category_name', 'product.name as product_name' ,'coalesce(sum(transfer.money),0) AS product_money', 'coalesce(sum(transfer.count),0) as product_count']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->groupBy(['product.id_product','product.name','product_category.id_product_category','product_category.name']);
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$query->orderBy(['product_category.name' => SORT_ASC,'product.name' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$result = $query->all();
|
||||||
|
|
||||||
|
foreach ($result as $row){
|
||||||
|
$curCategory = $row['product_category_id'];
|
||||||
|
if ( $curCategory != $prevCategory ){
|
||||||
|
//store last category
|
||||||
|
if ( $category != null ){
|
||||||
|
$formatted['categories'][] = $category;
|
||||||
|
}
|
||||||
|
$prevCategory = $curCategory;
|
||||||
|
//create new category
|
||||||
|
$category = [];
|
||||||
|
$category['category'] = [];
|
||||||
|
$category['category']['name'] = $row['product_category_name'];
|
||||||
|
$category['category']['id'] = $row['product_category_id'];
|
||||||
|
$category['products'] = [];
|
||||||
|
$category['total'] = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
$category['products'][] = $row;
|
||||||
|
$category['total'] += $row['product_money'];
|
||||||
|
$formatted['total'] += $row['product_money'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $category != null ){
|
||||||
|
$formatted['categories'][]= $category;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->productsByCategory = $formatted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readProductsMoney(){
|
||||||
|
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['coalesce(sum(transfer.money),0) AS product_money' ]);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->productMoney = $query->scalar();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function readMoneyMovementMoney(){
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([' coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN. ' then transfer.money else -1 * transfer.money end ),0) AS money_movement_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||||
|
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->moneyMovementMoneis = $query->scalar();
|
||||||
|
}
|
||||||
|
protected function readMoneyMovementsStats(){
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([ 'money_movement.type as money_movement_type', ' coalesce(count(transfer.id_transfer),0) AS money_movement_count', 'coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN. ' then transfer.money else -1 * transfer.money end ),0) AS money_movement_money']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||||
|
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
||||||
|
$query->groupBy(['money_movement.type']);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->moneyMovementsByType = $query->all();
|
||||||
|
for ($i = 0; $i < count($this->moneyMovementsByType) ;$i++ ){
|
||||||
|
$this->moneyMovementsByType[$i]['name'] = MoneyMovement::typeName($this->moneyMovementsByType[$i]['money_movement_type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readTickets(){
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select(['user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' , 'transfer.count AS ticket_count', 'transfer.money AS ticket_money','transfer.item_price AS ticket_item_price', 'transfer.created_at as ticket_created_at','transfer.paid_at as ticket_paid_at']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
|
||||||
|
$query->innerJoin("ticket_type", "ticket.id_ticket_type = ticket_type.id_ticket_type");
|
||||||
|
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
||||||
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
|
||||||
|
$this->tickets = $query->all();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($this->tickets) ;$i++ ){
|
||||||
|
$this->tickets[$i]['ticket_created_at'] = Yii::$app->formatter->asDatetime($this->tickets[$i]['ticket_created_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
$this->tickets[$i]['ticket_paid_at'] = empty($this->tickets[$i]['ticket_paid_at'] ) ? '-' : Yii::$app->formatter->asDatetime($this->tickets[$i]['ticket_paid_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readProducts(){
|
||||||
|
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([ 'user.username as user_name','account.name as account_name' , 'product_category.name as product_category_name', 'product.name as product_name', 'transfer.money AS product_money', 'transfer.count AS product_count', 'transfer.money AS product_money','transfer.item_price AS product_item_price', 'transfer.created_at as product_created_at','transfer.paid_at as product_paid_at']);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_PRODUCT]);
|
||||||
|
$query->innerJoin("sale", "sale.id_sale = transfer.id_object");
|
||||||
|
$query->innerJoin("product", "sale.id_product = product.id_product");
|
||||||
|
$query->innerJoin("product_category", "product.id_product_category = product_category.id_product_category");
|
||||||
|
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
||||||
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->products = $query->all();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($this->products) ;$i++ ){
|
||||||
|
$this->products[$i]['product_created_at'] = Yii::$app->formatter->asDatetime($this->products[$i]['product_created_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
$this->products[$i]['product_paid_at'] = empty($this->products[$i]['product_paid_at'] ) ? '-' : Yii::$app->formatter->asDatetime($this->products[$i]['product_paid_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readMoneyMovements(){
|
||||||
|
$query = (new \yii\db\Query());
|
||||||
|
$query->select([ 'user.username as user_name','account.name as account_name', 'transfer.direction as transfer_direction' ,'money_movement.type as money_movement_type', 'transfer.money AS money_movement_money', 'money_movement.name as money_movement_name','transfer.created_at as money_movement_created_at', ]);
|
||||||
|
$query->from('transfer');
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_MONEY_MOVEMENT_OUT]);
|
||||||
|
$query->innerJoin("money_movement", "money_movement.id_money_movement = transfer.id_object");
|
||||||
|
$query->innerJoin("account", "transfer.id_account = account.id_account");
|
||||||
|
$query->innerJoin("user", "transfer.id_user = user.id");
|
||||||
|
$query->orderBy(['transfer.created_at' => SORT_ASC]);
|
||||||
|
$this->addQueryFilters($query);
|
||||||
|
|
||||||
|
$this->moneyMovements = $query->all();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($this->moneyMovements) ;$i++ ){
|
||||||
|
$this->moneyMovements[$i]['money_movement_type_name'] = MoneyMovement::typeName($this->moneyMovements[$i]['money_movement_type']);
|
||||||
|
$this->moneyMovements[$i]['money_movement_created_at'] = Yii::$app->formatter->asDatetime($this->moneyMovements[$i]['money_movement_created_at'], 'yyyy.MM.dd HH:mm:ss');
|
||||||
|
$this->moneyMovements[$i]['signed_money'] = Transfer::toSignedMoney($this->moneyMovements[$i]['transfer_direction'],$this->moneyMovements[$i]['money_movement_money']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,6 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
use common\components\AccountTotalWidget;
|
use common\components\AccountTotalWidget;
|
||||||
?>
|
?>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<a class="btn btn-primary" style="margin-bottom: 6px" onclick="javascript: $('#account_stat_panels').toggle();">Statisztika mutatása/elrejtése</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id='account_stat_panels' style="display: none;">
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php
|
<?php
|
||||||
@ -61,4 +67,5 @@ use common\components\AccountTotalWidget;
|
|||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -25,7 +25,8 @@
|
|||||||
"bower-asset/moment": "^2.10",
|
"bower-asset/moment": "^2.10",
|
||||||
"bower-asset/accounting": "^0.3.2",
|
"bower-asset/accounting": "^0.3.2",
|
||||||
"dmstr/yii2-adminlte-asset": "2.*",
|
"dmstr/yii2-adminlte-asset": "2.*",
|
||||||
"bassjobsen/bootstrap-3-typeahead": "^4.0"
|
"bassjobsen/bootstrap-3-typeahead": "^4.0",
|
||||||
|
"bower-asset/webcamjs": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-codeception": "*",
|
"yiisoft/yii2-codeception": "*",
|
||||||
|
|||||||
40
composer.lock
generated
40
composer.lock
generated
@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "acfc873fb659d08adc23d325138a56b2",
|
"hash": "fa82e6ba1233a366a5f044d19a7bd69d",
|
||||||
"content-hash": "28e2bce30da929c84bd2ac7cffd90f3f",
|
"content-hash": "ea0b9fcfc8a270415b8f9292af1c17d3",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "almasaeed2010/adminlte",
|
"name": "almasaeed2010/adminlte",
|
||||||
@ -410,6 +410,42 @@
|
|||||||
"remarkable"
|
"remarkable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "bower-asset/webcamjs",
|
||||||
|
"version": "v1.0.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/jhuckaby/webcamjs.git",
|
||||||
|
"reference": "1f164b822507977bf746838c66b9e4332764c062"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/jhuckaby/webcamjs/zipball/1f164b822507977bf746838c66b9e4332764c062",
|
||||||
|
"reference": "1f164b822507977bf746838c66b9e4332764c062",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "bower-asset-library",
|
||||||
|
"extra": {
|
||||||
|
"bower-asset-main": "webcam.js",
|
||||||
|
"bower-asset-ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests",
|
||||||
|
"build.sh",
|
||||||
|
"demos",
|
||||||
|
"flash"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "HTML5 Webcam Image Capture Library with Flash Fallback",
|
||||||
|
"keywords": [
|
||||||
|
"webcam"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "bower-asset/yii2-pjax",
|
"name": "bower-asset/yii2-pjax",
|
||||||
"version": "v2.0.4",
|
"version": "v2.0.4",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class m151208_212339_alter__table__customer__add__column__key extends Migration
|
|||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
$this->addColumn("key", "id_key", "int");
|
$this->addColumn("customer", "id_key", "int");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151231_095117_alter__table__account_state__add__column__collection_money extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("account_state", "collection_money", "int");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -21,7 +21,7 @@ class AppAsset extends AssetBundle
|
|||||||
'css/site.css',
|
'css/site.css',
|
||||||
];
|
];
|
||||||
public $js = [
|
public $js = [
|
||||||
|
'js/app.js',
|
||||||
];
|
];
|
||||||
public $depends = [
|
public $depends = [
|
||||||
'yii\web\YiiAsset',
|
'yii\web\YiiAsset',
|
||||||
|
|||||||
31
frontend/assets/CustomerAsset.php
Normal file
31
frontend/assets/CustomerAsset.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @link http://www.yiiframework.com/
|
||||||
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||||
|
* @license http://www.yiiframework.com/license/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace frontend\assets;
|
||||||
|
|
||||||
|
use yii\web\AssetBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
class CustomerAsset extends AssetBundle
|
||||||
|
{
|
||||||
|
public $basePath = '@webroot';
|
||||||
|
public $baseUrl = '@web';
|
||||||
|
public $css = [
|
||||||
|
];
|
||||||
|
public $js = [
|
||||||
|
'js/customer.js',
|
||||||
|
];
|
||||||
|
public $depends = [
|
||||||
|
'frontend\assets\AppAsset',
|
||||||
|
'common\assets\MomentAsset',
|
||||||
|
'common\assets\WebcamjsAsset',
|
||||||
|
'yii\jui\JuiAsset',
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -8,17 +8,23 @@ use yii\widgets\DetailView;
|
|||||||
use yii\grid\GridView;
|
use yii\grid\GridView;
|
||||||
use yii\base\Object;
|
use yii\base\Object;
|
||||||
use yii\data\ArrayDataProvider;
|
use yii\data\ArrayDataProvider;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
class AccountStateBanknoteCountWidget extends Widget{
|
class AccountStateBanknoteCountWidget extends Widget{
|
||||||
|
|
||||||
public $model;
|
public $model;
|
||||||
public $layout;
|
public $layout;
|
||||||
|
public $index;
|
||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
|
|
||||||
$panelStyleClas = 'panel-default';
|
$panelStyleClas = 'panel-default';
|
||||||
if ( $this->model->hasDifferenceToPrevState()){
|
if ( $this->model->hasDifferenceToPrevState()){
|
||||||
$panelStyleClas = 'panel-danger';
|
if ( $this->model->hasPlus()){
|
||||||
|
$panelStyleClas = 'panel-success';
|
||||||
|
}else if ( $this->model->hasMinus() ){
|
||||||
|
$panelStyleClas = 'panel-danger';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = "";
|
$s = "";
|
||||||
@ -27,9 +33,67 @@ class AccountStateBanknoteCountWidget extends Widget{
|
|||||||
$s .= "Kassza művelet - " . $this->model->typeName;
|
$s .= "Kassza művelet - " . $this->model->typeName;
|
||||||
$s .= Html::endTag("div");
|
$s .= Html::endTag("div");
|
||||||
$s .= Html::beginTag("div",['class' => 'panel-body '] );
|
$s .= Html::beginTag("div",['class' => 'panel-body '] );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$s .= $this->generateInfoRow();
|
$s .= $this->generateInfoRow();
|
||||||
$s .= $this->generateNotes();
|
$s .= $this->generateNotes();
|
||||||
|
|
||||||
|
if ( $this->model->hasDifferenceToPrevState()){
|
||||||
|
|
||||||
|
$ft = " Ft";
|
||||||
|
$s .= DetailView::widget([
|
||||||
|
'model' => $this->model,
|
||||||
|
'template' =>"<tr><th>{label}</th><td style='text-align: right;'>{value} </td></tr>",
|
||||||
|
'attributes' => [
|
||||||
|
[
|
||||||
|
'label' => "Előző nyitás ideje",
|
||||||
|
'value' => $this->model->prevObject ? \Yii::$app->formatter->asDatetime( $this->model->prevObject->created_at) : "-",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Előzőleg nyitott",
|
||||||
|
'value' => $this->model->prevObject ? $this->model->user->username : "-",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Előző nyitás összege",
|
||||||
|
'value' => $this->model->prev_money.$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Bevételek összesen utolsó nyitás óta",
|
||||||
|
'value' => $this->model->collection_money .$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Zárás összege",
|
||||||
|
'value' => $this->model->money.$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Várt összeg",
|
||||||
|
'value' => $this->model->expected.$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Különbözet",
|
||||||
|
'value' => $this->model->signedDiff.$ft
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$s .= $this->generateComment();
|
$s .= $this->generateComment();
|
||||||
|
|
||||||
|
$s .= Html::beginTag("div", ['class' => 'row', 'style' => 'margin-top: 6px;']);
|
||||||
|
$s .= Html::beginTag("div", ['class' => 'col-md-12 text-right']);
|
||||||
|
|
||||||
|
$s .= Html::a('<span class="glyphicon glyphicon-trash"></span>Törlés', Url::toRoute(['delete','id' =>$this->model->id_account_state]), [
|
||||||
|
'title' => \Yii::t('yii', 'Delete'),
|
||||||
|
'data-confirm' =>\Yii::t('yii', 'Are you sure to delete this item?'),
|
||||||
|
'data-method' => 'post',
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'style' =>'margin-bottom: 12px;'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$s .= Html::endTag("div");//end col
|
||||||
|
$s .= Html::endTag("div");//end row
|
||||||
|
|
||||||
$s .= Html::endTag("div");
|
$s .= Html::endTag("div");
|
||||||
$s .= Html::endTag("div");
|
$s .= Html::endTag("div");
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use yii\helpers\Html;
|
|||||||
use common\models\MoneyMovement;
|
use common\models\MoneyMovement;
|
||||||
use yii\db\Query;
|
use yii\db\Query;
|
||||||
use common\models\AccountState;
|
use common\models\AccountState;
|
||||||
|
use backend\models\AccountSearch;
|
||||||
|
|
||||||
class FrontendMenuStructure{
|
class FrontendMenuStructure{
|
||||||
|
|
||||||
@ -20,8 +21,8 @@ class FrontendMenuStructure{
|
|||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->menuItems = [];
|
$this->menuItems = [];
|
||||||
|
|
||||||
$this->start = Yii::$app->formatter->asDatetime( strtotime('today UTC') );
|
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today') );
|
||||||
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
|
||||||
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
|
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
|
||||||
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
|
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ class FrontendMenuStructure{
|
|||||||
|
|
||||||
|
|
||||||
if ( $this->isLogged() ){
|
if ( $this->isLogged() ){
|
||||||
$lastAccountState = AccountState::find()->andWhere(['id_user' => Yii::$app->user->id])->orderBy(['account_state.created_at' => SORT_DESC])->limit(1)->one();
|
$lastAccountState = AccountState::find()->andWhere(['id_user' => Yii::$app->user->id])->andWhere(['type' => AccountState::TYPE_OPEN ])->orderBy(['account_state.created_at' => SORT_DESC])->limit(1)->one();
|
||||||
if ( isset($lastAccountState) ){
|
if ( isset($lastAccountState) ){
|
||||||
$this->start = Yii::$app->formatter->asDatetime(strtotime( $lastAccountState->created_at . ' UTC' ));
|
$this->start = Yii::$app->formatter->asDatetime(strtotime( $lastAccountState->created_at . ' UTC' ));
|
||||||
}
|
}
|
||||||
@ -67,6 +68,7 @@ class FrontendMenuStructure{
|
|||||||
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
|
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
|
||||||
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
||||||
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
|
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
|
||||||
|
['label' => Yii::t('frontend/transfer','Daily transfers'), 'url' => [ '/transfer/list', 'TransferListSearch[start]' => $this->start, 'TransferListSearch[end]' => $this->tomorrow ] ],
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( $isadmin || Yii::$app->user->can('reception.transfers') ){
|
if ( $isadmin || Yii::$app->user->can('reception.transfers') ){
|
||||||
|
|||||||
@ -84,6 +84,8 @@ class AccountStateController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function actionClose()
|
public function actionClose()
|
||||||
{
|
{
|
||||||
|
$lastStates = AccountState::readLastForUser(AccountState::TYPE_OPEN );
|
||||||
|
$lastStates = AccountState::modelsToArray($lastStates);
|
||||||
$model = new AccountState();
|
$model = new AccountState();
|
||||||
$model->type = AccountState::TYPE_CLOSE;
|
$model->type = AccountState::TYPE_CLOSE;
|
||||||
$model->id_user = Yii::$app->user->id;
|
$model->id_user = Yii::$app->user->id;
|
||||||
@ -97,6 +99,7 @@ class AccountStateController extends Controller
|
|||||||
return $this->render('close', [
|
return $this->render('close', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'accounts' => $accounts,
|
'accounts' => $accounts,
|
||||||
|
'lastStates' => $lastStates,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,13 +163,13 @@ class AccountStateController extends Controller
|
|||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
*/
|
||||||
public function actionDelete($id)
|
public function actionDelete($id)
|
||||||
{
|
{
|
||||||
$this->findModel($id)->delete();
|
$this->findModel($id)->delete();
|
||||||
|
\Yii::$app->session->setFlash( 'success','Kassza művelet törölve' );
|
||||||
return $this->redirect(['index']);
|
return $this->redirect(Yii::$app->request->referrer);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Displays a single AccountState model.
|
* Displays a single AccountState model.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
|
|||||||
@ -13,6 +13,7 @@ use yii\base\Object;
|
|||||||
use common\models\Card;
|
use common\models\Card;
|
||||||
use frontend\models\CustomerUpdate;
|
use frontend\models\CustomerUpdate;
|
||||||
use frontend\models\CustomerCreate;
|
use frontend\models\CustomerCreate;
|
||||||
|
use common\models\Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CustomerController implements the CRUD actions for Customer model.
|
* CustomerController implements the CRUD actions for Customer model.
|
||||||
@ -119,6 +120,7 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
$this->saveBinaryImage($model);
|
||||||
\Yii::$app->session->setFlash( 'success','Vendég létrehozva!' );
|
\Yii::$app->session->setFlash( 'success','Vendég létrehozva!' );
|
||||||
return $this->redirect(['update', 'number' => $model->cardNumber]);
|
return $this->redirect(['update', 'number' => $model->cardNumber]);
|
||||||
} else {
|
} else {
|
||||||
@ -160,6 +162,9 @@ class CustomerController extends Controller
|
|||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
|
||||||
|
$this->saveBinaryImage($model);
|
||||||
|
|
||||||
|
|
||||||
\Yii::$app->session->setFlash( 'success','Vendég módosításai elmentve' );
|
\Yii::$app->session->setFlash( 'success','Vendég módosításai elmentve' );
|
||||||
|
|
||||||
return $this->redirect(['update', 'number' => $card->number]);
|
return $this->redirect(['update', 'number' => $card->number]);
|
||||||
@ -175,6 +180,24 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function saveBinaryImage($model){
|
||||||
|
if ( !empty($model->photo_data)){
|
||||||
|
$encoded_data = $model->photo_data;
|
||||||
|
$binary_data = base64_decode( $encoded_data );
|
||||||
|
// save to server (beware of permissions)
|
||||||
|
$path = \common\components\Image::saveBinary($binary_data,'profile');
|
||||||
|
|
||||||
|
$image = new Image();
|
||||||
|
$image->path = $path;
|
||||||
|
$image->save();
|
||||||
|
|
||||||
|
//todo delete old image
|
||||||
|
|
||||||
|
$model->id_image = $image->id_image;
|
||||||
|
$model->save(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing Customer model.
|
* Deletes an existing Customer model.
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class ProductController extends Controller
|
|||||||
$model->customer = $this->customer;
|
$model->customer = $this->customer;
|
||||||
$model->card = $this->card;
|
$model->card = $this->card;
|
||||||
|
|
||||||
$products = Product::read();
|
$products = Product::readForDefaultAccount();
|
||||||
$products = Product::modelToMapIdName($products);
|
$products = Product::modelToMapIdName($products);
|
||||||
|
|
||||||
$model->products = $products;
|
$model->products = $products;
|
||||||
@ -199,7 +199,7 @@ class ProductController extends Controller
|
|||||||
public function actionLookup($query = null)
|
public function actionLookup($query = null)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
$product = Product::findProduct($query);
|
$product = Product::findProduct($query, Account::readDefault());
|
||||||
$product = Product::modelToArray($product);
|
$product = Product::modelToArray($product);
|
||||||
|
|
||||||
$result['product'] = $product;
|
$result['product'] = $product;
|
||||||
@ -207,7 +207,6 @@ class ProductController extends Controller
|
|||||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
|
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class TicketController extends FrontendController
|
|||||||
|
|
||||||
$discounts = Discount::read();
|
$discounts = Discount::read();
|
||||||
|
|
||||||
$ticketTypes = TicketType::read();
|
$ticketTypes = TicketType::read(null, Account::readDefault());
|
||||||
|
|
||||||
$accounts = Account::readAccounts();
|
$accounts = Account::readAccounts();
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ use yii\web\NotFoundHttpException;
|
|||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
use frontend\models\TransferMoneyMovementSearch;
|
use frontend\models\TransferMoneyMovementSearch;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
use frontend\models\TransferListSearch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferController implements the CRUD actions for Transfer model.
|
* TransferController implements the CRUD actions for Transfer model.
|
||||||
@ -55,13 +56,31 @@ class TransferController extends Controller
|
|||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
$searchModel->totalsTransfers(Yii::$app->request->queryParams);
|
$searchModel->totalsTransfers(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Transfer models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionList()
|
||||||
|
{
|
||||||
|
$searchModel = new TransferListSearch();
|
||||||
|
$searchModel->accounts = Account::read();
|
||||||
|
$searchModel->load(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
$searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->render('list', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,6 +95,7 @@ class TransferController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Transfer model.
|
* Creates a new Transfer model.
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
@ -139,11 +159,26 @@ class TransferController extends Controller
|
|||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
*/
|
||||||
public function actionDelete($id)
|
public function actionDelete($id)
|
||||||
{
|
{
|
||||||
$this->findModel($id)->delete();
|
$transfer = $this->findModel($id);
|
||||||
|
$connection = \Yii::$app->db;
|
||||||
|
$transaction = $connection->beginTransaction();
|
||||||
|
try {
|
||||||
|
if ( $transfer->delete() ){
|
||||||
|
\Yii::$app->session->setFlash( 'success','Tranzakció törölve' );
|
||||||
|
$transaction->commit();
|
||||||
|
}else{
|
||||||
|
throw new \Exception("Failed to save");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(Exception $e) {
|
||||||
|
$transaction->rollback();
|
||||||
|
\Yii::$app->session->setFlash( 'danger','Tranzakció törlése nem sikerült' );
|
||||||
|
}
|
||||||
|
|
||||||
return $this->redirect(['index']);
|
|
||||||
|
return $this->redirect(Yii::$app->request->referrer);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,6 +100,7 @@ class CustomerCreate extends \common\models\Customer
|
|||||||
[['zip'], 'string', 'max' => 8],
|
[['zip'], 'string', 'max' => 8],
|
||||||
|
|
||||||
[['city'], 'string', 'max' => 30],
|
[['city'], 'string', 'max' => 30],
|
||||||
|
[['photo_data'] ,'safe']
|
||||||
|
|
||||||
// [['email','phone'], 'validateEmailOrPhoneRequired' ],
|
// [['email','phone'], 'validateEmailOrPhoneRequired' ],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -100,7 +100,8 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
|
|
||||||
[['zip'], 'string', 'max' => 8],
|
[['zip'], 'string', 'max' => 8],
|
||||||
|
|
||||||
[['city'], 'string', 'max' => 30]
|
[['city'], 'string', 'max' => 30],
|
||||||
|
[['photo_data'] ,'safe']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,9 @@ class ReceptionForm extends Model
|
|||||||
|
|
||||||
public function readCard(){
|
public function readCard(){
|
||||||
|
|
||||||
$this->card = Card::find()->andWhere(['or',[ 'in','number' , [$this->number]],['in','rfid_key' ,[ $this->number]]])->one();
|
$this->number = str_replace("ö", "0", $this->number);
|
||||||
|
|
||||||
|
$this->card = Card::find()->andWhere(['or',[ 'in','number' , [$this->number]], ['in','rfid_key' ,[ $this->number]]])->one();
|
||||||
if ( $this->card != null ){
|
if ( $this->card != null ){
|
||||||
$this->customer = $this->card->customer;
|
$this->customer = $this->card->customer;
|
||||||
$this->readValidTickets();
|
$this->readValidTickets();
|
||||||
|
|||||||
23
frontend/models/TransferListSearch.php
Normal file
23
frontend/models/TransferListSearch.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\base\Object;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\db\Expression;
|
||||||
|
use common\models\Account;
|
||||||
|
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
/**
|
||||||
|
* TransferSearch represents the model behind the search form about `common\models\Transfer`.
|
||||||
|
*/
|
||||||
|
class TransferListSearch extends \common\models\TransferListSearch
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,13 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
use frontend\components\AccountStateBanknoteCountWidget;
|
use frontend\components\AccountStateBanknoteCountWidget;
|
||||||
use yii\base\Widget;
|
use yii\base\Widget;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo AccountStateBanknoteCountWidget::widget([
|
echo AccountStateBanknoteCountWidget::widget([
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
|
'index' => $index
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
if ( $index == 0){
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<?php ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,6 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
AccountStateAsset::register($this);
|
AccountStateAsset::register($this);
|
||||||
$options = [];
|
$options = [];
|
||||||
|
|
||||||
$this->registerJs ( 'new AccountState( '. json_encode($options).');' );
|
$this->registerJs ( 'new AccountState( '. json_encode($options).');' );
|
||||||
?>
|
?>
|
||||||
<div class="account-state-create">
|
<div class="account-state-create">
|
||||||
|
|||||||
@ -4,6 +4,8 @@ use frontend\model\ReceptionForm;
|
|||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\DetailView;
|
use yii\widgets\DetailView;
|
||||||
use yii\base\Widget;
|
use yii\base\Widget;
|
||||||
|
use common\components\Image;
|
||||||
|
use yii\helpers\Url;
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\model\ReceptionForm */
|
/* @var $model frontend\model\ReceptionForm */
|
||||||
|
|
||||||
@ -34,6 +36,12 @@ if ( $model->isCardWithCustomer() ){
|
|||||||
'label' => 'Telefon',
|
'label' => 'Telefon',
|
||||||
'value' => $model->customer->phone
|
'value' => $model->customer->phone
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'label' => 'Fénykép',
|
||||||
|
'value' => $model->customer->image1 ? Html::img( Url::base( ) . Image::thumb( $model->customer->image1->path,160,120 )) : 'Nincs kép',
|
||||||
|
'format' => 'raw'
|
||||||
|
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|||||||
29
frontend/views/customer/_camera.php
Normal file
29
frontend/views/customer/_camera.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
use frontend\assets\CustomerAsset;
|
||||||
|
use backend\models\CustomerCreate;
|
||||||
|
CustomerAsset::register($this);
|
||||||
|
$options = [];
|
||||||
|
|
||||||
|
|
||||||
|
if ( $model instanceof frontend\models\CustomerCreate){
|
||||||
|
$options['image_data' ] = 'customercreate-photo_data';
|
||||||
|
}else{
|
||||||
|
}
|
||||||
|
$this->registerJs ( 'new Customer( '. json_encode($options).');' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.photo{
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div id="my_camera" class='photo pull-left' style="width: 160px; height: 120px; margin-right: 12px;"></div>
|
||||||
|
<div id="my_result" class='photo pull-left' style="width: 160px; height: 120px;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a id="snap" class="btn btn-primary">Fénykép</a>
|
||||||
@ -16,7 +16,7 @@ use kartik\widgets\DatePicker;
|
|||||||
<div class="customer-form">
|
<div class="customer-form">
|
||||||
|
|
||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
<?= $form->field($model, 'photo_data')->hiddenInput()->label(false) ?>
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use yii\base\Widget;
|
|||||||
|
|
||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'photo_data')->hiddenInput()->label(false) ?>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?php //echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
<?php //echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
||||||
|
|||||||
@ -20,7 +20,7 @@ $card = $customer->card;
|
|||||||
<div class="customer-create">
|
<div class="customer-create">
|
||||||
|
|
||||||
<?php echo ReceptionWidget::widget( ['form' => $receptionForm, 'route' => ['customer/create'] ] )?>
|
<?php echo ReceptionWidget::widget( ['form' => $receptionForm, 'route' => ['customer/create'] ] )?>
|
||||||
|
<?php echo $this->render('_camera',['model' => $model]); ?>
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
<?= $this->render('_form_create', [
|
<?= $this->render('_form_create', [
|
||||||
|
|||||||
@ -4,10 +4,16 @@ use yii\helpers\Html;
|
|||||||
use frontend\components\ReceptionMenuWidget;
|
use frontend\components\ReceptionMenuWidget;
|
||||||
use frontend\components\ReceptionCardNumberWidget;
|
use frontend\components\ReceptionCardNumberWidget;
|
||||||
use frontend\components\ReceptionWidget;
|
use frontend\components\ReceptionWidget;
|
||||||
|
use common\assets\WebcamjsAsset;
|
||||||
|
use frontend\assets\CustomerAsset;
|
||||||
|
use common\components\Image;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Customer */
|
/* @var $model common\models\Customer */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->title = Yii::t('common/customer', 'Update customer:' ) . ' ' . $model->name;
|
$this->title = Yii::t('common/customer', 'Update customer:' ) . ' ' . $model->name;
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]];
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]];
|
||||||
@ -16,6 +22,8 @@ $this->params['breadcrumbs'][] = Yii::t('common/customer', 'Update');
|
|||||||
$customer = $model;
|
$customer = $model;
|
||||||
$card = $customer->card;
|
$card = $customer->card;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="customer-update">
|
<div class="customer-update">
|
||||||
|
|
||||||
@ -23,9 +31,18 @@ $card = $customer->card;
|
|||||||
<?php echo ReceptionWidget::widget( ['form' => $receptionForm, 'route' => ['customer/reception'] ] )?>
|
<?php echo ReceptionWidget::widget( ['form' => $receptionForm, 'route' => ['customer/reception'] ] )?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php echo $this->render('_camera',['model' => $model]); ?>
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?php if ( $model->image1 ){
|
||||||
|
echo Html::img( Url::base( ) . Image::thumb( $model->image1->path,160,120 ));
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
<?= $this->render('_form_update', [
|
<?= $this->render('_form_update', [
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ use common\widgets\Alert;
|
|||||||
use common\components\FrotnendMenuStructure;
|
use common\components\FrotnendMenuStructure;
|
||||||
use frontend\components\FrontendMenuStructure;
|
use frontend\components\FrontendMenuStructure;
|
||||||
use kartik\widgets\AlertBlock;
|
use kartik\widgets\AlertBlock;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
AppAsset::register($this);
|
AppAsset::register($this);
|
||||||
?>
|
?>
|
||||||
@ -23,6 +24,9 @@ AppAsset::register($this);
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<?= Html::csrfMetaTags() ?>
|
<?= Html::csrfMetaTags() ?>
|
||||||
<title><?= Html::encode($this->title) ?></title>
|
<title><?= Html::encode($this->title) ?></title>
|
||||||
|
<script>
|
||||||
|
var reception_card_url = '<?php echo Url::toRoute('customer/reception');?>';
|
||||||
|
</script>
|
||||||
<?php $this->head() ?>
|
<?php $this->head() ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -68,7 +72,14 @@ AppAsset::register($this);
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
||||||
|
|
||||||
<p class="pull-right"><?= Yii::powered() ?></p>
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Az oldalon szereplő adatok csak tájékoztató jellegűek.<br>
|
||||||
|
Az adatok helyességéért és igazságtartalmáért felelősséget nem vállalunk.<br>
|
||||||
|
Az oldal nem használható hivatalos adatforrásként.<br>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
use frontend\components\HtmlHelper;
|
use frontend\components\HtmlHelper;
|
||||||
|
use common\models\MoneyMovement;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\MoneyMovement */
|
/* @var $model common\models\MoneyMovement */
|
||||||
@ -18,6 +19,8 @@ $accountOptions = HtmlHelper::mkAccountOptions($accounts);
|
|||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'type')->dropDownList(MoneyMovement::types()) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
'accountName',
|
'accountName',
|
||||||
'userName',
|
'userName',
|
||||||
|
[
|
||||||
|
'attribute' => 'type',
|
||||||
|
'value' =>'humanType'
|
||||||
|
],
|
||||||
'name',
|
'name',
|
||||||
'money',
|
'money',
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
|
|||||||
@ -37,4 +37,7 @@ use yii\bootstrap\Html;
|
|||||||
<div class='col-md-3 '>
|
<div class='col-md-3 '>
|
||||||
<?php echo Html::a(Yii::t('frontend/product', "Paid"),null,[ 'id' => 'btn_pay_customer_cart', 'class' => 'btn btn-primary btn-block' , 'name' => 'payout_customer_cart']) ?>
|
<?php echo Html::a(Yii::t('frontend/product', "Paid"),null,[ 'id' => 'btn_pay_customer_cart', 'class' => 'btn btn-primary btn-block' , 'name' => 'payout_customer_cart']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-md-3 '>
|
||||||
|
<?php echo Html::a(Yii::t('frontend/product', "Frissít"),null,[ 'class' => 'btn btn-primary btn-block' , 'onclick' => 'location.reload();']) ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -40,4 +40,7 @@ use kartik\widgets\ActiveForm;
|
|||||||
<?php echo Html::submitButton( Yii::t('frontend/product', "Paid"), [ 'id' => 'btn_pay_user_cart', 'class' => 'btn btn-primary btn-block' , 'name' => 'payout_user_cart']) ?>
|
<?php echo Html::submitButton( Yii::t('frontend/product', "Paid"), [ 'id' => 'btn_pay_user_cart', 'class' => 'btn btn-primary btn-block' , 'name' => 'payout_user_cart']) ?>
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-md-3 '>
|
||||||
|
<?php echo Html::a(Yii::t('frontend/product', "Frissít"),null,[ 'class' => 'btn btn-primary btn-block' , 'onclick' => 'location.reload();']) ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -6,6 +6,7 @@ use frontend\assets\ProductSellAsset;
|
|||||||
use frontend\components\ReceptionWidget;
|
use frontend\components\ReceptionWidget;
|
||||||
use yii\bootstrap\ActiveForm;
|
use yii\bootstrap\ActiveForm;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $form yii\bootstrap\ActiveForm */
|
/* @var $form yii\bootstrap\ActiveForm */
|
||||||
@ -78,9 +79,11 @@ $this->params['breadcrumbs'][] = Yii::t('frontend/product', 'Sale');
|
|||||||
.table-transfers .product-money{
|
.table-transfers .product-money{
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
.typeahead.dropdown-menu{
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php echo ReceptionWidget::widget( ['form' => $receptionForm, 'route' => ['customer/reception'] ] )?>
|
<?php echo ReceptionWidget::widget( ['form' => $receptionForm, 'route' => ['customer/reception'] ] )?>
|
||||||
|
|
||||||
<div class='row '>
|
<div class='row '>
|
||||||
|
|||||||
@ -30,6 +30,7 @@ $options['clear_cart_url'] = Url::toRoute(['product/clear-list']);
|
|||||||
$options['types'] = TicketType::modelsToArray($ticketTypes);
|
$options['types'] = TicketType::modelsToArray($ticketTypes);
|
||||||
$options['user_cart'] = $model->userCart;
|
$options['user_cart'] = $model->userCart;
|
||||||
$options['customer_cart'] = $model->customerCart;
|
$options['customer_cart'] = $model->customerCart;
|
||||||
|
$options['selected_type'] = count($ticketTypes) > 0 ? $ticketTypes[0]->id_ticket_type : 0;
|
||||||
|
|
||||||
$this->registerJs ( 'new TicketSell( '. json_encode($options).');' );
|
$this->registerJs ( 'new TicketSell( '. json_encode($options).');' );
|
||||||
?>
|
?>
|
||||||
|
|||||||
59
frontend/views/transfer/_search_list.php
Normal file
59
frontend/views/transfer/_search_list.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?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 );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
@ -35,6 +37,9 @@ $formatter = Yii::$app->formatter;
|
|||||||
<dl class="dl-horizontal dl-transfer">
|
<dl class="dl-horizontal dl-transfer">
|
||||||
<dt><?php echo $model->getAttributeLabel( 'type') ?></dt>
|
<dt><?php echo $model->getAttributeLabel( 'type') ?></dt>
|
||||||
<dd><?php echo Html::getAttributeValue($model, 'transferTypeName') ?></dd>
|
<dd><?php echo Html::getAttributeValue($model, 'transferTypeName') ?></dd>
|
||||||
|
|
||||||
|
<dt>Megnevezés</dt>
|
||||||
|
<dd><?php echo Html::getAttributeValue($model, 'objectName') ?></dd>
|
||||||
|
|
||||||
<dt><?php echo $model->getAttributeLabel( 'id_user') ?></dt>
|
<dt><?php echo $model->getAttributeLabel( 'id_user') ?></dt>
|
||||||
<dd><?php echo Html::getAttributeValue($model, 'userName') ?></dd>
|
<dd><?php echo Html::getAttributeValue($model, 'userName') ?></dd>
|
||||||
@ -59,6 +64,17 @@ $formatter = Yii::$app->formatter;
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-11 text-right">
|
||||||
|
<?php echo Html::a('<span class="glyphicon glyphicon-trash"></span>Törlés', Url::toRoute(['delete','id' =>$model->id_transfer]), [
|
||||||
|
'title' => Yii::t('yii', 'Delete'),
|
||||||
|
'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'),
|
||||||
|
'data-method' => 'post',
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
// 'style' =>'margin-right: 12px;'
|
||||||
|
]);?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
399
frontend/views/transfer/list.php
Normal file
399
frontend/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>
|
||||||
71
frontend/web/js/app.js
Normal file
71
frontend/web/js/app.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
var enterPressed;
|
||||||
|
var keyDate;
|
||||||
|
var seq = '';
|
||||||
|
$(document).ready(
|
||||||
|
function(){
|
||||||
|
|
||||||
|
$("input[name='number']").on('focus', function (e) {
|
||||||
|
$(this)
|
||||||
|
.one('mouseup', function () {
|
||||||
|
$(this).select();
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
.select();
|
||||||
|
});
|
||||||
|
|
||||||
|
addDocumentKeypressedListener();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
function addDocumentKeypressedListener(){
|
||||||
|
$( document ).keypress(function( event ) {
|
||||||
|
var tag = event.target.tagName.toLowerCase();
|
||||||
|
if ( tag != 'input' && tag != 'textarea' && tag != 'select') {
|
||||||
|
|
||||||
|
resetSequenceIfToMuchTimePassedOrEnterWasPressed(event);
|
||||||
|
|
||||||
|
if ( event.which == 13 ) {
|
||||||
|
enterPressed = 1;
|
||||||
|
if ( seq ){
|
||||||
|
$( document ).trigger( "wordtyped", [ { originalEvent: event, 'word': seq } ] );
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
appendCharToSeq(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$( document ).on( "wordtyped", function( event, data ) {
|
||||||
|
var word;
|
||||||
|
word = data.word;
|
||||||
|
if ( word && word.length > 0){
|
||||||
|
|
||||||
|
location.href= reception_card_url +'&number=' + word;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function resetSequenceIfToMuchTimePassedOrEnterWasPressed(){
|
||||||
|
var prevDate, timePassed;
|
||||||
|
prevDate= keyDate;
|
||||||
|
keyDate = new Date().getTime();
|
||||||
|
timePassed = keyDate - prevDate;
|
||||||
|
if ( enterPressed > 0 || timePassed > 2000 ){
|
||||||
|
seq = '';
|
||||||
|
enterPressed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendCharToSeq(event){
|
||||||
|
var code,s;
|
||||||
|
code = event.which;
|
||||||
|
if ( code ){
|
||||||
|
s = String.fromCharCode(code);
|
||||||
|
if ( s )
|
||||||
|
seq += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
43
frontend/web/js/customer.js
Normal file
43
frontend/web/js/customer.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
function Customer(o){
|
||||||
|
|
||||||
|
var defaults = {
|
||||||
|
'image_data' : 'customerupdate-photo_data'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
|
||||||
|
defaults = $.extend(defaults,o);
|
||||||
|
|
||||||
|
Webcam.set({
|
||||||
|
width: 160,
|
||||||
|
height: 120,
|
||||||
|
dest_width: 320,
|
||||||
|
dest_height: 240,
|
||||||
|
image_format: 'jpeg',
|
||||||
|
jpeg_quality: 90,
|
||||||
|
// force_flash: false,
|
||||||
|
// flip_horiz: true,
|
||||||
|
// fps: 45
|
||||||
|
});
|
||||||
|
|
||||||
|
Webcam.attach( '#my_camera' );
|
||||||
|
|
||||||
|
$("#snap").click(snap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function snap(){
|
||||||
|
Webcam.snap( function(data_uri) {
|
||||||
|
document.getElementById('my_result').innerHTML = '<img width="160" height="120" src="'+data_uri+'"/>';
|
||||||
|
|
||||||
|
var raw_image_data = data_uri.replace(/^data\:image\/\w+\;base64\,/, '');
|
||||||
|
|
||||||
|
document.getElementById(defaults.image_data ).value = raw_image_data;
|
||||||
|
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -52,7 +52,7 @@ function ProductSell(o){
|
|||||||
addPayoutButtons();
|
addPayoutButtons();
|
||||||
|
|
||||||
productChanged();
|
productChanged();
|
||||||
addDocumentKeypressedListener();
|
// addDocumentKeypressedListener();
|
||||||
|
|
||||||
initAutocomplete();
|
initAutocomplete();
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@ function ProductSell(o){
|
|||||||
var $input = $('#product_search');
|
var $input = $('#product_search');
|
||||||
$input.typeahead({source: app.defaults.products,
|
$input.typeahead({source: app.defaults.products,
|
||||||
autoSelect: true,
|
autoSelect: true,
|
||||||
items: 12,
|
items: 20,
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
// displayText: function (item){
|
// displayText: function (item){
|
||||||
// return item.
|
// return item.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user