add reception key changes, add money movent storno, status display

This commit is contained in:
2016-01-22 19:10:30 +01:00
parent a2a6b1f240
commit 027a96790a
24 changed files with 220 additions and 25 deletions

View File

@@ -9,6 +9,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Account;
use common\models\Transfer;
/**
* MoneyMovementController implements the CRUD actions for MoneyMovement model.
@@ -66,6 +67,7 @@ class MoneyMovementController extends Controller
$model->id_user = Yii::$app->user->id;
$model->type = MoneyMovement::TYPE_OUT;
$model->id_account = Account::readDefault();
$model->status = MoneyMovement::STATUS_PAID;
$accounts = Account::read();
@@ -107,9 +109,13 @@ class MoneyMovementController extends Controller
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
$model = $this->findModel($id);
$transfer = Transfer::find()->andWhere([ 'type' => Transfer::TYPE_MONEY_MOVEMENT_OUT ,'id_object' => $model->id_money_movement])->one();
$transfer->storno();
// $this->findModel($id)->delete();
return $this->redirect(Yii::$app->request->referrer);
// return $this->redirect(['index']);
}
/**

View File

@@ -51,7 +51,24 @@ class ReceptionForm extends Model
$this->number = str_replace("ö", "0", $this->number);
$this->card = Card::find()->andWhere(['or', ['and',[ 'in','number' , [$this->number]],"trim(coalesce(number, '')) <>'' " ], ['and', ['in','rfid_key' ,[ $this->number] ],"trim(coalesce(rfid_key, '')) <>'' "]])->one();
$query = Card::find();
$query->leftJoin("card_key_assignment", 'card.id_card = card_key_assignment.id_card');
$query->leftJoin("key", 'key.id_key = card_key_assignment.id_key');
$query->andWhere(['or',
['and',[ 'in','card.number' , [$this->number]],"trim(coalesce(card.number, '')) <>'' " ],
['and', ['in','card.rfid_key' ,[ $this->number] ],"trim(coalesce(card.rfid_key, '')) <>'' "],
['and',[ 'in','key.number' , [$this->number]],"trim(coalesce(key.number, '')) <>'' " ],
['and', ['in','key.rfid_key' ,[ $this->number] ],"trim(coalesce(key.rfid_key, '')) <>'' "]
]);
$this->card = $query->one();
if ( $this->card == null ){
}
if ( $this->card != null ){
$this->customer = $this->card->customer;
$this->readValidTickets();

View File

@@ -25,7 +25,7 @@ use yii\widgets\ActiveForm;
<?php echo $form->field($model, 'customerName') ?>
</div>
<div class="col-md-4">
<?php echo $form->field($model, 'number') ?>
<?php echo $form->field($model, 'number')->label("Kártya/kulcs szám") ?>
</div>
</div>

View File

@@ -37,10 +37,15 @@ use yii\helpers\Html;
<?php echo Html::textInput('CardSearch[customerName]','',['class'=>"form-control", 'placeholder' =>'Vendég neve']) ?>
</div>
<div class='col-md-3'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
<div class='col-md-2'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary btn-block']) ?>
</div>
<?php ActiveForm::end(); ?>
<?php ActiveForm::end(); ?>
</div>
<?php /* ?>
<div class="row" style="margin-bottom: 6px;">
<div class='col-md-4'>
</div>
<?php $form = ActiveForm::begin([
'action' => ['key/toggle', 'number' => $model->getCardNumber()],
'method' => 'post',
@@ -50,12 +55,13 @@ use yii\helpers\Html;
<?php echo Html::textInput('KeyToggleForm[key]','',['class'=>"form-control", 'placeholder' =>'Kulcs']) ?>
</div>
<div class='col-md-3'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Ki/Be'), ['class' => 'btn btn-primary']) ?>
<div class='col-md-2'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Ki/Be'), ['class' => 'btn btn-primary btn-block']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php */ ?>
<div class='row'>
<div class='col-md-3'>
<?php echo ReceptionMenuWidget::widget( [ 'model' => $model ] ) ?>

View File

@@ -34,7 +34,7 @@ if ( isset($model->card)){
]); ?>
<div class="row" >
<div class='col-md-12'>
<?php echo Html::textInput("number", $number ,['class' => 'form-control', 'placeholder' => 'Kártyaszám'])?>
<?php echo Html::textInput("number", $number ,['class' => 'form-control', 'placeholder' => 'Kártya/kulcs szám'])?>
</div>
</div>
<div class="row" >

View File

@@ -54,6 +54,30 @@ $card = $model->card;
<?php echo HtmlHelper::mkReceptionBtn($model, Yii::t( 'frontend/transfer', 'Termékeladás'), 'product/sale')?>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
&nbsp;
</div>
</div>
<?php $form = ActiveForm::begin([
'action' => ['key/toggle', 'number' => $model->getCardNumber()],
'method' => 'post',
]); ?>
<div class="row" style="margin-bottom: 6px;">
<div class='col-md-12'>
<?php echo Html::hiddenInput('number', $model->getCardNumber())?>
<?php echo Html::textInput('KeyToggleForm[key]','',['class'=>"form-control", 'placeholder' =>'Kulcs']) ?>
</div>
</div>
<div class="row">
<div class='col-md-12'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Kulcs Ki/Be'), ['class' => 'btn btn-primary btn-block']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

View File

@@ -2,6 +2,7 @@
use yii\helpers\Html;
use yii\grid\GridView;
use common\models\MoneyMovement;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\MoneyMovementSearch */
@@ -10,6 +11,11 @@ use yii\grid\GridView;
$this->title = Yii::t('backend/money-movement', 'Money Movements');
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
.table .btn{ margin-right: 6px;}
</style>
<div class="money-movement-index">
<h1><?= Html::encode($this->title) ?></h1>
@@ -40,10 +46,20 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'status',
'value' => 'statusName',
'label' => "Státusz"
],
],
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
'template' => '{view}{delete}',
'buttons' => [
'view' => function($url, $model, $key){
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url,
[ 'title' => "Pénzmozgás részletei", 'class'=>'btn btn-success btn-xs', ]) ;
},
'delete' => function($url, $model, $key){
return $model->status == MoneyMovement::STATUS_STORNO ? "" : Html::a('<span class="glyphicon glyphicon-trash"></span>', $url,
[ 'title' => "Bérlet módosítása", 'class'=>'btn btn-danger btn-xs', 'data-method' =>'post']) ;
},
],
],
],
]); ?>

View File

@@ -74,11 +74,11 @@ $this->params['breadcrumbs'][] = $this->title;
'buttons' => [
'update' => function($url, $model, $key){
return $model->status == Ticket::STATUS_DELETED ? "" : Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url,
[ 'title' => "Bérlet törlése", 'class'=>'btn btn-primary btn-xs', ]) ;
[ 'title' => "Bérlet módosítása", 'class'=>'btn btn-primary btn-xs', ]) ;
},
'delete' => function($url, $model, $key){
return $model->status == Ticket::STATUS_DELETED ? "" : Html::a('<span class="glyphicon glyphicon-trash"></span>', $url,
[ 'title' => "Bérlet módosítása", 'class'=>'btn btn-primary btn-xs', 'data-method' =>'post']) ;
[ 'title' => "Bérlet törlése", 'class'=>'btn btn-primary btn-xs', 'data-method' =>'post']) ;
},
],
// 'buttons ' => [

View File

@@ -3,6 +3,7 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
use common\models\Ticket;
/* @var $this yii\web\View */
/* @var $searchModel common\models\TransferSearch */
@@ -66,12 +67,14 @@ td.name {
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>B. Azon</th>
<th>Kiadva</th>
<th>Fizetve</th>
<th>Kassza</th>
<th>Felhasználó</th>
<th>Vendég</th>
<th>Bérlet típus</th>
<th>Státusz</th>
<th>Egység ár</th>
<th>Mennyiség</th>
<th>Összeg</th>
@@ -80,12 +83,14 @@ td.name {
<tbody>
<?php foreach ($searchModel->tickets as $t ){?>
<tr>
<td><?php echo $t['ticket_id_ticket']?> </td>
<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['customer_name']?> </td>
<td><?php echo $t['ticket_type_name'] ?></td>
<td><?php echo Ticket::toStatusName( $t['ticket_status'] ) ?></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>