diff --git a/backend/components/AdminMenuStructure.php b/backend/components/AdminMenuStructure.php index 9ce79b9..62bfbdc 100644 --- a/backend/components/AdminMenuStructure.php +++ b/backend/components/AdminMenuStructure.php @@ -5,6 +5,7 @@ use Yii; use common\models\Order; use yii\helpers\Html; use common\components\RoleDefinition; +use common\components\Helper; class AdminMenuStructure{ @@ -112,13 +113,15 @@ class AdminMenuStructure{ $items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro' ] ]; $items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index' ] ]; $items[] = ['label' => 'Detsta feltöltés', 'url' => ['/ugiro/upload' ] ]; - $items[] = ['label' => 'Részletek aktiválása', 'url' => ['/ugiro/parts' ] ]; +// $items[] = ['label' => 'Részletek aktiválása', 'url' => ['/ugiro/parts' ] ]; // $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'] ]; + if ( RoleDefinition::isAdmin() || RoleDefinition::isEmployee() ){ $this->menuItems[] = ['label' => 'Tartós megbízások', 'url' => $this->emptyUrl, 'items' => $items ]; + } } diff --git a/backend/controllers/TicketInstallmentRequestController.php b/backend/controllers/TicketInstallmentRequestController.php index 7254588..9feea6a 100644 --- a/backend/controllers/TicketInstallmentRequestController.php +++ b/backend/controllers/TicketInstallmentRequestController.php @@ -28,6 +28,23 @@ class TicketInstallmentRequestController extends Controller 'accept' => ['post'], ], ], + 'access' => [ + 'class' => \yii\filters\AccessControl::className (), + 'rules' => [ + // allow authenticated users + [ + 'actions' => [], + 'allow' => true, + 'roles' => [ + 'admin', + 'employee', + 'reception' + ] + ] + ] + // everything else is denied + + ] ]; } diff --git a/backend/controllers/UgiroController.php b/backend/controllers/UgiroController.php index 01e515a..444426e 100644 --- a/backend/controllers/UgiroController.php +++ b/backend/controllers/UgiroController.php @@ -26,6 +26,23 @@ class UgiroController extends Controller 'delete' => ['post'], ], ], + 'access' => [ + 'class' => \yii\filters\AccessControl::className (), + 'rules' => [ + // allow authenticated users + [ + 'actions' => [], + 'allow' => true, + 'roles' => [ + 'admin', + 'employee', + 'reception' + ] + ] + ] + // everything else is denied + + ] ]; } diff --git a/backend/models/TransferSearch.php b/backend/models/TransferSearch.php index 7c75095..0529c6f 100644 --- a/backend/models/TransferSearch.php +++ b/backend/models/TransferSearch.php @@ -40,7 +40,7 @@ class TransferSearch extends Transfer public function rules() { return [ - [[ 'id_account','id_user', 'type'], 'integer'], + [[ 'id_account','id_user', 'type','status'], 'integer'], // [[ 'searchObjectName' ], 'string'], [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], @@ -101,6 +101,7 @@ class TransferSearch extends Transfer 'transfer.id_account' => $this->id_account, 'transfer.type' => $this->type, 'transfer.id_user' => $this->id_user, + 'transfer.status' => $this->status ]); $query->andFilterWhere(['in' ,'transfer.type', $this->types]); diff --git a/backend/views/ticket-installment-request/view.php b/backend/views/ticket-installment-request/view.php index 98f3dc4..bf931e9 100644 --- a/backend/views/ticket-installment-request/view.php +++ b/backend/views/ticket-installment-request/view.php @@ -190,6 +190,24 @@ $this->params['breadcrumbs'][] = $this->title; ticket->part_paid ;?> + + + DetSta válasz kód + + + detsta_answer ;?> + + + DetSta válasz szöveg + + + comment ;?> + + + + + + params['breadcrumbs'][] = $this->title; ], 'start:date', 'end:date', + 'created_at:date', [ 'attribute' => 'id_user', 'value' => 'userName' diff --git a/backend/views/transfer/_search.php b/backend/views/transfer/_search.php index e2172d3..301cbf8 100644 --- a/backend/views/transfer/_search.php +++ b/backend/views/transfer/_search.php @@ -22,15 +22,18 @@ use kartik\widgets\DatePicker; ]); ?>
-
+
field($model, 'id_account')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +HtmlHelper::mkAccountOptions($accounts) ) ?>
-
+
field($model, 'types')->checkboxList( Transfer::types()) ?>
-
+
field($model, 'id_user')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +ArrayHelper::map($users,'id' , 'username') ) ?>
+
+ field($model, 'status')->dropDownList( ['' => "Mind"] + Transfer::statuses() ) ?> +
diff --git a/backend/views/transfer/index.php b/backend/views/transfer/index.php index 02ad157..946593c 100644 --- a/backend/views/transfer/index.php +++ b/backend/views/transfer/index.php @@ -75,6 +75,10 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'money', 'value' => 'signedMoney' ], + [ + 'attribute' => 'status', + 'value' => 'statusName' + ], 'created_at:datetime', 'paid_at:datetime', diff --git a/common/components/Helper.php b/common/components/Helper.php index d8b3a75..71a6fde 100644 --- a/common/components/Helper.php +++ b/common/components/Helper.php @@ -5,6 +5,11 @@ namespace common\components; use \Yii; class Helper { + + public static function getDateTimeString(){ + return date("Y-m-d H:i:s"); + } + public static function hufRound($m) { $result = round ( $m / 5, 0 ) * 5; return $result; diff --git a/common/models/CardSearch.php b/common/models/CardSearch.php index 3cb6525..1b5c4e7 100644 --- a/common/models/CardSearch.php +++ b/common/models/CardSearch.php @@ -60,6 +60,8 @@ class CardSearch extends Card $query->select(['card.id_card as card_id_card', 'card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']); $query->from('card'); $query->innerJoin('customer','card.id_card = customer.id_customer_card'); + $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->orderBy(['customer.name' => SORT_ASC]); @@ -77,9 +79,18 @@ class CardSearch extends Card return $dataProvider; } - $query->andFilterWhere([ -// 'lower(customer.name)' => $this->customerName - ]); +// $query->andFilterWhere([ +// 'lower(card.number)' => $this->customerName +// ]); + + if ( !empty($this->number)){ + $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, '')) <>'' "] + ]); + } $query->andFilterWhere(['like', 'customer.name', $this->customerName]); diff --git a/common/models/MoneyMovement.php b/common/models/MoneyMovement.php index b111181..91103e7 100644 --- a/common/models/MoneyMovement.php +++ b/common/models/MoneyMovement.php @@ -152,7 +152,7 @@ class MoneyMovement extends \yii\db\ActiveRecord public static function toStatusName($id_status){ $result = "Ismeretlen"; - $statuses = Ticket::statuses(); + $statuses = MoneyMovement::statuses(); if ( array_key_exists($id_status, $statuses)){ $result = $statuses[$id_status]; } diff --git a/common/models/TicketInstallmentRequest.php b/common/models/TicketInstallmentRequest.php index 4f7fc7f..f331594 100644 --- a/common/models/TicketInstallmentRequest.php +++ b/common/models/TicketInstallmentRequest.php @@ -5,6 +5,7 @@ namespace common\models; use Yii; use yii\helpers\ArrayHelper; use yii\behaviors\TimestampBehavior; +use common\components\Helper; /** * This is the model class for table "ticket_installment_request". @@ -25,6 +26,9 @@ use yii\behaviors\TimestampBehavior; * @property string $request_target_time_at * @property string $created_at * @property string $updated_at + * @property string $detsta_answer + * @property string $comment + * @property string $updated_at * @property common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból */ class TicketInstallmentRequest extends \yii\db\ActiveRecord @@ -144,6 +148,7 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord $this->status = $status; $tranfer = $this->addTransfer(); $this->id_transfer = $tranfer->id_transfer; + $this->request_processed_at = Helper::getDateTimeString(); $this->save(false); $this->applyNewTicketState($partRequired); return true; @@ -152,6 +157,9 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord } }else{ $this->status = $status; + $this->detsta_answer = $visszajelzes; + $this->comment = $comment; + $this->request_processed_at = Helper::getDateTimeString(); $this->save(false); $this->applyNewTicketState($partRequired); return true; diff --git a/common/models/Transfer.php b/common/models/Transfer.php index ff8847b..2b15e93 100644 --- a/common/models/Transfer.php +++ b/common/models/Transfer.php @@ -580,6 +580,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord $query->andFilterWhere(['in' ,'transfer.type', $types]); + $query->andWhere(['not in','transfer.status', Transfer::STATUS_STORNO]); + if ( $mode == 'created_at'){ self::inInterval($query, 'transfer.created_at', $start, $end); diff --git a/common/models/TransferTicketSearch.php b/common/models/TransferTicketSearch.php index 0375dc2..b69ae6d 100644 --- a/common/models/TransferTicketSearch.php +++ b/common/models/TransferTicketSearch.php @@ -207,7 +207,7 @@ class TransferTicketSearch extends Transfer protected function readTickets(){ $query = (new \yii\db\Query()); - $query->select([ 'customer.name as customer_name', '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->select([ 'ticket.id_ticket as ticket_id_ticket', 'customer.name as customer_name', 'user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' ,'ticket.status as ticket_status', '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"); diff --git a/console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php b/console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php new file mode 100644 index 0000000..1713e26 --- /dev/null +++ b/console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php @@ -0,0 +1,31 @@ +addColumn("ticket_installment_request", "detsta_answer", "string"); + $this->addColumn("ticket_installment_request", "comment", "string"); + } + + public function down() + { + echo "m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment cannot be reverted.\n"; + + return false; + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/frontend/controllers/MoneyMovementController.php b/frontend/controllers/MoneyMovementController.php index 40fb172..94aee92 100644 --- a/frontend/controllers/MoneyMovementController.php +++ b/frontend/controllers/MoneyMovementController.php @@ -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']); } /** diff --git a/frontend/models/ReceptionForm.php b/frontend/models/ReceptionForm.php index 29f98f6..1f62bf5 100644 --- a/frontend/models/ReceptionForm.php +++ b/frontend/models/ReceptionForm.php @@ -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(); diff --git a/frontend/views/card/_search.php b/frontend/views/card/_search.php index 9222da1..f2c5a4c 100644 --- a/frontend/views/card/_search.php +++ b/frontend/views/card/_search.php @@ -25,7 +25,7 @@ use yii\widgets\ActiveForm; field($model, 'customerName') ?>
- field($model, 'number') ?> + field($model, 'number')->label("Kártya/kulcs szám") ?>
diff --git a/frontend/views/common/_reception.php b/frontend/views/common/_reception.php index f100672..db8c510 100644 --- a/frontend/views/common/_reception.php +++ b/frontend/views/common/_reception.php @@ -37,10 +37,15 @@ use yii\helpers\Html; "form-control", 'placeholder' =>'Vendég neve']) ?>
-
- 'btn btn-primary']) ?> +
+ 'btn btn-primary btn-block']) ?>
- + +
+ +
+
+
['key/toggle', 'number' => $model->getCardNumber()], 'method' => 'post', @@ -50,12 +55,13 @@ use yii\helpers\Html; "form-control", 'placeholder' =>'Kulcs']) ?>
-
- 'btn btn-primary']) ?> +
+ 'btn btn-primary btn-block']) ?>
+
$model ] ) ?> diff --git a/frontend/views/common/_reception_form_card_number.php b/frontend/views/common/_reception_form_card_number.php index 89285a7..289e5d4 100644 --- a/frontend/views/common/_reception_form_card_number.php +++ b/frontend/views/common/_reception_form_card_number.php @@ -34,7 +34,7 @@ if ( isset($model->card)){ ]); ?>
- 'form-control', 'placeholder' => 'Kártyaszám'])?> + 'form-control', 'placeholder' => 'Kártya/kulcs szám'])?>
diff --git a/frontend/views/common/_reception_menu.php b/frontend/views/common/_reception_menu.php index 313a00c..e1c9f1b 100644 --- a/frontend/views/common/_reception_menu.php +++ b/frontend/views/common/_reception_menu.php @@ -54,6 +54,30 @@ $card = $model->card;
+
+
+   +
+
+ + ['key/toggle', 'number' => $model->getCardNumber()], + 'method' => 'post', + ]); ?> +
+
+ getCardNumber())?> + "form-control", 'placeholder' =>'Kulcs']) ?> + +
+
+
+
+ 'btn btn-primary btn-block']) ?> +
+ +
+ diff --git a/frontend/views/money-movement/index.php b/frontend/views/money-movement/index.php index 0067de3..a2b6520 100644 --- a/frontend/views/money-movement/index.php +++ b/frontend/views/money-movement/index.php @@ -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; ?> + + +

title) ?>

@@ -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('', $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('', $url, + [ 'title' => "Bérlet módosítása", 'class'=>'btn btn-danger btn-xs', 'data-method' =>'post']) ; + }, + ], ], ], ]); ?> diff --git a/frontend/views/ticket/index.php b/frontend/views/ticket/index.php index 131152f..4b45e2f 100644 --- a/frontend/views/ticket/index.php +++ b/frontend/views/ticket/index.php @@ -74,11 +74,11 @@ $this->params['breadcrumbs'][] = $this->title; 'buttons' => [ 'update' => function($url, $model, $key){ return $model->status == Ticket::STATUS_DELETED ? "" : Html::a('', $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('', $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 ' => [ diff --git a/frontend/views/transfer/tickets.php b/frontend/views/transfer/tickets.php index 12d6713..45c3e50 100644 --- a/frontend/views/transfer/tickets.php +++ b/frontend/views/transfer/tickets.php @@ -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 { + + @@ -80,12 +83,14 @@ td.name { tickets as $t ){?> + +
B. Azon Kiadva Fizetve Kassza Felhasználó Vendég Bérlet típusStátusz Egység ár Mennyiség Összeg
Ft Db FT