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; = $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?> +
| + 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'] ) ;?> + | ++ | ++ | +
| + 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'] ) ;?> + | ++ | ++ | +
| + 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'] ) ;?> + | ++ | ++ | +
+ = Html::a(Yii::t('common/ticket_installment_request', 'Update'), ['update', 'id' => $model->id_ticket_installment_request], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('common/ticket_installment_request', 'Delete'), ['delete', 'id' => $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', + ], + ]) ?> +
+ + = DetailView::widget([ + 'model' => $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', + ], + ]) ?> + +A részletek havonta kerülnek beszedésre
+ = $form->field($model, 'installment_money')->textInput() ?> + = $form->field($model, 'installment_count')->textInput() ?>+ = Html::a(Yii::t('frontend/key', 'Update'), ['update', 'id' => $model->id_key], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('frontend/key', 'Delete'), ['delete', 'id' => $model->id_key], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('frontend/key', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +
+ + = DetailView::widget([ + 'model' => $model, + 'attributes' => [ + 'id_key', + 'number', + 'status', + 'type', + 'created_at', + 'updated_at', + 'rfid_key', + ], + ]) ?> + +