From d7cc84e78fe2b29a40dc2eb9d66b0342b5f07107 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Wed, 20 Jan 2016 14:48:34 +0100 Subject: [PATCH 1/4] =?UTF-8?q?add=20kulcsok,=20add=20=20tart=C3=B3s=20bes?= =?UTF-8?q?zed=C3=A9s,=20add=20ticket=20type=20with=20intallments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/assets/PendingRequestAsset.php | 28 +++ backend/components/AdminMenuStructure.php | 14 ++ .../TicketInstallmentRequestController.php | 175 ++++++++++++++++++ backend/controllers/UgiroController.php | 121 ++++++++++++ backend/giro2710txt | 2 + backend/giro5459txt | 2 + backend/giro9077txt | 2 + backend/giro9550txt | 2 + backend/models/CustomerCreate.php | 3 + backend/models/CustomerUpdate.php | 2 + backend/models/GiroKotegForm.php | 137 ++++++++++++++ .../TicketInstallmentMarkForSendForm.php | 40 ++++ .../models/TicketInstallmentRequestSearch.php | 130 +++++++++++++ ...etInstallmentRequestSearchDownloadGiro.php | 114 ++++++++++++ .../TicketInstallmentRequestSearchPending.php | 114 ++++++++++++ backend/models/TicketSearch.php | 3 +- backend/models/UgiroSearch.php | 67 +++++++ backend/views/customer/_form_create.php | 10 + backend/views/customer/_form_update.php | 10 + backend/views/customer/view.php | 2 + .../_download_giro_view.php | 124 +++++++++++++ .../ticket-installment-request/_form.php | 51 +++++ .../_index_view.php | 124 +++++++++++++ .../_pending_view.php | 142 ++++++++++++++ .../ticket-installment-request/_search.php | 137 ++++++++++++++ .../_search_pending.php | 76 ++++++++ .../ticket-installment-request/create.php | 21 +++ .../ticket-installment-request/index.php | 29 +++ .../index_download_giro.php | 44 +++++ .../index_pending.php | 50 +++++ .../views/ticket-installment-request/test.php | 85 +++++++++ .../ticket-installment-request/update.php | 23 +++ .../views/ticket-installment-request/view.php | 50 +++++ backend/views/ticket-type/_form.php | 8 +- backend/views/ticket-type/view.php | 6 + backend/views/ticket/_search.php | 3 + backend/views/ticket/index.php | 5 + backend/views/ugiro/_form.php | 27 +++ backend/views/ugiro/_search.php | 33 ++++ backend/views/ugiro/create.php | 21 +++ backend/views/ugiro/index.php | 46 +++++ backend/views/ugiro/update.php | 23 +++ backend/views/ugiro/view.php | 58 ++++++ backend/web/giro/megbizas/giro10_20160120txt | 3 + backend/web/giro/megbizas/giro11_20160120txt | 3 + backend/web/giro/megbizas/giro12_20160120txt | 4 + backend/web/giro/megbizas/giro14_20160120txt | 4 + backend/web/giro/megbizas/giro15_20160120txt | 4 + backend/web/giro/megbizas/giro16_20160120txt | 4 + backend/web/giro/megbizas/giro17_20160120txt | 4 + backend/web/giro/megbizas/giro18_20160120txt | 4 + backend/web/giro/megbizas/giro19_20160120txt | 4 + backend/web/giro/megbizas/giro20_20160120txt | 4 + backend/web/giro/megbizas/giro21_20160120txt | 4 + backend/web/giro/megbizas/giro22_20160120txt | 4 + backend/web/giro/megbizas/giro23_20160120txt | 4 + backend/web/giro/megbizas/giro26_20160120txt | 4 + backend/web/giro/megbizas/giro27_20160120txt | 4 + backend/web/giro/megbizas/giro28_20160120txt | 3 + backend/web/giro/megbizas/giro29_20160120.txt | 3 + backend/web/giro/megbizas/giro30_20160120.txt | 13 ++ backend/web/giro/megbizas/giro9_20160120txt | 3 + backend/web/js/index.pending.js | 8 + bkr.html | 120 ++++++++++++ common/components/DailyListing.php | 4 + common/components/giro/GiroBankszamla.php | 16 ++ common/components/giro/GiroBase.php | 43 +++++ common/components/giro/GiroBeszed.php | 80 ++++++++ common/components/giro/GiroBeszedFej.php | 45 +++++ common/components/giro/GiroBeszedLab.php | 30 +++ common/components/giro/GiroBeszedTetel.php | 44 +++++ common/components/giro/GiroDETSTA.php | 38 ++++ common/components/giro/GiroDETSTAFej.php | 55 ++++++ common/components/giro/GiroDETSTALab.php | 44 +++++ common/components/giro/GiroDETSTATetel.php | 61 ++++++ common/components/giro/GiroUzenetSorszam.php | 16 ++ common/config/params.php | 5 +- common/models/CardKeyAssignment.php | 62 +++++++ common/models/CardSearch.php | 2 +- common/models/Ticket.php | 20 +- common/models/TicketInstallmentRequest.php | 156 ++++++++++++++++ common/models/TicketType.php | 21 +++ common/models/Transfer.php | 10 +- common/models/Ugiro.php | 86 +++++++++ common/models/UgiroRequestAssignment.php | 51 +++++ ...m160117_182720_add_card_key_assignment.php | 38 ++++ ...e__ticket_type__add_installment_fields.php | 29 +++ ...te__table__ticket__installment_request.php | 50 +++++ .../m160120_044951_add__ugiro_tables.php | 52 ++++++ ...56_alter__table__ugiro_add_column_path.php | 30 +++ ...le__customer__add__column__bankaccount.php | 31 ++++ ...93445_alter__table__ugiro__add__status.php | 27 +++ frontend/controllers/KeyController.php | 109 +++++++++++ frontend/models/CustomerCreate.php | 3 + frontend/models/CustomerUpdate.php | 3 + frontend/models/KeySearch.php | 76 ++++++++ frontend/models/KeyToggleForm.php | 75 ++++++++ frontend/models/ReceptionForm.php | 32 +++- frontend/models/TicketCreate.php | 15 +- frontend/views/card/index.php | 7 +- frontend/views/common/_reception.php | 13 ++ frontend/views/common/_reception_customer.php | 4 + frontend/views/customer/_form_create.php | 10 + frontend/views/customer/_form_update.php | 10 + frontend/views/customer/view.php | 2 + frontend/views/key/_form.php | 29 +++ frontend/views/key/_search.php | 39 ++++ frontend/views/key/create.php | 21 +++ frontend/views/key/index.php | 59 ++++++ frontend/views/key/update.php | 23 +++ frontend/views/key/view.php | 41 ++++ 111 files changed, 4077 insertions(+), 12 deletions(-) create mode 100644 backend/assets/PendingRequestAsset.php create mode 100644 backend/controllers/TicketInstallmentRequestController.php create mode 100644 backend/controllers/UgiroController.php create mode 100644 backend/giro2710txt create mode 100644 backend/giro5459txt create mode 100644 backend/giro9077txt create mode 100644 backend/giro9550txt create mode 100644 backend/models/GiroKotegForm.php create mode 100644 backend/models/TicketInstallmentMarkForSendForm.php create mode 100644 backend/models/TicketInstallmentRequestSearch.php create mode 100644 backend/models/TicketInstallmentRequestSearchDownloadGiro.php create mode 100644 backend/models/TicketInstallmentRequestSearchPending.php create mode 100644 backend/models/UgiroSearch.php create mode 100644 backend/views/ticket-installment-request/_download_giro_view.php create mode 100644 backend/views/ticket-installment-request/_form.php create mode 100644 backend/views/ticket-installment-request/_index_view.php create mode 100644 backend/views/ticket-installment-request/_pending_view.php create mode 100644 backend/views/ticket-installment-request/_search.php create mode 100644 backend/views/ticket-installment-request/_search_pending.php create mode 100644 backend/views/ticket-installment-request/create.php create mode 100644 backend/views/ticket-installment-request/index.php create mode 100644 backend/views/ticket-installment-request/index_download_giro.php create mode 100644 backend/views/ticket-installment-request/index_pending.php create mode 100644 backend/views/ticket-installment-request/test.php create mode 100644 backend/views/ticket-installment-request/update.php create mode 100644 backend/views/ticket-installment-request/view.php create mode 100644 backend/views/ugiro/_form.php create mode 100644 backend/views/ugiro/_search.php create mode 100644 backend/views/ugiro/create.php create mode 100644 backend/views/ugiro/index.php create mode 100644 backend/views/ugiro/update.php create mode 100644 backend/views/ugiro/view.php create mode 100644 backend/web/giro/megbizas/giro10_20160120txt create mode 100644 backend/web/giro/megbizas/giro11_20160120txt create mode 100644 backend/web/giro/megbizas/giro12_20160120txt create mode 100644 backend/web/giro/megbizas/giro14_20160120txt create mode 100644 backend/web/giro/megbizas/giro15_20160120txt create mode 100644 backend/web/giro/megbizas/giro16_20160120txt create mode 100644 backend/web/giro/megbizas/giro17_20160120txt create mode 100644 backend/web/giro/megbizas/giro18_20160120txt create mode 100644 backend/web/giro/megbizas/giro19_20160120txt create mode 100644 backend/web/giro/megbizas/giro20_20160120txt create mode 100644 backend/web/giro/megbizas/giro21_20160120txt create mode 100644 backend/web/giro/megbizas/giro22_20160120txt create mode 100644 backend/web/giro/megbizas/giro23_20160120txt create mode 100644 backend/web/giro/megbizas/giro26_20160120txt create mode 100644 backend/web/giro/megbizas/giro27_20160120txt create mode 100644 backend/web/giro/megbizas/giro28_20160120txt create mode 100644 backend/web/giro/megbizas/giro29_20160120.txt create mode 100644 backend/web/giro/megbizas/giro30_20160120.txt create mode 100644 backend/web/giro/megbizas/giro9_20160120txt create mode 100644 backend/web/js/index.pending.js create mode 100644 bkr.html create mode 100644 common/components/giro/GiroBankszamla.php create mode 100644 common/components/giro/GiroBase.php create mode 100644 common/components/giro/GiroBeszed.php create mode 100644 common/components/giro/GiroBeszedFej.php create mode 100644 common/components/giro/GiroBeszedLab.php create mode 100644 common/components/giro/GiroBeszedTetel.php create mode 100644 common/components/giro/GiroDETSTA.php create mode 100644 common/components/giro/GiroDETSTAFej.php create mode 100644 common/components/giro/GiroDETSTALab.php create mode 100644 common/components/giro/GiroDETSTATetel.php create mode 100644 common/components/giro/GiroUzenetSorszam.php create mode 100644 common/models/CardKeyAssignment.php create mode 100644 common/models/TicketInstallmentRequest.php create mode 100644 common/models/Ugiro.php create mode 100644 common/models/UgiroRequestAssignment.php create mode 100644 console/migrations/m160117_182720_add_card_key_assignment.php create mode 100644 console/migrations/m160119_103347_alter__table__ticket_type__add_installment_fields.php create mode 100644 console/migrations/m160119_110151_create__table__ticket__installment_request.php create mode 100644 console/migrations/m160120_044951_add__ugiro_tables.php create mode 100644 console/migrations/m160120_050556_alter__table__ugiro_add_column_path.php create mode 100644 console/migrations/m160120_054556_alter__table__customer__add__column__bankaccount.php create mode 100644 console/migrations/m160120_093445_alter__table__ugiro__add__status.php create mode 100644 frontend/controllers/KeyController.php create mode 100644 frontend/models/KeySearch.php create mode 100644 frontend/models/KeyToggleForm.php create mode 100644 frontend/views/key/_form.php create mode 100644 frontend/views/key/_search.php create mode 100644 frontend/views/key/create.php create mode 100644 frontend/views/key/index.php create mode 100644 frontend/views/key/update.php create mode 100644 frontend/views/key/view.php diff --git a/backend/assets/PendingRequestAsset.php b/backend/assets/PendingRequestAsset.php new file mode 100644 index 0000000..08451cc --- /dev/null +++ b/backend/assets/PendingRequestAsset.php @@ -0,0 +1,28 @@ + + * @since 2.0 + */ +class PendingRequestAsset extends AssetBundle +{ + public $basePath = '@webroot'; + public $baseUrl = '@web'; + public $css = [ + ]; + public $js = [ + 'js/index.pending.js', + ]; + public $depends = [ + 'backend\assets\AppAsset', + ]; +} diff --git a/backend/components/AdminMenuStructure.php b/backend/components/AdminMenuStructure.php index 9fd2042..159836c 100644 --- a/backend/components/AdminMenuStructure.php +++ b/backend/components/AdminMenuStructure.php @@ -103,6 +103,20 @@ class AdminMenuStructure{ $this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl, 'items' => $items ]; + ///////////////////////////// + // Tartós megbízások + ///////////////////////////// + $items = []; + $items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index' , 'TicketInstallmentRequestSearch[start]' =>$today,'TicketInstallmentRequestSearch[end]' => $tomorrow ] ]; + $items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending' , 'TicketInstallmentRequestSearchPending[end]' => $tomorrow ] ]; + $items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro' ] ]; + $items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index' ] ]; +// $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'] ]; + $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 new file mode 100644 index 0000000..7263a9a --- /dev/null +++ b/backend/controllers/TicketInstallmentRequestController.php @@ -0,0 +1,175 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all TicketInstallmentRequest models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new TicketInstallmentRequestSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Lists pending TicketInstallmentRequest models. + * @return mixed + */ + public function actionPending() + { + $model = new TicketInstallmentMarkForSendForm(); + if ($model->load(Yii::$app->request->post()) ) { + $model->markForSend(); + } + + $searchModel = new TicketInstallmentRequestSearchPending(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index_pending', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Lists pending TicketInstallmentRequest models. + * @return mixed + */ + public function actionDownloadGiro() + { + $model = new GiroKotegForm(); + + if ($model->load(Yii::$app->request->post()) ) { + $model->createKoteg(); + return $this->redirect(['ugiro/view', 'id' => $model->koteg->id_ugiro]); + } + + $searchModel = new TicketInstallmentRequestSearchDownloadGiro(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + $model->action = "create"; + return $this->render('index_download_giro', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'model' => $model, + ]); + } + + /** + * Displays a single TicketInstallmentRequest model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new TicketInstallmentRequest model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new TicketInstallmentRequest(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_ticket_installment_request]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing TicketInstallmentRequest model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_ticket_installment_request]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing TicketInstallmentRequest model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + public function actionTest( ) + { + + return $this->render('test'); + } + + /** + * Finds the TicketInstallmentRequest model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return TicketInstallmentRequest the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = TicketInstallmentRequest::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/UgiroController.php b/backend/controllers/UgiroController.php new file mode 100644 index 0000000..535c7fc --- /dev/null +++ b/backend/controllers/UgiroController.php @@ -0,0 +1,121 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Ugiro models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new UgiroSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Ugiro model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Ugiro model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Ugiro(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_ugiro]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Ugiro model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_ugiro]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Ugiro model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the Ugiro model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Ugiro the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Ugiro::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/giro2710txt b/backend/giro2710txt new file mode 100644 index 0000000..ab8f61d --- /dev/null +++ b/backend/giro2710txt @@ -0,0 +1,2 @@ +01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar +030000000000000000000000 diff --git a/backend/giro5459txt b/backend/giro5459txt new file mode 100644 index 0000000..ab8f61d --- /dev/null +++ b/backend/giro5459txt @@ -0,0 +1,2 @@ +01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar +030000000000000000000000 diff --git a/backend/giro9077txt b/backend/giro9077txt new file mode 100644 index 0000000..ab8f61d --- /dev/null +++ b/backend/giro9077txt @@ -0,0 +1,2 @@ +01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar +030000000000000000000000 diff --git a/backend/giro9550txt b/backend/giro9550txt new file mode 100644 index 0000000..ab8f61d --- /dev/null +++ b/backend/giro9550txt @@ -0,0 +1,2 @@ +01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar +030000000000000000000000 diff --git a/backend/models/CustomerCreate.php b/backend/models/CustomerCreate.php index 2f00b07..4f272c1 100644 --- a/backend/models/CustomerCreate.php +++ b/backend/models/CustomerCreate.php @@ -89,6 +89,9 @@ class CustomerCreate extends \common\models\Customer [['phone', 'tax_number', 'country'], 'string', 'max' => 20], + [['bank_account'], 'string', 'max' => 24], + [['bank_name'], 'string', 'max' => 100], + [['phone'], 'required', 'when' => function($model) { return !isset( $model->email ) || empty( $model->email ) ; } , diff --git a/backend/models/CustomerUpdate.php b/backend/models/CustomerUpdate.php index cef9ec9..fbd32e0 100644 --- a/backend/models/CustomerUpdate.php +++ b/backend/models/CustomerUpdate.php @@ -88,6 +88,8 @@ class CustomerUpdate extends \common\models\Customer [[ 'description', 'address'], 'string', 'max' => 255], [['phone', 'tax_number', 'country'], 'string', 'max' => 20], + [['bank_account'], 'string', 'max' => 24], + [['bank_name'], 'string', 'max' => 100], [['phone'], 'required', 'when' => function($model) { return !isset( $model->email ) || empty( $model->email ) ; diff --git a/backend/models/GiroKotegForm.php b/backend/models/GiroKotegForm.php new file mode 100644 index 0000000..590fbfc --- /dev/null +++ b/backend/models/GiroKotegForm.php @@ -0,0 +1,137 @@ +readRequests(); + $this->success = true; + if ( count( $this->requests ) > 0 ){ + $connection = \Yii::$app->db; + $transaction = $connection->beginTransaction(); + + try { + $this->createUGiroKoteg(); + $this->assignRequestsToUgiro(); + $this->changeRequestsStatusToSent(); + $this->generateFileContent(); + $this->saveFile(); + + if ($this->success) { + $transaction->commit(); + \Yii::$app->session->setFlash('success',"Fájl létrehozva"); + return true; + } else { + $transaction->rollback(); + throw new NotFoundHttpException( "Hiba történt!"); + } + + } catch (\Exception $e) { + $transaction->rollback(); + throw $e; + } + }else{ + \Yii::$app->session->setFlash('danger', "Megbízások száma 0!"); + return false; + } + } + + public function changeRequestsStatusToSent(){ + foreach ($this->requests as $request){ + $request->status = TicketInstallmentRequest::$STATUS_SENT; + $this->success &= $request->save(false); + } + } + + public function assignRequestsToUgiro(){ + foreach ($this->requests as $request){ + $assignment = new UgiroRequestAssignment(); + $assignment->id_request = $request->id_ticket_installment_request; + $assignment->id_ugiro = $this->koteg->id_ugiro; + $this->success &= $assignment->save(false); + } + } + + public function createUGiroKoteg(){ + $this->koteg = new Ugiro(); + $this->koteg->status = Ugiro::$STATUS_SENT; + $this->koteg->id_user = \Yii::$app->user->id; + $this->success &= $this->koteg->save(false); + } + public function readRequests(){ + $this->requests = TicketInstallmentRequest::find()->andWhere(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND])->all(); + } + + public function generateFileContent(){ + $this->content = GiroBeszed::createFileContent($this->koteg->id_ugiro, $this->requests); + } + + public function saveFile( ) { +// $data = static::transliterate($this->content); + $data = $this->content; + $data = iconv("utf-8","ASCII",$data); + $path = Ugiro::$PATH_MEGBIZAS . DIRECTORY_SEPARATOR ."giro" . $this->koteg->id_ugiro."_". date('Ymd' ) .".txt"; + $filename = Yii::getAlias('@backend/web').DIRECTORY_SEPARATOR .$path; + $dir = Yii::getAlias('@backend/web').DIRECTORY_SEPARATOR .Ugiro::$PATH_MEGBIZAS; + $this->koteg->path = $path; + $this->koteg->save(false); + if(!FileHelper::createDirectory($dir)){ + throw new HttpException(500, 'Cannot create "'.$dir.'". Please check write permissions.'); + } + $myfile = fopen($filename,'a'); + fwrite($myfile, $data); + fclose($myfile); + } + + public static function transliterate($string) + { +// if (static::hasIntl()) { +// return transliterator_transliterate(BaseInflector::$transliterator, $string); +// } else { + return str_replace(array_keys(BaseInflector::$transliteration), BaseInflector::$transliteration, $string); +// } + } + + /** + * @return boolean if intl extension is loaded + */ + protected static function hasIntl() + { + return extension_loaded('intl'); + } +} \ No newline at end of file diff --git a/backend/models/TicketInstallmentMarkForSendForm.php b/backend/models/TicketInstallmentMarkForSendForm.php new file mode 100644 index 0000000..94fa3b6 --- /dev/null +++ b/backend/models/TicketInstallmentMarkForSendForm.php @@ -0,0 +1,40 @@ + ['integer']], + ]; + } + + + + public function markForSend(){ + if ( $this->validate() && isset($this->items ) && is_array($this->items ) ){ + $updated = 0; + $updated = TicketInstallmentRequest::updateAll(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND ],['in', 'id_ticket_installment_request' , $this->items]); + \Yii::$app->session->setFlash('success', $updated . " megbízás küldésre jelölve " ); + }else{ + \Yii::$app->session->setFlash('success', " Nem történt küldésre jelölés! " ); + } + } + +} \ No newline at end of file diff --git a/backend/models/TicketInstallmentRequestSearch.php b/backend/models/TicketInstallmentRequestSearch.php new file mode 100644 index 0000000..d4f42bb --- /dev/null +++ b/backend/models/TicketInstallmentRequestSearch.php @@ -0,0 +1,130 @@ + 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'processedStart', ], 'date' , 'timestampAttribute' => 'timestampProcessedStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'processedEnd' , ], 'date' , 'timestampAttribute' => 'timestampProcessedEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'sentStart', ], 'date' , 'timestampAttribute' => 'timestampSentStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'sentEnd' , ], 'date' , 'timestampAttribute' => 'timestampSentEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = new Query(); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + } + + $query->select([ + 'ticket_installment_request.id_ticket_installment_request as request_id_ticket_installment_request', //id + 'ticket_installment_request.request_target_time_at as request_request_target_time_at',//target time + 'ticket_installment_request.money as request_money',//money + 'ticket_installment_request.status as request_status',//status + 'ticket_installment_request.request_sent_at as request_sent_at',//sent_at + 'ticket_installment_request.priority as request_priority',//sent_at + 'ticket_installment_request.request_processed_at as request_processed_at',//request_processed_at + 'customer.id_customer as customer_id_customer',//id_customer + 'customer.name as customer_name',//customer_name + 'ticket_type.name as ticket_type_name',//ticket_type_name + 'ticket.status as ticket_status',//ticket_status + 'ticket.start as ticket_start',//ticket_start + 'ticket.end as ticket_end',//ticket_send + 'ticket.id_ticket as ticket_id_ticket',//id_ticket + ]); + $query->from("ticket_installment_request"); + $query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer"); + $query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket"); + $query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type"); + + $query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]); + + $query->andFilterWhere([ + 'ticket_installment_request.id_ticket_installment_request' => $this->id_ticket_installment_request, + 'ticket.id_ticket' => $this->id_ticket, + 'customer.id_customer' => $this->id_customer, + 'ticket_installment_request.status' => $this->status, + 'ticket_type.id_ticket_type' => $this->id_ticket_type, + ]); + $query->andFilterWhere(['like', 'customer.name', $this->customer_name]); + //target time + $query->andFilterWhere(['>=', 'ticket_installment_request.request_target_time_at', $this->timestampStart]); + $query->andFilterWhere(['<', 'ticket_installment_request.request_target_time_at', $this->timestampEnd]); + //sent time + $query->andFilterWhere(['>=', 'ticket_installment_request.request_sent_at', $this->timestampSentStart]); + $query->andFilterWhere(['<', 'ticket_installment_request.request_sent_at', $this->timestampSentEnd]); + //processed time + $query->andFilterWhere(['>=', 'ticket_installment_request.request_processed_at', $this->timestampProcessedStart]); + $query->andFilterWhere(['<', 'ticket_installment_request.request_processed_at', $this->timestampProcessedEnd]); + + $dataProvider = new ArrayDataProvider([ + 'allModels' => $query->all(), +// 'sort' => [ +// 'attributes' => ['id', 'username', 'email'], +// ], +// 'pagination' => [ +// 'pageSize' => 10, +// ], + ]); + + return $dataProvider; + } +} diff --git a/backend/models/TicketInstallmentRequestSearchDownloadGiro.php b/backend/models/TicketInstallmentRequestSearchDownloadGiro.php new file mode 100644 index 0000000..303d38b --- /dev/null +++ b/backend/models/TicketInstallmentRequestSearchDownloadGiro.php @@ -0,0 +1,114 @@ + 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = new Query(); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + } + + $query->select([ + 'ticket_installment_request.id_ticket_installment_request as request_id_ticket_installment_request', //id + 'ticket_installment_request.request_target_time_at as request_request_target_time_at',//target time + 'ticket_installment_request.money as request_money',//money + 'ticket_installment_request.status as request_status',//status + 'ticket_installment_request.request_sent_at as request_sent_at',//sent_at + 'ticket_installment_request.priority as request_priority',//sent_at + 'ticket_installment_request.request_processed_at as request_processed_at',//request_processed_at + 'customer.id_customer as customer_id_customer',//id_customer + 'customer.name as customer_name',//customer_name + 'ticket_type.name as ticket_type_name',//ticket_type_name + 'ticket.status as ticket_status',//ticket_status + 'ticket.start as ticket_start',//ticket_start + 'ticket.end as ticket_end',//ticket_send + 'ticket.id_ticket as ticket_id_ticket',//id_ticket + ]); + $query->from("ticket_installment_request"); + $query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer"); + $query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket"); + $query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type"); + + $query->andWhere(['ticket_installment_request.status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND]); + + $query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]); + +// $query->andFilterWhere([ +// 'ticket_installment_request.id_ticket_installment_request' => $this->id_ticket_installment_request, +// 'ticket.id_ticket' => $this->id_ticket, +// 'customer.id_customer' => $this->id_customer, +// 'ticket_installment_request.status' => $this->status, +// 'ticket_type.id_ticket_type' => $this->id_ticket_type, +// ]); +// $query->andFilterWhere(['like', 'customer.name', $this->customer_name]); + //target time +// $query->andFilterWhere(['>=', 'ticket_installment_request.request_target_time_at', $this->timestampStart]); +// $query->andFilterWhere(['<', 'ticket_installment_request.request_target_time_at', $this->timestampEnd]); + + $dataProvider = new ArrayDataProvider([ + 'allModels' => $query->all(), +// 'sort' => [ +// 'attributes' => ['id', 'username', 'email'], +// ], +// 'pagination' => [ +// 'pageSize' => 10, +// ], + ]); + + return $dataProvider; + } +} diff --git a/backend/models/TicketInstallmentRequestSearchPending.php b/backend/models/TicketInstallmentRequestSearchPending.php new file mode 100644 index 0000000..4a69ddd --- /dev/null +++ b/backend/models/TicketInstallmentRequestSearchPending.php @@ -0,0 +1,114 @@ + 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = new Query(); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + } + + $query->select([ + 'ticket_installment_request.id_ticket_installment_request as request_id_ticket_installment_request', //id + 'ticket_installment_request.request_target_time_at as request_request_target_time_at',//target time + 'ticket_installment_request.money as request_money',//money + 'ticket_installment_request.status as request_status',//status + 'ticket_installment_request.request_sent_at as request_sent_at',//sent_at + 'ticket_installment_request.priority as request_priority',//sent_at + 'ticket_installment_request.request_processed_at as request_processed_at',//request_processed_at + 'customer.id_customer as customer_id_customer',//id_customer + 'customer.name as customer_name',//customer_name + 'ticket_type.name as ticket_type_name',//ticket_type_name + 'ticket.status as ticket_status',//ticket_status + 'ticket.start as ticket_start',//ticket_start + 'ticket.end as ticket_end',//ticket_send + 'ticket.id_ticket as ticket_id_ticket',//id_ticket + ]); + $query->from("ticket_installment_request"); + $query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer"); + $query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket"); + $query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type"); + + $query->andWhere(['ticket_installment_request.status' => TicketInstallmentRequest::$STATUS_PENDING]); + + $query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]); + + $query->andFilterWhere([ + 'ticket_installment_request.id_ticket_installment_request' => $this->id_ticket_installment_request, + 'ticket.id_ticket' => $this->id_ticket, + 'customer.id_customer' => $this->id_customer, + 'ticket_installment_request.status' => $this->status, + 'ticket_type.id_ticket_type' => $this->id_ticket_type, + ]); + $query->andFilterWhere(['like', 'customer.name', $this->customer_name]); + //target time + $query->andFilterWhere(['>=', 'ticket_installment_request.request_target_time_at', $this->timestampStart]); + $query->andFilterWhere(['<', 'ticket_installment_request.request_target_time_at', $this->timestampEnd]); + + $dataProvider = new ArrayDataProvider([ + 'allModels' => $query->all(), +// 'sort' => [ +// 'attributes' => ['id', 'username', 'email'], +// ], +// 'pagination' => [ +// 'pageSize' => 10, +// ], + ]); + + return $dataProvider; + } +} diff --git a/backend/models/TicketSearch.php b/backend/models/TicketSearch.php index c71bbf5..30a587b 100644 --- a/backend/models/TicketSearch.php +++ b/backend/models/TicketSearch.php @@ -37,7 +37,7 @@ class TicketSearch extends Ticket public function rules() { return [ - [[ 'id_user', 'id_ticket_type', 'id_account'], 'integer'], + [[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account'], 'integer'], [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] , @@ -117,6 +117,7 @@ class TicketSearch extends Ticket 'id_ticket_type' => $this->id_ticket_type, 'id_account' => $this->id_account, 'id_card' => $this->id_card, + 'id_ticket' => $this->id_ticket ]); diff --git a/backend/models/UgiroSearch.php b/backend/models/UgiroSearch.php new file mode 100644 index 0000000..c51e759 --- /dev/null +++ b/backend/models/UgiroSearch.php @@ -0,0 +1,67 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'id_ugiro' => $this->id_ugiro, + 'id_user' => $this->id_user, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + return $dataProvider; + } +} diff --git a/backend/views/customer/_form_create.php b/backend/views/customer/_form_create.php index 1b9949e..ab0e281 100644 --- a/backend/views/customer/_form_create.php +++ b/backend/views/customer/_form_create.php @@ -75,6 +75,16 @@ use kartik\widgets\DatePicker; field($model, 'tax_number')->textInput(['maxlength' => true]) ?> +
+
+ field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?> +
+
+
+
+ field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?> +
+
field($model, 'country')->textInput(['maxlength' => true]) ?> diff --git a/backend/views/customer/_form_update.php b/backend/views/customer/_form_update.php index ed36c4e..0b3f62e 100644 --- a/backend/views/customer/_form_update.php +++ b/backend/views/customer/_form_update.php @@ -79,6 +79,16 @@ use kartik\widgets\DatePicker; field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
+
+
+ field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?> +
+
+
+
+ field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?> +
+
field($model, 'country')->textInput(['maxlength' => true]) ?> diff --git a/backend/views/customer/view.php b/backend/views/customer/view.php index 7029491..7c1f095 100644 --- a/backend/views/customer/view.php +++ b/backend/views/customer/view.php @@ -44,6 +44,8 @@ $this->params['breadcrumbs'][] = $this->title; 'image', 'description', 'tax_number', + 'bank_name', + 'bank_account', 'country', 'zip', 'city', diff --git a/backend/views/ticket-installment-request/_download_giro_view.php b/backend/views/ticket-installment-request/_download_giro_view.php new file mode 100644 index 0000000..3df8fc7 --- /dev/null +++ b/backend/views/ticket-installment-request/_download_giro_view.php @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Megbízás azonosító + + + + Megbízás státusza + + + + Megbízás összege + + +
+ Megbízás inditására irányzott dátum + + formatter->asDatetime( $model['request_request_target_time_at'] );?> + + Megbízás elindításának ideje + + formatter->asDatetime( $model['request_sent_at'] );?> + + Megbízás feldoglozásának ideje + + formatter->asDatetime( $model['request_processed_at'] );?> +
+ Megbízás prioritása + + + + + + +
+ Vendég azonosító + + + + Vendég neve + + + + +
+ Bérlet azonosító + + + + Bérlet típus + + + + Bérlet státusza + + +
+ Bérlet érvényességének kezdete + + formatter->asDate( $model['ticket_start'] ) ;?> + + Bérlet érvényességének vége + + formatter->asDate( $model['ticket_end'] ) ;?> + + +
\ No newline at end of file diff --git a/backend/views/ticket-installment-request/_form.php b/backend/views/ticket-installment-request/_form.php new file mode 100644 index 0000000..56b303b --- /dev/null +++ b/backend/views/ticket-installment-request/_form.php @@ -0,0 +1,51 @@ + + +
+ + + + field($model, 'id_ticket')->textInput() ?> + + field($model, 'id_customer')->textInput() ?> + + field($model, 'id_transfer')->textInput() ?> + + field($model, 'status')->textInput() ?> + + field($model, 'money')->textInput() ?> + + field($model, 'customer_name')->textInput(['maxlength' => true]) ?> + + field($model, 'bank_name')->textInput(['maxlength' => true]) ?> + + field($model, 'bank_address')->textInput(['maxlength' => true]) ?> + + field($model, 'bank_account')->textInput(['maxlength' => true]) ?> + + field($model, 'priority')->textInput() ?> + + field($model, 'request_sent_at')->textInput() ?> + + field($model, 'request_processed_at')->textInput() ?> + + field($model, 'request_target_time_at')->textInput() ?> + + field($model, 'created_at')->textInput() ?> + + field($model, 'updated_at')->textInput() ?> + +
+ isNewRecord ? Yii::t('common/ticket_installment_request', 'Create') : Yii::t('common/ticket_installment_request', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/ticket-installment-request/_index_view.php b/backend/views/ticket-installment-request/_index_view.php new file mode 100644 index 0000000..3df8fc7 --- /dev/null +++ b/backend/views/ticket-installment-request/_index_view.php @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Megbízás azonosító + + + + Megbízás státusza + + + + Megbízás összege + + +
+ Megbízás inditására irányzott dátum + + formatter->asDatetime( $model['request_request_target_time_at'] );?> + + Megbízás elindításának ideje + + formatter->asDatetime( $model['request_sent_at'] );?> + + Megbízás feldoglozásának ideje + + formatter->asDatetime( $model['request_processed_at'] );?> +
+ Megbízás prioritása + + + + + + +
+ Vendég azonosító + + + + Vendég neve + + + + +
+ Bérlet azonosító + + + + Bérlet típus + + + + Bérlet státusza + + +
+ Bérlet érvényességének kezdete + + formatter->asDate( $model['ticket_start'] ) ;?> + + Bérlet érvényességének vége + + formatter->asDate( $model['ticket_end'] ) ;?> + + +
\ No newline at end of file diff --git a/backend/views/ticket-installment-request/_pending_view.php b/backend/views/ticket-installment-request/_pending_view.php new file mode 100644 index 0000000..ab4ed8d --- /dev/null +++ b/backend/views/ticket-installment-request/_pending_view.php @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Beküldésre jelöl + + 'pending-request', 'value' => $model['request_id_ticket_installment_request']])?> + + + + +
+ Megbízás azonosító + + + + Megbízás státusza + + + + Megbízás összege + + +
+ Megbízás inditására irányzott dátum + + formatter->asDatetime( $model['request_request_target_time_at'] );?> + + Megbízás elindításának ideje + + formatter->asDatetime( $model['request_sent_at'] );?> + + Megbízás feldoglozásának ideje + + formatter->asDatetime( $model['request_processed_at'] );?> +
+ Megbízás prioritása + + + + + + +
+ Vendég azonosító + + + + Vendég neve + + + + +
+ Bérlet azonosító + + + + Bérlet típus + + + + Bérlet státusza + + +
+ Bérlet érvényességének kezdete + + formatter->asDate( $model['ticket_start'] ) ;?> + + Bérlet érvényességének vége + + formatter->asDate( $model['ticket_end'] ) ;?> + + +
\ No newline at end of file diff --git a/backend/views/ticket-installment-request/_search.php b/backend/views/ticket-installment-request/_search.php new file mode 100644 index 0000000..e2b53e8 --- /dev/null +++ b/backend/views/ticket-installment-request/_search.php @@ -0,0 +1,137 @@ + + + 'Mind'] + ArrayHelper::map(TicketType::read(), 'id_ticket_type', 'name'); + +?> + + diff --git a/backend/views/ticket-installment-request/_search_pending.php b/backend/views/ticket-installment-request/_search_pending.php new file mode 100644 index 0000000..c2443c9 --- /dev/null +++ b/backend/views/ticket-installment-request/_search_pending.php @@ -0,0 +1,76 @@ + + + 'Mind'] + ArrayHelper::map(TicketType::read(), 'id_ticket_type', 'name'); + +?> + + diff --git a/backend/views/ticket-installment-request/create.php b/backend/views/ticket-installment-request/create.php new file mode 100644 index 0000000..853d876 --- /dev/null +++ b/backend/views/ticket-installment-request/create.php @@ -0,0 +1,21 @@ +title = Yii::t('common/ticket_installment_request', 'Create Ticket Installment Request'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_installment_request', 'Ticket Installment Requests'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/ticket-installment-request/index.php b/backend/views/ticket-installment-request/index.php new file mode 100644 index 0000000..9112d61 --- /dev/null +++ b/backend/views/ticket-installment-request/index.php @@ -0,0 +1,29 @@ +title = Yii::t('common/ticket_installment_request', 'Bérlet fizetési megbízások'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + + + $dataProvider, + 'itemView' => '_index_view' + ]); + ?> + + +
diff --git a/backend/views/ticket-installment-request/index_download_giro.php b/backend/views/ticket-installment-request/index_download_giro.php new file mode 100644 index 0000000..765cdff --- /dev/null +++ b/backend/views/ticket-installment-request/index_download_giro.php @@ -0,0 +1,44 @@ +title = Yii::t('common/ticket_installment_request', 'Giro köteg létrehozása'); +$this->params['breadcrumbs'][] = $this->title; +?> + +
+ +

title) ?>

+ + + $dataProvider, + 'itemView' => '_download_giro_view' + ]); + ?> + + Url::current(), + 'method' => 'post', + ]); ?> + field($model, 'action')->hiddenInput()->label(false) ?> +
+ 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/ticket-installment-request/index_pending.php b/backend/views/ticket-installment-request/index_pending.php new file mode 100644 index 0000000..b1f84a3 --- /dev/null +++ b/backend/views/ticket-installment-request/index_pending.php @@ -0,0 +1,50 @@ +title = Yii::t('common/ticket_installment_request', 'Indításra váró bérlet fizetési megbízások'); +$this->params['breadcrumbs'][] = $this->title; +?> + +
+ +

title) ?>

+ render('_search_pending', ['model' => $searchModel]); ?> + + +
+ +
+ Url::current(), + 'method' => 'post', + ]); ?> + + $dataProvider, + 'itemView' => '_pending_view' + ]); + ?> +
+ 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/ticket-installment-request/test.php b/backend/views/ticket-installment-request/test.php new file mode 100644 index 0000000..8ee4258 --- /dev/null +++ b/backend/views/ticket-installment-request/test.php @@ -0,0 +1,85 @@ +duplumKod = 1; +$fej->kezdemenyezoAzonosito = "A25366936T244" ;//"66658092128"; +$fej->uzenetSorszam ->osszeallitasDatuma = "20160120"; +$fej->uzenetSorszam->sorszam = 1; +$fej->kezdemenyezoBankszamla->szamlaszam = "5860025215371128";//"5860025215371128"; +// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; //"TAKBHUHB"; +$fej->ertesitesiHatarido = ""; +$fej->kezdemenyezoCegNeve = "Cutler Four kft"; + +echo "fej
"; +echo "'".str_replace(' ', ' ',Html::encode($fej->toString()) )."'"; +echo "
"; + +$tetel = new GiroBeszedTetel(); +$tetel->tetelSorszam = 1; +$tetel->terhelesiDatum = "20160122"; +$tetel->osszeg = "1000"; +// $tetel->kotelezettBankszamla->bankszerv = "58600252"; +$tetel->kotelezettBankszamla->szamlaszam = "5860025215371128"; +$tetel->ugyfelazonositoAKezdemenyezonel = 1; +$tetel->ugyfelNeve = "Schneider Roland"; +$tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31"; +$tetel->szamlaTulajdonosNeve = "Schneider Roland"; +$tetel->kozlemeny = "Berlet"; + +echo "tetel
"; +echo "'".str_replace(' ', ' ',($tetel->toString())) ."'"; +echo "
"; + + +$lab = new GiroBeszedLab(); + +$lab->tetelekOsszerteke = 1000; +$lab->tetelekSzama=1; + +echo "
lab
"; +echo str_replace(' ', ' ', $lab->toString() ); + + +$content = GiroBeszed::createFileContent(1, []); +echo "'".str_replace(' ', ' ', Html::encode(GiroBeszed::createFileContent(1, [])) ."'"); + + +$data = iconv("windows-1252","ASCII",$content); + + +// $filename = \Yii::$app->basePath . "/" ."giro" . rand(0,10000)."txt"; +// $myfile = fopen($filename,'a'); +// fwrite($myfile, $data); +// fclose($myfile); + +$dfej = new GiroDETSTAFej(); +$dfej->kezdemenyezoAzonosito = "A25366936T244"; +$dfej->csoportosUzenetSorszam ->osszeallitasDatuma = "20160120"; +$dfej->csoportosUzenetSorszam->sorszam = 1; +$dfej->detstaUzenetSorszam ->osszeallitasDatuma = "20160120"; +$dfej->detstaUzenetSorszam->sorszam = 1; +$dfej->ido = "100000"; +echo "dfej
"; +echo $dfej->toString(); + +echo "
"; + +$s = "01DETSTA0A25366936T244201601200001201601200001100000"; +$def2 = GiroDETSTAFej::parse($s); + +print_r($def2); + + +?> \ No newline at end of file diff --git a/backend/views/ticket-installment-request/update.php b/backend/views/ticket-installment-request/update.php new file mode 100644 index 0000000..f633fd2 --- /dev/null +++ b/backend/views/ticket-installment-request/update.php @@ -0,0 +1,23 @@ +title = Yii::t('common/ticket_installment_request', 'Update {modelClass}: ', [ + 'modelClass' => 'Ticket Installment Request', +]) . ' ' . $model->id_ticket_installment_request; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_installment_request', 'Ticket Installment Requests'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id_ticket_installment_request, 'url' => ['view', 'id' => $model->id_ticket_installment_request]]; +$this->params['breadcrumbs'][] = Yii::t('common/ticket_installment_request', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/ticket-installment-request/view.php b/backend/views/ticket-installment-request/view.php new file mode 100644 index 0000000..11bb934 --- /dev/null +++ b/backend/views/ticket-installment-request/view.php @@ -0,0 +1,50 @@ +title = $model->id_ticket_installment_request; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_installment_request', 'Ticket Installment Requests'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->id_ticket_installment_request], ['class' => 'btn btn-primary']) ?> + $model->id_ticket_installment_request], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('common/ticket_installment_request', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id_ticket_installment_request', + 'id_ticket', + 'id_customer', + 'id_transfer', + 'status', + 'money', + 'customer_name', + 'bank_name', + 'bank_address', + 'bank_account', + 'priority', + 'request_sent_at', + 'request_processed_at', + 'request_target_time_at', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/backend/views/ticket-type/_form.php b/backend/views/ticket-type/_form.php index 330979d..3c3ff86 100644 --- a/backend/views/ticket-type/_form.php +++ b/backend/views/ticket-type/_form.php @@ -56,8 +56,12 @@ use yii\helpers\ArrayHelper; field($model, 'status')->checkbox( ['value' => 10, 'label' => Yii::t('common/ticket_type', "Active") ]) ?> field($model, 'flag_student')->checkbox( ['value' => 1, 'label' => Yii::t('common/ticket_type', "Student") ]) ?> - - + + + field($model, 'installment_enabled')->checkbox( ['value' => 1, 'label' => Yii::t('common/ticket_type', "Csoportos beszedéses a bruttó áron felül") ]) ?> +

A részletek havonta kerülnek beszedésre

+ field($model, 'installment_money')->textInput() ?> + field($model, 'installment_count')->textInput() ?>
isNewRecord ? Yii::t('common/ticket_type', 'Create') : Yii::t('common/ticket_type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/backend/views/ticket-type/view.php b/backend/views/ticket-type/view.php index edd246a..3396d34 100644 --- a/backend/views/ticket-type/view.php +++ b/backend/views/ticket-type/view.php @@ -52,6 +52,12 @@ $this->params['breadcrumbs'][] = $this->title; ], 'created_at:datetime', 'updated_at:datetime', + [ + 'attribute' => 'installment_enabled', + 'value' => ( $model->isInstallment() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ), + ], + 'installment_money', + 'installment_count', ], ]) ?> diff --git a/backend/views/ticket/_search.php b/backend/views/ticket/_search.php index 04e7bf5..de41150 100644 --- a/backend/views/ticket/_search.php +++ b/backend/views/ticket/_search.php @@ -54,6 +54,9 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna ] ]) ?>
+
+ field($model, 'id_ticket')->textInput() ?> +
diff --git a/backend/views/ticket/index.php b/backend/views/ticket/index.php index 19b2d50..5121848 100644 --- a/backend/views/ticket/index.php +++ b/backend/views/ticket/index.php @@ -77,6 +77,11 @@ $this->params['breadcrumbs'][] = $this->title; $dataProvider, 'columns' => [ + [ + 'attribute' => 'id_ticket', + 'value' => 'id_ticket', + 'label' => 'B. Azonosító' + ], [ 'attribute' => 'id_customer', 'value' => 'customerName' diff --git a/backend/views/ugiro/_form.php b/backend/views/ugiro/_form.php new file mode 100644 index 0000000..90adc03 --- /dev/null +++ b/backend/views/ugiro/_form.php @@ -0,0 +1,27 @@ + + +
+ + + + field($model, 'id_user')->textInput() ?> + + field($model, 'created_at')->textInput() ?> + + field($model, 'updated_at')->textInput() ?> + +
+ isNewRecord ? Yii::t('common/ugiro', 'Create') : Yii::t('common/ugiro', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/ugiro/_search.php b/backend/views/ugiro/_search.php new file mode 100644 index 0000000..649aa9c --- /dev/null +++ b/backend/views/ugiro/_search.php @@ -0,0 +1,33 @@ + + + diff --git a/backend/views/ugiro/create.php b/backend/views/ugiro/create.php new file mode 100644 index 0000000..50428ce --- /dev/null +++ b/backend/views/ugiro/create.php @@ -0,0 +1,21 @@ +title = Yii::t('common/ugiro', 'Create Ugiro'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ugiro', 'Ugiros'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/ugiro/index.php b/backend/views/ugiro/index.php new file mode 100644 index 0000000..466ce37 --- /dev/null +++ b/backend/views/ugiro/index.php @@ -0,0 +1,46 @@ +title = Yii::t('common/ugiro', 'Kötegek'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + + + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'id_ugiro', + 'label' => 'Köteg azonosító' + ], + [ + 'attribute' => 'user.username', + 'label' => 'Felhasnáló' + ], + [ + 'attribute' => 'statusName', + 'label' => 'Státusz' + ], + [ + 'attribute' => 'created_at', + 'label' => 'Létrehozva', + 'format' =>'datetime' + ], + + ['class' => 'yii\grid\ActionColumn', + 'template' => '{view}' + ], + ], + ]); ?> + +
diff --git a/backend/views/ugiro/update.php b/backend/views/ugiro/update.php new file mode 100644 index 0000000..ef90b39 --- /dev/null +++ b/backend/views/ugiro/update.php @@ -0,0 +1,23 @@ +title = Yii::t('common/ugiro', 'Update {modelClass}: ', [ + 'modelClass' => 'Ugiro', +]) . ' ' . $model->id_ugiro; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ugiro', 'Ugiros'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id_ugiro, 'url' => ['view', 'id' => $model->id_ugiro]]; +$this->params['breadcrumbs'][] = Yii::t('common/ugiro', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/ugiro/view.php b/backend/views/ugiro/view.php new file mode 100644 index 0000000..047dd47 --- /dev/null +++ b/backend/views/ugiro/view.php @@ -0,0 +1,58 @@ +title = "Köteg részletei"; +$this->params['breadcrumbs'][] = ['label' => "Kötegek", 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + + 'id_ugiro', + 'label' => 'Köteg azonosító' + ], + [ + 'attribute' => 'user.username', + 'label' => 'Felhasználó' + ], + [ + 'attribute' => 'statusName', + 'label' => 'Státusz' + ], + [ + 'attribute' => 'created_at', + 'label' => 'Létrehozva', + 'format' =>'datetime' + ], + [ + 'attribute' => 'path', + 'label' => 'Köteg Fájl', + 'value' => Html::a( "Letöltés" , Url::base() ."/". $model->path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ), + 'format' => 'raw' + ], + ]; + if ( $model->status == Ugiro::$STATUS_FINISHED){ + + } + + ?> + + + $model, + 'attributes' => $attributes, + ]) ?> + +
diff --git a/backend/web/giro/megbizas/giro10_20160120txt b/backend/web/giro/megbizas/giro10_20160120txt new file mode 100644 index 0000000..6da6459 --- /dev/null +++ b/backend/web/giro/megbizas/giro10_20160120txt @@ -0,0 +1,3 @@ +01BESZED1A25366936T2442016012000105860025215371128 00000000BEEmovar +02000001201601250000007800 1 roland Berlet :614 +030000010000000000007800 diff --git a/backend/web/giro/megbizas/giro11_20160120txt b/backend/web/giro/megbizas/giro11_20160120txt new file mode 100644 index 0000000..59e1ffb --- /dev/null +++ b/backend/web/giro/megbizas/giro11_20160120txt @@ -0,0 +1,3 @@ +01BESZED1A25366936T2442016012000115860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland Berlet :614 +030000010000000000007800 diff --git a/backend/web/giro/megbizas/giro12_20160120txt b/backend/web/giro/megbizas/giro12_20160120txt new file mode 100644 index 0000000..f34862e --- /dev/null +++ b/backend/web/giro/megbizas/giro12_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000125860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland Berlet :614 +020000022016012500000078005860025215371128 1 roland Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro14_20160120txt b/backend/web/giro/megbizas/giro14_20160120txt new file mode 100644 index 0000000..cb84d0f --- /dev/null +++ b/backend/web/giro/megbizas/giro14_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000145860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland rvztr tkrfrgBerlet :614 +020000022016012500000078005860025215371128 1 roland rvztr tkrfrgBerlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro15_20160120txt b/backend/web/giro/megbizas/giro15_20160120txt new file mode 100644 index 0000000..8107554 --- /dev/null +++ b/backend/web/giro/megbizas/giro15_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000155860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland rvztr tkrfr Berlet :614 +020000022016012500000078005860025215371128 1 roland rvztr tkrfr Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro16_20160120txt b/backend/web/giro/megbizas/giro16_20160120txt new file mode 100644 index 0000000..847de95 --- /dev/null +++ b/backend/web/giro/megbizas/giro16_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000165860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro17_20160120txt b/backend/web/giro/megbizas/giro17_20160120txt new file mode 100644 index 0000000..77a4a9e --- /dev/null +++ b/backend/web/giro/megbizas/giro17_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000175860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro18_20160120txt b/backend/web/giro/megbizas/giro18_20160120txt new file mode 100644 index 0000000..5ac7d50 --- /dev/null +++ b/backend/web/giro/megbizas/giro18_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000185860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro19_20160120txt b/backend/web/giro/megbizas/giro19_20160120txt new file mode 100644 index 0000000..d9a5ad2 --- /dev/null +++ b/backend/web/giro/megbizas/giro19_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000195860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro20_20160120txt b/backend/web/giro/megbizas/giro20_20160120txt new file mode 100644 index 0000000..985d444 --- /dev/null +++ b/backend/web/giro/megbizas/giro20_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000205860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland Berlet :614 +020000022016012500000078005860025215371128 1 roland a Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro21_20160120txt b/backend/web/giro/megbizas/giro21_20160120txt new file mode 100644 index 0000000..c2b2f13 --- /dev/null +++ b/backend/web/giro/megbizas/giro21_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000215860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro22_20160120txt b/backend/web/giro/megbizas/giro22_20160120txt new file mode 100644 index 0000000..8445f4d --- /dev/null +++ b/backend/web/giro/megbizas/giro22_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000225860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro23_20160120txt b/backend/web/giro/megbizas/giro23_20160120txt new file mode 100644 index 0000000..c59db10 --- /dev/null +++ b/backend/web/giro/megbizas/giro23_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000235860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro26_20160120txt b/backend/web/giro/megbizas/giro26_20160120txt new file mode 100644 index 0000000..05723ed --- /dev/null +++ b/backend/web/giro/megbizas/giro26_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000265860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro27_20160120txt b/backend/web/giro/megbizas/giro27_20160120txt new file mode 100644 index 0000000..4f0a0eb --- /dev/null +++ b/backend/web/giro/megbizas/giro27_20160120txt @@ -0,0 +1,4 @@ +01BESZED1A25366936T2442016012000275860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +030000020000000000015600 diff --git a/backend/web/giro/megbizas/giro28_20160120txt b/backend/web/giro/megbizas/giro28_20160120txt new file mode 100644 index 0000000..ec7a33c --- /dev/null +++ b/backend/web/giro/megbizas/giro28_20160120txt @@ -0,0 +1,3 @@ +01BESZED1A25366936T2442016012000285860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +030000010000000000007800 diff --git a/backend/web/giro/megbizas/giro29_20160120.txt b/backend/web/giro/megbizas/giro29_20160120.txt new file mode 100644 index 0000000..d085099 --- /dev/null +++ b/backend/web/giro/megbizas/giro29_20160120.txt @@ -0,0 +1,3 @@ +01BESZED1A25366936T2442016012000295860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +030000010000000000007800 diff --git a/backend/web/giro/megbizas/giro30_20160120.txt b/backend/web/giro/megbizas/giro30_20160120.txt new file mode 100644 index 0000000..1f473ad --- /dev/null +++ b/backend/web/giro/megbizas/giro30_20160120.txt @@ -0,0 +1,13 @@ +01BESZED1A25366936T2442016012000305860025215371128 00000000BEEmovar +020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000032016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000042016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000052016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000062016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000072016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000082016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000092016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000102016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +020000112016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614 +030000110000000000085800 diff --git a/backend/web/giro/megbizas/giro9_20160120txt b/backend/web/giro/megbizas/giro9_20160120txt new file mode 100644 index 0000000..01c5b20 --- /dev/null +++ b/backend/web/giro/megbizas/giro9_20160120txt @@ -0,0 +1,3 @@ +01BESZED1A25366936T2442016012000095860025215371128 00000000BEEmovar +02000001201601250000007800 1 roland Berlet :614 +030000010000000000007800 diff --git a/backend/web/js/index.pending.js b/backend/web/js/index.pending.js new file mode 100644 index 0000000..79635cd --- /dev/null +++ b/backend/web/js/index.pending.js @@ -0,0 +1,8 @@ + + +$(document).ready(function() { + $("#select-all-pending").click(function() { + var checkBoxes = $(".pending-request"); + checkBoxes.prop("checked", $("#select-all-pending").prop("checked")); + }); +}); \ No newline at end of file diff --git a/bkr.html b/bkr.html new file mode 100644 index 0000000..5d61346 --- /dev/null +++ b/bkr.html @@ -0,0 +1,120 @@ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
pozíciómező-névtartalomtípushosszértékK / Vmegjegyzés
1 – 2F210rekordtípusN201K
3 – 8F211üzenettípusA6BESZEDK
9F212**duplum-kódN10 - 9Ka feldolgozás menetére nincs hatással
10-22F213kezdeményező azonosítójaAN13Ka CSBESZ-t összeállító +szolgáltató / beszedő +- adószáma +(Aaaaaaaaa[Tttt]), +- EAN kódja, +- egyéb azonosítója +(Ebbbsssss)
9F212**duplum-kódN10 - 9Ka feldolgozás menetére nincs hatással
+ +
+ + + + Generál + + + +
+ + + + \ No newline at end of file diff --git a/common/components/DailyListing.php b/common/components/DailyListing.php index 85340f0..34ad974 100644 --- a/common/components/DailyListing.php +++ b/common/components/DailyListing.php @@ -252,6 +252,10 @@ class DailyListing $query->andFilterWhere(['or' , $created_condition , $paid_condition]); $query->andWhere(['transfer.status' => Transfer::STATUS_PAID]); + + if ( $this->isModeReception() || $this->isModeAccountState() ){ + $query->andWhere(['transfer.payment_method' => Transfer::PAYMENT_METHOD_CASH]); + } } diff --git a/common/components/giro/GiroBankszamla.php b/common/components/giro/GiroBankszamla.php new file mode 100644 index 0000000..ae2331e --- /dev/null +++ b/common/components/giro/GiroBankszamla.php @@ -0,0 +1,16 @@ +szovegKitolt( $this->szamlaszam, 24 ); + } + +} \ No newline at end of file diff --git a/common/components/giro/GiroBase.php b/common/components/giro/GiroBase.php new file mode 100644 index 0000000..075d55e --- /dev/null +++ b/common/components/giro/GiroBase.php @@ -0,0 +1,43 @@ + $hossz){ + $data = substr($data, 0, $hossz ); + } + $data = str_pad($data, $hossz, $pad_string, STR_PAD_RIGHT); + echo $data; +// echo strlen($data); + return $data; + } + + public function szovegOlvas($row,$start,$length, $padchar = " "){ + return rtrim(substr($row, $start,$length),$padchar); + } + + public function szamOlvas($row,$start,$length, $padchar = "0"){ + return ltrim(substr($row, $start,$length),$padchar); + } + + public function rekordVege(){ + return "\r\n"; + } +} \ No newline at end of file diff --git a/common/components/giro/GiroBeszed.php b/common/components/giro/GiroBeszed.php new file mode 100644 index 0000000..2605ce7 --- /dev/null +++ b/common/components/giro/GiroBeszed.php @@ -0,0 +1,80 @@ +duplumKod = \Yii::$app->params['ugiro_duplom_kod']; + $fej->kezdemenyezoAzonosito = \Yii::$app->params['ugiro_kezdemenyezo_azonosito'];//"A25366936T244"; // "66658092128"; + $fej->uzenetSorszam->osszeallitasDatuma = date('Ymd' ); + $fej->uzenetSorszam->sorszam = $id; + $fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128"; +// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB"; + $fej->ertesitesiHatarido = ""; + $fej->kezdemenyezoCegNeve = \Yii::$app->params['company']; + + return $fej->toString (); + } + + public static function createTetelek($requests){ + $s = ""; + foreach ($requests as $request){ + $s .= self::createTetel($request); + } + return $s; + } + + /** + * @param common\models\TicketInstallmentRequest $request + * */ + public static function createTetel($request) { + $tetel = new GiroBeszedTetel (); + $customer = $request->customer; + $tetel->tetelSorszam = $request->id_ticket_installment_request; + $tetel->terhelesiDatum = date('Ymd' ,strtotime("+5 day"));; + $tetel->osszeg = $request->money; +// $tetel->kotelezettBankszamla->bankszerv = "58600252"; + $tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account; + $tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer; +// $tetel->ugyfelNeve = "Schneider Roland"; +// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31"; + $tetel->szamlaTulajdonosNeve = $customer->name; + $tetel->kozlemeny = "Berlet :" . $request->id_ticket; + + return $tetel->toString(); + } + + public static function createLab($requests) { + $lab = new GiroBeszedLab (); + + $osszeg = 0; + foreach ($requests as $request ){ + $osszeg += $request->money; + } + + $lab->tetelekOsszerteke = $osszeg; + $lab->tetelekSzama = count($requests); + + return $lab->toString (); + } +} \ No newline at end of file diff --git a/common/components/giro/GiroBeszedFej.php b/common/components/giro/GiroBeszedFej.php new file mode 100644 index 0000000..a90fca4 --- /dev/null +++ b/common/components/giro/GiroBeszedFej.php @@ -0,0 +1,45 @@ +uzenetSorszam = new GiroUzenetsorszam(); + $this->kezdemenyezoBankszamla = new GiroBankszamla(); + } + + + public function toString( ) { + return $this->recordTipus + .$this->uzenetTipus + . $this->duplumKod + . $this->szamKitolt( $this->kezdemenyezoAzonosito , 13) + . $this->uzenetSorszam->toString() + . $this->kezdemenyezoBankszamla->toString() + . $this->szamKitolt($this->ertesitesiHatarido,8) + . $this->jogcim + . $this->szovegKitolt($this->kezdemenyezoCegNeve, 35) + . $this->szovegKitolt($this->kozlemeny, 70) + . $this->rekordVege() + ; + } + + +} \ No newline at end of file diff --git a/common/components/giro/GiroBeszedLab.php b/common/components/giro/GiroBeszedLab.php new file mode 100644 index 0000000..382ea49 --- /dev/null +++ b/common/components/giro/GiroBeszedLab.php @@ -0,0 +1,30 @@ +rekordTipus + . $this->szamKitolt($this->tetelekSzama,6) + . $this->szamKitolt($this->tetelekOsszerteke,16) + . $this->rekordVege() + ; + + } + + +} \ No newline at end of file diff --git a/common/components/giro/GiroBeszedTetel.php b/common/components/giro/GiroBeszedTetel.php new file mode 100644 index 0000000..b4fa234 --- /dev/null +++ b/common/components/giro/GiroBeszedTetel.php @@ -0,0 +1,44 @@ +kotelezettBankszamla = new GiroBankszamla(); + } + + public function toString(){ + return $this->rekordTipus + . $this->szamKitolt($this->tetelSorszam,6) + . $this->terhelesiDatum + . $this->szamKitolt($this->osszeg, 10) + . $this->kotelezettBankszamla->toString() + . $this->szovegKitolt($this->ugyfelazonositoAKezdemenyezonel ,24) + . $this->szovegKitolt( $this->ugyfelNeve ,35 ) + . $this->szovegKitolt($this->ugyfelCime , 35 ) + . $this->szovegKitolt($this->szamlaTulajdonosNeve , 35 ) + . $this->szovegKitolt($this->kozlemeny , 70 ) + . $this->rekordVege() + ; + + } + + +} \ No newline at end of file diff --git a/common/components/giro/GiroDETSTA.php b/common/components/giro/GiroDETSTA.php new file mode 100644 index 0000000..22cc26b --- /dev/null +++ b/common/components/giro/GiroDETSTA.php @@ -0,0 +1,38 @@ +fej = GiroDETSTAFej::parse($array[0]); + $detsta->lab = GiroDETSTALab::parse($array[count($array) -1]); + + for ( $i = 1 ; $i < count($array) -1; $i++ ){ + $row = $array[$i]; + $tetel = GiroDETSTATetel::parse($row); + $detsta->tetelek[] = $tetel; + } + return $detsta; + } + +} \ No newline at end of file diff --git a/common/components/giro/GiroDETSTAFej.php b/common/components/giro/GiroDETSTAFej.php new file mode 100644 index 0000000..13bf96b --- /dev/null +++ b/common/components/giro/GiroDETSTAFej.php @@ -0,0 +1,55 @@ +csoportosUzenetSorszam = new GiroUzenetsorszam(); + $this->detstaUzenetSorszam = new GiroUzenetsorszam(); + } + + public function toString( ) { + return $this->recordTipus + .$this->uzenetTipus + . $this->jelentesJelzo + . $this->szamKitolt( $this->kezdemenyezoAzonosito , 13) + . $this->csoportosUzenetSorszam->toString() + . $this->detstaUzenetSorszam->toString() + . $this->ido + . $this->rekordVege() + ; + } + + public static function parse($row){ + $fej = new GiroDETSTAFej(); + + $fej->recordTipus = substr($row,0,2 ); + $fej->uzenetTipus = substr($row, 2,6 ); + $fej->jelentesJelzo = substr($row, 8,1); + $fej->kezdemenyezoAzonosito = substr($row, 9,13); + $fej->csoportosUzenetSorszam ->osszeallitasDatuma = substr($row, 22, 8); + $fej->csoportosUzenetSorszam->sorszam = substr($row, 30, 4); + $fej->detstaUzenetSorszam ->osszeallitasDatuma = substr($row, 34,8); + $fej->detstaUzenetSorszam->sorszam = substr($row, 42,4); + $fej->ido = substr($row, 46,6); + + return $fej; + } + + +} \ No newline at end of file diff --git a/common/components/giro/GiroDETSTALab.php b/common/components/giro/GiroDETSTALab.php new file mode 100644 index 0000000..ae18a12 --- /dev/null +++ b/common/components/giro/GiroDETSTALab.php @@ -0,0 +1,44 @@ +recordTipus + . $this->szamKitolt ( $this->teljesitettTetelekSzama, 6 ) + . $this->szamKitolt ( $this->teljesitettTetelekOsszerteke, 16 ) + . $this->szamKitolt ( $this->visszautasitottTetelekSzama, 6 ) + . $this->szamKitolt ( $this->visszautasitottTetelekOsszerteke, 16 ) + . $this->szamKitolt ( $this->megNemValaszoltTetelekSzama, 6 ) + . $this->szamKitolt ( $this->megNemValaszoltTetelekOsszerteke, 16 ) + . $this->rekordVege(); + ; + } + public static function parse($row) { + $lab = new GiroDETSTALab (); + $lab->recordTipus = substr($row,0,2 ); + $lab->teljesitettTetelekSzama = substr($row,2,6 ); + $lab->teljesitettTetelekOsszerteke = substr($row,8,16 ); + $lab->visszautasitottTetelekSzama = substr($row,24,6 ); + $lab->visszautasitottTetelekOsszerteke = substr($row,30,16 ); + $lab->megNemValaszoltTetelekSzama = substr($row,46,6 ); + $lab->megNemValaszoltTetelekOsszerteke = substr($row,52, 16 ); + return $lab; + } +} \ No newline at end of file diff --git a/common/components/giro/GiroDETSTATetel.php b/common/components/giro/GiroDETSTATetel.php new file mode 100644 index 0000000..f2bf20c --- /dev/null +++ b/common/components/giro/GiroDETSTATetel.php @@ -0,0 +1,61 @@ + "nem létező 'címzett' számlaszám", + '03' => "megszűnt 'címzett' számlaszám", + '06' => "a 'címzett' számlaszáma nem értelmezhető (az ügyfél számlaszáma helyett a bank ügyfélforgalmi számlaszáma szerepel)", + '10' => "a számlatulajdonos neve és a megadott számlaszám nem tartozik össze szemantikai, 'teljesíthetetlen' ok miatti visszaküldés (RETURN)", + '50' => "fedezethiány miatti visszaküldés", + '51' => "felhatalmazás hiánya miatti visszaküldés", + '54' => "általános visszaküldés (az ügyfél megbízása alapján)", + '65' => "összeghatár feletti beszedési megbízás", + '99' => "egyéb hiba" + ]; + + public $recordTipus = "01"; + public $tetelSorszam = "0"; + public $osszeg = "0"; + public $eredetiTetelElszamolasiDatuma = ""; + public $visszajelzesInformacio; + public $feldolgozasDatum; + public $terhelesiDatum; + public $valaszHivatkozasiKod; + public $eredetiHivatkozasiKod; + public $ugyfelAzonosito; + + public function __construct() { + $this->csoportosUzenetSorszam = new GiroUzenetsorszam (); + $this->detstaUzenetSorszam = new GiroUzenetsorszam (); + } + public function toString() { + return $this->recordTipus . $this->szamKitolt ( $this->tetelSorszam, 6 ) . $this->szamKitolt ( $this->osszeg, 10 ) . $this->eredetiTetelElszamolasiDatuma . $this->visszajelzesInformacio . $this->feldolgozasDatum . $this->terhelesiDatum . $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->ugyfelAzonosito, 29 ); + } + + public static function parse($row) { + + $tetel = new GiroDETSTATetel (); + $tetel->recordTipus = substr ( $row, 0, 2 ); + $tetel->tetelSorszam = substr ( $row, 2, 6 ); + $tetel->osszeg = substr ( $row, 8, 10 ); + $tetel->eredetiTetelElszamolasiDatuma = substr ( $row, 18, 8 ); + $tetel->visszajelzesInformacio = substr ( $row, 26, 2 ); + $tetel->feldolgozasDatum = substr ( $row, 28, 8 ); + $tetel->terhelesiDatum = substr ( $row, 36, 8 ); + $tetel->valaszHivatkozasiKod = substr ( $row, 44, 29 ); + $tetel->eredetiHivatkozasiKod = substr ( $row, 73, 29 ); + $tetel->ugyfelAzonosito = substr ( $row, 102, 24 ); + + return $tetel; + } +} \ No newline at end of file diff --git a/common/components/giro/GiroUzenetSorszam.php b/common/components/giro/GiroUzenetSorszam.php new file mode 100644 index 0000000..60a2bf7 --- /dev/null +++ b/common/components/giro/GiroUzenetSorszam.php @@ -0,0 +1,16 @@ +osszeallitasDatuma . $this->szamKitolt( $this->sorszam,4); + } + + } +?> \ No newline at end of file diff --git a/common/config/params.php b/common/config/params.php index 87d153f..39f98ed 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -13,5 +13,8 @@ return [ 'login_reception_email' => true, //if reception login should send email 'login_admin_email' => true, //if admin login should send email 'account_state_close_preload_money' => 'true',//preload money wnen show account state close page - + 'ugiro_duplom_kod' => 1, + 'ugiro_kezdemenyezo_szamlaszam' => '5860025215371128', + 'ugiro_kezdemenyezo_azonosito' => 'A25366936T244', + ]; diff --git a/common/models/CardKeyAssignment.php b/common/models/CardKeyAssignment.php new file mode 100644 index 0000000..cf60198 --- /dev/null +++ b/common/models/CardKeyAssignment.php @@ -0,0 +1,62 @@ + TimestampBehavior::className(), + 'value' => function(){ return date('Y-m-d H:i:s' ); } + ], + ], parent::behaviors()); + } + + /** + * @inheritdoc + */ + public static function tableName() + { + return 'card_key_assignment'; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [['id_card', 'id_key', 'id_user'], 'integer'], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id_card' => Yii::t('common/image', 'Id Card'), + 'id_key' => Yii::t('common/image', 'Id Key'), + 'id_user' => Yii::t('common/image', 'Id User'), + 'created_at' => Yii::t('common/image', 'Created At'), + 'updated_at' => Yii::t('common/image', 'Updated At'), + ]; + } +} diff --git a/common/models/CardSearch.php b/common/models/CardSearch.php index 414462b..3cb6525 100644 --- a/common/models/CardSearch.php +++ b/common/models/CardSearch.php @@ -57,7 +57,7 @@ class CardSearch extends Card { $query = new Query(); - $query->select(['card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']); + $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->orderBy(['customer.name' => SORT_ASC]); diff --git a/common/models/Ticket.php b/common/models/Ticket.php index 3986101..d82aef5 100644 --- a/common/models/Ticket.php +++ b/common/models/Ticket.php @@ -46,7 +46,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord public function rules() { return [ - [['id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'], + [[ 'id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'], [['start', 'end', 'created_at', 'updated_at'], 'safe'], [['comment'], 'required'], [['comment'], 'string', 'max' => 255] @@ -59,7 +59,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord public function attributeLabels() { return [ - 'id_ticket' => Yii::t('common/ticket', 'Id Ticket'), + 'id_ticket' => Yii::t('common/ticket', 'Bérlet azonosító'), 'id_user' => Yii::t('common/ticket', 'Id User'), 'id_ticket_type' => Yii::t('common/ticket', 'Id Ticket Type'), 'id_account' => Yii::t('common/ticket', 'Id Account'), @@ -233,4 +233,20 @@ class Ticket extends \common\models\BaseFitnessActiveRecord return $query; } + public static function statuses( ) { + return [ + Ticket::STATUS_ACTIVE => 'Aktív', + Ticket::STATUS_DELETED => 'Törölve', + ]; + } + + public static function toStatusName($id_status){ + $result = "Ismeretlen"; + $statuses = Ticket::statuses(); + if ( array_key_exists($id_status, $statuses)){ + $result = $statuses[$id_status]; + } + return $result; + } + } diff --git a/common/models/TicketInstallmentRequest.php b/common/models/TicketInstallmentRequest.php new file mode 100644 index 0000000..f38cf18 --- /dev/null +++ b/common/models/TicketInstallmentRequest.php @@ -0,0 +1,156 @@ + 255] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id_ticket_installment_request' => Yii::t('common/ticket_installment_request', 'Id Ticket Installment Request'), + 'id_ticket' => Yii::t('common/ticket_installment_request', 'Id Ticket'), + 'id_customer' => Yii::t('common/ticket_installment_request', 'Id Customer'), + 'id_transfer' => Yii::t('common/ticket_installment_request', 'Id Transfer'), + 'status' => Yii::t('common/ticket_installment_request', 'Status'), + 'money' => Yii::t('common/ticket_installment_request', 'Money'), + 'customer_name' => Yii::t('common/ticket_installment_request', 'Customer Name'), + 'bank_name' => Yii::t('common/ticket_installment_request', 'Bank Name'), + 'bank_address' => Yii::t('common/ticket_installment_request', 'Bank Address'), + 'bank_account' => Yii::t('common/ticket_installment_request', 'Bank Account'), + 'priority' => Yii::t('common/ticket_installment_request', 'Priority'), + 'request_sent_at' => Yii::t('common/ticket_installment_request', 'Request Sent At'), + 'request_processed_at' => Yii::t('common/ticket_installment_request', 'Request Processed At'), + 'request_target_time_at' => Yii::t('common/ticket_installment_request', 'Request Target Time At'), + 'created_at' => Yii::t('common/ticket_installment_request', 'Created At'), + 'updated_at' => Yii::t('common/ticket_installment_request', 'Updated At'), + ]; + } + + + public function behaviors() + { + return ArrayHelper::merge( [ + [ + 'class' => TimestampBehavior::className(), + 'value' => function(){ return date('Y-m-d H:i:s' ); } + ], + ], parent::behaviors()); + } + + public function getCustomer(){ + return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] ); + } + + /** + * @param common\models\Ticket $ticket + * @param common\models\TicketType $type + * @return common\models\TicketInstallmentRequest[] + * */ + public static function createInstallments($ticket,$type,$customer){ + $result = []; + if ( $type->isInstallment() ){ + $count = $type->installment_count; + $ticketCreatedAt = time(); + $money = $type->price_brutto; + for ( $i = 1; $i <= $count; $i++){ + $request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $money, $ticketCreatedAt, $i); + $result[] = $request; + } + + } + return $result; + } + + public static function createInstallment($ticket,$type,$customer,$money,$ticketCreated,$index){ + $request = new TicketInstallmentRequest(); + $request->id_ticket = $ticket->id_ticket; + $request->id_customer = $customer->id_customer; + $request->status = TicketInstallmentRequest::$STATUS_PENDING; + $request->priority = $index; + $request->request_target_time_at = date('Y-m-d H:i:s', strtotime("+".$index." month" )); + $request->request_processed_at = null; + $request->request_sent_at = null; + $request->money = $money; + + return $request; + } + + public static function statuses(){ + return [ + TicketInstallmentRequest::$STATUS_PENDING => 'Indításra vár', + TicketInstallmentRequest::$STATUS_MARKED_TO_SEND=> 'Beküldésre jelölve', + TicketInstallmentRequest::$STATUS_SENT=> 'Beküldve', + TicketInstallmentRequest::$STATUS_CANCELED=> 'Törölve', + TicketInstallmentRequest::$STATUS_REJECTED=> 'Visszautasítva', + TicketInstallmentRequest::$STATUS_ACCEPTED=> 'Sikeresen végrehajtva', + + ]; + } + + public static function toStatusName($id_status){ + $result = "Ismeretlen"; + $statuses = TicketInstallmentRequest::statuses(); + if ( array_key_exists($id_status, $statuses)){ + $result = $statuses[$id_status]; + } + return $result; + } + +} diff --git a/common/models/TicketType.php b/common/models/TicketType.php index 831514e..9cbaf09 100644 --- a/common/models/TicketType.php +++ b/common/models/TicketType.php @@ -18,6 +18,9 @@ use yii\helpers\ArrayHelper; * @property integer $id_account * @property integer $flag_student * @property integer $status + * @property integer installment_enabled + * @property integer installment_count + * @property integer installment_money * @property string $created_at * @property string $updated_at */ @@ -33,6 +36,9 @@ class TicketType extends \common\models\BaseFitnessActiveRecord { const FLAG_STUDENT_OFF = 0; const FLAG_STUDENT_ON = 1; + const INSTALLMENT_OFF = 0; + const INSTALLMENT_ON = 1; + /** * @inheritdoc */ @@ -89,6 +95,15 @@ class TicketType extends \common\models\BaseFitnessActiveRecord { //////////////// [['id_account',], 'integer'], [['id_account',], 'validateIdAccount'], + + ///////////////////// + //INSTALLMENT ENABLED + ///////////////////// + [['installment_enabled',], 'integer'], + [['installment_enabled',], 'in', 'range' => [ self::INSTALLMENT_ON, self::INSTALLMENT_OFF ]], + + [['installment_money',], 'integer'], + [['installment_count',], 'integer'], ]; } @@ -110,6 +125,9 @@ class TicketType extends \common\models\BaseFitnessActiveRecord { 'status' => Yii::t('common/ticket_type', 'Status'), 'created_at' => Yii::t('common/ticket_type', 'Created At'), 'updated_at' => Yii::t('common/ticket_type', 'Updated At'), + 'installment_enabled' => Yii::t('common/ticket_type', 'Részlet fizetés a brutto áron felül'), + 'installment_count' => Yii::t('common/ticket_type', 'Havi részletek száma'), + 'installment_money' => Yii::t('common/ticket_type', 'Havi részlet összege'), ]; } @@ -170,6 +188,9 @@ class TicketType extends \common\models\BaseFitnessActiveRecord { public function isStudent(){ return $this->flag_student == ( self::FLAG_STUDENT_ON); } + public function isInstallment(){ + return $this->installment_enabled == ( self::INSTALLMENT_ON); + } public function validateIdAccount($attribute,$params){ diff --git a/common/models/Transfer.php b/common/models/Transfer.php index 1818bb7..c92eca5 100644 --- a/common/models/Transfer.php +++ b/common/models/Transfer.php @@ -51,7 +51,10 @@ class Transfer extends \common\models\BaseFitnessActiveRecord const DIRECTION_IN = 20;//MONEY GOES IN TO THE ACCOUNT ( COMPANY EARN MONEY ) const PAYMENT_METHOD_CASH = 10; - const PAYMENT_METHOD_TRANSFER = 20; + const PAYMENT_METHOD_BANCCARD = 20; //BANKKÁRTYA + const PAYMENT_METHOD_TRANSFER= 30; // ÁTUTALÁS + const PAYMENT_METHOD_CAFETERY = 40;//SZÉCHENYI KÁRTYA +// const PAYMENT_METHOD_DEBIT_MANDATE = 50;//CSOPORTOS BESZEDÉSI MEGBÍZÁS /** * @inheritdoc @@ -464,7 +467,10 @@ class Transfer extends \common\models\BaseFitnessActiveRecord public static function paymentMethods( ) { return [ self::PAYMENT_METHOD_CASH=> Yii::t('common/transfer','Készpénz'), - self::PAYMENT_METHOD_TRANSFER => Yii::t('common/transfer','Bankkártyás fizetés'), + self::PAYMENT_METHOD_BANCCARD => Yii::t('common/transfer','Bankkártyás fizetés'), + self::PAYMENT_METHOD_TRANSFER => Yii::t('common/transfer','Átutalás'), + self::PAYMENT_METHOD_CAFETERY => Yii::t('common/transfer','Széchenyi kártya'), +// self::PAYMENT_METHOD_DEBIT_MANDATE => Yii::t('common/transfer','Csoportos beszedési megbízás'), ]; } public static function statuses( ) { diff --git a/common/models/Ugiro.php b/common/models/Ugiro.php new file mode 100644 index 0000000..8423407 --- /dev/null +++ b/common/models/Ugiro.php @@ -0,0 +1,86 @@ + TimestampBehavior::className(), + 'value' => function(){ return date('Y-m-d H:i:s' ); } + ], + ], parent::behaviors()); + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id_ugiro' => Yii::t('common/ticket_installment_request', 'Id Ugiro'), + 'id_user' => Yii::t('common/ticket_installment_request', 'Id User'), + 'created_at' => Yii::t('common/ticket_installment_request', 'Created At'), + 'updated_at' => Yii::t('common/ticket_installment_request', 'Updated At'), + ]; + } + + public function getUser(){ + return $this->hasOne( User::className(), ["id" =>"id_user" ] ); + } + + public static function statuses() { + return [ + static::$STATUS_SENT =>"Folyamatban", + static::$STATUS_FINISHED =>"Befejezve", + ] + ; + } + + public function getStatusName( ) { + $statuses = static::statuses() ; + $result = "Ismeretlen"; + if ( array_key_exists($this->status, $statuses)){ + $result = $statuses[$this->status]; + } + return $result; + } + +} diff --git a/common/models/UgiroRequestAssignment.php b/common/models/UgiroRequestAssignment.php new file mode 100644 index 0000000..9bfbbbe --- /dev/null +++ b/common/models/UgiroRequestAssignment.php @@ -0,0 +1,51 @@ + Yii::t('common/ugiro_request_assignment', 'Id Ugiro Request Assignment'), + 'id_ugiro' => Yii::t('common/ugiro_request_assignment', 'Id Ugiro'), + 'id_request' => Yii::t('common/ugiro_request_assignment', 'Id Request'), + 'created_at' => Yii::t('common/ugiro_request_assignment', 'Created At'), + 'updated_at' => Yii::t('common/ugiro_request_assignment', 'Updated At'), + ]; + } +} diff --git a/console/migrations/m160117_182720_add_card_key_assignment.php b/console/migrations/m160117_182720_add_card_key_assignment.php new file mode 100644 index 0000000..8592150 --- /dev/null +++ b/console/migrations/m160117_182720_add_card_key_assignment.php @@ -0,0 +1,38 @@ +db->driverName === 'mysql') { + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; + } + + $this->createTable('{{%card_key_assignment}}', [ + 'id_card' => $this->integer(11), + 'id_key' => $this->integer(11), + 'id_user' => $this->integer(11), + 'created_at' => $this->dateTime()->notNull(), + 'updated_at' => $this->dateTime()->notNull(), + ], $tableOptions); + } + + public function down() + { + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/console/migrations/m160119_103347_alter__table__ticket_type__add_installment_fields.php b/console/migrations/m160119_103347_alter__table__ticket_type__add_installment_fields.php new file mode 100644 index 0000000..4b83b79 --- /dev/null +++ b/console/migrations/m160119_103347_alter__table__ticket_type__add_installment_fields.php @@ -0,0 +1,29 @@ +addColumn("ticket_type", "installment_enabled", "int default 0"); + $this->addColumn("ticket_type", "installment_count", "int"); + $this->addColumn("ticket_type", "installment_money", "int"); + } + + public function down() + { + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/console/migrations/m160119_110151_create__table__ticket__installment_request.php b/console/migrations/m160119_110151_create__table__ticket__installment_request.php new file mode 100644 index 0000000..7049646 --- /dev/null +++ b/console/migrations/m160119_110151_create__table__ticket__installment_request.php @@ -0,0 +1,50 @@ +db->driverName === 'mysql') { + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; + } + + $this->createTable('{{%ticket_installment_request}}', [ + 'id_ticket_installment_request' => $this->primaryKey(), + 'id_ticket' => $this->integer(11), + 'id_customer' => $this->integer(11), + 'id_transfer' => $this->integer(11), + 'status' => $this->integer(11), + 'money' => $this->integer(11), + 'customer_name' => $this->string(), + 'bank_name' => $this->string(), + 'bank_address' => $this->string(), + 'bank_account' => $this->string(), + 'priority' => $this->integer(11), + 'request_sent_at' => $this->dateTime(), + 'request_processed_at' => $this->dateTime(), + 'request_target_time_at' => $this->dateTime(), + 'created_at' => $this->dateTime()->notNull(), + 'updated_at' => $this->dateTime()->notNull(), + ], $tableOptions); + } + + public function down() + { + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/console/migrations/m160120_044951_add__ugiro_tables.php b/console/migrations/m160120_044951_add__ugiro_tables.php new file mode 100644 index 0000000..c0d6900 --- /dev/null +++ b/console/migrations/m160120_044951_add__ugiro_tables.php @@ -0,0 +1,52 @@ +db->driverName === 'mysql') { + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; + } + + $this->createTable('{{%ugiro}}', [ + 'id_ugiro' => $this->primaryKey(), + 'id_user' => $this->integer(11), + 'created_at' => $this->dateTime()->notNull(), + 'updated_at' => $this->dateTime()->notNull(), + ], $tableOptions); + + $tableOptions = null; + if ($this->db->driverName === 'mysql') { + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; + } + + $this->createTable('{{%ugiro_request_assignment}}', [ + 'id_ugiro_request_assignment' => $this->primaryKey(), + 'id_ugiro' => $this->integer(11), + 'id_request' => $this->integer(11), + 'created_at' => $this->dateTime()->notNull(), + 'updated_at' => $this->dateTime()->notNull(), + ], $tableOptions); + } + + public function down() + { + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/console/migrations/m160120_050556_alter__table__ugiro_add_column_path.php b/console/migrations/m160120_050556_alter__table__ugiro_add_column_path.php new file mode 100644 index 0000000..909a3be --- /dev/null +++ b/console/migrations/m160120_050556_alter__table__ugiro_add_column_path.php @@ -0,0 +1,30 @@ +addColumn("ugiro", "path", "string"); + } + + public function down() + { + echo "m160120_050556_alter__table__ugiro_add_column_path 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/console/migrations/m160120_054556_alter__table__customer__add__column__bankaccount.php b/console/migrations/m160120_054556_alter__table__customer__add__column__bankaccount.php new file mode 100644 index 0000000..c984165 --- /dev/null +++ b/console/migrations/m160120_054556_alter__table__customer__add__column__bankaccount.php @@ -0,0 +1,31 @@ +addColumn("customer", "bank_account", "string"); + $this->addColumn("customer", "bank_name", "string"); + } + + public function down() + { + echo "m160120_054556_alter__table__customer__add__column__bankaccount 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/console/migrations/m160120_093445_alter__table__ugiro__add__status.php b/console/migrations/m160120_093445_alter__table__ugiro__add__status.php new file mode 100644 index 0000000..57fad66 --- /dev/null +++ b/console/migrations/m160120_093445_alter__table__ugiro__add__status.php @@ -0,0 +1,27 @@ +addColumn("ugiro", "status", "int"); + } + + public function down() + { + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/frontend/controllers/KeyController.php b/frontend/controllers/KeyController.php new file mode 100644 index 0000000..c6ada24 --- /dev/null +++ b/frontend/controllers/KeyController.php @@ -0,0 +1,109 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Key models. + * @return mixed + */ + public function actionIndex( $id_card ) + { + $card = Card::findOne($id_card); + if ( !isset( $card ) ){ + throw new NotFoundHttpException("Vendég nem található"); + } + + $searchModel = new KeySearch(); + $searchModel->card = $card; + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Deletes an existing CardKeyAssignment model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id_key) + { + $key = Key::findOne($id_key); + if ( !isset($key)){ + throw new NotFoundHttpException("Kulcs nem található"); + } + + + CardKeyAssignment::deleteAll(['id_key' => $key->id_key]); + + \Yii::$app->session->setFlash('success','Kulcs visszaadva'); + + return $this->redirect(['customer/reception' ]); + } + + + /** + * Lists all Key models. + * @return mixed + */ + public function actionToggle($number = null) + { + // $this->findByNumber($number); + $receptionForm = new ReceptionForm(); + $receptionForm->number = $number; + $receptionForm->readCard (); + + $customer = $receptionForm->customer; + $card = $receptionForm->card; + + + $model = new KeyToggleForm(); + $model->card = $receptionForm->card; + $model->customer = $receptionForm->customer; + + if ( $model->load ( Yii::$app->request->post () )) { + $model->toggleKey(); + } + + + return $this->redirect(['customer/reception', 'number' => $number ]); + + } + + +} diff --git a/frontend/models/CustomerCreate.php b/frontend/models/CustomerCreate.php index a6f4357..14e5556 100644 --- a/frontend/models/CustomerCreate.php +++ b/frontend/models/CustomerCreate.php @@ -88,6 +88,9 @@ class CustomerCreate extends \common\models\Customer [['phone', 'tax_number', 'country'], 'string', 'max' => 20], + [['bank_account'], 'string', 'max' => 24], + [['bank_name'], 'string', 'max' => 100], + [['phone'], 'required', 'when' => function($model) { return !isset( $model->email ) || empty( $model->email ) ; } , diff --git a/frontend/models/CustomerUpdate.php b/frontend/models/CustomerUpdate.php index ed920a9..3157d83 100644 --- a/frontend/models/CustomerUpdate.php +++ b/frontend/models/CustomerUpdate.php @@ -89,6 +89,9 @@ class CustomerUpdate extends \common\models\Customer [['phone', 'tax_number', 'country'], 'string', 'max' => 20], + [['bank_account'], 'string', 'max' => 24], + [['bank_name'], 'string', 'max' => 100], + [['phone'], 'required', 'when' => function($model) { return !isset( $model->email ) || empty( $model->email ) ; } , diff --git a/frontend/models/KeySearch.php b/frontend/models/KeySearch.php new file mode 100644 index 0000000..6f9297a --- /dev/null +++ b/frontend/models/KeySearch.php @@ -0,0 +1,76 @@ +select([ 'user.username as user_username', 'card.id_card as card_id_card', 'key.id_key as key_id_key', 'card.number as card_number' , 'key.number as key_number','card_key_assignment.created_at as assign_created_at'] ); + $query->from('card'); + $query->innerJoin('card_key_assignment','card.id_card = card_key_assignment.id_card' ); + $query->innerJoin('key','key.id_key = card_key_assignment.id_key' ); + $query->innerJoin('user','user.id = card_key_assignment.id_user' ); + $query->andWhere(['card_key_assignment.id_card' => $this->card->id_card]); + $query->orderBy( ['card_key_assignment.created_at' => SORT_ASC] ); + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'type' => $this->type, + ]); + + $query->andFilterWhere(['like', 'number', $this->number]) + ->andFilterWhere(['like', 'rfid_key', $this->rfid_key]); + + return $dataProvider; + } +} diff --git a/frontend/models/KeyToggleForm.php b/frontend/models/KeyToggleForm.php new file mode 100644 index 0000000..a8df8d4 --- /dev/null +++ b/frontend/models/KeyToggleForm.php @@ -0,0 +1,75 @@ +keyModel = Key::find()->andWhere(['rfid_key' => $this->key])->one(); + if ( isset($this->keyModel) ){ + $assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all(); + if ( count($assignments) > 0){ + $this->unassign(); + }else{ + $this->assign(); + } + }else{ + \Yii::$app->session->setFlash ( 'danger', 'Kulcs nem található!' ); + } + } + + public function assign(){ + if ( isset($this->card) && isset($this->customer) ){ + $assignment = new CardKeyAssignment(); + $assignment->id_card = $this->card->id_card; + $assignment->id_key = $this->keyModel->id_key; + $assignment->id_user = \Yii::$app->user->id; + $assignment->save(false); + \Yii::$app->session->setFlash ( 'success', 'Kulcs kiadva!' ); + }else{ + \Yii::$app->session->setFlash ( 'danger', 'Nincs vendég kiválasztva vagy érvénytelen kártya!' ); + } + } + + public function unassign(){ + CardKeyAssignment::deleteAll(['id_key' => $this->keyModel->id_key]); + \Yii::$app->session->setFlash ( 'success', 'Kulcs visszaadva!' ); + } + +} diff --git a/frontend/models/ReceptionForm.php b/frontend/models/ReceptionForm.php index 814a5ab..29f98f6 100644 --- a/frontend/models/ReceptionForm.php +++ b/frontend/models/ReceptionForm.php @@ -10,6 +10,8 @@ use common\models\Ticket; use common\models\Account; use common\models\CardSearch; use common\models\AccountState; +use common\models\Key; +use common\models\CardKeyAssignment; /** * ContactForm is the model behind the contact form. @@ -23,7 +25,7 @@ class ReceptionForm extends Model public $defaultAccount; public $cardSearchModel; public $lastCassaState; - + public $keys; /** * @inheritdoc */ @@ -53,6 +55,7 @@ class ReceptionForm extends Model if ( $this->card != null ){ $this->customer = $this->card->customer; $this->readValidTickets(); + $this->readAssignedKeys(); } $defaultAccount = Account::readDefault(); @@ -65,6 +68,14 @@ class ReceptionForm extends Model } + public function readAssignedKeys(){ + $query = Key::find(); + $query->join( 'INNER JOIN', CardKeyAssignment::tableName() , Key::tableName().".id_key = " . CardKeyAssignment::tableName() . ".id_key"); + $query->andWhere([ "card_key_assignment.id_card" => $this->card->id_card ]); + $this->keys = $query->all(); + + } + public function readLastCassaState(){ $a = Account::readDefault(); if ( isset($a)){ @@ -136,4 +147,23 @@ class ReceptionForm extends Model } + public function getCardNumber(){ + if ( isset($this->card)){ + return $this->card->number; + } + return null; + } + + public function getKeysText(){ + $keyNumbers = []; + $result = "-"; + if ( isset($this->keys)){ + foreach ($this->keys as $k ){ + $keyNumbers[] = $k->number; + } + $result = implode(", ",$keyNumbers); + } + return $result; + } + } diff --git a/frontend/models/TicketCreate.php b/frontend/models/TicketCreate.php index fac7c47..181aa9f 100644 --- a/frontend/models/TicketCreate.php +++ b/frontend/models/TicketCreate.php @@ -9,6 +9,7 @@ use common\models\Transfer; use common\models\UserSoldItem; use common\models\ShoppingCart; use yii\base\Object; +use common\models\TicketInstallmentRequest; /** * @property $cart string name of cart, into we put the ticket @@ -111,9 +112,21 @@ class TicketCreate extends Ticket{ $this->addTransfer(); $this->appendToUserCart(); $this->appendToCustomerCart(); - + $this->addTicketInstallmentRequests($insert); } + + public function addTicketInstallmentRequests($insert){ + if ($insert){ + $ticketType = TicketType::findOne($this->id_ticket_type); + if ( isset($ticketType) && $ticketType->isInstallment() ){ + $requests = TicketInstallmentRequest::createInstallments($this, $ticketType, $this->customer); + foreach ($requests as $request){ + $request->save(false); + } + } + } + } protected function addTransfer(){ $transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this); diff --git a/frontend/views/card/index.php b/frontend/views/card/index.php index b1a2409..8ab0e9b 100644 --- a/frontend/views/card/index.php +++ b/frontend/views/card/index.php @@ -45,7 +45,7 @@ $this->params['breadcrumbs'][] = $this->title; ['class' => 'yii\grid\ActionColumn', - 'template' => '{ticket} {ticket_history}', + 'template' => '{ticket} {ticket_history} {keys}', 'buttons' => [ 'ticket' => function ($url, $model, $key) { return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ; @@ -53,6 +53,9 @@ $this->params['breadcrumbs'][] = $this->title; 'ticket_history' => function ($url, $model, $key) { return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ; }, + 'keys' => function ($url, $model, $key) { + return Html::a('Kulcsok', $url, ['class'=> 'btn btn-xs btn-success' ]) ; + }, ], 'urlCreator' => function ($action, $model, $key, $index){ $url = ""; @@ -60,6 +63,8 @@ $this->params['breadcrumbs'][] = $this->title; $url = Url::to(['ticket/create','number' => $model['card_number']]); }else if ( 'ticket_history' == $action ){ $url = Url::to(['ticket/index','number' => $model['card_number']]); + }else if ( 'keys' == $action ){ + $url = Url::to(['key/index','id_card' => $model['card_id_card']]); } return $url; } diff --git a/frontend/views/common/_reception.php b/frontend/views/common/_reception.php index 8a39fc6..f100672 100644 --- a/frontend/views/common/_reception.php +++ b/frontend/views/common/_reception.php @@ -41,6 +41,19 @@ use yii\helpers\Html; 'btn btn-primary']) ?>
+ ['key/toggle', 'number' => $model->getCardNumber()], + 'method' => 'post', + ]); ?> +
+ getCardNumber())?> + "form-control", 'placeholder' =>'Kulcs']) ?> + +
+
+ 'btn btn-primary']) ?> +
+
diff --git a/frontend/views/common/_reception_customer.php b/frontend/views/common/_reception_customer.php index 2c2b96d..c768a71 100644 --- a/frontend/views/common/_reception_customer.php +++ b/frontend/views/common/_reception_customer.php @@ -36,6 +36,10 @@ if ( $model->isCardWithCustomer() ){ 'label' => 'Telefon', 'value' => $model->customer->phone ], + [ + 'label' => 'Kulcsok', + 'value' => $model->keysText, + ], [ 'label' => 'Fénykép', 'value' => $model->customer->image1 ? Html::img( Url::base( ) . Image::thumb( $model->customer->image1->path,160,120 )) : 'Nincs kép', diff --git a/frontend/views/customer/_form_create.php b/frontend/views/customer/_form_create.php index 16a66c1..b0f27a0 100644 --- a/frontend/views/customer/_form_create.php +++ b/frontend/views/customer/_form_create.php @@ -89,6 +89,16 @@ use kartik\widgets\DatePicker; field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
+
+
+ field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?> +
+
+
+
+ field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?> +
+
field($model, 'country')->textInput(['maxlength' => true]) ?> diff --git a/frontend/views/customer/_form_update.php b/frontend/views/customer/_form_update.php index ea8b541..c3544a7 100644 --- a/frontend/views/customer/_form_update.php +++ b/frontend/views/customer/_form_update.php @@ -83,6 +83,16 @@ use yii\base\Widget; field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
+
+
+ field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?> +
+
+
+
+ field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?> +
+
field($model, 'country')->textInput(['maxlength' => true]) ?> diff --git a/frontend/views/customer/view.php b/frontend/views/customer/view.php index e9765a0..e5c8d8a 100644 --- a/frontend/views/customer/view.php +++ b/frontend/views/customer/view.php @@ -43,6 +43,8 @@ $this->params['breadcrumbs'][] = $this->title; 'image', 'description', 'tax_number', + 'bank_name', + 'bank_account', 'country', 'zip', 'city', diff --git a/frontend/views/key/_form.php b/frontend/views/key/_form.php new file mode 100644 index 0000000..341ef15 --- /dev/null +++ b/frontend/views/key/_form.php @@ -0,0 +1,29 @@ + + +
+ + + + field($model, 'number')->textInput(['maxlength' => true]) ?> + + field($model, 'status')->textInput() ?> + + field($model, 'type')->textInput() ?> + + field($model, 'rfid_key')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? Yii::t('frontend/key', 'Create') : Yii::t('frontend/key', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/key/_search.php b/frontend/views/key/_search.php new file mode 100644 index 0000000..37b298b --- /dev/null +++ b/frontend/views/key/_search.php @@ -0,0 +1,39 @@ + + + diff --git a/frontend/views/key/create.php b/frontend/views/key/create.php new file mode 100644 index 0000000..7470971 --- /dev/null +++ b/frontend/views/key/create.php @@ -0,0 +1,21 @@ +title = Yii::t('frontend/key', 'Create Key'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/key', 'Keys'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/key/index.php b/frontend/views/key/index.php new file mode 100644 index 0000000..1ab216a --- /dev/null +++ b/frontend/views/key/index.php @@ -0,0 +1,59 @@ +title = Yii::t('frontend/key', 'Vendéghez rendelt kulcsok'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

Vendég: card->customer->name ;?>

+

Kártyaszám: card->number ;?>

+ $dataProvider, + 'columns' => [ + [ + 'attribute' => 'key_number', + 'label' => 'Kulcs' + + ], + [ + 'attribute' => 'assign_created_at', + 'label' => 'Kiadás dátuma', + 'format' => 'datetime' + + ], + [ + 'attribute' => 'user_username', + 'label' => 'Felhasználó', + ], + + ['class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + 'buttons' => [ + 'delete' => function ($url, $model, $key) { + return Html::a('Visszaad', $url, ['class'=> 'btn btn-xs btn-danger','data-method' => 'post' ]) ; + }, + ], + 'urlCreator' => function ($action, $model, $key, $index){ + $url = ""; + if ( 'delete' == $action ){ + $url = Url::to(['key/delete','id_key' => $model['key_id_key']]); + } + return $url; + } + + ], + ], + ]); ?> + +
diff --git a/frontend/views/key/update.php b/frontend/views/key/update.php new file mode 100644 index 0000000..875ec18 --- /dev/null +++ b/frontend/views/key/update.php @@ -0,0 +1,23 @@ +title = Yii::t('frontend/key', 'Update {modelClass}: ', [ + 'modelClass' => 'Key', +]) . ' ' . $model->id_key; +$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/key', 'Keys'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id_key, 'url' => ['view', 'id' => $model->id_key]]; +$this->params['breadcrumbs'][] = Yii::t('frontend/key', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/key/view.php b/frontend/views/key/view.php new file mode 100644 index 0000000..929bbbe --- /dev/null +++ b/frontend/views/key/view.php @@ -0,0 +1,41 @@ +title = $model->id_key; +$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/key', 'Keys'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->id_key], ['class' => 'btn btn-primary']) ?> + $model->id_key], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('frontend/key', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id_key', + 'number', + 'status', + 'type', + 'created_at', + 'updated_at', + 'rfid_key', + ], + ]) ?> + +
From a2a6b1f24073604ba36708231da2f248c483f221 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 22 Jan 2016 14:45:56 +0100 Subject: [PATCH 2/4] add ticket installment --- .gitignore | 7 +- backend/0209ch7z.det | 5 + backend/components/AdminMenuStructure.php | 2 + .../TicketInstallmentRequestController.php | 20 ++ backend/controllers/UgiroController.php | 64 +++++ backend/detsta.txt | 5 + backend/models/DestaUploadForm.php | 68 ++++++ backend/models/GiroKotegForm.php | 20 +- .../models/TicketInstallmentRequestSearch.php | 10 +- backend/models/TicketSearch.php | 5 +- .../_index_view.php | 56 ++++- .../ticket-installment-request/_search.php | 9 +- .../ticket-installment-request/index.php | 7 + .../views/ticket-installment-request/view.php | 224 +++++++++++++++--- backend/views/ticket/_search.php | 10 + backend/views/ticket/index.php | 4 + backend/views/ticket/view.php | 35 ++- backend/views/ugiro/detsta.php | 26 ++ backend/views/ugiro/upload.php | 27 +++ backend/views/ugiro/view.php | 43 +++- backend/web/giro/megbizas/.gitkeep | 0 backend/web/giro/valasz/.gitkeep | 0 common/components/DetStatProcessor.php | 137 +++++++++++ common/components/DetStatTetelProcessor.php | 129 ++++++++++ common/components/giro/GiroBase.php | 4 +- common/components/giro/GiroBeszed.php | 33 ++- common/components/giro/GiroDETSTA.php | 20 +- common/components/giro/GiroDETSTAFej.php | 2 +- common/components/giro/GiroDETSTALab.php | 2 + common/components/giro/GiroDETSTATetel.php | 12 +- common/models/AccountState.php | 3 +- common/models/MoneyMovement.php | 22 ++ common/models/Sale.php | 23 ++ common/models/Ticket.php | 71 +++++- common/models/TicketInstallmentRequest.php | 98 +++++++- common/models/Transfer.php | 26 +- common/models/Ugiro.php | 17 +- ...le__money_movement__add_column__status.php | 30 +++ ...ble__ticket__add_part__and__parts_paid.php | 32 +++ ...2_alter__table__ugiro__add__desta_path.php | 30 +++ ...9_alter__table__ugiro__uzenet__sorszam.php | 28 +++ .../controllers/AccountStateController.php | 2 +- frontend/controllers/TicketController.php | 39 ++- frontend/controllers/TransferController.php | 13 +- frontend/models/TicketCreate.php | 30 +++ frontend/models/TicketUpdate.php | 25 ++ frontend/views/money-movement/index.php | 5 + frontend/views/ticket/_form_update.php | 84 +++++++ frontend/views/ticket/index.php | 35 ++- frontend/views/ticket/update.php | 6 +- frontend/views/transfer/_view.php | 6 +- 51 files changed, 1498 insertions(+), 113 deletions(-) create mode 100644 backend/0209ch7z.det create mode 100644 backend/detsta.txt create mode 100644 backend/models/DestaUploadForm.php create mode 100644 backend/views/ugiro/detsta.php create mode 100644 backend/views/ugiro/upload.php create mode 100644 backend/web/giro/megbizas/.gitkeep create mode 100644 backend/web/giro/valasz/.gitkeep create mode 100644 common/components/DetStatProcessor.php create mode 100644 common/components/DetStatTetelProcessor.php create mode 100644 console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php create mode 100644 console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php create mode 100644 console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php create mode 100644 console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php create mode 100644 frontend/models/TicketUpdate.php create mode 100644 frontend/views/ticket/_form_update.php diff --git a/.gitignore b/.gitignore index 1d62e63..4f9d1fa 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,9 @@ phpunit.phar /frontend/web/profile/** !/frontend/web/profile/.gitkeep -/frontend/web/uploads/** \ No newline at end of file +/frontend/web/uploads/** + +/backend/web/giro/megbizas/** +!/backend/web/giro/megbizas/.gitkeep +/backend/web/giro/valasz/** +!/backend/web/giro/valasz/.gitkeep \ No newline at end of file diff --git a/backend/0209ch7z.det b/backend/0209ch7z.det new file mode 100644 index 0000000..20598c0 --- /dev/null +++ b/backend/0209ch7z.det @@ -0,0 +1,5 @@ +01DETSTA8A24237545 201501270001201502094542162957 +020000010000014097201501270020150204201502031104 03916201502031001307001595 0015520150127321538700000000000000000000000340 +020000020000015240201501275020150204 1117 73377201502033417908001595 0015520150127321538800000000000000000000000347 +020000030000015240201501270020150204201502031120 94002201502030005151001595 0015520150127321538900000000000000000000000176 +03000002000000000002933700000100000000000152400000000000000000000000 diff --git a/backend/components/AdminMenuStructure.php b/backend/components/AdminMenuStructure.php index 159836c..9ce79b9 100644 --- a/backend/components/AdminMenuStructure.php +++ b/backend/components/AdminMenuStructure.php @@ -111,6 +111,8 @@ class AdminMenuStructure{ $items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending' , 'TicketInstallmentRequestSearchPending[end]' => $tomorrow ] ]; $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' => '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'] ]; diff --git a/backend/controllers/TicketInstallmentRequestController.php b/backend/controllers/TicketInstallmentRequestController.php index 7263a9a..7254588 100644 --- a/backend/controllers/TicketInstallmentRequestController.php +++ b/backend/controllers/TicketInstallmentRequestController.php @@ -25,6 +25,7 @@ class TicketInstallmentRequestController extends Controller 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['post'], + 'accept' => ['post'], ], ], ]; @@ -65,6 +66,25 @@ class TicketInstallmentRequestController extends Controller ]); } + + public function actionAccept( $id ) + { + $model = $this->findModel($id); + + if ( !$model->isStatusAccepted() ){ + $model->applyStatus(TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL,true); + \Yii::$app->session->setFlash('success',"Megbízás teljesítve"); + } +// else{ + +// } + +// echo "asdff"; + + return $this->redirect(['ticket-installment-request/view', + 'id' => $model->id_ticket_installment_request, + ]); + } /** * Lists pending TicketInstallmentRequest models. * @return mixed diff --git a/backend/controllers/UgiroController.php b/backend/controllers/UgiroController.php index 535c7fc..01e515a 100644 --- a/backend/controllers/UgiroController.php +++ b/backend/controllers/UgiroController.php @@ -8,6 +8,9 @@ use backend\models\UgiroSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; +use common\components\DetStatProcessor; +use backend\models\DestaUploadForm; +use yii\web\UploadedFile; /** * UgiroController implements the CRUD actions for Ugiro model. @@ -40,7 +43,25 @@ class UgiroController extends Controller 'dataProvider' => $dataProvider, ]); } + /** + * Lists all Ugiro models. + * @return mixed + */ + public function actionItems($id) + { + $searchModel = new UgiroSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + public function actionActivate(){ + + } + /** * Displays a single Ugiro model. * @param integer $id @@ -48,6 +69,20 @@ class UgiroController extends Controller */ public function actionView($id) { + $model = $this->findModel($id); + if (Yii::$app->request->isPost) { + if ($model->status == Ugiro::$STATUS_RECIEVED){ + set_time_limit(1200);//20 perc + $processor = new DetStatProcessor( + ['koteg' => $model] + ); + $processor->run(); + }else{ + \Yii::$app->session->setFlash('danger','Nem lehet futtatni a fájlt'); + \Yii::error("a koteg státusza nem STATUS_RECIEVED. A koteg azonosíótja:" . $model->id_ugiro ); + } + } + return $this->render('view', [ 'model' => $this->findModel($id), ]); @@ -102,6 +137,35 @@ class UgiroController extends Controller return $this->redirect(['index']); } + + public function actionDetsta(){ + + $ugiro = Ugiro::findOne(31); + $model = new DetStatProcessor( + ['koteg' => $ugiro] + ); + + + return $this->render('detsta', [ + 'model' => $model, + ]); + } + + public function actionUpload(){ + $model = new DestaUploadForm(); + + if (Yii::$app->request->isPost) { + $model->destaFile = UploadedFile::getInstance($model, 'destaFile'); + if ($model->upload()) { + // file is uploaded successfully + return $this->redirect(['view', 'id' => $model->koteg->id_ugiro]); + } + } + + return $this->render('upload', ['model' => $model]); + + } + /** * Finds the Ugiro model based on its primary key value. diff --git a/backend/detsta.txt b/backend/detsta.txt new file mode 100644 index 0000000..20598c0 --- /dev/null +++ b/backend/detsta.txt @@ -0,0 +1,5 @@ +01DETSTA8A24237545 201501270001201502094542162957 +020000010000014097201501270020150204201502031104 03916201502031001307001595 0015520150127321538700000000000000000000000340 +020000020000015240201501275020150204 1117 73377201502033417908001595 0015520150127321538800000000000000000000000347 +020000030000015240201501270020150204201502031120 94002201502030005151001595 0015520150127321538900000000000000000000000176 +03000002000000000002933700000100000000000152400000000000000000000000 diff --git a/backend/models/DestaUploadForm.php b/backend/models/DestaUploadForm.php new file mode 100644 index 0000000..11cd999 --- /dev/null +++ b/backend/models/DestaUploadForm.php @@ -0,0 +1,68 @@ + false, ], + [['destaFile'], 'validateKoteg', ], + ]; + } + + public function attributeLabels(){ + return [ + "destaFile" => "Desta fájl" + ]; + } + + + public function validateKoteg($attribute,$params){ + if ( !$this->hasErrors()){ + $content = file_get_contents($this->destaFile->tempName); + $destaUzenet = GiroDETSTA::parse($content); + $number = $destaUzenet->fej->csoportosUzenetSorszam->sorszam; + $datum = $destaUzenet->fej->csoportosUzenetSorszam->osszeallitasDatuma; + $koteg = Ugiro::find()->andWhere(['number' =>$number,'datum' => $datum ])->one(); + $this->koteg = $koteg; + $idKoteg = $this->koteg->id_ugiro; + if (!isset($koteg)){ + $this->addError($attribute,"Nincs ilyen köteg! ( Datum: $datum, Sorszam: $number )"); + }else{ + if ( $koteg->status != Ugiro::$STATUS_SENT ){ + $this->addError($attribute,"A köteg detsta fájl-ja már fel van töltve !( Köteg azonosító: $idKoteg )"); + } + } + + + } + } + + public function upload() + { + if ($this->validate()) { + $path = 'giro/valasz/' . $this->destaFile->baseName . '.' . $this->destaFile->extension; + $this->destaFile->saveAs( $path ); + $this->koteg->desta_path = $path; + $this->koteg->status = Ugiro::$STATUS_RECIEVED; + $this->koteg->save(false); + return true; + } else { + return false; + } + } +} diff --git a/backend/models/GiroKotegForm.php b/backend/models/GiroKotegForm.php index 590fbfc..400e236 100644 --- a/backend/models/GiroKotegForm.php +++ b/backend/models/GiroKotegForm.php @@ -16,6 +16,7 @@ use yii\helpers\FileHelper; use yii\helpers\Inflector; use yii\helpers\BaseInflector; use common\models\UgiroRequestAssignment; +use yii\db\Query; /** * ContactForm is the model behind the contact form. @@ -91,14 +92,31 @@ class GiroKotegForm extends Model{ $this->koteg = new Ugiro(); $this->koteg->status = Ugiro::$STATUS_SENT; $this->koteg->id_user = \Yii::$app->user->id; + + $this->koteg->datum = date('Ymd'); + + $lastNumber = $this->loadLastNumber($this->koteg->datum); + $nextNumber = $lastNumber+1; + $this->koteg->number = $nextNumber; + $this->success &= $this->koteg->save(false); } + + + public function loadLastNumber($datum){ + $query = new Query(); + $query->select(['coalesce(max(number),0)']); + $query->from('ugiro'); + $query->andWhere(["datum" => $datum]); + return $query->scalar(); + } + public function readRequests(){ $this->requests = TicketInstallmentRequest::find()->andWhere(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND])->all(); } public function generateFileContent(){ - $this->content = GiroBeszed::createFileContent($this->koteg->id_ugiro, $this->requests); + $this->content = GiroBeszed::createFileContent($this->koteg->number, $this->koteg->datum, $this->requests); } public function saveFile( ) { diff --git a/backend/models/TicketInstallmentRequestSearch.php b/backend/models/TicketInstallmentRequestSearch.php index d4f42bb..0d5ce27 100644 --- a/backend/models/TicketInstallmentRequestSearch.php +++ b/backend/models/TicketInstallmentRequestSearch.php @@ -30,13 +30,15 @@ class TicketInstallmentRequestSearch extends TicketInstallmentRequest public $customer_name; public $id_ticket_type; + public $id_ugiro; + /** * @inheritdoc */ public function rules() { return [ - [['id_ticket_installment_request', 'id_ticket', 'id_customer', 'status' ,'id_ticket_type'], 'integer'], + [['id_ticket_installment_request', 'id_ticket', 'id_customer', 'status' ,'id_ticket_type','id_ugiro'], 'integer'], [['customer_name' ], 'safe'], [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], @@ -89,11 +91,13 @@ class TicketInstallmentRequestSearch extends TicketInstallmentRequest 'ticket.start as ticket_start',//ticket_start 'ticket.end as ticket_end',//ticket_send 'ticket.id_ticket as ticket_id_ticket',//id_ticket + 'ugiro_request_assignment.id_ugiro as ugiro_id_ugiro' ,//köteg azonosító ]); $query->from("ticket_installment_request"); $query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer"); $query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket"); $query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type"); + $query->leftJoin("ugiro_request_assignment","ticket_installment_request.id_ticket_installment_request = ugiro_request_assignment.id_request"); $query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]); @@ -115,6 +119,10 @@ class TicketInstallmentRequestSearch extends TicketInstallmentRequest $query->andFilterWhere(['>=', 'ticket_installment_request.request_processed_at', $this->timestampProcessedStart]); $query->andFilterWhere(['<', 'ticket_installment_request.request_processed_at', $this->timestampProcessedEnd]); + if ( isset($this->id_ugiro ) && !empty($this->id_ugiro)){ + $query->andWhere(["ugiro_request_assignment.id_ugiro" => $this->id_ugiro]); + } + $dataProvider = new ArrayDataProvider([ 'allModels' => $query->all(), // 'sort' => [ diff --git a/backend/models/TicketSearch.php b/backend/models/TicketSearch.php index 30a587b..a0e7922 100644 --- a/backend/models/TicketSearch.php +++ b/backend/models/TicketSearch.php @@ -37,7 +37,7 @@ class TicketSearch extends Ticket public function rules() { return [ - [[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account'], 'integer'], + [[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'], [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], [['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] , @@ -117,7 +117,8 @@ class TicketSearch extends Ticket 'id_ticket_type' => $this->id_ticket_type, 'id_account' => $this->id_account, 'id_card' => $this->id_card, - 'id_ticket' => $this->id_ticket + 'id_ticket' => $this->id_ticket, + 'status' => $this->status ]); diff --git a/backend/views/ticket-installment-request/_index_view.php b/backend/views/ticket-installment-request/_index_view.php index 3df8fc7..f793404 100644 --- a/backend/views/ticket-installment-request/_index_view.php +++ b/backend/views/ticket-installment-request/_index_view.php @@ -3,8 +3,31 @@ use common\models\TicketInstallmentRequest; use common\models\Ticket; +use yii\helpers\Html; ?> + + +
+
+
- - - + + - + - + - + - -
@@ -16,7 +39,7 @@ use common\models\Ticket; Megbízás státusza + @@ -25,8 +48,7 @@ use common\models\Ticket;
Megbízás inditására irányzott dátum @@ -47,7 +69,7 @@ use common\models\Ticket; formatter->asDatetime( $model['request_processed_at'] );?> -
Megbízás prioritása @@ -56,15 +78,17 @@ use common\models\Ticket; + Köteg azonosító +
Vendég azonosító @@ -82,7 +106,7 @@ use common\models\Ticket;
Bérlet azonosító @@ -102,7 +126,7 @@ use common\models\Ticket;
Bérlet érvényességének kezdete @@ -120,5 +144,19 @@ use common\models\Ticket;
\ No newline at end of file + + +
+ $model['ugiro_id_ugiro']] ,[ 'class' => 'btn btn-primary']); + } + echo Html::a("Megbízás részletek",['ticket-installment-request/view', 'id' => $model['request_id_ticket_installment_request']] ,[ 'class' => 'btn btn-primary']); + if ( !empty( $model['ticket_id_ticket'] )){ + echo Html::a("Bérlet részletei",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ticket]' => $model['ticket_id_ticket']] ,[ 'class' => 'btn btn-primary']); + } + ?> +
+
+
+
\ No newline at end of file diff --git a/backend/views/ticket-installment-request/_search.php b/backend/views/ticket-installment-request/_search.php index e2b53e8..d4a7091 100644 --- a/backend/views/ticket-installment-request/_search.php +++ b/backend/views/ticket-installment-request/_search.php @@ -28,7 +28,9 @@ $ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map(TicketType::read(), 'i
field($model, 'id_ticket_installment_request')->label("Megbízás azonosító") ?>
- +
+ field($model, 'id_ugiro')->label("Köteg azonosító") ?> +
field($model, 'id_ticket')->label("Bérlet azonosító") ?>
@@ -65,6 +67,7 @@ $ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map(TicketType::read(), 'i ])->label('Megbízás inditására irányzott dátum vége ( exklúzív )') ?>
+
field($model, 'sentStart')->widget(DatePicker::classname(), [ @@ -83,6 +86,7 @@ $ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map(TicketType::read(), 'i ])->label('Megbízás elindításának időszak vége ( exklúzív )') ?>
+
field($model, 'processedStart')->widget(DatePicker::classname(), [ @@ -128,8 +132,7 @@ $ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map(TicketType::read(), 'i field($model, 'updated_at') ?>
- 'btn btn-primary']) ?> - 'btn btn-default']) ?> + 'btn btn-primary']) ?>
diff --git a/backend/views/ticket-installment-request/index.php b/backend/views/ticket-installment-request/index.php index 9112d61..fbc0f4b 100644 --- a/backend/views/ticket-installment-request/index.php +++ b/backend/views/ticket-installment-request/index.php @@ -12,6 +12,13 @@ use yii\base\Widget; $this->title = Yii::t('common/ticket_installment_request', 'Bérlet fizetési megbízások'); $this->params['breadcrumbs'][] = $this->title; ?> + + +

title) ?>

diff --git a/backend/views/ticket-installment-request/view.php b/backend/views/ticket-installment-request/view.php index 11bb934..98f3dc4 100644 --- a/backend/views/ticket-installment-request/view.php +++ b/backend/views/ticket-installment-request/view.php @@ -2,49 +2,207 @@ use yii\helpers\Html; use yii\widgets\DetailView; +use common\models\TicketInstallmentRequest; +use common\models\Ticket; +use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model common\models\TicketInstallmentRequest */ -$this->title = $model->id_ticket_installment_request; -$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_installment_request', 'Ticket Installment Requests'), 'url' => ['index']]; +$this->title = "Megbízás: " . $model->id_ticket_installment_request; +$this->params['breadcrumbs'][] = ['label' => "Megbízások", 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> +isStatusAccepted() ){ + $statusStyle = "accepted"; + }else if ( $model->isStatusRejected() ){ + $statusStyle = "rejected"; + } + +?> +

title) ?>

-

- $model->id_ticket_installment_request], ['class' => 'btn btn-primary']) ?> - $model->id_ticket_installment_request], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('common/ticket_installment_request', 'Are you sure you want to delete this item?'), - 'method' => 'post', - ], - ]) ?> -

+ - $model, - 'attributes' => [ - 'id_ticket_installment_request', - 'id_ticket', - 'id_customer', - 'id_transfer', - 'status', - 'money', - 'customer_name', - 'bank_name', - 'bank_address', - 'bank_account', - 'priority', - 'request_sent_at', - 'request_processed_at', - 'request_target_time_at', - 'created_at', - 'updated_at', - ], - ]) ?> + +
+
+ isStatusRejected()){ + echo Html::a("Teljesítettnek jelölés",['accept', 'id' => $model->id_ticket_installment_request] ,['data-method' =>'post', 'class' => 'btn btn-danger']); + } + ?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Megbízás azonosító + + id_ticket_installment_request;?> + + Megbízás státusza + + status );?> + + Megbízás összege + + money." Ft";?> +
+ Megbízás inditására irányzott dátum + + formatter->asDatetime( $model->request_target_time_at );?> + + Megbízás elindításának ideje + + formatter->asDatetime( $model->request_sent_at);?> + + Megbízás feldoglozásának ideje + + formatter->asDatetime( $model->request_processed_at );?> +
+ Megbízás prioritása (Sorszám) + + priority ;?> + + Köteg azonosító + + idGiro ;?> + + +
+ Vendég azonosító + + customer->id_customer;?> + + Vendég neve + + customer->name;?> + + +
+ Bérlet azonosító + + ticket->id_ticket;?> + + Bérlet típus + + ticket->ticketTypeName;?> + + Bérlet státusza + + ticket->status );?> +
+ Bérlet érvényességének kezdete + + formatter->asDate( $model->ticket->start) ;?> + + Bérlet érvényességének vége + + formatter->asDate( $model->ticket->end ) ;?> + + +
+ Bérlet részletek száma + + ticket->part_count ;?> + + Bérlet esedékes részlet + + ticket->part ;?> + + Bérlet utoljára fizetett részlet + + ticket->part_paid ;?> +
+ +idGiro )){ + echo Html::a("Köteg",['ugiro/view', 'id' => $model->idGiro] ,[ 'class' => 'btn btn-primary']); + echo Html::a("Részletek a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->idGiro] ,[ 'class' => 'btn btn-primary']); +} +echo Html::a("Bérlet fizetési részletei",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ticket]' => $model->id_ticket] ,[ 'class' => 'btn btn-primary']); + +?>
+
+
+
diff --git a/backend/views/ticket/_search.php b/backend/views/ticket/_search.php index de41150..651cc72 100644 --- a/backend/views/ticket/_search.php +++ b/backend/views/ticket/_search.php @@ -4,6 +4,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use kartik\widgets\DatePicker; +use common\models\Ticket; /* @var $this yii\web\View */ /* @var $model backend\models\TicketSearch */ @@ -36,6 +37,15 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna field($model, 'id_account')->dropDownList($accountOptions) ?>
+
+
+ field($model, 'status')->dropDownList( ["" =>"Mind"]+ Ticket::statuses()) ?> +
+
+
+
+
+
diff --git a/backend/views/ticket/index.php b/backend/views/ticket/index.php index 5121848..d0bb127 100644 --- a/backend/views/ticket/index.php +++ b/backend/views/ticket/index.php @@ -104,6 +104,10 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'id_account', 'value' => 'accountName' ], + [ + 'attribute' => 'status', + 'value' => 'statusName' + ], // 'max_usage_count', // 'usage_count', diff --git a/backend/views/ticket/view.php b/backend/views/ticket/view.php index 2cf4115..5a6e79e 100644 --- a/backend/views/ticket/view.php +++ b/backend/views/ticket/view.php @@ -19,17 +19,36 @@ $this->params['breadcrumbs'][] = $this->title; 'model' => $model, 'attributes' => [ 'id_ticket', - 'id_user', - 'id_ticket_type', - 'id_account', - 'id_discount', - 'start', - 'end', + [ + 'attribute' => 'id_user', + 'value' => $model->user->username, + + ], + [ + 'attribute' => 'id_ticket_type', + 'value' => $model->ticketTypeName, + + ], + [ + 'attribute' => 'id_account', + 'value' => $model->accountName, + + ], + [ + 'attribute' => 'id_discount', + 'value' => $model->discountName, + + ], + 'start:datetime', + 'end:datetime', 'max_usage_count', 'usage_count', - 'status', + [ + 'attribute' => 'status', + 'value' => $model->statusName + ], 'price_brutto', - 'comment', + 'comment:raw', 'created_at', 'updated_at', ], diff --git a/backend/views/ugiro/detsta.php b/backend/views/ugiro/detsta.php new file mode 100644 index 0000000..dc9a242 --- /dev/null +++ b/backend/views/ugiro/detsta.php @@ -0,0 +1,26 @@ + + +detsta + +koteg->id_ugiro; + $model->run(); + + $megbizasok = $model->megbizasok; + + echo "
Megbízások száma:". count($megbizasok); + + foreach ($megbizasok as $m){ + echo "
". $m->id_ticket_installment_request . " - " . ($m->detstaTetel->toString()); + } + + echo "
" . nl2br( $model->detstatUzenet->toString()); + + + print_r($model->errors); + +?> \ No newline at end of file diff --git a/backend/views/ugiro/upload.php b/backend/views/ugiro/upload.php new file mode 100644 index 0000000..e42779c --- /dev/null +++ b/backend/views/ugiro/upload.php @@ -0,0 +1,27 @@ + + +

DetSta Fájl Feltöltés

+

+ Ezen a felületen csak a fájl feltöltés törénik meg, a fájl feldolgozása a köteg nézet-ben lehetséges +

+
+ + ['enctype' => 'multipart/form-data']]) ?> + + field($model, 'destaFile')->fileInput() ?> + +
+ 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/ugiro/view.php b/backend/views/ugiro/view.php index 047dd47..f3904e1 100644 --- a/backend/views/ugiro/view.php +++ b/backend/views/ugiro/view.php @@ -4,6 +4,7 @@ use yii\helpers\Html; use yii\widgets\DetailView; use yii\helpers\Url; use common\models\Ugiro; +use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model common\models\Ugiro */ @@ -12,17 +13,33 @@ $this->title = "Köteg részletei"; $this->params['breadcrumbs'][] = ['label' => "Kötegek", 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> +

title) ?>

- 'id_ugiro', 'label' => 'Köteg azonosító' ], + [ + 'attribute' => 'number', + 'label' => 'Üzenet sorszám' + ], + [ + 'attribute' => 'datum', + 'label' => 'Üzenet összeállítási dátum' + ], [ 'attribute' => 'user.username', 'label' => 'Felhasználó' @@ -38,13 +55,21 @@ $attributes = [ ], [ 'attribute' => 'path', - 'label' => 'Köteg Fájl', + 'label' => 'Beszed Fájl', 'value' => Html::a( "Letöltés" , Url::base() ."/". $model->path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ), 'format' => 'raw' ], ]; - if ( $model->status == Ugiro::$STATUS_FINISHED){ - + + + + if ( $model->status == Ugiro::$STATUS_RECIEVED || $model->status == Ugiro::$STATUS_FINISHED ){ + $attributes[] = [ + 'attribute' => 'desta_path', + 'label' => 'Detsta Fájl', + 'value' => Html::a( "Letöltés" , Url::base() ."/". $model->desta_path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ), + 'format' => 'raw' + ]; } ?> @@ -56,3 +81,13 @@ $attributes = [ ]) ?>
+
+status == Ugiro::$STATUS_RECIEVED ){ + echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']); + } + echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']); +?> +
+ + diff --git a/backend/web/giro/megbizas/.gitkeep b/backend/web/giro/megbizas/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/backend/web/giro/valasz/.gitkeep b/backend/web/giro/valasz/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/common/components/DetStatProcessor.php b/common/components/DetStatProcessor.php new file mode 100644 index 0000000..e9141fa --- /dev/null +++ b/common/components/DetStatProcessor.php @@ -0,0 +1,137 @@ +readKoteg(); + $this->readKotegMegbizasok(); + $this->readDetstaUzenet(); + $this->createMegbizasTetelHozzarendelesek(); + $this->processMegbizasok(); + $this->markKotegFinished(); + } + + public function markKotegFinished(){ + $this->koteg->status = Ugiro::$STATUS_FINISHED; + $this->koteg->save(); + } + + public function processMegbizasok(){ + foreach ($this->megbizasok as $megbizas){ + $processor = new DetStatTetelProcessor( + [ + 'tetel' => $megbizas->detstaTetel, + 'megbizas' => $megbizas + ] + ); + $processor->run(); + $this->errors = $this->errors + $processor->errors; + } + } + + public function readDetstaUzenet(){ + + $filename = \Yii::getAlias("@webroot") ."/" .$this->koteg->desta_path; + $content = file_get_contents($filename); + $this->detstatUzenet = GiroDETSTA::parse($content); + + + + + $this->detstatUzenet = new GiroDETSTA(); + $this->idKoteg = 33; + + $fej = new GiroDETSTAFej(); + + $this->detstatUzenet->fej = $fej; + + $tetel = new GiroDETSTATetel(); + $tetel->ugyfelAzonosito = 12; + $tetel->visszajelzesInformacio = "00"; + $tetel->visszajelzesInformacio = "02"; + + $this->detstatUzenet->tetelek[] = $tetel; + + $lab = new GiroDETSTALab(); + $this->detstatUzenet->lab = $lab; + + } + + public function createMegbizasTetelHozzarendelesek(){ + $mapTetel = []; + foreach ($this->detstatUzenet->tetelek as $tetel ){ + $mapTetel[$tetel->ugyfelAzonosito] = $tetel; + } + + foreach ($this->megbizasok as $megbizas){ + if ( array_key_exists($megbizas->id_ticket_installment_request, $mapTetel)){ + $megbizas->detstaTetel = $mapTetel[$megbizas->id_ticket_installment_request]; + } + } + + + } + + + public function readKoteg(){ + $this->koteg = Ugiro::findOne($this->idKoteg ); + if ( !isset($this->koteg) ){ + $this->errors [] = "Kötege nem található! (".$this->detstatUzenet->fej." )"; + } + } + public function readKotegMegbizasok(){ + $this->megbizasok = $this->koteg->requests; + } + + public function applyNewMegbizasState(){ + $kod = $this->tetel->valaszHivatkozasiKod; + + if ( $kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT){ + $this->megbizas->status = TicketInstallmentRequest::$STATUS_ACCEPTED; + }else{ + $this->megbizas->status = TicketInstallmentRequest::$STATUS_REJECTED; + } + $this->megbizas->save(false); + } + + public function applyNewTicketState(){ + $this->ticket->applyTicketInstallmentRequest($this->megbizas); + $this->ticket->save(false); + } + + + public function hasError(){ + return count($this->errors) > 0; + } + + +} \ No newline at end of file diff --git a/common/components/DetStatTetelProcessor.php b/common/components/DetStatTetelProcessor.php new file mode 100644 index 0000000..e986bb3 --- /dev/null +++ b/common/components/DetStatTetelProcessor.php @@ -0,0 +1,129 @@ +readMegbizas(); + if ($this->megbizas->isStatusAccepted()) { +// return; + } + $status = TicketInstallmentRequest::$STATUS_REJECTED; + $kod = 'xx'; + $comment = ""; + if (isset ( $this->tetel )) { + $kod = $this->tetel->visszajelzesInformacio; + } + + if ($kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT) { + $status = TicketInstallmentRequest::$STATUS_ACCEPTED; + } else { + $status = TicketInstallmentRequest::$STATUS_REJECTED; + + if ( $kod == "xx"){ + $comment = "Nem található a detsta fájlban a tétel válasza"; + }else{ + if ( array_key_exists($kod, GiroDETSTATetel::$INFORMACIOK)){ + $comment = "Hiba kód: ".$kod ." - " .GiroDETSTATetel::$INFORMACIOK[$kod]; + }else{ + $comment = "Ismeretlen hiba kód: " .$kod; + } + } + } + + $this->megbizas->applyStatus($status,true,$kod,$comment); + + + // $this->readTicket(); + // if ( !$this->hasError() ){ + // $this->applyNewMegbizasState(); + // $this->applyNewTicketState(); + // $this->addTransfer(); + // } + } + + // public function readMegbizas(){ + // $this->megbizas = TicketInstallmentRequest::findOne($this->tetel->ugyfelAzonosito); + // if ( !isset($this->megbizas) ){ + // $this->errors [] = "Válaszban jelölt megbízás nem található! (".$this->tetel->ugyfelAzonosito." )"; + // } + // } + // public function readTicket(){ + // $this->ticket = $this->megbizas->ticket; + // if ( !isset($this->ticket) ){ + // $this->errors [] = "Válaszban jelölt bérlet nem található! (".$this->megbizas->id_ticket." )"; + // } + // } + + // public function applyNewMegbizasState(){ + // $kod = 'xx'; + // if ( isset($this->tetel ) ) { + // $kod = $this->tetel->visszajelzesInformacio; + // } + + // if ( $kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT){ + // $this->megbizas->status = TicketInstallmentRequest::$STATUS_ACCEPTED; + // }else{ + // $this->megbizas->status = TicketInstallmentRequest::$STATUS_REJECTED; + // } + // if ( !$this->isDryRun() ){ + // $this->megbizas->save(false); + // } + // } + + // public function applyNewTicketState(){ + // $this->ticket->applyTicketInstallmentRequest($this->megbizas); + // if ( !$this->isDryRun() ){ + // $this->ticket->save(false); + // } + // } + + // protected function addTransfer(){ + + // $account = Account::findOne($this->ticket->id_account); + // $discount = null; + // if ( isset($this->ticket->id_account)){ + // $discount = Discount::findOne( $this->ticket->id_discount ); + // } + + // $transfer = Transfer::createTicketTransfer($account, $discount, null, 1, $this->ticket); + + // $transfer->status = Transfer::STATUS_PAID; + // $transfer->paid_at = date('Y-m-d H:i:s' ) ; + // $transfer->paid_by = \Yii::$app->user->id; + // $transfer->payment_method = Transfer::PAYMENT_METHOD_TRANSFER; + // $transfer->money = $this->megbizas->money; + // $transfer->comment = "Csoportos beszedes"; + // $transfer->id_user = \Yii::$app->user->id; + // $transfer->id_customer = $this->ticket->id_customer; + // $transfer->save(false); + // } + public function hasError() { + return count ( $this->errors ) > 0; + } + public function isDryRun() { + return $this->dryRun; + } +} \ No newline at end of file diff --git a/common/components/giro/GiroBase.php b/common/components/giro/GiroBase.php index 075d55e..60971c0 100644 --- a/common/components/giro/GiroBase.php +++ b/common/components/giro/GiroBase.php @@ -29,11 +29,11 @@ class GiroBase { return $data; } - public function szovegOlvas($row,$start,$length, $padchar = " "){ + public static function szovegOlvas($row,$start,$length, $padchar = " "){ return rtrim(substr($row, $start,$length),$padchar); } - public function szamOlvas($row,$start,$length, $padchar = "0"){ + public static function szamOlvas($row,$start,$length, $padchar = "0"){ return ltrim(substr($row, $start,$length),$padchar); } diff --git a/common/components/giro/GiroBeszed.php b/common/components/giro/GiroBeszed.php index 2605ce7..3d3ba31 100644 --- a/common/components/giro/GiroBeszed.php +++ b/common/components/giro/GiroBeszed.php @@ -15,19 +15,24 @@ class GiroBeszed extends GiroBase { public function __construct() { } - public static function createFileContent($id, $requests) { - $s = self::createFej($id); - $s .= self::createTetelek($requests); + + + public static function createFileContent($number,$datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) { + if ( !isset($terhelesiDatum)){ + $terhelesiDatum = date('Ymd' ,strtotime("+5 day")); + } + $s = self::createFej($number, $datum); + $s .= self::createTetelek($requests,$terhelesiDatum); $s .= self::createLab($requests); return $s; } - public static function createFej($id) { + public static function createFej($number, $daturm) { $fej = new GiroBeszedFej (); $fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod']; $fej->kezdemenyezoAzonosito = \Yii::$app->params['ugiro_kezdemenyezo_azonosito'];//"A25366936T244"; // "66658092128"; - $fej->uzenetSorszam->osszeallitasDatuma = date('Ymd' ); - $fej->uzenetSorszam->sorszam = $id; + $fej->uzenetSorszam->osszeallitasDatuma = $daturm; + $fej->uzenetSorszam->sorszam = $number; $fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128"; // $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB"; $fej->ertesitesiHatarido = ""; @@ -36,10 +41,12 @@ class GiroBeszed extends GiroBase { return $fej->toString (); } - public static function createTetelek($requests){ + public static function createTetelek($requests,$terhelesiDatum){ $s = ""; + $i = 0; foreach ($requests as $request){ - $s .= self::createTetel($request); + $i++; + $s .= self::createTetel($request,$i,$terhelesiDatum); } return $s; } @@ -47,19 +54,19 @@ class GiroBeszed extends GiroBase { /** * @param common\models\TicketInstallmentRequest $request * */ - public static function createTetel($request) { + public static function createTetel($request,$sorszam,$terhelesiDatum) { $tetel = new GiroBeszedTetel (); $customer = $request->customer; - $tetel->tetelSorszam = $request->id_ticket_installment_request; - $tetel->terhelesiDatum = date('Ymd' ,strtotime("+5 day"));; + $tetel->tetelSorszam = $sorszam; + $tetel->terhelesiDatum = $terhelesiDatum; $tetel->osszeg = $request->money; // $tetel->kotelezettBankszamla->bankszerv = "58600252"; $tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account; - $tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer; + $tetel->ugyfelazonositoAKezdemenyezonel = $request->id_ticket_installment_request; // $tetel->ugyfelNeve = "Schneider Roland"; // $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31"; $tetel->szamlaTulajdonosNeve = $customer->name; - $tetel->kozlemeny = "Berlet :" . $request->id_ticket; + $tetel->kozlemeny = "Berlet:" . $request->id_ticket .";MegbizasAzo:" . $request->id_ticket_installment_request; return $tetel->toString(); } diff --git a/common/components/giro/GiroDETSTA.php b/common/components/giro/GiroDETSTA.php index 22cc26b..3dab266 100644 --- a/common/components/giro/GiroDETSTA.php +++ b/common/components/giro/GiroDETSTA.php @@ -6,8 +6,9 @@ use common\components\giro\GiroBase; /** * - * @property common\components\giro\GiroUzenetsorszam $uzenetSorszam - * @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla + * @property common\components\giro\GiroDETSTAFej $fej + * @property common\components\giro\GiroDETSTALab $lab + * @property common\components\giro\GiroDETSTATetel $tetelek * */ class GiroDETSTA extends GiroBase { @@ -20,14 +21,25 @@ class GiroDETSTA extends GiroBase { } + public function toString(){ + $s = ""; + $s .= $this->fej->toString(); + foreach ($this->tetelek as $tetel ){ + $s .= $tetel->toString(); + } + $s .= $this->lab->toString(); + + return $s; + } + public static function parse($content){ $detsta = new GiroDETSTA(); $array = preg_split("/\r\n|\n|\r/", $content); $detsta->fej = GiroDETSTAFej::parse($array[0]); - $detsta->lab = GiroDETSTALab::parse($array[count($array) -1]); + $detsta->lab = GiroDETSTALab::parse($array[count($array) -2]); - for ( $i = 1 ; $i < count($array) -1; $i++ ){ + for ( $i = 1 ; $i < count($array) -2; $i++ ){ $row = $array[$i]; $tetel = GiroDETSTATetel::parse($row); $detsta->tetelek[] = $tetel; diff --git a/common/components/giro/GiroDETSTAFej.php b/common/components/giro/GiroDETSTAFej.php index 13bf96b..1a509c0 100644 --- a/common/components/giro/GiroDETSTAFej.php +++ b/common/components/giro/GiroDETSTAFej.php @@ -43,7 +43,7 @@ class GiroDETSTAFej extends GiroBase{ $fej->jelentesJelzo = substr($row, 8,1); $fej->kezdemenyezoAzonosito = substr($row, 9,13); $fej->csoportosUzenetSorszam ->osszeallitasDatuma = substr($row, 22, 8); - $fej->csoportosUzenetSorszam->sorszam = substr($row, 30, 4); + $fej->csoportosUzenetSorszam->sorszam = static::szamOlvas($row, 30, 4); $fej->detstaUzenetSorszam ->osszeallitasDatuma = substr($row, 34,8); $fej->detstaUzenetSorszam->sorszam = substr($row, 42,4); $fej->ido = substr($row, 46,6); diff --git a/common/components/giro/GiroDETSTALab.php b/common/components/giro/GiroDETSTALab.php index ae18a12..d015963 100644 --- a/common/components/giro/GiroDETSTALab.php +++ b/common/components/giro/GiroDETSTALab.php @@ -17,8 +17,10 @@ class GiroDETSTALab extends GiroBase { public $visszautasitottTetelekOsszerteke = "0"; public $megNemValaszoltTetelekSzama = "0"; public $megNemValaszoltTetelekOsszerteke = "0"; + public function __construct() { } + public function toString() { return $this->recordTipus . $this->szamKitolt ( $this->teljesitettTetelekSzama, 6 ) diff --git a/common/components/giro/GiroDETSTATetel.php b/common/components/giro/GiroDETSTATetel.php index f2bf20c..f59afc8 100644 --- a/common/components/giro/GiroDETSTATetel.php +++ b/common/components/giro/GiroDETSTATetel.php @@ -39,7 +39,17 @@ class GiroDETSTATetel extends GiroBase { $this->detstaUzenetSorszam = new GiroUzenetsorszam (); } public function toString() { - return $this->recordTipus . $this->szamKitolt ( $this->tetelSorszam, 6 ) . $this->szamKitolt ( $this->osszeg, 10 ) . $this->eredetiTetelElszamolasiDatuma . $this->visszajelzesInformacio . $this->feldolgozasDatum . $this->terhelesiDatum . $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->ugyfelAzonosito, 29 ); + return $this->recordTipus + . $this->szamKitolt ( $this->tetelSorszam, 6 ) + . $this->szamKitolt ( $this->osszeg, 10 ) + . $this->eredetiTetelElszamolasiDatuma + . $this->visszajelzesInformacio + . $this->feldolgozasDatum + . $this->terhelesiDatum + . $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 ) + . $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 ) + . $this->szovegKitolt ( $this->ugyfelAzonosito, 24 ) + . $this->rekordVege(); } public static function parse($row) { diff --git a/common/models/AccountState.php b/common/models/AccountState.php index 3936121..0ec2689 100644 --- a/common/models/AccountState.php +++ b/common/models/AccountState.php @@ -233,7 +233,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord $this->prev_state = $lastOpen->id_account_state; $this->prev_money = $lastOpen->money; } - $end = date("Y-m-d H:i:s"); + $end = date('Y-m-d H:i:s' ); +// $end = Yii::$app->formatter->asDatetime(strtotime("now"), "php:Y-m-d H:i:s"); $this->collection_money = Transfer::readPaid($start, $end, Yii::$app->user->id); diff --git a/common/models/MoneyMovement.php b/common/models/MoneyMovement.php index 9024c0a..b111181 100644 --- a/common/models/MoneyMovement.php +++ b/common/models/MoneyMovement.php @@ -29,6 +29,9 @@ class MoneyMovement extends \yii\db\ActiveRecord const TYPE_OUT = 10; const TYPE_IN = 20; + const STATUS_PAID = 20; + const STATUS_STORNO = 30; + public $_account; /** @@ -140,4 +143,23 @@ class MoneyMovement extends \yii\db\ActiveRecord return self::typeName($this->type); } + public static function statuses( ) { + return [ + MoneyMovement::STATUS_PAID => 'Fizetve', + MoneyMovement::STATUS_STORNO => 'Törölve', + ]; + } + + public static function toStatusName($id_status){ + $result = "Ismeretlen"; + $statuses = Ticket::statuses(); + if ( array_key_exists($id_status, $statuses)){ + $result = $statuses[$id_status]; + } + return $result; + } + + public function getStatusName(){ + return static::toStatusName($this->status); + } } diff --git a/common/models/Sale.php b/common/models/Sale.php index d3a6e5c..6ed7abe 100644 --- a/common/models/Sale.php +++ b/common/models/Sale.php @@ -37,6 +37,7 @@ class Sale extends \yii\db\ActiveRecord const STATUS_NOT_PAID = 10; const STATUS_PAID = 20; + const STATUS_DELETED= 30; /** * @inheritdoc @@ -140,4 +141,26 @@ class Sale extends \yii\db\ActiveRecord return $sale; } + + public static function statuses( ) { + return [ + Sale::STATUS_PAID => 'Aktív', + Sale::STATUS_DELETED => 'Törölve', + Sale::STATUS_NOT_PAID => 'Nincs fizetve', + ]; + } + + public static function toStatusName($id_status){ + $result = "Ismeretlen"; + $statuses = Sale::statuses(); + if ( array_key_exists($id_status, $statuses)){ + $result = $statuses[$id_status]; + } + return $result; + } + + public function getStatusName(){ + return static::toStatusName($this->status); + } + } diff --git a/common/models/Ticket.php b/common/models/Ticket.php index d82aef5..e15eaf7 100644 --- a/common/models/Ticket.php +++ b/common/models/Ticket.php @@ -23,6 +23,9 @@ use common\components\Helper; * @property integer $usage_count * @property integer $status * @property integer $price_brutto + * @property integer $part eddig a részletig kell kifizetve lenni + * @property integer $part_count ennyi részlet van összesen + * @property integer $part_paid ennyi részlet van kifizetve * @property string $comment * @property string $created_at * @property string $updated_at @@ -31,6 +34,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord { const STATUS_DELETED = 0; const STATUS_ACTIVE = 10; + const STATUS_INACTIVE = 20; /** * @inheritdoc @@ -200,10 +204,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord new Expression( 'ticket_type.name as name'), new Expression( 'coalesce( count(ticket.id_ticket),0) as total'), - new Expression( "coalesce( sum( case when ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid - new Expression( "coalesce( sum( case when ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created - new Expression( "coalesce( sum( case when ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money - new Expression( "coalesce( sum( case when " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ), + new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid + new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created + new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money + new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ), ]); @@ -237,6 +241,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord return [ Ticket::STATUS_ACTIVE => 'Aktív', Ticket::STATUS_DELETED => 'Törölve', + Ticket::STATUS_INACTIVE => 'Inaktív', ]; } @@ -249,4 +254,62 @@ class Ticket extends \common\models\BaseFitnessActiveRecord return $result; } + public function getStatusName(){ + return static::toStatusName($this->status); + } + + public function isDeleted(){ + return $this->status == Ticket::STATUS_DELETED; + } + + /**csoportos beszedéses a bérlet*/ + public function isInstallmentTicket(){ + return ( isset($this->part_count) && $this->part_count > 0 ); + } + + /** + * Apply request + * + * @var common\models\TicketInstallmentRequest $request megbízás + * */ + public function applyTicketInstallmentRequest( $request ) { + //ha csoportos beszedéses + if ( $this->isInstallmentTicket() ){ + if ( $request->isStatusAccepted() ){ + if ( $this->part_paid < $request->priority ){ + $this->part_paid = $request->priority; + } + $this->recalclulate(); + }else if ( $request->isStatusRejected() ){ + $this->status = static::STATUS_INACTIVE; + } + } + } + /* + * * + * @param common\models\TicketInstallmentRequest $request megbízás + */ + public function setPartRequired($request){ + // ha keveseb a részlet sorszám mint a bérlet max sorszáma + if ( $request->priority <= $this->part_count ){ + //ha az aktuális elvárt részlet kisebb , mint a megbízása + if ( $this->part < $request-> priority ){ + $this->part = $request->priority; + } + } + } + + /** + * Csoportos beszedéses bérlet érvényességének újraszámolása + * */ + public function recalclulate( ) { + if ( $this->isInstallmentTicket() ){ + $enabled = $this->part_paid >= $this->part; + if ( $enabled == true ){ + $this->status = static::STATUS_ACTIVE; + }else{ + $this->status = static::STATUS_INACTIVE; + } + } + } } diff --git a/common/models/TicketInstallmentRequest.php b/common/models/TicketInstallmentRequest.php index f38cf18..4f7fc7f 100644 --- a/common/models/TicketInstallmentRequest.php +++ b/common/models/TicketInstallmentRequest.php @@ -25,6 +25,7 @@ use yii\behaviors\TimestampBehavior; * @property string $request_target_time_at * @property string $created_at * @property string $updated_at + * @property common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból */ class TicketInstallmentRequest extends \yii\db\ActiveRecord { @@ -36,6 +37,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord public static $STATUS_CANCELED = 30; public static $STATUS_REJECTED = 40; public static $STATUS_ACCEPTED = 50; + public static $STATUS_ACCEPTED_MANUAL = 60; + + /** + * GiroDetstaTetel record a DetSta fájlból + * */ + public $detstaTetel; /** * @inheritdoc @@ -98,6 +105,90 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] ); } + public function getTicket(){ + return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket", ] ) ; + } + + public function getUgiro() + { + return $this->hasOne(Ugiro::className(), [ 'id_ugiro' => 'id_ugiro' ]) + ->viaTable('ugiro_request_assignment', [ 'id_request' => 'id_ticket_installment_request' ]); + } + + public function isStatusAccepted(){ + return $this->status == static::$STATUS_ACCEPTED || $this->status == static::$STATUS_ACCEPTED_MANUAL; + } + public function isStatusRejected(){ + return $this->status == static::$STATUS_REJECTED ; + } + + public function getIdGiro(){ + $result = null; + $giro = $this->ugiro; + if ( isset($giro) ){ + $result = $giro->id_ugiro; + } + return $result; + } + + /** + * Megbízás státuszának beállítása + * + * Létrehozza a szükséges ticket/transfer objectumokat + * + * @param boolean $partRequired ha igaz, a bérleten a part mezőt változtatjuk + * */ + public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){ + if ( $status == static::$STATUS_ACCEPTED || $status == static::$STATUS_ACCEPTED_MANUAL){ + if ( !$this->isStatusAccepted() ){ + $this->status = $status; + $tranfer = $this->addTransfer(); + $this->id_transfer = $tranfer->id_transfer; + $this->save(false); + $this->applyNewTicketState($partRequired); + return true; + }else{ + return false; + } + }else{ + $this->status = $status; + $this->save(false); + $this->applyNewTicketState($partRequired); + return true; + } + } + + protected function applyNewTicketState($partRequired = false){ + if ( $partRequired ){ + $this->ticket->setPartRequired($this); + } + $this->ticket->applyTicketInstallmentRequest($this); + $this->ticket->save(false); + } + + protected function addTransfer(){ + + $account = Account::findOne($this->ticket->id_account); + $discount = null; + if ( isset($this->ticket->id_account)){ + $discount = Discount::findOne( $this->ticket->id_discount ); + } + + $transfer = Transfer::createTicketTransfer($account, $discount, null, 1, $this->ticket); + + $transfer->status = Transfer::STATUS_PAID; + $transfer->paid_at = date('Y-m-d H:i:s' ) ; + $transfer->paid_by = \Yii::$app->user->id; + $transfer->payment_method = Transfer::PAYMENT_METHOD_TRANSFER; + $transfer->money = $this->money; + $transfer->comment = "Csoportos beszedes"; + $transfer->id_user = \Yii::$app->user->id; + $transfer->id_customer = $this->ticket->card->customer->id_customer; + $transfer->save(false); + return $transfer; + } + + /** * @param common\models\Ticket $ticket * @param common\models\TicketType $type @@ -107,8 +198,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord $result = []; if ( $type->isInstallment() ){ $count = $type->installment_count; - $ticketCreatedAt = time(); + $discount = $ticket->discount; $money = $type->price_brutto; + if ( isset($discount ) ){ + $money = Discount::applyDiscount($money, $discount); + } + $ticketCreatedAt = time(); for ( $i = 1; $i <= $count; $i++){ $request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $money, $ticketCreatedAt, $i); $result[] = $request; @@ -140,6 +235,7 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord TicketInstallmentRequest::$STATUS_CANCELED=> 'Törölve', TicketInstallmentRequest::$STATUS_REJECTED=> 'Visszautasítva', TicketInstallmentRequest::$STATUS_ACCEPTED=> 'Sikeresen végrehajtva', + TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL=> 'Manuálisan elfogadva', ]; } diff --git a/common/models/Transfer.php b/common/models/Transfer.php index c92eca5..ff8847b 100644 --- a/common/models/Transfer.php +++ b/common/models/Transfer.php @@ -46,6 +46,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord const STATUS_NOT_PAID = 10; const STATUS_PAID = 20; + const STATUS_STORNO = 30; const DIRECTION_OUT = 10;// MONEY GOES OUT FROM ACCOUNT ( COMPANY LOST MONEY ) const DIRECTION_IN = 20;//MONEY GOES IN TO THE ACCOUNT ( COMPANY EARN MONEY ) @@ -477,6 +478,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord return [ self::STATUS_NOT_PAID => Yii::t('common/transfer','Nincs fizetve'), self::STATUS_PAID => Yii::t('common/transfer','Fizetve'), + self::STATUS_STORNO => Yii::t('common/transfer','Törölve'), ]; } public function getStatusName( ) { @@ -751,6 +753,28 @@ class Transfer extends \common\models\BaseFitnessActiveRecord } - + public function storno(){ + $this->status = Transfer::STATUS_STORNO; + $this->save(false); + if ( $this->type == Transfer::TYPE_TICKET){ + $ticket = $this->ticket; + $ticket->status = Ticket::STATUS_DELETED; + $ticket->save(false); + + TicketInstallmentRequest::updateAll( + ['status' => TicketInstallmentRequest::$STATUS_CANCELED ], + ['id_ticket' => $this->ticket->id_ticket ] + ); + + }else if ( $this->type == Transfer::TYPE_PRODUCT ){ + $sale = $this->sale; + $sale->status = Sale::STATUS_DELETED; + $sale->save(false); + }else if ( $this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT ){ + $mm = $this->moneyMovement; + $mm->status = MoneyMovement::STATUS_STORNO; + $mm->save(false); + } + } } diff --git a/common/models/Ugiro.php b/common/models/Ugiro.php index 8423407..7544e9b 100644 --- a/common/models/Ugiro.php +++ b/common/models/Ugiro.php @@ -11,6 +11,10 @@ use yii\helpers\ArrayHelper; * * @property integer $id_ugiro * @property integer $id_user + * @property string $path + * @property string $desta_path + * @property string $datum + * @property integer $number * @property string $created_at * @property string $updated_at */ @@ -18,8 +22,10 @@ class Ugiro extends \yii\db\ActiveRecord { public static $PATH_MEGBIZAS = "giro/megbizas"; + public static $PATH_VALASZ = "giro/valasz"; public static $STATUS_SENT = 0; - public static $STATUS_FINISHED = 1; + public static $STATUS_RECIEVED = 10; + public static $STATUS_FINISHED = 20; /** * @inheritdoc @@ -66,10 +72,19 @@ class Ugiro extends \yii\db\ActiveRecord return $this->hasOne( User::className(), ["id" =>"id_user" ] ); } + + public function getRequests() + { + return $this->hasMany(TicketInstallmentRequest::className(), ['id_ticket_installment_request' => 'id_request']) + ->viaTable('ugiro_request_assignment', ['id_ugiro' => 'id_ugiro']); + } + + public static function statuses() { return [ static::$STATUS_SENT =>"Folyamatban", static::$STATUS_FINISHED =>"Befejezve", + static::$STATUS_RECIEVED =>"Detsta fájl feltöltve", ] ; } diff --git a/console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php b/console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php new file mode 100644 index 0000000..689630f --- /dev/null +++ b/console/migrations/m160120_224044_alter__table__money_movement__add_column__status.php @@ -0,0 +1,30 @@ +addColumn("money_movement", "status", "int"); + } + + public function down() + { + echo "m160120_224044_alter__table__money_movement__add_column__status 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/console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php b/console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php new file mode 100644 index 0000000..da724bf --- /dev/null +++ b/console/migrations/m160121_083841_alter__table__ticket__add_part__and__parts_paid.php @@ -0,0 +1,32 @@ +addColumn("ticket", "part", "int"); + $this->addColumn("ticket", "part_count", "int"); + $this->addColumn("ticket", "part_paid", "int"); + } + + public function down() + { + echo "m160121_083841_alter__table__ticket__add_part__and__parts_paid 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/console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php b/console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php new file mode 100644 index 0000000..e4c34ca --- /dev/null +++ b/console/migrations/m160121_183512_alter__table__ugiro__add__desta_path.php @@ -0,0 +1,30 @@ +addColumn("ugiro", "desta_path", "string"); + } + + public function down() + { + echo "m160121_183512_alter__table__ugiro__add__desta_path 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/console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php b/console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php new file mode 100644 index 0000000..a8cb534 --- /dev/null +++ b/console/migrations/m160121_192759_alter__table__ugiro__uzenet__sorszam.php @@ -0,0 +1,28 @@ +addColumn("ugiro", "datum", "string"); + $this->addColumn("ugiro", "number", "integer"); + } + + public function down() + { + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/frontend/controllers/AccountStateController.php b/frontend/controllers/AccountStateController.php index 2b15d45..9e73d51 100644 --- a/frontend/controllers/AccountStateController.php +++ b/frontend/controllers/AccountStateController.php @@ -162,7 +162,7 @@ class AccountStateController extends Controller { $total += $cassaOpen->money; $openDate = $cassaOpen->created_at; } - $total += Transfer::readPaid($openDate, date('Y-m-d h:i:s'), \Yii::$app->user->id); + $total += Transfer::readPaid($openDate, date('Y-m-d H:i:s'), \Yii::$app->user->id); return $total; } diff --git a/frontend/controllers/TicketController.php b/frontend/controllers/TicketController.php index c98cea8..9260c96 100644 --- a/frontend/controllers/TicketController.php +++ b/frontend/controllers/TicketController.php @@ -21,6 +21,7 @@ use common\models\UserSoldItem; use frontend\components\FrontendController; use frontend\components\DefaultAccountBehavior; use frontend\components\CassaOpenBehavior; +use frontend\models\TicketUpdate; /** * TicketController implements the CRUD actions for Ticket model. @@ -38,7 +39,7 @@ class TicketController extends FrontendController ], 'access' => [ 'class' => \yii\filters\AccessControl::className(), - 'only' => ['create', 'index' ], + 'only' => ['create', 'index','update' ], 'rules' => [ // allow authenticated users [ @@ -135,6 +136,21 @@ class TicketController extends FrontendController ]); } + public function actionUpdate($id){ + $model = TicketUpdate::findOne($id); + + if ( !isset($model)){ + throw new NotFoundHttpException('The requested page does not exist.'); + } + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['index', 'number' => $model->card->number]); + } + + return $this->render('update',['model' => $model]); + + } + /** * Deletes an existing Transfer model. * If deletion is successful, the browser will be redirected to the 'index' page. @@ -152,12 +168,21 @@ class TicketController extends FrontendController try { ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]); UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]); - if ( $transfer->delete() ){ - \Yii::$app->session->setFlash( 'success','Bérlet törölve' ); - $transaction->commit(); - }else{ - throw new \Exception("Failed to save"); - } +// $transfer->status = Transfer::STATUS_STORNO; +// $transfer->save(false); +// $ticket->status = Ticket::STATUS_DELETED; +// $ticket->save(false); + $transfer->storno(); + $transaction->commit(); + \Yii::$app->session->setFlash( 'success','Bérlet törölve' ); + + // $transaction->commit(); +// if ( $transfer->delete() ){ +// \Yii::$app->session->setFlash( 'success','Bérlet törölve' ); +// $transaction->commit(); +// }else{ +// throw new \Exception("Failed to save"); +// } } catch(Exception $e) { $transaction->rollback(); diff --git a/frontend/controllers/TransferController.php b/frontend/controllers/TransferController.php index f5cac04..14729b8 100644 --- a/frontend/controllers/TransferController.php +++ b/frontend/controllers/TransferController.php @@ -222,12 +222,13 @@ class TransferController extends Controller try { ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]); UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]); - if ( $transfer->delete() ){ - \Yii::$app->session->setFlash( 'success','Tranzakció törölve' ); - $transaction->commit(); - }else{ - throw new \Exception("Failed to save"); - } + $transfer->storno(); +// 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(); diff --git a/frontend/models/TicketCreate.php b/frontend/models/TicketCreate.php index 181aa9f..3c6e33d 100644 --- a/frontend/models/TicketCreate.php +++ b/frontend/models/TicketCreate.php @@ -83,6 +83,7 @@ class TicketCreate extends Ticket{ //cart ///////////////////// [['cart'], 'string', 'max' => 10] + ]; } @@ -91,6 +92,18 @@ class TicketCreate extends Ticket{ $type = TicketType::findOne($this->id_ticket_type); if ( !isset($type)) { $this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid ticket type' )); + }else{ + if ( $type->isInstallment()){ + $bankAccount = trim($this->customer->bank_account); + if ( !isset($bankAccount) || empty($bankAccount)){ + $this->addError($attribute,"Nincs bankszámlaszám vagy érvénytelen"); + return; + } + if ( !( strlen($bankAccount) == 16 || strlen($bankAccount) == 24 ) ){ + $this->addError($attribute,"Vendég bankszámlaszáma nem 16 vagy 24 hosszú"); + return; + } + } } } @@ -108,6 +121,23 @@ class TicketCreate extends Ticket{ } } + public function beforeSave($insert){ + $result = parent::beforeSave($insert); + if ( $result ){ + if ($insert){ + $ticketType = TicketType::findOne($this->id_ticket_type); + if ( isset($ticketType) && $ticketType->isInstallment() ){ + $this->part = 0; + $this->part_paid = 0; + $this->part_count = $ticketType->installment_count; + }else{ + $this->part_count = 0; + } + } + } + return $result; + } + public function afterSave($insert, $changedAttributes){ $this->addTransfer(); $this->appendToUserCart(); diff --git a/frontend/models/TicketUpdate.php b/frontend/models/TicketUpdate.php new file mode 100644 index 0000000..c1e3a0f --- /dev/null +++ b/frontend/models/TicketUpdate.php @@ -0,0 +1,25 @@ + [ static ::STATUS_ACTIVE, static ::STATUS_INACTIVE ]], + + ]; + } + + + + } + + +?> \ No newline at end of file diff --git a/frontend/views/money-movement/index.php b/frontend/views/money-movement/index.php index 1e985dd..0067de3 100644 --- a/frontend/views/money-movement/index.php +++ b/frontend/views/money-movement/index.php @@ -36,6 +36,11 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'comment', 'format' => 'html' ], + [ + 'attribute' => 'status', + 'value' => 'statusName', + 'label' => "Státusz" + ], ['class' => 'yii\grid\ActionColumn', 'template' => '{view}' diff --git a/frontend/views/ticket/_form_update.php b/frontend/views/ticket/_form_update.php new file mode 100644 index 0000000..28a498f --- /dev/null +++ b/frontend/views/ticket/_form_update.php @@ -0,0 +1,84 @@ + + +
+ + status != Ticket::STATUS_DELETED){?> + + 'ticket_form', + ; + ?> + + field ( $model, 'status' )->dropDownList ( $options ); + + ?> + +
+ 'btn btn-success' ]) ?> +
+ + + + +
+ + 'id_user', + 'value' => $model->user->username + ] + , + [ + 'attribute' => 'id_ticket_type', + 'value' => $model->ticketTypeName + ] + , + [ + 'attribute' => 'id_account', + 'value' => $model->accountName + ] + , + [ + 'attribute' => 'id_discount', + 'value' => $model->discountName + ] + , + 'start:datetime', + 'end:datetime', + 'max_usage_count', + 'usage_count', + // [ + // 'attribute' => 'status', + // 'value' => $model->statusName + // ], + 'price_brutto', + 'comment:raw', + 'created_at', + 'updated_at' +]; + + +if ( $model->status == Ticket::STATUS_DELETED ){ + $attributes[] = [ + 'attribute' => 'status', + 'value' => $model->statusName + ]; +} + +?> + + $model,'attributes' => $attributes ] )?> diff --git a/frontend/views/ticket/index.php b/frontend/views/ticket/index.php index 3386bba..131152f 100644 --- a/frontend/views/ticket/index.php +++ b/frontend/views/ticket/index.php @@ -6,6 +6,7 @@ use frontend\components\ReceptionMenuWidget; use frontend\components\ReceptionCardNumberWidget; use frontend\components\ReceptionWidget; use yii\base\Widget; +use common\models\Ticket; /* @var $this yii\web\View */ /* @var $searchModel frontend\models\TicketSearch */ @@ -34,7 +35,11 @@ $this->params['breadcrumbs'][] = $this->title; $dataProvider, 'columns' => [ - + [ + 'attribute' => 'id_ticket', + 'value' => 'id_ticket', + 'label' => "B. Azonosító" + ], [ 'attribute' => 'id_account', 'value' => 'accountName' @@ -51,6 +56,10 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'id_user', 'value' => 'userName' ], + [ + 'attribute' => 'status', + 'value' => 'statusName' + ], /* [ 'attribute' => 'id_discount', @@ -58,9 +67,31 @@ $this->params['breadcrumbs'][] = $this->title; ], */ 'price_brutto', + 'created_at:datetime', ['class' => 'yii\grid\ActionColumn', - 'template' =>'{delete}', + 'template' =>'{delete} {update}', + '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', ]) ; + }, + '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']) ; + }, + ], +// 'buttons ' => [ + +// 'update' =>function ($url, $model, $key){ +// return "update"; +// }, +// 'delete' =>function ($url, $model, $key){ +// return "delete"; + +// } +// ] +// 'template' => function($model){ return $model->status == Ticket::STATUS_DELETED ? "" : "'{delete} {update}'" ;}, ], ], ]); ?> diff --git a/frontend/views/ticket/update.php b/frontend/views/ticket/update.php index 09f838a..422c44d 100644 --- a/frontend/views/ticket/update.php +++ b/frontend/views/ticket/update.php @@ -5,9 +5,7 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model common\models\Ticket */ -$this->title = Yii::t('common/ticket', 'Update {modelClass}: ', [ - 'modelClass' => 'Ticket', -]) . ' ' . $model->id_ticket; +$this->title = "Bérlet módosítása:" . ' ' . $model->id_ticket; $this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->id_ticket, 'url' => ['view', 'id' => $model->id_ticket]]; $this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update'); @@ -16,7 +14,7 @@ $this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');

title) ?>

- render('_form', [ + render('_form_update', [ 'model' => $model, ]) ?> diff --git a/frontend/views/transfer/_view.php b/frontend/views/transfer/_view.php index f04328b..836357c 100644 --- a/frontend/views/transfer/_view.php +++ b/frontend/views/transfer/_view.php @@ -69,13 +69,15 @@ $formatter = Yii::$app->formatter;
- Törlés', Url::toRoute(['delete','id' =>$model->id_transfer]), [ + status != Transfer::STATUS_STORNO){ + echo Html::a('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;' - ]);?> + ]);}?>
From 027a96790a403c81c93f7538965d7cac5b29f253 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 22 Jan 2016 19:10:30 +0100 Subject: [PATCH 3/4] add reception key changes, add money movent storno, status display --- backend/components/AdminMenuStructure.php | 5 ++- .../TicketInstallmentRequestController.php | 17 ++++++++++ backend/controllers/UgiroController.php | 17 ++++++++++ backend/models/TransferSearch.php | 3 +- .../views/ticket-installment-request/view.php | 18 +++++++++++ backend/views/ticket/index.php | 1 + backend/views/transfer/_search.php | 9 ++++-- backend/views/transfer/index.php | 4 +++ common/components/Helper.php | 5 +++ common/models/CardSearch.php | 17 ++++++++-- common/models/MoneyMovement.php | 2 +- common/models/TicketInstallmentRequest.php | 8 +++++ common/models/Transfer.php | 2 ++ common/models/TransferTicketSearch.php | 2 +- ...add__column__detsta_code__and__comment.php | 31 +++++++++++++++++++ .../controllers/MoneyMovementController.php | 12 +++++-- frontend/models/ReceptionForm.php | 19 +++++++++++- frontend/views/card/_search.php | 2 +- frontend/views/common/_reception.php | 16 +++++++--- .../common/_reception_form_card_number.php | 2 +- frontend/views/common/_reception_menu.php | 24 ++++++++++++++ frontend/views/money-movement/index.php | 20 ++++++++++-- frontend/views/ticket/index.php | 4 +-- frontend/views/transfer/tickets.php | 5 +++ 24 files changed, 220 insertions(+), 25 deletions(-) create mode 100644 console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php 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 ){?> + + From 33c6f46ce975ee25fbc996bb00137021db965c1f Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 22 Jan 2016 19:25:34 +0100 Subject: [PATCH 4/4] change version to 0.0.25 --- changelog.txt | 5 +++++ common/config/params.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 22b821b..55d4011 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +-0.0.25 + - add reception key changes, + - add money movent storno, + - status displays + - ticket installmetn request, ugiro, beszed, detsta -0.0.24 - add transfer payment_method -0.0.23 diff --git a/common/config/params.php b/common/config/params.php index 39f98ed..b276ceb 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -4,7 +4,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.0.24', + 'version' => 'v0.0.25', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global
B. Azon Kiadva Fizetve Kassza Felhasználó Vendég Bérlet típusStátusz Egység ár Mennyiség Összeg
Ft Db FT