add ticket original end and original price
add helper links to related object in admin
This commit is contained in:
@@ -22,7 +22,7 @@ class LogController extends \backend\controllers\BackendController
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => [ 'index' ],
|
||||
'actions' => [ 'index','view' ],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee','reception'],
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use common\models\Log;
|
||||
use common\models\Transfer;
|
||||
use Yii;
|
||||
use common\models\Ticket;
|
||||
@@ -459,6 +460,13 @@ class TicketController extends \backend\controllers\BackendController {
|
||||
|
||||
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||
|
||||
|
||||
Log::log([
|
||||
'type' =>Log::$TYPE_TICKET_UPDATED_BY_ADMIN,
|
||||
'id_ticket' => $model->id_ticket,
|
||||
'message' => 'Bérlet módosítva'
|
||||
]);
|
||||
|
||||
Helper::flash("success", "Bérlet sikeresen módosítva");
|
||||
|
||||
$url = Url::previous("ticket_index_customer");
|
||||
|
||||
@@ -20,6 +20,7 @@ class LogSearch extends Log
|
||||
public $timestampStart;
|
||||
public $timestampEnd;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -99,12 +100,12 @@ class LogSearch extends Log
|
||||
$query->andFilterWhere([
|
||||
'id_log' => $this->id_log,
|
||||
'type' => $this->type,
|
||||
'id_user' => $this->id_user,
|
||||
'log.id_user' => $this->id_user,
|
||||
'id_transfer' => $this->id_transfer,
|
||||
'id_money_movement' => $this->id_money_movement,
|
||||
'id_ticket' => $this->id_ticket,
|
||||
'id_sale' => $this->id_sale,
|
||||
'id_customer' => $this->id_customer,
|
||||
'log.id_customer' => $this->id_customer,
|
||||
'id_account' => $this->id_account,
|
||||
'id_account_state' => $this->id_account_state,
|
||||
'id_key' => $this->id_key,
|
||||
|
||||
@@ -41,6 +41,8 @@ class TicketSearch extends Ticket
|
||||
public $customer_name;
|
||||
public $card_number;
|
||||
|
||||
public $modified;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -48,13 +50,13 @@ class TicketSearch extends Ticket
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id_ticket', 'id_user', 'id_ticket_type', 'id_account', 'status', 'id_customer'], 'integer'],
|
||||
[['id_ticket', 'id_user', 'id_ticket_type', 'id_account', 'status', 'id_customer', 'modified'], 'integer'],
|
||||
// [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
// [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[['start',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'timestampStart', 'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm', 'timeZone' => 'UTC'],
|
||||
[['end',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'timestampEnd', 'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm', 'timeZone' => 'UTC'],
|
||||
[['valid_in_interval', 'created_in_interval', 'expire_in_interval', 'paid_in_interval'], 'boolean'],
|
||||
[['output', 'customer_name','card_number'], 'safe']
|
||||
[['output', 'customer_name', 'card_number'], 'safe']
|
||||
|
||||
];
|
||||
}
|
||||
@@ -77,6 +79,7 @@ class TicketSearch extends Ticket
|
||||
'created_in_interval' => Yii::t('backend/ticket', 'Created in interval'),
|
||||
'expire_in_interval' => Yii::t('backend/ticket', 'Expire in interval'),
|
||||
'paid_in_interval' => "Fizetve az időszakban",
|
||||
'modified' => "Módosított",
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -192,6 +195,19 @@ class TicketSearch extends Ticket
|
||||
'card.number' => $this->card_number
|
||||
]);
|
||||
|
||||
if ($this->modified == 1) {
|
||||
$query->andWhere(
|
||||
[
|
||||
'or',
|
||||
['and', ['not', ['ticket.original_price' => null]], ['<>', 'ticket.original_price', 'ticket.price_brutto']],
|
||||
['and', ['not', ['ticket.original_end' => null]], ['<>', 'ticket.original_end', 'ticket.end']],
|
||||
|
||||
]
|
||||
);
|
||||
// $query->andWhere('ticket.original_price is not null and ticket.original_price <> ticket.price_brutto');
|
||||
// $query->andWhere('ticket.original_end is not null and ticket.original_end <> ticket.end');
|
||||
}
|
||||
|
||||
$query->andFilterWhere(['like', new Expression('LOWER(customer.name)'), strtolower($this->customer_name)]);
|
||||
|
||||
$all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) && !($this->paid_in_interval))
|
||||
@@ -232,7 +248,8 @@ class TicketSearch extends Ticket
|
||||
}
|
||||
|
||||
|
||||
public function isAllDateConditionOn(){
|
||||
public function isAllDateConditionOn()
|
||||
{
|
||||
$all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) && !($this->paid_in_interval))
|
||||
||
|
||||
($this->valid_in_interval == true && $this->expire_in_interval == true && $this->created_in_interval && $this->paid_in_interval);
|
||||
|
||||
@@ -30,4 +30,23 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<?php
|
||||
$customer = $model->customer;
|
||||
if (isset($customer)) {
|
||||
?>
|
||||
<?= DetailView::widget(
|
||||
['model' => $customer,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'id_customer',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($customer->name, ['customer/view', 'id' => $customer->id_customer]),
|
||||
'label' => 'Vendég'
|
||||
|
||||
]
|
||||
]]) ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,8 @@ use kartik\widgets\DateTimePicker;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\LogSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
|
||||
$userOptions = ['' => 'Mind'] + \yii\helpers\ArrayHelper::map(\common\models\User::read (), 'id', 'username');
|
||||
?>
|
||||
|
||||
<div class="log-search">
|
||||
@@ -39,6 +41,18 @@ use kartik\widgets\DateTimePicker;
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
|
||||
<?= $form->field($model, 'type')->dropDownList( ["" =>"Mind"] + \common\models\Log::getTypes()) ?>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<?= $form->field($model, 'id_user')->dropDownList( $userOptions ) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -53,7 +53,19 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
// 'id_door_log',
|
||||
// 'updated_at',
|
||||
|
||||
// ['class' => 'yii\grid\ActionColumn'],
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}',
|
||||
'urlCreator' => function($action, $model, $key, $index){
|
||||
$result = "";
|
||||
|
||||
if ( $action == 'view'){
|
||||
$result = \yii\helpers\Url::toRoute(['log/view','id' => $model['log_id_log']]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
|
||||
@@ -13,32 +13,43 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<div class="log-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('common/log', 'Update'), ['update', 'id' => $model->id_log], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('common/log', 'Delete'), ['delete', 'id' => $model->id_log], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('common/log', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_log',
|
||||
'type',
|
||||
[
|
||||
'attribute' => 'type',
|
||||
// 'format' => 'raw',
|
||||
'value' =>$model->typeName,
|
||||
'label' => 'Típus'
|
||||
|
||||
],
|
||||
'message',
|
||||
'url:ntext',
|
||||
'app',
|
||||
'id_user',
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->userName, ['user/view', 'id' => $model->id_user]),
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_ticket',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->ticketName, ['ticket/view', 'id' => $model->id_ticket]),
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_customer',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->customerName, ['customer/view', 'id' => $model->id_customer]),
|
||||
|
||||
],
|
||||
'id_transfer',
|
||||
'id_money_movement',
|
||||
'id_ticket',
|
||||
|
||||
|
||||
'id_sale',
|
||||
'id_customer',
|
||||
'id_account',
|
||||
'id_account_state',
|
||||
'id_key',
|
||||
|
||||
@@ -57,6 +57,7 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
|
||||
<?= $form->field($model, 'card_number')->textInput()->label("Kártyaszám") ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'modified')->dropDownList( ["" =>"Mind", '1' => 'Módosított'] ) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ $this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'),
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="ticket-view">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<h1>Bérlet információ: #<?= Html::encode($this->title) ?></h1>
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
@@ -23,12 +23,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_ticket_type',
|
||||
'value' => $model->ticketTypeName,
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->ticketTypeName, ['ticket-type/view', 'id' => $model->id_ticket_type]),
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_account',
|
||||
'value' => $model->accountName,
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->accountName, ['account/view', 'id' => $model->id_account]),
|
||||
|
||||
],
|
||||
[
|
||||
@@ -45,9 +47,75 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'value' => $model->statusName
|
||||
],
|
||||
'price_brutto',
|
||||
[
|
||||
'attribute' => 'price_brutto',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->price_brutto, ['transfer/view', 'id' => $model->transfer->id_transfer]),
|
||||
|
||||
],
|
||||
'comment:raw',
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
'original_end:date',
|
||||
'original_price',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
||||
<h3>Bérletkártya</h3>
|
||||
<?php
|
||||
|
||||
echo DetailView::widget([
|
||||
'model' => $model->card,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'number',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->card->number, ['card/view', 'id' => $model->card->id_card]),
|
||||
]
|
||||
]]);
|
||||
|
||||
?>
|
||||
|
||||
<h3>Vendég</h3>
|
||||
<?php
|
||||
|
||||
echo DetailView::widget([
|
||||
'model' => $model->customer,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'name',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($model->customer->name, ['customer/view', 'id' => $model->customer->id_customer]),
|
||||
]
|
||||
|
||||
]]);
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
$contract = $model->contract;
|
||||
if (isset($contract)) {
|
||||
?>
|
||||
<h3>Szerződés</h3>
|
||||
<?php
|
||||
|
||||
echo DetailView::widget([
|
||||
'model' => $contract,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'id_contract',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($contract->id_contract, ['contract/details', 'id' => $contract->id_contract]),
|
||||
]
|
||||
|
||||
]]);
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
use common\components\RoleDefinition;
|
||||
@@ -10,67 +11,107 @@ use common\models\Transfer;
|
||||
|
||||
$this->title = $model->id_transfer;
|
||||
$this->params ['breadcrumbs'] [] = [
|
||||
'label' => Yii::t ( 'frontend/transfer', 'Transfers' ),
|
||||
'url' => [
|
||||
'index'
|
||||
]
|
||||
'label' => Yii::t('frontend/transfer', 'Transfers'),
|
||||
'url' => [
|
||||
'index'
|
||||
]
|
||||
];
|
||||
$this->params ['breadcrumbs'] [] = $this->title;
|
||||
?>
|
||||
<div class="transfer-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?=DetailView::widget (
|
||||
[ 'model' => $model,
|
||||
'attributes' => [
|
||||
[ 'attribute' => 'id_transfer' ],
|
||||
[ 'attribute' => 'id_account','value' => $model->accountName ],
|
||||
[ 'attribute' => 'type','value' => $model->transferTypeName ],
|
||||
[ 'attribute' => 'id_object','value' => $model->objectName ],
|
||||
[ 'attribute' => 'id_user','value' => $model->userName ],
|
||||
[ 'attribute' => 'id_discount','value' => $model->discountName ],
|
||||
[ 'attribute' => 'payment_method','value' => $model->paymentMethodName ],
|
||||
[ 'attribute' => 'status','value' => $model->statusName ],
|
||||
'item_price',
|
||||
'count',
|
||||
'money',
|
||||
'comment',
|
||||
'created_at',
|
||||
'paid_at' ] ] )?>
|
||||
</div>
|
||||
</div>
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?= DetailView::widget(
|
||||
['model' => $model,
|
||||
'attributes' => [
|
||||
['attribute' => 'id_transfer'],
|
||||
['attribute' => 'id_account', 'value' => $model->accountName],
|
||||
['attribute' => 'type', 'value' => $model->transferTypeName],
|
||||
['attribute' => 'id_object', 'value' => $model->objectName],
|
||||
['attribute' => 'id_user', 'value' => $model->userName],
|
||||
['attribute' => 'id_discount', 'value' => $model->discountName],
|
||||
['attribute' => 'payment_method', 'value' => $model->paymentMethodName],
|
||||
['attribute' => 'status', 'value' => $model->statusName],
|
||||
'item_price',
|
||||
'count',
|
||||
'money',
|
||||
'comment',
|
||||
'created_at',
|
||||
'paid_at']]) ?>
|
||||
|
||||
|
||||
<?php
|
||||
if ($model->type == Transfer::TYPE_TICKET) {
|
||||
$ticket = $model->ticket;
|
||||
?>
|
||||
<?= DetailView::widget(
|
||||
['model' => $ticket,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'id_ticket_type',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($ticket->ticketTypeName, ['ticket/view', 'id' => $ticket->id_ticket]),
|
||||
'label' => 'Bérlet'
|
||||
|
||||
]
|
||||
]]) ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$customer = $model->customer;
|
||||
if (isset($customer)) {
|
||||
?>
|
||||
<?= DetailView::widget(
|
||||
['model' => $customer,
|
||||
'attributes' => [
|
||||
[
|
||||
'attribute' => 'id_customer',
|
||||
'format' => 'raw',
|
||||
'value' => Html::a($customer->name, ['customer/view', 'id' => $customer->id_customer]),
|
||||
'label' => 'Vendég'
|
||||
|
||||
]
|
||||
]]) ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if (RoleDefinition::isAdmin () ) {
|
||||
if (RoleDefinition::isAdmin()) {
|
||||
|
||||
if ( $model->type == Transfer::TYPE_TICKET ){
|
||||
if ($model->type == Transfer::TYPE_TICKET) {
|
||||
|
||||
if ($model->status == Transfer::STATUS_STORNO || $model->status == Transfer::STATUS_PAID ) {
|
||||
if ($model->status == Transfer::STATUS_STORNO || $model->status == Transfer::STATUS_PAID) {
|
||||
|
||||
?>
|
||||
<p>Sztornózott vagy fizetett bérlet fizetettlenre állítása: </p>
|
||||
<ul>
|
||||
<li>A tranzakció státusza fizetetlen lesz</li>
|
||||
<li>A bérlet státusza inaktív lesz ( a bérlettel nem lehet bemenni a forgó kapun)</li>
|
||||
<li>A bérlet a vásárló kosarába kerül</li>
|
||||
</ul>
|
||||
<?php
|
||||
?>
|
||||
<p>Sztornózott vagy fizetett bérlet fizetettlenre állítása: </p>
|
||||
<ul>
|
||||
<li>A tranzakció státusza fizetetlen lesz</li>
|
||||
<li>A bérlet státusza inaktív lesz ( a bérlettel nem lehet bemenni a forgó kapun)</li>
|
||||
<li>A bérlet a vásárló kosarába kerül</li>
|
||||
</ul>
|
||||
<?php
|
||||
|
||||
echo Html::a ( "Bérlet fizetetlennek jelölése és vásárló kosarába helyezése", [
|
||||
'transfer/unstorno',
|
||||
'id' => $model->id_transfer
|
||||
], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data-confirm' => "Figyelem, a bérlet fizetetlennek lesz jelölve !!",
|
||||
'data-method' => 'post'
|
||||
] );
|
||||
}
|
||||
}
|
||||
echo Html::a("Bérlet fizetetlennek jelölése és vásárló kosarába helyezése", [
|
||||
'transfer/unstorno',
|
||||
'id' => $model->id_transfer
|
||||
], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data-confirm' => "Figyelem, a bérlet fizetetlennek lesz jelölve !!",
|
||||
'data-method' => 'post'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -101,4 +101,11 @@ class DateUtil
|
||||
return $formatter->asDatetime($dateTimeObject);
|
||||
}
|
||||
|
||||
public static function parseDate($dateString){
|
||||
|
||||
$date = \DateTime::createFromFormat("Y.m.d", $dateString, new \DateTimeZone( 'UTC'));
|
||||
$date->setTime(0, 0, 0);
|
||||
return $date;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace common\components;
|
||||
|
||||
use common\models\TicketType;
|
||||
use common\models\Transfer;
|
||||
use \Yii;
|
||||
|
||||
@@ -494,4 +495,39 @@ class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $start \DateTime datetime
|
||||
* @param $ticketType \common\models\TicketType the ticket type
|
||||
*/
|
||||
public static function getTicketExpirationDate($start,$ticketType){
|
||||
$result = new \DateTime();
|
||||
$result->setTimezone(new \DateTimeZone("UTC") );
|
||||
$result->setTimestamp($start->getTimestamp());
|
||||
|
||||
|
||||
$unitCount = $ticketType->time_unit_count;
|
||||
$unitType = $ticketType->time_unit_type;
|
||||
|
||||
switch ($unitType){
|
||||
case TicketType::TIME_UNIT_DAY:
|
||||
$result->add(new \DateInterval("P".$unitCount."D"));
|
||||
$result->sub(new \DateInterval("P1D"));
|
||||
break;
|
||||
case TicketType::TIME_UNIT_MONTH:
|
||||
$result->add(new \DateInterval("P".$unitCount."M"));
|
||||
$result->sub(new \DateInterval("P1D"));
|
||||
break;
|
||||
case TicketType::TIME_UNIT_MONTH_REFERENCE:
|
||||
if ( $unitCount > 1 ){
|
||||
$result->add(new \DateInterval("P". ($unitCount -1 )."M"));
|
||||
}
|
||||
$result->sub(new \DateInterval("P1D"));
|
||||
break;
|
||||
}
|
||||
|
||||
$result->setTime(0, 0, 0);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use common\components\Helper;
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use yii\helpers\VarDumper;
|
||||
@@ -54,6 +55,43 @@ class Log extends BaseFitnessActiveRecord
|
||||
public static $TYPE_TOWEL_IN = 190;
|
||||
public static $TYPE_TOWEL_OUT = 200;
|
||||
public static $TYPE_CRUD = 210;
|
||||
public static $TYPE_TICKET_UPDATED_BY_ADMIN = 220;
|
||||
|
||||
|
||||
public static function getTypes(){
|
||||
return [
|
||||
|
||||
Log::$TYPE_INFO => "Info",
|
||||
Log::$TYPE_ERR => "Hiba",
|
||||
Log::$TYPE_TICKET_USAGE_FIRST => "Bérlet használat",
|
||||
Log::$TYPE_TICKET_USAGE_MULTIPLE => "Többszöri bérlet használat",
|
||||
Log::$TYPE_LOGIN => "Bejelentkezés",
|
||||
Log::$TYPE_DEFAULT_ACCOUNT=> "Alapértelmezett kassza",
|
||||
Log::$TYPE_CREATE_CUSTOMER=> "Új vendég",
|
||||
Log::$TYPE_PROCUREMENT_UPDATE => "Beszerzés módosítás",
|
||||
Log::$TYPE_TICKET_COUNT_MOVE_OUT => "Ki mozgás",
|
||||
Log::$TYPE_WASTE => "Selejt",
|
||||
Log::$TYPE_NEWSLETTER_SUBSCRIBE => "Feliratkozás hirlevélre",
|
||||
Log::$TYPE_NEWSLETTER_UNSUBSCRIBE => "Leiratkozás hírlevélről",
|
||||
Log::$TYPE_NEWSLETTER_SENT => "Hirlevél elküldve",
|
||||
Log::$TYPE_TICKET_EXPIRE_SENT => "Bérlet lejáart figyelmeztetés elküldve",
|
||||
Log::$TYPE_NEWSLETTER_SEND_START => "Hirlevél küldés start",
|
||||
Log::$TYPE_NEWSLETTER_SEND_END => "Hirlevél küldés vége",
|
||||
Log::$TYPE_KEY_ASSIGN => "Kulcs kiadás",
|
||||
Log::$TYPE_KEY_UNASSIGN => "Kulcs visszaadás",
|
||||
Log::$TYPE_TOWEL_IN => "Törölköző ki",
|
||||
Log::$TYPE_TOWEL_OUT => "Törölköző vissza",
|
||||
Log::$TYPE_CRUD => "CRUD",
|
||||
Log::$TYPE_TICKET_UPDATED_BY_ADMIN => "Bérlet módosítás"
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeName(){
|
||||
$types = Log::getTypes();
|
||||
return Helper::getArrayValue($types,$this->type,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -133,4 +171,46 @@ class Log extends BaseFitnessActiveRecord
|
||||
$model->save(false);
|
||||
}
|
||||
|
||||
public function getUser(){
|
||||
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
|
||||
}
|
||||
|
||||
public function getTicket(){
|
||||
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket" ] );
|
||||
}
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
|
||||
}
|
||||
|
||||
public function getMoneyMovement(){
|
||||
return $this->hasOne( MoneyMovement::className(), ["id_money_movement" =>"id_money_movement" ] );
|
||||
}
|
||||
|
||||
|
||||
public function getUserName(){
|
||||
$user = $this->user;
|
||||
if ( isset($user)){
|
||||
return $user->username;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getCustomerName(){
|
||||
$customer = $this->customer;
|
||||
if ( isset($customer)){
|
||||
return $customer->name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTicketName(){
|
||||
$ticket = $this->ticket;
|
||||
if ( isset($ticket)){
|
||||
return $ticket->ticketTypeName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ use common\components\Helper;
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property int id_contract
|
||||
* @property integer $original_price
|
||||
* @property string $original_end;
|
||||
*
|
||||
* @property \common\models\Card card
|
||||
*/
|
||||
@@ -141,6 +143,8 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
||||
'id_card' => Yii::t('backend/ticket','Card'),
|
||||
'id_customer' => Yii::t('backend/ticket','Customer'),
|
||||
'payment_method' => Yii::t('common/transfer', 'Fizetési mód'),
|
||||
'original_price' => Yii::t('common/transfer', 'Eredeti ár'),
|
||||
'original_end' => Yii::t('common/transfer', 'Eredeti érvényesség vége'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -153,6 +157,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
||||
return $this->hasOne( Contract::className(), ["id_contract" =>"id_contract" ] );
|
||||
}
|
||||
|
||||
public function getTransfer(){
|
||||
return $this->hasOne( Transfer::className(), ["id_object" =>"id_ticket"] )->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||
}
|
||||
|
||||
public function getCardNumber(){
|
||||
$result = "";
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
|
||||
@@ -197,6 +197,13 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
||||
"id_transfer" => "id_transfer"
|
||||
] );
|
||||
}
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->hasOne ( Customer::className (), [
|
||||
"id_customer" => "id_customer"
|
||||
] );
|
||||
}
|
||||
|
||||
public function getSale() {
|
||||
return $this->hasOne ( Sale::className (), [
|
||||
"id_sale" => "id_object"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m170902_211224_add_column_original_expiration_date_and_price extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn("ticket", "original_end","datetime DEFAULT NULL");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m170902_211224_add_column_original_expiration_date_and_price cannot be reverted.\n";
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace frontend\models;
|
||||
|
||||
use common\components\DateUtil;
|
||||
use common\models\Ticket;
|
||||
use common\models\TicketType;
|
||||
use common\models\Account;
|
||||
@@ -156,6 +157,13 @@ class TicketCreate extends Ticket{
|
||||
}else{
|
||||
$this->part_count = 0;
|
||||
}
|
||||
|
||||
if ( isset($ticketType )){
|
||||
$this->original_price = $ticketType->price_brutto;
|
||||
$start = DateUtil::parseDate($this->start);
|
||||
$original_end = Helper::getTicketExpirationDate($start,$ticketType);
|
||||
$this->original_end = DateUtil::formatDateUtc($original_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
||||
@@ -13,4 +13,37 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<p>This is the About page. You may modify the following file to customize its content:</p>
|
||||
|
||||
<code><?= __FILE__ ?></code>
|
||||
<p>
|
||||
|
||||
<?php
|
||||
|
||||
$dt = new DateTime();
|
||||
|
||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
$dt->sub( new DateInterval( 'P2D') );
|
||||
|
||||
|
||||
echo \common\components\DateUtil::formatUtc($dt);
|
||||
|
||||
echo " - ";
|
||||
|
||||
$ticketType = new \common\models\TicketType();
|
||||
$ticketType->time_unit_type = \common\models\TicketType::TIME_UNIT_DAY;
|
||||
$ticketType->time_unit_count = 3;
|
||||
|
||||
$dt2 = \common\components\Helper::getTicketExpirationDate($dt, $ticketType);
|
||||
echo \common\components\DateUtil::formatUtc($dt2);
|
||||
|
||||
// $dt2 = \common\components\Helper::getTicketExpirationDate($dt, $ticketType);
|
||||
// echo \common\components\DateUtil::formatUtc($dt2);
|
||||
|
||||
|
||||
// $dt = \common\components\DateUtil::addMonth($dt,1);
|
||||
// echo \common\components\DateUtil::formatUtc($dt);
|
||||
// $dt = \common\components\DateUtil::addMonth($dt,1);
|
||||
// echo \common\components\DateUtil::formatUtc($dt);
|
||||
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user