From a580b3d295de141e3b5adbddf813e1fd6ba8ba43 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Wed, 13 Jul 2016 18:37:41 +0200 Subject: [PATCH] add backed transfer list chages. Add conffir dkailogsW --- backend/controllers/TicketController.php | 3 - backend/controllers/TransferController.php | 142 +++++++- backend/models/TransferSearch.php | 370 ++++++++++++--------- backend/views/transfer/_search.php | 13 +- backend/views/transfer/index.php | 118 ++++++- changelog.txt | 3 + common/config/params.php | 2 +- frontend/views/contract/view.php | 18 +- frontend/views/ticket/index.php | 5 +- frontend/views/transfer/_view.php | 6 +- frontend/web/js/transferlist.js | 2 +- 11 files changed, 514 insertions(+), 168 deletions(-) diff --git a/backend/controllers/TicketController.php b/backend/controllers/TicketController.php index 7d61370..f69b8ac 100644 --- a/backend/controllers/TicketController.php +++ b/backend/controllers/TicketController.php @@ -76,9 +76,6 @@ class TicketController extends \backend\controllers\BackendController { $searchModel->ticketTypes = TicketType::read (); } - - - if ( $searchModel->output == 'pdf' ){ return $this->downloadIndexPdf($searchModel,$dataProvider); }else if ( $searchModel->output == 'xls'){ diff --git a/backend/controllers/TransferController.php b/backend/controllers/TransferController.php index b768be5..2ad7a9a 100644 --- a/backend/controllers/TransferController.php +++ b/backend/controllers/TransferController.php @@ -131,11 +131,13 @@ class TransferController extends \backend\controllers\BackendController $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $accounts = Account::read(); - $searchModel->totalsTransfers(); - $users = User::read(); + if ( $searchModel->output == 'xls'){ + set_time_limit(0); + return $this->downloadIndexXls($searchModel,$dataProvider); + } return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -145,6 +147,142 @@ class TransferController extends \backend\controllers\BackendController } + /** + * @param $searchModel \backend\models\TicketSearch + * @param $dataProvider \yii\data\ActiveDataProvider + */ + private function downloadIndexXls($searchModel, $dataProvider){ + + $objPHPExcel = new \PHPExcel (); + $sheet = $objPHPExcel->setActiveSheetIndex ( 0 ); + $formatter = \Yii::$app->formatter; + + $admin = User::findOne(\Yii::$app->user->id); + + $row = 1; + + $sheet->setCellValue('A'.$row, 'Exportálta'); + $sheet->setCellValue('B'.$row, $admin->username); + $sheet->setCellValue('C'.$row, 'Exportálás ideje'); + $sheet->setCellValue('D'.$row, $formatter->asDatetime(new \DateTime())); + + $row++; + $user = User::findOne($searchModel->id_user); + $userName = isset($user) ? $user->username : 'Mind'; + $account = Account::findOne($searchModel->id_account); + $accountName = isset($account) ? $account->name : 'Mind' ; + $statusName = !empty($searchModel->status) ? Transfer::toStatusName($searchModel->status) : 'Mind'; + $start = isset($searchModel->start) ? $formatter->asDateTime($searchModel->timestampStart) : ''; + $end = isset($searchModel->end) ? $formatter->asDateTime($searchModel->timestampEnd) : ''; + $paymentMethodName = !empty($searchModel->payment_method ) ? Transfer::toPaymentMethodName($searchModel->payment_method) : ''; + $customerName = !empty($searchModel->customer_name) ? $searchModel->customer_name : "Mind"; + $cardNumber = !empty($searchModel->card_number) ? $searchModel->card_number : "Mind"; + $transferName = !empty($searchModel->transfer_name) ? $searchModel->transfer_name : "Mind"; + + + $sheet->setCellValue('A'.$row, 'Felhasználó'); + $sheet->setCellValue('B'.$row, $userName ); + $sheet->setCellValue('C'.$row, 'Kassza'); + $sheet->setCellValue('D'.$row, $accountName); + $sheet->setCellValue('E'.$row, 'Státusz'); + $sheet->setCellValue('F'.$row, $statusName); + + $row++; + $sheet->setCellValue('A'.$row, 'Fizetési mód'); + $sheet->setCellValue('B'.$row, $paymentMethodName ); + $sheet->setCellValue('C'.$row, 'Vendég neve'); + $sheet->setCellValue('D'.$row, $customerName); + $row++; + $sheet->setCellValue('A'.$row, 'Időszak kezdete'); + $sheet->setCellValue('B'.$row, $start); + $sheet->setCellValue('C'.$row, 'Időszak vége'); + $sheet->setCellValue('D'.$row, $end); + $row++; + $sheet->setCellValue('E'.$row, 'Megnevezés'); + $sheet->setCellValue('F'.$row, $transferName); + $sheet->setCellValue('G'.$row, 'Kártya szám'); + $sheet->setCellValue('H'.$row, $cardNumber); + + $row++; + $sheet->setCellValue('A'.$row, 'T. Azonosító') + ->setCellValue('B'.$row, 'Típus') + ->setCellValue('C'.$row, 'Megnevezés') + ->setCellValue('D'.$row, 'Kiadta') + ->setCellValue('E'.$row, 'Fizette') + ->setCellValue('F'.$row, 'Vendég') + ->setCellValue('G'.$row, 'Kassza') + ->setCellValue('H'.$row, 'Egységár') + ->setCellValue('I'.$row, 'Mennyiség') + ->setCellValue('J'.$row, 'Összeg') + ->setCellValue('K'.$row, 'Státusz') + ->setCellValue('L'.$row, 'Fizetési mód') + ->setCellValue('M'.$row, 'Kiadva') + ->setCellValue('N'.$row, 'Fizetve') + ->setCellValue('O'.$row, 'Érv. -tól') + ->setCellValue('P'.$row, 'Érv. -ig') + ; + + + foreach ( $dataProvider->getModels() as $model ) { + $row ++; + $sheet + ->setCellValue('A'.$row, $model['transfer_id_transfer']) + ->setCellValue('B'.$row, $model['transfer_type']) + ->setCellValue('C'.$row, $model['transfer_name']) + ->setCellValue('D'.$row, ($model['user_username'])) + ->setCellValue('E'.$row, ($model['paid_by_username'])) + ->setCellValue('F'.$row, ($model['customer_name'])) + ->setCellValue('G'.$row, $model['account_name']) + ->setCellValue('H'.$row, $model['transfer_item_price']) + ->setCellValue('I'.$row, $model['transfer_count']) + ->setCellValue('J'.$row, $model['transfer_money']) + ->setCellValue('K'.$row, $model['transfer_status']) + ->setCellValue('L'.$row, $model['transfer_payment_method']) + ->setCellValue('M'.$row, $model['transfer_created_at']) + ->setCellValue('N'.$row, $model['transfer_paid_at']) + ->setCellValue('O'.$row, $model['ticket_start']) + ->setCellValue('P'.$row, $model['ticket_end']) + ; + } + + $styleArray = array ( + 'font' => array ( + 'bold' => true + ) + ); + + foreach ( range ( 'A', 'Q' ) as $columnID ) { + $sheet->getColumnDimension ( $columnID )->setAutoSize ( true ); + $sheet->getStyle ( $columnID . '6' )->applyFromArray ( $styleArray ); + } + + foreach ( ['A','C','E' ,'G']as $columnID ) { + for ($i = 1 ; $i < 6; $i++){ + $sheet->getStyle ( $columnID . $i )->applyFromArray ( $styleArray ); + } + } + + $fileName = "berletek"; + $fileName .= "_" . date ( "Ymd_His" ); + $fileName .= ".xls"; + + // Redirect output to a client’s web browser (Excel5) + header ( 'Content-Type: application/vnd.ms-excel' ); + header ( 'Content-Disposition: attachment;filename="' . $fileName . '"' ); + 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 (); + } + + /** * Lists all Transfer models. * @return mixed diff --git a/backend/models/TransferSearch.php b/backend/models/TransferSearch.php index 016809e..2fb6e06 100644 --- a/backend/models/TransferSearch.php +++ b/backend/models/TransferSearch.php @@ -19,37 +19,43 @@ use common\components\RoleDefinition; */ class TransferSearch extends Transfer { - public $searchObjectName; - public $searchTypeName; - public $searchUserName; - public $start; - public $end; - - public $timestampStart; - public $timestampEnd; - - public $accountTotals; - public $fullTotal; - - public $types; - public $totals; - - public $customer_name; - + public $searchObjectName; + public $searchTypeName; + public $searchUserName; + + public $start; + public $end; + + public $timestampStart; + public $timestampEnd; + + public $accountTotals; + public $fullTotal; + + public $types; + public $totals; + + public $customer_name; + public $transfer_name; + public $card_number; + public $all; + + public $output; + /** * @inheritdoc */ public function rules() { return [ - [[ 'id_account','id_user', 'type','status','payment_method'], 'integer'], - [['customer_name'],'safe'], + [['id_account', 'id_user', 'type', 'status', 'payment_method'], 'integer'], + [['customer_name','output','transfer_name', 'card_number' ], 'safe'], // [[ 'searchObjectName' ], 'string'], // [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], // [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ], - [[ 'start', ], 'date', 'format' =>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' ], - ['types', 'each', 'rule' => ['integer']], + [['start',], 'date', 'format' => 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'], + ['types', 'each', 'rule' => ['integer']], ]; } @@ -62,6 +68,134 @@ class TransferSearch extends Transfer return Model::scenarios(); } + /** + * Create the payment method case when sql expression + * @return Expression the payment method expression + */ + private function buildPaymentMethodExpression(){ + $s = "case"; + $arr = Transfer::paymentMethods(); + foreach ( $arr as $key =>$value ){ + $s .= " when transfer.payment_method = $key then '$value' "; + } + $s .=" end as transfer_payment_method"; + return new Expression($s); + } + + private function buildTransferNameCondition($transferName){ + $exp = new Expression( 'case + when transfer.type = ' . Transfer::TYPE_TICKET . ' then ticket_type.name + when transfer.type = ' . Transfer::TYPE_PRODUCT . ' then product.name + when transfer.type = ' . Transfer::TYPE_MONEY_MOVEMENT_OUT . ' then \'Pénzmozgás\' end = \''.$transferName.'\' '); + return $exp->__toString() ; + } + + + /** + * @param $mode string the select mode: select or total + * @param $valid boolean the form validation result + * @return \Yii\db\Query the query object + */ + private function createQuery($mode, $valid) + { + $query = new Query(); + + if ($mode == 'select') { + $query->select([ + 'transfer.id_transfer as transfer_id_transfer', + new Expression('case + when transfer.type = ' . Transfer::TYPE_TICKET . ' then \'Bérlet\' + when transfer.type = ' . Transfer::TYPE_PRODUCT . ' then \'Termék\' + when transfer.type = ' . Transfer::TYPE_MONEY_MOVEMENT_OUT . ' then \'Pénzmozgás\' end as transfer_type'), + new Expression('case + when transfer.type = ' . Transfer::TYPE_TICKET . ' then ticket_type.name + when transfer.type = ' . Transfer::TYPE_PRODUCT . ' then product.name + when transfer.type = ' . Transfer::TYPE_MONEY_MOVEMENT_OUT . ' then \'Pénzmozgás\' end as transfer_name'), + 'user.username as user_username', + 'paid_by.username as paid_by_username', + 'customer.name as customer_name', + 'account.name as account_name', + 'transfer.item_price as transfer_item_price', + 'transfer.count as transfer_count', + new Expression('case + when transfer.direction = ' . Transfer::DIRECTION_IN . ' then transfer.money + when transfer.direction = ' . Transfer::DIRECTION_OUT . ' then transfer.money * -1 end as transfer_money'), + new Expression('case + when transfer.status = ' . Transfer::STATUS_NOT_PAID . ' then \'Nincs fizetve\' + when transfer.status = ' . Transfer::STATUS_PAID . ' then \'Fizetve\' + when transfer.status = ' . Transfer::STATUS_STORNO . ' then \'Törölve\' end as transfer_status'), + $this->buildPaymentMethodExpression(), + 'transfer.created_at as transfer_created_at', + 'transfer.paid_at as transfer_paid_at', + 'ticket.start as ticket_start', + 'ticket.end as ticket_end' + ]); + }else if ( $mode == 'total'){ + $query->select([ + new Expression('coalesce(sum(transfer.count),0) as total_count'), + new Expression('coalesce(sum(transfer.money),0) as total_money'), + ]); + } + $query->from("transfer"); + $query->innerJoin('account', 'account.id_account = transfer.id_account'); + $query->innerJoin('user', " user.id = transfer.id_user"); + $query->leftJoin('customer', " transfer.id_customer = customer.id_customer"); + $query->leftJoin('card', " card.id_card = customer.id_customer_card"); + $query->leftJoin('user as paid_by', " paid_by.id = transfer.paid_by"); + $query->leftJoin('ticket', "ticket.id_ticket = transfer.id_object and transfer.type = " . Transfer::TYPE_TICKET); + $query->leftJoin('sale', "sale.id_sale = transfer.id_object and transfer.type = " . Transfer::TYPE_PRODUCT); + $query->leftJoin('money_movement', "money_movement.id_money_movement = transfer.id_object and transfer.type = " . Transfer::TYPE_MONEY_MOVEMENT_OUT); + $query->leftJoin('ticket_type', "ticket_type.id_ticket_type = ticket.id_ticket_type"); + $query->leftJoin('product', 'product.id_product = sale.id_product'); + + if (!$valid) { + $query->where('0=1'); + return $query; + } + + if (!RoleDefinition::isAdmin()) { + $query->innerJoin("user_account_assignment", 'transfer.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]); + + if (RoleDefinition::isReception()) { + $query->andWhere(['transfer.id_user' => Yii::$app->user->id]); + } + } + + $query->andFilterWhere([ + 'transfer.id_account' => $this->id_account, + 'transfer.status' => $this->status, + 'transfer.payment_method' => $this->payment_method, + 'customer.name' => $this->customer_name, + 'card.number' => $this->card_number + ]); + + if ( !empty($this->transfer_name)) { + $query->andWhere($this->buildTransferNameCondition($this->transfer_name) ); + } + $query->andFilterWhere(['in', 'transfer.type', $this->types]); + + $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]); + + if (isset($this->id_user)) { + $query->andFilterWhere([ + 'or', + ['transfer.id_user' => $this->id_user], + ['transfer.paid_by' => $this->id_user], + ]); + } + + if (!RoleDefinition::isAdmin()) { + Helper::restrictIfNotAdminTheStartDate($query, $this->timestampStart, ['transfer.created_at', 'transfer.paid_at']); + } + + return $query; + } + /** * Creates data provider instance with search query applied * @@ -71,139 +205,75 @@ class TransferSearch extends Transfer */ public function search($params) { - $query = Transfer::find(); - - $query->innerJoinWith('account'); - $query->innerJoin('user', " user.id = transfer.id_user"); - $query->leftJoin('customer', " transfer.id_customer = customer.id_customer"); - - if ( !RoleDefinition::isAdmin() ){ - $query->innerJoin("user_account_assignment",'transfer.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 ]); - - if ( RoleDefinition::isReception()){ - $query->andWhere(['transfer.id_user' => Yii::$app->user->id ]); - } - } - - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'sort' =>[ - 'defaultOrder' =>[ - 'created_at' => SORT_DESC - ], - 'attributes' =>[ - 'paid_at' =>[ - 'asc' => ['transfer.paid_at' => SORT_ASC ], - 'desc' => ['transfer.paid_at' => SORT_DESC], - ], - 'created_at' =>[ - 'asc' => ['transfer.created_at' => SORT_ASC ], - 'desc' => ['transfer.created_at' => SORT_DESC], - ], - 'status' =>[ - 'asc' => ['transfer.status' => SORT_ASC ], - 'desc' => ['transfer.status' => SORT_DESC], - ], - 'money' =>[ - 'asc' => ['transfer.money' => SORT_ASC ], - 'desc' => ['transfer.money' => SORT_DESC], - ], - 'count' =>[ - 'asc' => ['transfer.count' => SORT_ASC ], - 'desc' => ['transfer.count' => SORT_DESC], - ], - 'item_price' =>[ - 'asc' => ['transfer.item_price' => SORT_ASC ], - 'desc' => ['transfer.item_price' => SORT_DESC], - ], - 'id_account' =>[ - 'asc' => ['account.name' => SORT_ASC ], - 'desc' => ['account.name' => SORT_DESC], - ], - 'id_user' =>[ - 'asc' => ['user.username' => SORT_ASC ], - 'desc' => ['user.username' => SORT_DESC], - ], - 'id_customer' =>[ - 'asc' => ['customer.name' => SORT_ASC ], - 'desc' => ['customer.name' => SORT_DESC], - ], - ] - ] - ]); - - -// $query->addSelect( ['*' ]); - $this->load($params); + $valid = $this->validate(); - 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 = $this->createQuery('total',$valid); + $this->all = $query->one(); + $query = $this->createQuery( 'select', $valid); + + $dataProviderSetup = [ + 'query' => $query, + 'sort' => [ + 'defaultOrder' => [ + 'transfer_created_at' => SORT_DESC + ], + 'attributes' => Helper::mkYiiSortItems([ + ['transfer_id_transfer'], + ['transfer_created_at'], + ['transfer_type'], + ['transfer_name'], + ['user_username'], + ['paid_by_username'], + ['customer_name'], + ['account_name'], + ['transfer_item_price'], + ['transfer_count'], + ['transfer_money'], + ['transfer_status'], + ['transfer_payment_method'], + ['transfer_paid_at'], + ['ticket_start'], + ['ticket_end'], + ]) + ] + ]; + + if ($this->output == 'pdf' || $this->output == 'xls') { + $dataProviderSetup['pagination'] = false; + }; + + $dataProvider = new ActiveDataProvider($dataProviderSetup); - - $query->andFilterWhere([ - 'transfer.id_account' => $this->id_account, - 'transfer.type' => $this->type, - 'transfer.status' => $this->status, - 'transfer.payment_method' => $this->payment_method, - 'customer.name' => $this->customer_name - ]); - - $query->andFilterWhere(['in' ,'transfer.type', $this->types]); - - $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]); - - if ( isset($this->id_user)){ - $query->andFilterWhere([ - 'or', - ['transfer.id_user' => $this->id_user], - ['transfer.paid_by' => $this->id_user], - ]); - } - - - if (!RoleDefinition::isAdmin()){ - Helper::restrictIfNotAdminTheStartDate($query, $this->timestampStart,['transfer.created_at','transfer.paid_at']); - } - return $dataProvider; } - - - public function totalsTransfers( ){ - $accountTotals = []; - $fullTotal = [ - 'label' => Yii::t('common/transfer', 'Total'), - 'money' => 0 - ]; - - - $accounts = Account::read(); - $accountMap = ArrayHelper::map( $accounts ,'id_account','name' ); - $idUser = $this->id_user; - - /**mk totals need date time format*/ - $start = $this->timestampStart; - if ( isset($start) && !empty($start)){ - $start .= " 00:00"; - } - - - $this->totals = Transfer::mkTotals($start, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap); - - + + + public function totalsTransfers() + { + $accountTotals = []; + $fullTotal = [ + 'label' => Yii::t('common/transfer', 'Total'), + 'money' => 0 + ]; + + + $accounts = Account::read(); + $accountMap = ArrayHelper::map($accounts, 'id_account', 'name'); + $idUser = $this->id_user; + + /**mk totals need date time format*/ + $start = $this->timestampStart; + if (isset($start) && !empty($start)) { + $start .= " 00:00"; + } + + + $this->totals = Transfer::mkTotals($start, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap); + + } - - - - + + } diff --git a/backend/views/transfer/_search.php b/backend/views/transfer/_search.php index b3fd8d8..e5a41bc 100644 --- a/backend/views/transfer/_search.php +++ b/backend/views/transfer/_search.php @@ -61,7 +61,18 @@ use kartik\widgets\DateTimePicker; field($model, 'customer_name')->label("Vendég") ?> - +
+
+ field($model, 'transfer_name')->label("Megnevezés") ?> +
+
+ field($model, 'card_number')->label("Kártya szám") ?> +
+
+
+
+
+
'btn btn-primary']) ?>
diff --git a/backend/views/transfer/index.php b/backend/views/transfer/index.php index 5dd6223..c89a9dc 100644 --- a/backend/views/transfer/index.php +++ b/backend/views/transfer/index.php @@ -28,18 +28,126 @@ $this->params['breadcrumbs'][] = $this->title;

title) ?>

+
render('_search', ['model' => $searchModel, 'accounts' => $accounts,'users' => $users,]); ?> +
+ +
+
+
+ + Exportálás: + + getTotalCount() < 1000) { + echo Html::a( + "XLS", \yii\helpers\Url::current([Html::getInputName($searchModel, 'output') => 'xls']), + ['class' => 'btn btn-primary pull-left', 'style' => 'margin-left: 12px;'] + ); + } + ?> +
+
+
- $searchModel->totals ]); ?> -

Tranzakciók

- ['class' => 'table table-striped table-bordered table-transfer'], + 'dataProvider' => $dataProvider, + 'showFooter'=>TRUE, + + 'columns' => [ + + [ + 'attribute' => 'transfer_id_transfer', + 'label' => 'Tranz. Azon.', + 'footer' => 'Oldalon / Összesen' + ], + [ + 'attribute' => 'transfer_type', + 'label' => 'Típus' + ], + [ + 'attribute' => 'transfer_name', + 'label' => 'Megnevezés' + ], + [ + 'attribute' => 'user_username', + 'label' => 'Kiadta' + ], + [ + 'attribute' => 'paid_by_username', + 'label' => 'Fizette' , + ], + [ + 'attribute' => 'customer_name', + 'label' => 'Vendég' + ], + [ + 'attribute' => 'account_name', + 'label' => 'Kassza' + ], + [ + 'contentOptions' =>[ 'class' => 'item-price' ], + 'attribute' => 'transfer_item_price', + 'label' => 'Egység ár' + ], + [ + 'contentOptions' =>[ 'class' => 'count' ], + 'attribute' => 'transfer_count', + 'label' => 'Mennyiség', + 'footer'=>DataProviderTotal::pageTotal($dataProvider->models,'transfer_count') .' / ' .$searchModel->all['total_count'], + ], + [ + 'contentOptions' =>[ 'class' => 'money' ], + 'footerOptions' =>[ 'class' => 'money' ], + 'attribute' => 'transfer_money', + 'label' => 'Összeg', + 'footer'=>DataProviderTotal::pageTotal($dataProvider->models,'transfer_money') .' / ' .$searchModel->all['total_money'], + ], + [ + 'attribute' => 'transfer_status', + 'label' => 'Státusz' + ], + [ + 'attribute' => 'transfer_payment_method', + 'label' => "Fizetési mód" + ], + [ + 'attribute' => 'transfer_created_at', + 'label' => "Kiadva", + 'format' => 'datetime' + ], + [ + 'attribute' => 'transfer_paid_at', + 'label' => "Fizetve", + 'format' => 'datetime' + ], +[ + 'attribute' => 'ticket_start', + 'label' => "Érv. tól", + 'format' => 'date' + ], +[ + 'attribute' => 'ticket_end', + 'label' => "Érv. ig", + 'format' => 'date' + ], + + ['class' => 'yii\grid\ActionColumn', + 'template' => '{view}' + ], + ], + ]); ?> + + + ['class' => 'table table-striped table-bordered table-transfer'], 'dataProvider' => $dataProvider, 'showFooter'=>TRUE, @@ -90,7 +198,7 @@ $this->params['breadcrumbs'][] = $this->title; 'footerOptions' =>[ 'class' => 'money' ], 'attribute' => 'money', 'value' => 'signedMoney' , - 'footer'=>DataProviderTotal::pageTotal($dataProvider->models,'signedMoney'), + 'footer'=>DataProviderTotal::pageTotal($dataProvider->models,'transfer_money'), ], [ 'attribute' => 'status', @@ -108,7 +216,7 @@ $this->params['breadcrumbs'][] = $this->title; 'template' => '{view}' ], ], - ]); ?> + ]); */?>

* A láblécben szereplő összesítések csak a táblázat aktuális oldalára vonatkoznak! diff --git a/changelog.txt b/changelog.txt index b503609..ae9d0b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +-0.0.79 + - add frontend confirm on delete, + - add transfer changes -0.0.78 - hide backend ticket export pdf -0.0.77 diff --git a/common/config/params.php b/common/config/params.php index 9547549..987889d 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -5,7 +5,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.0.78', + 'version' => 'v0.0.79', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global diff --git a/frontend/views/contract/view.php b/frontend/views/contract/view.php index 747fbec..5befd8d 100644 --- a/frontend/views/contract/view.php +++ b/frontend/views/contract/view.php @@ -52,14 +52,28 @@ $this->params['breadcrumbs'][] = $this->title;

$model->id_contract, 'flag' => Contract::$FLAG_CANCELED], [ 'data-method' => 'post', 'class' => 'btn btn-danger']); + echo Html::a("Szerződés felbontása ",['contract/cancel' , 'id' => $model->id_contract, 'flag' => Contract::$FLAG_CANCELED], + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('common/waste', 'Biztosan fel szeretné bontani a szerződést?'), + 'method' => 'post', + ] + ]); ?>
Szerződés felbontása esetén a már megkezdett hónapokra hónaponként 3000 Ft büntetést írunk fel a vásárló kosarába.
A vendég nem köthet új szerződést a felbontott szerződés eredet lejáratáig.
$model->id_contract , 'flag' => Contract::$FLAG_CANCELED_2], [ 'data-method' => 'post', 'class' => 'btn btn-danger']); + echo Html::a("Szerződés felbontása újrakötés lehetőségével", + ['contract/cancel' , 'id' => $model->id_contract , 'flag' => Contract::$FLAG_CANCELED_2], + [ 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('common/waste', 'Szerződés felbontása újrakötési lehetőséggel?'), + 'method' => 'post', + ] + ]); ?>
Szerződés felbontása esetén a már megkezdett hónapokra hónaponként 3000 Ft büntetést írunk fel a vásárló kosarába.
Ezen mód választásakor a vendégnek lehetősége lesz új szerződés kötésére a lemondott szerződés eredeti lejárati dátuma előtt! diff --git a/frontend/views/ticket/index.php b/frontend/views/ticket/index.php index f5b39cc..78549ea 100644 --- a/frontend/views/ticket/index.php +++ b/frontend/views/ticket/index.php @@ -80,7 +80,10 @@ $this->params['breadcrumbs'][] = $this->title; }, 'delete' => function($url, $model, $key){ return $model->status == Ticket::STATUS_DELETED ? "" : Html::a('', $url, - [ 'title' => "Bérlet törlése", 'class'=>'btn btn-primary btn-xs', 'data-method' =>'post']) ; + [ 'title' => "Bérlet törlése", 'class'=>'btn btn-primary btn-xs', 'data' => [ + 'confirm' => Yii::t('common/waste', 'Biztosan törli a bérletet?'), + 'method' => 'post', + ]]) ; }, ], // 'buttons ' => [ diff --git a/frontend/views/transfer/_view.php b/frontend/views/transfer/_view.php index 19d9f29..f7da630 100644 --- a/frontend/views/transfer/_view.php +++ b/frontend/views/transfer/_view.php @@ -78,8 +78,10 @@ $formatter = Yii::$app->formatter; if ( $model->status != Transfer::STATUS_STORNO){ echo Html::a('Törlés', Url::toRoute(['delete','id' =>$model->id_transfer]), [ 'title' => Yii::t('yii', 'Delete'), - 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), - 'data-method' => 'post', + 'data' => [ + 'confirm' => Yii::t('common/waste', 'Biztos törli a tranzakciót'), + 'method' => 'post', + ], 'class' => 'btn btn-danger', // 'style' =>'margin-right: 12px;' ]);}?> diff --git a/frontend/web/js/transferlist.js b/frontend/web/js/transferlist.js index c5a5e6d..866a086 100644 --- a/frontend/web/js/transferlist.js +++ b/frontend/web/js/transferlist.js @@ -112,7 +112,7 @@ $.widget( "fitness.transferList", { s += ""; s += ''; s += '
'; - s += ""; + s += ""; s += '
'; s += ''; s += '';