From a00331ce7c29b4c161c6faa43a3afe37d6ed58b7 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 29 Jan 2016 17:13:33 +0100 Subject: [PATCH] add indexes, add messagedetsta --- backend/components/AdminCustomerTabWidget.php | 27 ++ backend/components/AdminMenuStructure.php | 2 + backend/controllers/CardController.php | 2 +- backend/controllers/ContractController.php | 143 +++++++++ backend/controllers/KeyController.php | 24 ++ .../controllers/MessageDetstaController.php | 137 ++++++++ backend/controllers/ProcurementController.php | 6 +- backend/controllers/ProductController.php | 74 +++++ backend/controllers/TicketController.php | 3 +- backend/models/CardSearch.php | 81 ++++- backend/models/ContractCustomerSearch.php | 79 +++++ backend/models/ContractSearch.php | 151 +++++++++ backend/models/KeyCustomerSearch.php | 75 +++++ backend/models/MessageDetstaSearch.php | 69 ++++ backend/models/ProductStatisticsSearch.php | 184 +++++++++++ backend/models/TicketSearch.php | 2 + backend/models/TicketSearchCustomer.php | 296 ++++++++++++++++++ backend/views/account-state/_search.php | 4 +- backend/views/card/_search.php | 9 + backend/views/card/index.php | 75 +++-- backend/views/common/_customer_tab.php | 53 ++++ backend/views/contract/_form.php | 45 +++ backend/views/contract/_search-customer.php | 49 +++ backend/views/contract/_search.php | 40 +++ backend/views/contract/create.php | 21 ++ backend/views/contract/index-customer.php | 57 ++++ backend/views/contract/index.php | 85 +++++ backend/views/contract/update.php | 23 ++ backend/views/contract/view.php | 46 +++ backend/views/customer/update.php | 8 +- backend/views/customer/view.php | 16 +- backend/views/key/index-customer.php | 53 ++++ backend/views/message-detsta/_form.php | 31 ++ backend/views/message-detsta/_search.php | 35 +++ backend/views/message-detsta/create.php | 21 ++ backend/views/message-detsta/index.php | 38 +++ backend/views/message-detsta/update.php | 23 ++ backend/views/message-detsta/view.php | 171 ++++++++++ backend/views/procurement/_form.php | 4 +- backend/views/procurement/create.php | 3 +- backend/views/product/_search_statistics.php | 85 +++++ backend/views/product/statistics.php | 64 ++++ .../_index_view.php | 2 +- backend/views/ticket/_search_customer.php | 2 +- backend/views/ticket/index_customer.php | 55 +++- backend/views/ugiro/view.php | 5 + common/components/DetStaDBSave.php | 177 +++++++++++ common/components/DetStatProcessor.php | 33 +- common/components/giro/GiroDETSTAFej.php | 2 +- common/components/giro/GiroDETSTALab.php | 12 +- common/components/giro/GiroDETSTATetel.php | 6 +- common/models/Card.php | 6 + common/models/Key.php | 19 +- common/models/MessageDetsta.php | 61 ++++ common/models/MessageDetstaFej.php | 64 ++++ common/models/MessageDetstaLab.php | 58 ++++ common/models/MessageDetstaTetel.php | 73 +++++ common/models/Procurement.php | 18 +- common/models/Ugiro.php | 4 + composer.json | 3 +- composer.lock | 61 +++- ...03_add_index_customer_id_customer_card.php | 30 ++ ...1700_add_index_transfer_id_object_type.php | 39 +++ ...129_072601_add__tables__detsta_message.php | 113 +++++++ ..._message_detsta__add__column__id_ugiro.php | 30 ++ 65 files changed, 3195 insertions(+), 92 deletions(-) create mode 100644 backend/components/AdminCustomerTabWidget.php create mode 100644 backend/controllers/ContractController.php create mode 100644 backend/controllers/MessageDetstaController.php create mode 100644 backend/models/ContractCustomerSearch.php create mode 100644 backend/models/ContractSearch.php create mode 100644 backend/models/KeyCustomerSearch.php create mode 100644 backend/models/MessageDetstaSearch.php create mode 100644 backend/models/ProductStatisticsSearch.php create mode 100644 backend/models/TicketSearchCustomer.php create mode 100644 backend/views/common/_customer_tab.php create mode 100644 backend/views/contract/_form.php create mode 100644 backend/views/contract/_search-customer.php create mode 100644 backend/views/contract/_search.php create mode 100644 backend/views/contract/create.php create mode 100644 backend/views/contract/index-customer.php create mode 100644 backend/views/contract/index.php create mode 100644 backend/views/contract/update.php create mode 100644 backend/views/contract/view.php create mode 100644 backend/views/key/index-customer.php create mode 100644 backend/views/message-detsta/_form.php create mode 100644 backend/views/message-detsta/_search.php create mode 100644 backend/views/message-detsta/create.php create mode 100644 backend/views/message-detsta/index.php create mode 100644 backend/views/message-detsta/update.php create mode 100644 backend/views/message-detsta/view.php create mode 100644 backend/views/product/_search_statistics.php create mode 100644 backend/views/product/statistics.php create mode 100644 common/components/DetStaDBSave.php create mode 100644 common/models/MessageDetsta.php create mode 100644 common/models/MessageDetstaFej.php create mode 100644 common/models/MessageDetstaLab.php create mode 100644 common/models/MessageDetstaTetel.php create mode 100644 console/migrations/m160128_130803_add_index_customer_id_customer_card.php create mode 100644 console/migrations/m160128_131700_add_index_transfer_id_object_type.php create mode 100644 console/migrations/m160129_072601_add__tables__detsta_message.php create mode 100644 console/migrations/m160129_114910_alter__table__message_detsta__add__column__id_ugiro.php diff --git a/backend/components/AdminCustomerTabWidget.php b/backend/components/AdminCustomerTabWidget.php new file mode 100644 index 0000000..baa9a6f --- /dev/null +++ b/backend/components/AdminCustomerTabWidget.php @@ -0,0 +1,27 @@ +card = $this->customer->card; + } + + + public function run(){ + echo $this->render($this->viewFile,[ 'card' => $this->card, 'customer' => $this->customer ,'title' => $this->title ]); + } + + +} \ No newline at end of file diff --git a/backend/components/AdminMenuStructure.php b/backend/components/AdminMenuStructure.php index 9119d51..ad9f591 100644 --- a/backend/components/AdminMenuStructure.php +++ b/backend/components/AdminMenuStructure.php @@ -89,6 +89,7 @@ class AdminMenuStructure{ $items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ]; $items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ]; $items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ]; + $items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics' ,'ProductStatisticsSearch[start]' =>$todayDatetime,'ProductStatisticsSearch[end]' => $tomorrowDatetime ] ]; $this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl, 'items' => $items ]; @@ -108,6 +109,7 @@ class AdminMenuStructure{ // Tartós megbízások ///////////////////////////// $items = []; + $items[] = ['label' => 'Szerződések', 'url' => ['/contract/index' ] ]; $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' ] ]; diff --git a/backend/controllers/CardController.php b/backend/controllers/CardController.php index e8ced89..852fb63 100644 --- a/backend/controllers/CardController.php +++ b/backend/controllers/CardController.php @@ -228,7 +228,7 @@ class CardController extends \backend\controllers\BackendController { $card = Card::find()->andWhere(['number' => $item['number']])->one(); if ( $card != null ){ $card->rfid_key = $item['key']; - $sql = "update card set rfid_key = '" .$item['key'] ."' where id_card = " .$card->id_card .";"; + $sql = "update card set rfid_key = '" . strtolower( $item['key'] )."' where id_card = " .$card->id_card .";"; $sqls[] = $sql; $i++; }else{ diff --git a/backend/controllers/ContractController.php b/backend/controllers/ContractController.php new file mode 100644 index 0000000..6991f97 --- /dev/null +++ b/backend/controllers/ContractController.php @@ -0,0 +1,143 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Contract models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new ContractSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + /** + * Lists all Contract models. + * @return mixed + */ + public function actionIndexCustomer($id) + { + $model = Customer::findOne($id); + + if ( !isset($model)){ + throw new NotFoundHttpException('The requested page does not exist.'); + } + + $searchModel = new ContractCustomerSearch(['customer' => $model]); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index-customer', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Contract model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Contract model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Contract(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_contract]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Contract 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_contract]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Contract 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 Contract model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Contract the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Contract::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/KeyController.php b/backend/controllers/KeyController.php index 9d2efb7..11b1b3f 100644 --- a/backend/controllers/KeyController.php +++ b/backend/controllers/KeyController.php @@ -8,6 +8,8 @@ use backend\models\KeySearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; +use common\models\Customer; +use backend\models\KeyCustomerSearch; /** * KeyController implements the CRUD actions for Key model. @@ -41,6 +43,28 @@ class KeyController extends Controller 'dataProvider' => $dataProvider, //csomagoló osztály a queryhez ]); } + /** + * Lists all Key models. + * @return mixed + */ + public function actionIndexCustomer($id) + { + + $model = Customer::findOne($id); + + if ( !isset($model)){ + throw new NotFoundHttpException('The requested page does not exist.'); + } + + + $searchModel = new KeyCustomerSearch(['customer' => $model]); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + // backend/views/kex/index.php + return $this->render('index-customer', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, //csomagoló osztály a queryhez + ]); + } /** * Displays a single Key model. diff --git a/backend/controllers/MessageDetstaController.php b/backend/controllers/MessageDetstaController.php new file mode 100644 index 0000000..9f2eb15 --- /dev/null +++ b/backend/controllers/MessageDetstaController.php @@ -0,0 +1,137 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all MessageDetsta models. + * @return mixed + */ + public function actionIndex() + { + $filename = \Yii::getAlias("@backend") ."/web/giro/valasz/detsta.txt"; + $ugiro = GiroDETSTA::parse(file_get_contents($filename)); + + file_put_contents("c:\\tmp\\detsta.txt", $ugiro->toString()); + + $saver = new DetStaDBSave( + [ + 'giroDETSTA' => $ugiro, + 'koteg' => null, + 'idUser' =>\Yii::$app->user->id + ]); + + $saver->run(); + + $searchModel = new MessageDetstaSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single MessageDetsta model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new MessageDetsta model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new MessageDetsta(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_message]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing MessageDetsta 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_message]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing MessageDetsta 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 MessageDetsta model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return MessageDetsta the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = MessageDetsta::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/ProcurementController.php b/backend/controllers/ProcurementController.php index 1acb89d..61b7114 100644 --- a/backend/controllers/ProcurementController.php +++ b/backend/controllers/ProcurementController.php @@ -12,6 +12,7 @@ use common\models\Warehouse; use common\models\Product; use common\models\User; use common\components\Helper; +use common\models\Account; /** * ProcurementController implements the CRUD actions for Procurement model. @@ -92,6 +93,8 @@ class ProcurementController extends \backend\controllers\BackendController $model = new Procurement(); $model->scenario = 'create_general'; + $accounts = Account::find()->andWhere(['status' => Account::STATUS_ACTIVE])->andWhere(['type' => Account::TYPE_ALL])->all(); + $model->id_user = Yii::$app->user->id; $warehouses = Warehouse::read(null); @@ -137,7 +140,8 @@ class ProcurementController extends \backend\controllers\BackendController } else { return $this->render('create', [ 'model' => $model, - 'warehouses' =>$warehouses + 'warehouses' =>$warehouses, + 'accounts' => $accounts ]); } } diff --git a/backend/controllers/ProductController.php b/backend/controllers/ProductController.php index 178fd0f..333c9ea 100644 --- a/backend/controllers/ProductController.php +++ b/backend/controllers/ProductController.php @@ -10,6 +10,8 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use common\models\Account; use common\models\ProductCategory; +use backend\models\ProductStatisticsSearch; +use PHPExcel; /** * ProductController implements the CRUD actions for Product model. @@ -17,6 +19,24 @@ use common\models\ProductCategory; class ProductController extends \backend\controllers\BackendController { + public function behaviors() + { + return [ + 'access' => [ + 'class' => \yii\filters\AccessControl::className(), + 'rules' => [ + // allow authenticated users + [ + 'actions' => ['create','index','view','update','statistics'], + 'allow' => true, + 'roles' => ['admin','employee','reception'], + ], + // everything else is denied + ], + ], + ]; + } + /** * Lists all Product models. @@ -106,6 +126,60 @@ class ProductController extends \backend\controllers\BackendController return $this->redirect(['index']); } + + + public function actionStatistics(){ + + $searchModel = new ProductStatisticsSearch(); + + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + + if ( $searchModel->output == 'xls' ){ + + $models = $dataProvider->getModels(); + $objPHPExcel = new \PHPExcel(); + + $sheet = $objPHPExcel->setActiveSheetIndex(0); + + $row = 1; + $sheet->setCellValue('A'.$row, "Termék név") + ->setCellValue('B'.$row, "Eladási ár") + ->setCellValue('C'.$row, "Kassza") + ->setCellValue('D'.$row, "Eladott mennyiség") + ->setCellValue('E'.$row, "Eladás összege"); + + foreach ($models as $model ){ + $row++; + $sheet->setCellValue('A'.$row, $model['product_name']) + ->setCellValue('B'.$row, $model['product_sale_price']) + ->setCellValue('C'.$row, $model['father_account_name']) + ->setCellValue('D'.$row, $model['transfer_count']) + ->setCellValue('E'.$row, $model['transfer_money']); + } + + // Redirect output to a client’s web browser (Excel5) + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment;filename="termek_statisztika.xls"'); + header('Cache-Control: max-age=0'); + // If you're serving to IE 9, then the following may be needed + header('Cache-Control: max-age=1'); + // If you're serving to IE over SSL, then the following may be needed + header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified + header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 + header ('Pragma: public'); // HTTP/1.0 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); + $objWriter->save('php://output'); + exit; + + } + + return $this->render('statistics', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } /** * Finds the Product model based on its primary key value. diff --git a/backend/controllers/TicketController.php b/backend/controllers/TicketController.php index 8adc0e6..a6b6c1b 100644 --- a/backend/controllers/TicketController.php +++ b/backend/controllers/TicketController.php @@ -15,6 +15,7 @@ use common\models\User; use common\models\Customer; use common\models\Card; use backend\models\TicketSearchStatisitcs; +use backend\models\TicketSearchCustomer; /** * TicketController implements the CRUD actions for Ticket model. @@ -128,7 +129,7 @@ class TicketController extends \backend\controllers\BackendController { throw new NotFoundHttpException ( 'The requested page does not exist.' ); } - $searchModel = new TicketSearch (); + $searchModel = new TicketSearchCustomer(['customer' => $customer]); $searchModel->id_card = $customer->id_customer_card; $dataProvider = $searchModel->search ( Yii::$app->request->queryParams ); $searchModel->searchTotals (); diff --git a/backend/models/CardSearch.php b/backend/models/CardSearch.php index 5ddcbbd..f71af90 100644 --- a/backend/models/CardSearch.php +++ b/backend/models/CardSearch.php @@ -7,6 +7,8 @@ use yii\base\Model; use yii\data\ActiveDataProvider; use common\models\Card; use common\models\Customer; +use yii\db\Query; +use common\models\Key; /** * CardSearch represents the model behind the search form about `common\models\Card`. @@ -15,6 +17,9 @@ class CardSearch extends Card { public $searchCustomerName; + public $searchKeyNumber; + public $usage; + public $key_assigned; /** * @inheritdoc @@ -22,8 +27,8 @@ class CardSearch extends Card public function rules() { return [ - [['id_card', 'status', 'type'], 'integer'], - [[ 'searchCustomerName', 'number','rfid_key', 'created_at', 'updated_at'], 'safe'], + [['id_card', 'status', 'type','usage'], 'integer'], + [[ 'searchCustomerName', 'number','rfid_key', 'created_at', 'updated_at','searchKeyNumber','key_assigned'], 'safe'], ]; } @@ -47,14 +52,64 @@ class CardSearch extends Card { $query = Card::find(); + $query = new Query(); + + $query->select([ + 'card.id_card as card_id_card', + 'card.number as card_number', + 'card.rfid_key as card_rfid_key', + 'card.status as card_status', + 'card.type as card_type', + 'customer.name as customer_name' , + 'customer.id_customer as customer_id_customer', + 'key.number as key_number', + + + ]); + $query->from(Card::tableName()); + $query->leftJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card'); + $query->leftJoin("card_key_assignment", 'card.id_card = card_key_assignment.id_card'); + $query->leftJoin(Key::tableName(), 'key.id_key = card_key_assignment.id_key'); + $dataProvider = new ActiveDataProvider([ 'query' => $query, + 'sort' =>[ + 'defaultOrder' => [ + 'card_number' => SORT_ASC + ], + 'attributes' => [ + 'card_number' => [ + 'asc' => ['card.number' => SORT_ASC ], + 'desc' => ['card.number' => SORT_DESC], + ], + 'card_rfid_key' => [ + 'asc' => ['card.rfid_key' => SORT_ASC ], + 'desc' => ['card.rfid_key' => SORT_DESC], + ], + 'card_status' => [ + 'asc' => ['card.status' => SORT_ASC ], + 'desc' => ['card.status' => SORT_DESC], + ], + 'card_type' => [ + 'asc' => ['card.type' => SORT_ASC ], + 'desc' => ['card.type' => SORT_DESC], + ], + 'customer_name' => [ + 'asc' => ['customer.name' => SORT_ASC ], + 'desc' => ['customer.name' => SORT_DESC], + ], + 'customer_id_customer' => [ + 'asc' => ['customer.id_customer' => SORT_ASC ], + 'desc' => ['customer.id_customer' => SORT_DESC], + ], + 'key_number' => [ + 'asc' => ['key.number' => SORT_ASC ], + 'desc' => ['key.number' => SORT_DESC], + ], + ] + ] ]); - $dataProvider->sort ->attributes['customerName'] =[ - 'asc' => ['customer.name' => SORT_ASC ], - 'desc' => ['customer.name' => SORT_DESC ], - ]; $this->load($params); @@ -64,7 +119,6 @@ class CardSearch extends Card return $dataProvider; } - $query->leftJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card'); $query->andFilterWhere([ 'card.status' => $this->status, @@ -74,6 +128,19 @@ class CardSearch extends Card $query->andFilterWhere(['like', 'card.number', $this->number]); $query->andFilterWhere(['like', 'card.rfid_key', $this->rfid_key]); $query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]); + + if ( $this->usage == '1') { + $query->andWhere('customer.id_customer is not null'); + }else if ( $this->usage == '2') { + $query->andWhere('customer.id_customer is null'); + } + if ( $this->key_assigned == '1') { + $query->andWhere('key.id_key is not null'); + }else if ( $this->key_assigned == '2') { + $query->andWhere('key.id_key is null'); + } + + Key::addKeyConditionOptional($query, $this->searchKeyNumber); return $dataProvider; } diff --git a/backend/models/ContractCustomerSearch.php b/backend/models/ContractCustomerSearch.php new file mode 100644 index 0000000..4ac003f --- /dev/null +++ b/backend/models/ContractCustomerSearch.php @@ -0,0 +1,79 @@ + $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_contract' => $this->id_contract, + 'id_user' => $this->id_user, + 'id_customer' => $this->id_customer, + 'status' => $this->status, + 'flag' => $this->flag, + 'part_paid' => $this->part_paid, + 'part_count' => $this->part_count, + 'part_required' => $this->part_required, + 'expired_at' => $this->expired_at, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + 'id_ticket_type' => $this->id_ticket_type, + ]); + + $query->andWhere(['contract.id_customer' => $this->customer->id_customer]); + + return $dataProvider; + } +} diff --git a/backend/models/ContractSearch.php b/backend/models/ContractSearch.php new file mode 100644 index 0000000..6fe2c03 --- /dev/null +++ b/backend/models/ContractSearch.php @@ -0,0 +1,151 @@ +select([ + 'contract.id_contract as contract_id_contract', + 'user.username as user_name', + 'customer.id_customer as customer_id_customer', + 'customer.name as customer_name', + 'contract.status as contract_status', + 'contract.flag as contract_flag', + 'contract.part_required as contract_part_required', + 'contract.part_paid as contract_part_paid', + 'contract.part_count as contract_part_count', + 'contract.created_at as contract_created_at', + 'contract.expired_at as contract_expired_at', + + ]); + $query->from('contract'); + $query->innerJoin('user' ,'user.id = contract.id_user'); + $query->innerJoin('customer' ,'customer.id_customer = contract.id_customer'); + + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' =>[ + 'defaultOrder' =>[ + 'contract_id_contract' => SORT_ASC + ], + 'attributes' =>[ + 'contract_id_contract' => [ + 'asc' => ['contract.id_contract' => SORT_ASC ], + 'desc' => ['contract.id_contract' => SORT_DESC], + ], + 'user_name' => [ + 'asc' => ['user.username' => SORT_ASC ], + 'desc' => ['user.username' => SORT_DESC], + ], + 'customer_id_customer' => [ + 'asc' => ['customer.id_customer' => SORT_ASC ], + 'desc' => ['customer.id_customer' => SORT_DESC], + ], + 'customer_name' => [ + 'asc' => ['customer.name' => SORT_ASC ], + 'desc' => ['customer.name' => SORT_DESC], + ], + 'contract_status' => [ + 'asc' => ['contract.status' => SORT_ASC ], + 'desc' => ['contract.status' => SORT_DESC], + ], + 'contract_flag' => [ + 'asc' => ['contract.flag' => SORT_ASC ], + 'desc' => ['contract.flag' => SORT_DESC], + ], + 'contract_part_required' => [ + 'asc' => ['contract.part_required' => SORT_ASC ], + 'desc' => ['contract.part_required' => SORT_DESC], + ], + 'contract_part_paid' => [ + 'asc' => ['contract.part_paid' => SORT_ASC ], + 'desc' => ['contract.part_paid' => SORT_DESC], + ], + 'contract_part_count' => [ + 'asc' => ['contract.part_count' => SORT_ASC ], + 'desc' => ['contract.part_count' => SORT_DESC], + ], + 'contract_created_at' => [ + 'asc' => ['contract.created_at' => SORT_ASC ], + 'desc' => ['contract.created_at' => SORT_DESC], + ], + 'contract_expired_at' => [ + 'asc' => ['contract.expired_at' => SORT_ASC ], + 'desc' => ['contract.expired_at' => SORT_DESC], + ], + ] + ], + ]); + + $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([ + 'contract.id_contract' => $this->id_contract, + 'contract.id_user' => $this->id_user, + 'contract.id_customer' => $this->id_customer, + 'contract.status' => $this->status, + 'contract.flag' => $this->flag, + 'contract.part_paid' => $this->part_paid, + 'contract.part_count' => $this->part_count, + 'contract.part_required' => $this->part_required, + 'contract.expired_at' => $this->expired_at, + 'contract.created_at' => $this->created_at, + 'contract.updated_at' => $this->updated_at, + 'contract.id_ticket_type' => $this->id_ticket_type, + ]); + + $query->andFilterWhere(['like', 'customer.name', $this->customer_name]); + + return $dataProvider; + } +} diff --git a/backend/models/KeyCustomerSearch.php b/backend/models/KeyCustomerSearch.php new file mode 100644 index 0000000..e1df3b6 --- /dev/null +++ b/backend/models/KeyCustomerSearch.php @@ -0,0 +1,75 @@ +select(['key.number','key.rfid_key','key.created_at','key.status','key.type','card_key_assignment.created_at as assigned_at']); + $query->from('key'); + + $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([ + ]); + + $query->innerJoin('card_key_assignment', 'card_key_assignment.id_key = key.id_key'); + $query->innerJoin('customer', 'card_key_assignment.id_card = customer.id_customer_card'); + $query->andWhere(['customer.id_customer' => $this->customer->id_customer]); + + return $dataProvider; + } +} diff --git a/backend/models/MessageDetstaSearch.php b/backend/models/MessageDetstaSearch.php new file mode 100644 index 0000000..dca3ff8 --- /dev/null +++ b/backend/models/MessageDetstaSearch.php @@ -0,0 +1,69 @@ + $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_message' => $this->id_message, + 'id_user' => $this->id_user, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'path', $this->path]); + + return $dataProvider; + } +} diff --git a/backend/models/ProductStatisticsSearch.php b/backend/models/ProductStatisticsSearch.php new file mode 100644 index 0000000..517018d --- /dev/null +++ b/backend/models/ProductStatisticsSearch.php @@ -0,0 +1,184 @@ +Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ], + [[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ], + + ]; + } + + /** + * @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(); + + $query->select([ + 'product.id_product as product_id_product', + 'product.name as product_name', + 'product.sale_price as product_sale_price', + 'product.product_number as product_number', + 'product.barcode as product_barcode', + "father_account.name as father_account_name", +// "coalesce(account.name,'-') as account_name", + 'coalesce(sum(transfer.count),0) as transfer_count', + 'coalesce(sum(transfer.money),0) as transfer_money', + + ]); + $query->from("product"); + $query->innerJoin('account as father_account','father_account.id_account = product.id_account'); + $query->innerJoin('product_category','product_category.id_product_category = product.id_product_category'); + $query->leftJoin("sale" ,'sale.id_product = product.id_product ' ); + $query->leftJoin("transfer" ,'transfer.id_object = sale.id_sale and transfer.type =' .Transfer::TYPE_PRODUCT ); + $query->leftJoin('account','account.id_account = transfer.id_account'); + + + if ( !RoleDefinition::isAdmin() ){ + $query->innerJoin ( "user_account_assignment", 'father_account.id_account = user_account_assignment.id_account' ); + $query->andWhere ( [ + 'user_account_assignment.id_user' => Yii::$app->user->id + ] ); + + $query->andWhere(['account.type' => Account::TYPE_ALL]); + } + + $query->andWhere(['in' , 'transfer.status',[Transfer::STATUS_PAID,Transfer::STATUS_NOT_PAID]]); + + $query->groupBy([ + 'product.id_product', + 'product.name', + 'product.sale_price', + 'father_account.name', + 'product.barcode', + 'product.product_number', + ]); + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' =>[ + 'defaultOrder' =>[ + 'product_name' => SORT_ASC + ], + 'attributes' =>[ + 'product_name' => [ + 'asc' => ['product.name' => SORT_ASC ], + 'desc' => ['product.name' => SORT_DESC], + ], + 'product_number' => [ + 'asc' => ['product.product_number' => SORT_ASC ], + 'desc' => ['product.product_number' => SORT_DESC], + ], + 'product_barcode' => [ + 'asc' => ['product.barcode' => SORT_ASC ], + 'desc' => ['product.barcode' => SORT_DESC], + ], + 'father_account_name' => [ + 'asc' => ['father_account.name' => SORT_ASC ], + 'desc' => ['father_account.name' => SORT_DESC], + ], + 'product_sale_price' => [ + 'asc' => ['product.sale_price' => SORT_ASC ], + 'desc' => ['product.sale_price' => SORT_DESC], + ], + 'transfer_count' => [ + 'asc' => ['coalesce(sum(transfer.count),0)' => SORT_ASC ], + 'desc' => ['coalesce(sum(transfer.count),0)' => SORT_DESC], + ], + 'transfer_money' => [ + 'asc' => ['coalesce(sum(transfer.money),0)' => SORT_ASC ], + 'desc' => ['coalesce(sum(transfer.money),0)' => SORT_DESC], + ], +// 'account_name' => [ +// 'asc' => ['account.name' => SORT_ASC ], +// 'desc' => ['account.name' => SORT_DESC], +// ], + ] + ], + ]); + + + + $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; + } + + if ( $this->output == 'xls'){ + $dataProvider->pagination = false; + } + + $query->andFilterWhere([ + 'product_category.id_product_category' => $this->id_product_category, + 'product.barcode' => Helper::fixAsciiChars($this->barcode), + 'product.product_number' => Helper::fixAsciiChars($this->product_number), + 'product.name' => ($this->name), + 'product.id_account' => ($this->id_account), +// 'id_product_category' => $this->id_product_category, + ]); + + $created_condition = ['and',[ '>=', 'transfer.created_at', $this->timestampStart ] ,[ '<', 'transfer.created_at', $this->timestampEnd ] ]; + $paid_condition = ['and',[ '>=', 'transfer.paid_at', $this->timestampStart ] ,[ '<', 'transfer.paid_at', $this->timestampEnd ] ]; + + + $query->andFilterWhere(['or' , $created_condition , $paid_condition]); + +// $query->andFilterWhere(['like', 'product.name', $this->name]); + + return $dataProvider; + } +} diff --git a/backend/models/TicketSearch.php b/backend/models/TicketSearch.php index a0e7922..963be67 100644 --- a/backend/models/TicketSearch.php +++ b/backend/models/TicketSearch.php @@ -30,6 +30,8 @@ class TicketSearch extends Ticket public $statistics; public $statisticsTotal; + public $customer; + /** * @inheritdoc diff --git a/backend/models/TicketSearchCustomer.php b/backend/models/TicketSearchCustomer.php new file mode 100644 index 0000000..c800f0a --- /dev/null +++ b/backend/models/TicketSearchCustomer.php @@ -0,0 +1,296 @@ + 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], + [['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] , + + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + public function attributeLabels(){ + return ArrayHelper::merge(parent::attributeLabels(), [ + 'start' => Yii::t('backend/ticket','Start of interval'), + 'end' => Yii::t('backend/ticket','End of interval'), + 'valid_in_interval' => Yii::t('backend/ticket','Valid in interval'), + 'created_in_interval' => Yii::t('backend/ticket','Created in interval'), + 'expire_in_interval' => Yii::t('backend/ticket','Expire in interval'), + ]); + } + + public function afterValidate(){ + + if ( !isset($this->timestampStart)) { + $this->timestampStart ='1900-01-01'; + } + + if ( !isset($this->timestampEnd)) { + $this->timestampEnd ='3000-01-01'; + } + + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = new Query(); + + $query->select([ + 'ticket.id_ticket as ticket_id_ticket', + 'account.name as account_name', + 'card.number as card_number', + 'ticket_type.name as ticket_type_name', + 'ticket.start as ticket_start', + 'ticket.end as ticket_end', + 'ticket.max_usage_count as ticket_max_usage_count', + 'ticket.usage_count as ticket_usage_count', + 'user.username as user_username', + 'paid_by.username as paid_by_username', + 'ticket.status as ticket_status', + 'ticket.price_brutto as ticket_price_brutto', + + ]); + $query->from('ticket'); + $query->innerJoin('ticket_type', 'ticket_type.id_ticket_type = ticket.id_ticket_type'); + $query->innerJoin('transfer', 'transfer.id_object = ticket.id_ticket and transfer.type = ' . Transfer::TYPE_TICKET); + $query->innerJoin('account', 'account.id_account = ticket.id_account'); + $query->innerJoin('user', 'user.id = transfer.id_user'); + $query->leftJoin('user as paid_by', 'paid_by.id = transfer.paid_by'); + $query->leftJoin('card', 'ticket.id_card = card.id_card'); + $query->leftJoin('customer', 'customer.id_customer_card = card.id_card'); + + Helper::queryAccountConstraint($query, 'ticket.id_account'); + + + + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' =>[ +// 'defaultOrder' => ['end' => SORT_DESC], + 'attributes' => [ + +// 'end', + 'ticket_id_ticket' => [ + 'asc' => ['ticket.id_ticket' => SORT_ASC ], + 'desc' => ['ticket.id_ticket' => SORT_DESC], + ], + 'ticket_start' => [ + 'asc' => ['ticket.start' => SORT_ASC ], + 'desc' => ['ticket.start' => SORT_DESC], + ], + 'ticket_end' => [ + 'asc' => ['ticket.end' => SORT_ASC ], + 'desc' => ['ticket.end' => SORT_DESC], + ], + 'user_username' => [ + 'asc' => ['user.username' => SORT_ASC ], + 'desc' => ['user.username' => SORT_DESC], + ], + 'paid_by_username' => [ + 'asc' => ['paid_by.username' => SORT_ASC ], + 'desc' => ['paid_by.username' => SORT_DESC], + ], + 'ticket_type_name' => [ + 'asc' => ['ticket_type.name' => SORT_ASC ], + 'desc' => ['ticket_type.name' => SORT_DESC], + ], + 'account_name' => [ + 'asc' => ['account.name' => SORT_ASC ], + 'desc' => ['account.name' => SORT_DESC], + ], + 'ticket_status' => [ + 'asc' => ['ticket.status' => SORT_ASC ], + 'desc' => ['ticket.status' => SORT_DESC], + ], + 'ticket_price_brutto' => [ + 'asc' => ['ticket.price_brutto' => SORT_ASC ], + 'desc' => ['ticket.price_brutto' => SORT_DESC], + ], +// 'id_card' => [ +// 'asc' => ['card.number' => SORT_ASC ], +// 'desc' => ['card.number' => SORT_DESC], +// ], + + + ] + ] + ]); + + $this->load($params); + + + if (!$this->validate()) { + $query->where('0=1'); + return $query; + } + + + $query->andFilterWhere([ + 'ticket.id_user' => $this->id_user, + 'ticket.id_ticket_type' => $this->id_ticket_type, + 'ticket.id_account' => $this->id_account, + 'ticket.id_card' => $this->id_card, + 'ticket.id_ticket' => $this->id_ticket, + 'ticket.status' => $this->status + ]); + + $query->andWhere(['customer.id_customer' => $this->customer->id_customer]); + + + $all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) ) + || + ($this->valid_in_interval == true && $this->expire_in_interval == true && $this->created_in_interval); + + $dateConditions = []; + $start = $this->timestampStart; + $end = $this->timestampEnd; + + if( $all || $this->created_in_interval ){ + $dateConditions[] = Helper::queryInIntervalRule('ticket.created_at', $start, $end); + } + + if ( $all || $this->valid_in_interval ){ + $dateConditions[] = Helper::queryValidRule('ticket.start', 'ticket.end', $start, $end); + } + + if ( $all || $this->expire_in_interval ){ + $dateConditions[] = Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end); + } + + if ( count($dateConditions) == 1 ){ + $query->andWhere($dateConditions[0]); + }else if ( count($dateConditions) > 1 ){ + $cond = ['or']; + foreach ($dateConditions as $c){ + $cond[] = $c; + } + $query->andWhere($cond); + } + + return $dataProvider; + } + + + + public function searchTotals(){ + $query = Ticket::mkStatisticQuery($this->timestampStart, $this->timestampEnd,$this->id_card); + $this->statistics = $query->all(); + + $this->statisticsTotal =[ + 'valid' => 0, + 'created' => 0, + 'created_at_money' => 0, + 'expired' => 0, + ]; + + $this->statisticsTotal['valid'] = array_sum(array_column($this->statistics, 'valid')); + $this->statisticsTotal['created'] = array_sum(array_column($this->statistics, 'created')); + $this->statisticsTotal['created_money'] = array_sum(array_column($this->statistics, 'created_money')); + $this->statisticsTotal['expired'] = array_sum(array_column($this->statistics, 'expired')); + } + + + public static function mkSearchCondition( $timestampStart, $timestampEnd, $id_user,$id_ticket_tpye,$id_account,$valid_in_interval ,$expire_in_interval,$created_in_interval ){ + $query = Ticket::find(); + + Helper::queryAccountConstraint($query, 'ticket.id_account'); + + $query->with('ticketType' ); + $query->with('user'); + $query->with('customer'); + + $query->andFilterWhere([ + 'id_user' => $id_user, + 'id_ticket_type' => $id_ticket_type, + 'id_account' => $id_account, + ]); + + $all = (!($valid_in_interval) && !($expire_in_interval) && !($created_in_interval) ) + || + ($valid_in_interval == true && $expire_in_interval == true && $created_in_interval); + + $dateConditions = []; + $start = $timestampStart; + $end = $timestampEnd; + + if( $all || $created_in_interval ){ + $dateConditions[] = Helper::queryInIntervalRule('ticket.created_at', $start, $end); + } + + if ( $all || $valid_in_interval ){ + $dateConditions[] = Helper::queryValidRule('ticket.start', 'ticket.end', $start, $end); + } + + if ( $all || $expire_in_interval ){ + $dateConditions[] = Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end); + } + + if ( count($dateConditions) == 1 ){ + $query->andWhere($dateConditions[0]); + }else if ( count($dateConditions) > 1 ){ + $cond = ['or']; + foreach ($dateConditions as $c){ + $cond[] = $c; + } + $query->andWhere($cond); + } + } + +} diff --git a/backend/views/account-state/_search.php b/backend/views/account-state/_search.php index fe23edf..abaf5d5 100644 --- a/backend/views/account-state/_search.php +++ b/backend/views/account-state/_search.php @@ -45,7 +45,7 @@ $userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($users,'id','username') 'autoclose'=>true, 'format' => 'yyyy.mm.dd' ] - ]) ?> + ])->label('Időszak kezdete') ?>
field($model, 'end') ->widget(DatePicker::classname(), [ @@ -53,7 +53,7 @@ $userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($users,'id','username') 'autoclose'=>true, 'format' => 'yyyy.mm.dd' ] - ]) ?> + ]) ->label('Időszak vége') ?>
diff --git a/backend/views/card/_search.php b/backend/views/card/_search.php index 36ab2e0..552d43b 100644 --- a/backend/views/card/_search.php +++ b/backend/views/card/_search.php @@ -49,6 +49,15 @@ $statusOptions = mkOptions(Card::statuses());
field($model, 'rfid_key')->textInput() ?>
+
+ field($model, 'searchKeyNumber')->textInput()->label("Kulcs") ?> +
+
+ field($model, 'usage')->dropDownList(['' => 'Mind' , '1' => 'Használt', '2' => 'Üres' ])->label("Használat") ?> +
+
+ field($model, 'key_assigned')->dropDownList(['' => 'Mind' , '1' => 'Kulcs hozzárendelve', '2' => 'Kulcs nélkül' ])->label("Kulcs hozzárendelés") ?> +
diff --git a/backend/views/card/index.php b/backend/views/card/index.php index 32802f2..b088d21 100644 --- a/backend/views/card/index.php +++ b/backend/views/card/index.php @@ -2,6 +2,8 @@ use yii\helpers\Html; use yii\grid\GridView; +use common\models\Card; +use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $searchModel backend\models\CardSearch */ @@ -10,6 +12,13 @@ use yii\grid\GridView; $this->title = Yii::t('common/card', 'Cards'); $this->params['breadcrumbs'][] = $this->title; ?> + +

title) ?>

@@ -23,33 +32,63 @@ $this->params['breadcrumbs'][] = $this->title; 'dataProvider' => $dataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], - [ - 'attribute' => 'number', - 'value' => 'number' + 'attribute' => 'card_number', + 'label' => 'Kártyaszám' ], [ - 'attribute' => 'rfid_key', - 'value' => 'rfid_key' + 'attribute' => 'card_rfid_key', + 'label' => 'RFID szám' ], [ - 'attribute' => 'status', - 'value' => 'statusHuman' + 'attribute' => 'card_status', + 'label' => 'Státusz', + 'value' => function ($model, $key, $index, $column){ + return Card::toStatusName($model['card_status'],'-'); + } ], - [ - 'attribute' => 'type', - 'value' => 'typeHuman' - ], - [ - 'attribute' => 'customerName', - 'value' => 'customerName' - ], - 'updated_at:datetime', + [ + 'attribute' => 'card_type', + 'label' => 'Típus', + 'value' => function ($model, $key, $index, $column){ + return Card::toTypeName($model['card_type'],'-'); + } + ], + [ + 'attribute' => 'customer_id_customer', + 'label' => 'Vendég azonosító' + ], + [ + 'attribute' => 'customer_name', + 'label' => 'Vendég név' + ], + [ + 'attribute' => 'key_number', + 'label' => 'Kulcs száma' + ], + [ 'class' => 'yii\grid\ActionColumn', - 'template' => '{view}{update}' - ], + 'template' => '{view}{update}', + 'urlCreator' => function ($action, $model, $key, $index){ + $result = ""; + if ( 'view' == $action ){ + $result = Url::toRoute(['card/view' , 'id' => $model['card_id_card'] ]); + }else if ( 'update' == $action ){ + $result = Url::toRoute(['card/update' , 'id' => $model['card_id_card'] ]); + } + return $result; + }, + 'buttons' =>[ + 'view' => function ($url, $model, $key) { + return Html::a("Nézet" ,$url,['class' =>'btn btn-primary btn-xs']); + }, + 'update' => function ($url, $model, $key) { + return Html::a("Módosít" ,$url,['class' =>'btn btn-primary btn-xs']); + }, + ] + ], ], ]); ?> diff --git a/backend/views/common/_customer_tab.php b/backend/views/common/_customer_tab.php new file mode 100644 index 0000000..6ff20d5 --- /dev/null +++ b/backend/views/common/_customer_tab.php @@ -0,0 +1,53 @@ + + +controller->id .'/'. \Yii::$app->controller->action->id; + + + + + + + +$items = [ +// [ 'Recepció', ['customer/reception', 'number' => $card->number ]], +// [ 'Termék eladás', ['product/sale', 'number' => $card->number ]], + [ 'Információ', ['customer/view', 'id' => $customer->id_customer ]], + [ 'Adatlap', ['customer/update', 'id' => $customer->id_customer ]], + [ 'Befizetések', ['ticket/index-customer', 'id' => $customer->id_customer ]], + [ 'Kulcsok', ['key/index-customer','id' => $customer->id_customer ]], + [ 'Szerződések', ['contract/index-customer', 'id' => $customer->id_customer ]], +// [ 'Kosár', ['transfer/customer-cart', 'id_card' => $card->id_card ]], +]; + + + + + +?> + + + + + + + +

+

Vendég: customer->name ?>

+

Kártyaszám: number ?>

+ \ No newline at end of file diff --git a/backend/views/contract/_form.php b/backend/views/contract/_form.php new file mode 100644 index 0000000..24bf878 --- /dev/null +++ b/backend/views/contract/_form.php @@ -0,0 +1,45 @@ + + +
+ + + + field($model, 'id_contract')->textInput() ?> + + field($model, 'id_user')->textInput() ?> + + field($model, 'id_customer')->textInput() ?> + + field($model, 'status')->textInput() ?> + + field($model, 'flag')->textInput() ?> + + field($model, 'part_paid')->textInput() ?> + + field($model, 'part_count')->textInput() ?> + + field($model, 'part_required')->textInput() ?> + + field($model, 'expired_at')->textInput() ?> + + field($model, 'created_at')->textInput() ?> + + field($model, 'updated_at')->textInput() ?> + + field($model, 'id_ticket_type')->textInput() ?> + +
+ isNewRecord ? Yii::t('common/door_log', 'Create') : Yii::t('common/door_log', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/contract/_search-customer.php b/backend/views/contract/_search-customer.php new file mode 100644 index 0000000..fe354ab --- /dev/null +++ b/backend/views/contract/_search-customer.php @@ -0,0 +1,49 @@ + + + diff --git a/backend/views/contract/_search.php b/backend/views/contract/_search.php new file mode 100644 index 0000000..1d77246 --- /dev/null +++ b/backend/views/contract/_search.php @@ -0,0 +1,40 @@ + + + diff --git a/backend/views/contract/create.php b/backend/views/contract/create.php new file mode 100644 index 0000000..4244f1b --- /dev/null +++ b/backend/views/contract/create.php @@ -0,0 +1,21 @@ +title = Yii::t('common/door_log', 'Create Contract'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/contract/index-customer.php b/backend/views/contract/index-customer.php new file mode 100644 index 0000000..89069a1 --- /dev/null +++ b/backend/views/contract/index-customer.php @@ -0,0 +1,57 @@ +title = "Vendég szerződések"; +$this->params['breadcrumbs'][] = "Vendég"; +$this->params['breadcrumbs'][] = "Szerződések"; +?> + + $searchModel->customer]) ?> +
+ + render('_search-customer', ['model' => $searchModel]); ?> + + + $dataProvider, + 'columns' => [ + [ + 'label' => 'Szerződés azonosító', + 'value' => 'id_contract', + 'attribute' =>'id_contract', + ], + [ + 'label' => 'Felhasználó', + 'value' => 'userName', + 'attribute' =>'id_user', + ], + [ + 'label' => 'Státusz', + 'value' => 'statusName', + 'attribute' =>'status', + ], + [ + 'label' => 'Állapot', + 'value' => 'flagName', + 'attribute' =>'flag', + ], + [ + 'label' => 'Lejárat', + 'value' => 'expired_at', + 'attribute' =>'expired_at', + 'format' => 'date' + ], + 'created_at:datetime', + +// ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/backend/views/contract/index.php b/backend/views/contract/index.php new file mode 100644 index 0000000..634bc47 --- /dev/null +++ b/backend/views/contract/index.php @@ -0,0 +1,85 @@ +title = "Szerződések"; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

+ render('_search', ['model' => $searchModel]); ?> + + + $dataProvider, + 'columns' => [ + /* + * 'contract.id_contract as contract_id_contract', + 'user.username as user_name', + 'customer.id_customer as customer_id_customer', + 'customer.name as customer_name', + 'customer.status as customer_status', + 'customer.flags as customer_flags',*/ + [ + 'attribute' => 'contract_id_contract' , + 'label' =>'Szerződés azonosító' + ], + [ + 'attribute' => 'user_name' , + 'label' =>'Felhasználó' + ], + [ + 'attribute' => 'customer_id_customer' , + 'label' =>'Vendég azonosító' + ], + [ + 'attribute' => 'customer_name' , + 'label' =>'Vendég név' + ], + [ + 'attribute' => 'contract_status' , + 'label' =>'Státusz', + 'value' => function ($model, $key, $index, $column){ + return Contract::toStatusName($model['contract_status']); + } + ], + [ + 'attribute' => 'contract_flag' , + 'label' =>'Állapot', + 'value' => function ($model, $key, $index, $column){ + return Contract::toFlangName($model['contract_flag']); + } + ], + [ + 'attribute' => 'contract_part_count' , + 'label' =>'Összes részlet' + ], + [ + 'attribute' => 'contract_part_required' , + 'label' =>'Esedékes részletek' + ], + [ + 'attribute' => 'contract_part_paid' , + 'label' =>'Részletek fizetve' + ], + [ + 'attribute' => 'contract_created_at' , + 'label' =>'Létrehozva', + 'format' => 'date' + ], + [ + 'attribute' => 'contract_expired_at' , + 'label' =>'Lejárat', + 'format' => 'date' + ], + ], + ]); ?> + +
diff --git a/backend/views/contract/update.php b/backend/views/contract/update.php new file mode 100644 index 0000000..5fdadcb --- /dev/null +++ b/backend/views/contract/update.php @@ -0,0 +1,23 @@ +title = Yii::t('common/door_log', 'Update {modelClass}: ', [ + 'modelClass' => 'Contract', +]) . ' ' . $model->id_contract; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id_contract, 'url' => ['view', 'id' => $model->id_contract]]; +$this->params['breadcrumbs'][] = Yii::t('common/door_log', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/contract/view.php b/backend/views/contract/view.php new file mode 100644 index 0000000..806c352 --- /dev/null +++ b/backend/views/contract/view.php @@ -0,0 +1,46 @@ +title = $model->id_contract; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/door_log', 'Contracts'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ + $model, + 'attributes' => [ + 'id_contract', + 'id_user', + 'id_customer', + 'status', + 'flag', + 'part_paid', + 'part_count', + 'part_required', + 'expired_at', + 'created_at', + 'updated_at', + 'id_ticket_type', + ], + ]) ?> + +
diff --git a/backend/views/customer/update.php b/backend/views/customer/update.php index ff3a1cf..4ab4d77 100644 --- a/backend/views/customer/update.php +++ b/backend/views/customer/update.php @@ -1,18 +1,18 @@ title = Yii::t('common/customer', 'Módosítás: ' ) . ' ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]]; +$this->title = "Vendég módosítása"; +$this->params['breadcrumbs'][] = "Vendég"; $this->params['breadcrumbs'][] = Yii::t('common/customer', 'Update'); ?> + $model]) ?>
-

title) ?>

render('_form_update', [ 'model' => $model, diff --git a/backend/views/customer/view.php b/backend/views/customer/view.php index 4974a4e..aabcd1f 100644 --- a/backend/views/customer/view.php +++ b/backend/views/customer/view.php @@ -2,21 +2,21 @@ use yii\helpers\Html; use yii\widgets\DetailView; +use yii\base\Widget; +use backend\components\AdminCustomerTabWidget; /* @var $this yii\web\View */ /* @var $model common\models\Customer */ -$this->title = $model->name; -$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; +$this->title = "Vendég információk"; +$this->params['breadcrumbs'][] = "Vendég"; +$this->params['breadcrumbs'][] = "Információk"; ?> + + $model]) ?> +
-

title) ?>

- -

- $model->id_customer], ['class' => 'btn btn-primary']) ?> -

$model, diff --git a/backend/views/key/index-customer.php b/backend/views/key/index-customer.php new file mode 100644 index 0000000..1c25d71 --- /dev/null +++ b/backend/views/key/index-customer.php @@ -0,0 +1,53 @@ +title = Yii::t('backend/key', 'Keys'); +$this->params['breadcrumbs'][] = "Vendég"; +$this->params['breadcrumbs'][] = "Kulcsok"; +?> + + $searchModel->customer]) ?> + +
+ + + $dataProvider, + //'filterModel' => $searchModel, // ezt nem szeretjük + 'columns' => [ + // ['class' => 'yii\grid\SerialColumn'], + // 'id_key', + [ + 'attribute' => 'number', + 'label' => "Kulcs szám", + ], + [ + 'attribute' => 'rfid_key', + 'label' => "RFID kód", + ], + [ + 'attribute' => 'status', + 'value' => function ($model, $key, $index, $column){ + $statuszok = Key::statuses(); + $result = $statuszok[$model['status']]; + return $result; + } + ], + [ + 'attribute' => 'assigned_at', + 'label' => "Kiadva", + 'format' =>'datetime' + ], + + ], + ]); ?> + +
diff --git a/backend/views/message-detsta/_form.php b/backend/views/message-detsta/_form.php new file mode 100644 index 0000000..7680a00 --- /dev/null +++ b/backend/views/message-detsta/_form.php @@ -0,0 +1,31 @@ + + +
+ + + + field($model, 'id_message')->textInput() ?> + + field($model, 'path')->textInput(['maxlength' => true]) ?> + + field($model, 'id_user')->textInput() ?> + + field($model, 'created_at')->textInput() ?> + + field($model, 'updated_at')->textInput() ?> + +
+ isNewRecord ? Yii::t('common/message_detsta', 'Create') : Yii::t('common/message_detsta', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/message-detsta/_search.php b/backend/views/message-detsta/_search.php new file mode 100644 index 0000000..4421023 --- /dev/null +++ b/backend/views/message-detsta/_search.php @@ -0,0 +1,35 @@ + + + diff --git a/backend/views/message-detsta/create.php b/backend/views/message-detsta/create.php new file mode 100644 index 0000000..49d6c30 --- /dev/null +++ b/backend/views/message-detsta/create.php @@ -0,0 +1,21 @@ +title = Yii::t('common/message_detsta', 'Create Message Detsta'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/message-detsta/index.php b/backend/views/message-detsta/index.php new file mode 100644 index 0000000..a025122 --- /dev/null +++ b/backend/views/message-detsta/index.php @@ -0,0 +1,38 @@ +title = Yii::t('common/message_detsta', 'Message Detstas'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

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

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id_message', + 'path', + 'id_user', + 'created_at', + 'updated_at', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/backend/views/message-detsta/update.php b/backend/views/message-detsta/update.php new file mode 100644 index 0000000..cf6a876 --- /dev/null +++ b/backend/views/message-detsta/update.php @@ -0,0 +1,23 @@ +title = Yii::t('common/message_detsta', 'Update {modelClass}: ', [ + 'modelClass' => 'Message Detsta', +]) . ' ' . $model->id_message; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id_message, 'url' => ['view', 'id' => $model->id_message]]; +$this->params['breadcrumbs'][] = Yii::t('common/message_detsta', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/message-detsta/view.php b/backend/views/message-detsta/view.php new file mode 100644 index 0000000..38132c1 --- /dev/null +++ b/backend/views/message-detsta/view.php @@ -0,0 +1,171 @@ +title = $model->id_message; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/message_detsta', 'Message Detstas'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ + $model->id_ugiro] ,[ 'class' => 'btn btn-primary']); +?> + + +
+
+ +

Fej

+ $model->fej, + 'attributes' => [ + [ + 'attribute' => 'record_tipus' , + 'label' => 'Rekord típus' + ], + [ + 'attribute' => 'uzenet_tipus' , + 'label' => 'Üzenet típus' + ], + [ + 'attribute' => 'jelentes_jelzo' , + 'label' => 'Jelentés jelző' + ], + [ + 'attribute' => 'kezdemenyezo_azonosito' , + 'label' => 'Kezdeményező azonosító' + ], + [ + 'attribute' => 'csoportos_uzenet_sorszam' , + 'label' => 'Csoportos üzenet sorszám' + ], + [ + 'attribute' => 'csoportos_uzenet_datum' , + 'label' => 'Csoportos üzenet dátum', + 'format' => 'date' + ], + [ + 'attribute' => 'detsta_uzenet_sorszam' , + 'label' => 'Detsta üzenet sorszám' + ], + [ + 'attribute' => 'detsta_uzenet_datum' , + 'label' => 'Detsta üzenet dátum', + 'format' => 'date' + ], + [ + 'attribute' => 'ido' , + 'label' => 'Idő' + ], + ], + ]) ?> +
+
+

Láb

+ $model->lab, + 'attributes' => [ + [ + 'attribute' => 'record_tipus' , + 'label' => 'Rekord típus' + ], + [ + 'attribute' => 'teljesitett_tetelek_szama' , + 'label' => 'Teljesített tételek száma' + ], + [ + 'attribute' => 'teljesitett_tetelek_osszerteke' , + 'label' => 'Teljesített tételek összértéke' + ], + [ + 'attribute' => 'visszautasitott_tetelek_szama' , + 'label' => 'Visszautasított tételek száma' + ], + [ + 'attribute' => 'visszautasitott_tetelek_osszerteke' , + 'label' => 'Visszautasított tételek összértéke' + ], + [ + 'attribute' => 'megnemvalaszolt_tetelek_szama' , + 'label' => 'Meg nem válaszolt tételek száma' + ], + [ + 'attribute' => 'megnemvalaszolt_tetelek_osszerteke' , + 'label' => 'Meg nem válaszolt tételek összértéke' + ], + ], + ]) ?> +
+
+ +
+
+

Tételek

+ + tetelek; + + foreach ($tetelek as $tetel){ + echo "

Tétel: ".$tetel->tetel_sorszam."

"; + echo DetailView::widget([ + 'model' => $tetel, + 'attributes' => [ + [ + 'attribute' => 'record_tipus' , + 'label' => 'Rekord típus' + ], + [ + 'attribute' => 'tetel_sorszam' , + 'label' => 'Tétel sorszám' + ], + [ + 'attribute' => 'osszeg' , + 'label' => 'Összeg' + ], + [ + 'attribute' => 'eredeti_tetel_elszamolasi_datuma' , + 'label' => 'Eredeti tétel elszámolási dátum' + ], + [ + 'attribute' => 'visszajelzes_informacio' , + 'label' => 'Visszajelzés Informacio' + ], + [ + 'attribute' => 'terhelesi_datum' , + 'label' => 'Terhelési dátuma' + ], + [ + 'attribute' => 'feldolgozas_datum' , + 'label' => 'Feldolgozás dátuma' + ], + [ + 'attribute' => 'valasz_hivatkozasi_kod' , + 'label' => 'Válasz hivatkozási kód' + ], + [ + 'attribute' => 'eredeti_hivatkozasi_kod' , + 'label' => 'Eredeti hivatkozási kód' + ], + [ + 'attribute' => 'ugyfel_azonosito' , + 'label' => 'Ügyfél azonosító' + ], + [ + 'value' => $tetel->request->customer->name , + 'label' => 'Vendég' + ], + ] + ]); + + } + + ?> +
+
+ +
diff --git a/backend/views/procurement/_form.php b/backend/views/procurement/_form.php index 3035e6a..8df1a3c 100644 --- a/backend/views/procurement/_form.php +++ b/backend/views/procurement/_form.php @@ -12,15 +12,17 @@ use yii\helpers\ArrayHelper;
- field($model, 'productIdentifier')->textInput()->hint(Yii::t('common/procurement', "Product name, product number or barcode")) ?> + field($model, 'productIdentifier')->textInput()->hint(Yii::t('common/procurement', "Product name, product number or barcode"))->label('Vonalkód vagy termékszám') ?> field($model, 'id_warehouse')->dropDownList($warehouseOptions) ?> + field($model, 'id_account')->dropDownList($accountsOptions)->label('Kassza') ?> field($model, 'count')->textInput() ?> diff --git a/backend/views/procurement/create.php b/backend/views/procurement/create.php index 415e4aa..936a858 100644 --- a/backend/views/procurement/create.php +++ b/backend/views/procurement/create.php @@ -17,7 +17,8 @@ $this->params['breadcrumbs'][] = $this->title; render('_form', [ 'model' => $model, - 'warehouses' => $warehouses + 'warehouses' => $warehouses, + 'accounts' => $accounts ]) ?>
diff --git a/backend/views/product/_search_statistics.php b/backend/views/product/_search_statistics.php new file mode 100644 index 0000000..c807bf8 --- /dev/null +++ b/backend/views/product/_search_statistics.php @@ -0,0 +1,85 @@ + + "Mind"] + ( Product::statuses() ); + +$productCategories = ['' => "Mind"] + ArrayHelper::map( ProductCategory::read(null) ,'id_product_category','name') ; + +$accounts = ['' => "Mind"] + ( ArrayHelper::map( Account::read(null) ,'id_account','name')); + +?> + diff --git a/backend/views/product/statistics.php b/backend/views/product/statistics.php new file mode 100644 index 0000000..27ab011 --- /dev/null +++ b/backend/views/product/statistics.php @@ -0,0 +1,64 @@ +title = Yii::t('common/product', 'Products'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

+ render('_search_statistics', ['model' => $searchModel]); ?> + + 'btn btn-primary'] ); + + ?> + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'product_name', + 'label' => 'Terméknév', + ], + [ + 'attribute' => 'product_number', + 'label' => 'Termékszám', + ], + [ + 'attribute' => 'product_barcode', + 'label' => 'Vonalkód', + ], + [ + 'attribute' => 'father_account_name', + 'label' => 'Termék kassza', + ], +// [ +// 'attribute' => 'account_name', +// 'label' => 'Fizetési kassza', +// ], + [ + 'attribute' => 'product_sale_price', + 'label' => 'Eladási ár', + ], + [ + 'attribute' => 'transfer_count', + 'label' => 'Eladott mennyiség', + ], + [ + 'attribute' => 'transfer_money', + 'label' => 'Eladás összege', + ], + + ], + ]); ?> + +
diff --git a/backend/views/ticket-installment-request/_index_view.php b/backend/views/ticket-installment-request/_index_view.php index ddd8adf..6b869cf 100644 --- a/backend/views/ticket-installment-request/_index_view.php +++ b/backend/views/ticket-installment-request/_index_view.php @@ -149,7 +149,7 @@ use yii\helpers\Html; - Sorszám a kötegben belül + Tétel sorszám diff --git a/backend/views/ticket/_search_customer.php b/backend/views/ticket/_search_customer.php index 04e7bf5..d83642e 100644 --- a/backend/views/ticket/_search_customer.php +++ b/backend/views/ticket/_search_customer.php @@ -20,7 +20,7 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna