add backand ticket/index changes, add backand\ticket\index export pdf, xls
This commit is contained in:
parent
06eca0fe03
commit
5438c9a038
@ -76,7 +76,7 @@ class AdminMenuStructure{
|
|||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] , 'target_url' => ['/customer/index' ,'/customer/view','/ticket/index-customer'] ];
|
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] , 'target_url' => ['/customer/index' ,'/customer/view','/ticket/index-customer'] ];
|
||||||
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
|
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
|
||||||
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index' , 'TicketSearch[start]' =>$today,'TicketSearch[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index' , 'TicketSearch[start]' =>$todayDatetime,'TicketSearch[end]' => $tomorrowDatetime ] ];
|
||||||
$items[] = ['label' => 'Statisztika', 'url' => ['/ticket/statistics' , 'TicketSearchStatisitcs[start]' =>$today,'TicketSearchStatisitcs[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Statisztika', 'url' => ['/ticket/statistics' , 'TicketSearchStatisitcs[start]' =>$today,'TicketSearchStatisitcs[end]' => $tomorrow ] ];
|
||||||
$items[] = ['label' => 'Kártya létrehozás', 'url' => ['/card-package/index' , ] ];
|
$items[] = ['label' => 'Kártya létrehozás', 'url' => ['/card-package/index' , ] ];
|
||||||
$items[] = ['label' => 'Kártya csomag RFId hozzárendelés', 'url' => ['/card-package/import' , ] ];
|
$items[] = ['label' => 'Kártya csomag RFId hozzárendelés', 'url' => ['/card-package/import' , ] ];
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
namespace backend\controllers;
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use common\models\Transfer;
|
||||||
use Yii;
|
use Yii;
|
||||||
use common\models\Ticket;
|
use common\models\Ticket;
|
||||||
use backend\models\TicketSearch;
|
use backend\models\TicketSearch;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
use yii\web\NotFoundHttpException;
|
use yii\web\NotFoundHttpException;
|
||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
@ -23,7 +25,6 @@ use common\components\DetStatTetelProcessor;
|
|||||||
use yii\helpers\VarDumper;
|
use yii\helpers\VarDumper;
|
||||||
use backend\models\TicketUpdate;
|
use backend\models\TicketUpdate;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
use frontend\components\HtmlHelper;
|
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,11 +69,21 @@ class TicketController extends \backend\controllers\BackendController {
|
|||||||
public function actionIndex() {
|
public function actionIndex() {
|
||||||
$searchModel = new TicketSearch ();
|
$searchModel = new TicketSearch ();
|
||||||
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||||
|
if ( $searchModel->output != 'pdf' && $searchModel->output != 'xls' ){
|
||||||
$searchModel->searchTotals ();
|
$searchModel->searchTotals ();
|
||||||
|
|
||||||
$searchModel->users = User::read ();
|
$searchModel->users = User::read ();
|
||||||
$searchModel->accounts = Account::read ();
|
$searchModel->accounts = Account::read ();
|
||||||
$searchModel->ticketTypes = TicketType::read ();
|
$searchModel->ticketTypes = TicketType::read ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ( $searchModel->output == 'pdf' ){
|
||||||
|
return $this->downloadIndexPdf($searchModel,$dataProvider);
|
||||||
|
}else if ( $searchModel->output == 'xls'){
|
||||||
|
return $this->downloadIndexXls($searchModel,$dataProvider);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->render ( 'index', [
|
return $this->render ( 'index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
@ -80,6 +91,234 @@ class TicketController 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);
|
||||||
|
$ticketType = TicketType::findOne($searchModel->id_ticket_type);
|
||||||
|
$account = Account::findOne($searchModel->id_account);
|
||||||
|
$cardNumber = !empty($searchModel->card_number) ? $searchModel->card_number : "Mind";
|
||||||
|
$ticketStatus = !empty($searchModel->status) ? Ticket::toStatusName($searchModel->status) : "Mind";
|
||||||
|
$customerIdCustomer = !empty($searchModel->id_customer) ? $searchModel->id_customer : "Mind";
|
||||||
|
$customerName = !empty($searchModel->customer_name) ? $searchModel->customer_name : "Mind";
|
||||||
|
$start = isset($searchModel->start) ? $formatter->asDateTime($searchModel->timestampStart) : '';
|
||||||
|
$end = isset($searchModel->end) ? $formatter->asDateTime($searchModel->timestampEnd) : '';
|
||||||
|
$ticketIdTicket = !empty($searchModel->id_ticket ) ? $searchModel->id_ticket : 'Mind';
|
||||||
|
|
||||||
|
$allDateConditionOn = $searchModel->isAllDateConditionOn();
|
||||||
|
$ticketIntervalIsValid = ( $allDateConditionOn || "1" == $searchModel->valid_in_interval )? "Igen" : "";
|
||||||
|
$ticketIntervalIsCreated =( $allDateConditionOn || "1" == $searchModel->created_in_interval) ? "Igen" : "";
|
||||||
|
$ticketIntervalIsExpire = ( $allDateConditionOn || "1" == $searchModel->expire_in_interval) ? "Igen" : "";
|
||||||
|
$ticketIntervalIsPaid = ( $allDateConditionOn || "1" == $searchModel->paid_in_interval) ? "Igen" : "";
|
||||||
|
|
||||||
|
$sheet->setCellValue('A'.$row, 'Felhasználó');
|
||||||
|
$sheet->setCellValue('B'.$row, isset($user) ? $user->username : 'Mind');
|
||||||
|
$sheet->setCellValue('C'.$row, 'Bérlet típus');
|
||||||
|
$sheet->setCellValue('D'.$row, isset($ticketType) ? $ticketType->name : 'Mind');
|
||||||
|
$sheet->setCellValue('E'.$row, 'Kassza');
|
||||||
|
$sheet->setCellValue('F'.$row, isset($account) ? $account->name : 'Mind');
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
$sheet->setCellValue('A'.$row, 'Bérlet státusz');
|
||||||
|
$sheet->setCellValue('B'.$row, $ticketStatus);
|
||||||
|
|
||||||
|
$sheet->setCellValue('C'.$row, 'Vendég azonosító');
|
||||||
|
$sheet->setCellValue('D'.$row, $customerIdCustomer);
|
||||||
|
|
||||||
|
$sheet->setCellValue('E'.$row, 'Vendég neve');
|
||||||
|
$sheet->setCellValue('F'.$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);
|
||||||
|
$sheet->setCellValue('E'.$row, 'Bérlet azonosító');
|
||||||
|
$sheet->setCellValue('F'.$row, $ticketIdTicket);
|
||||||
|
$sheet->setCellValue('G'.$row, 'Kártya szám');
|
||||||
|
$sheet->setCellValue('H'.$row, $cardNumber);
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
$sheet->setCellValue('A'.$row, 'Érvényes az időszakban');
|
||||||
|
$sheet->setCellValue('B'.$row, $ticketIntervalIsValid);
|
||||||
|
$sheet->setCellValue('C'.$row, 'Kiadva az időszakban');
|
||||||
|
$sheet->setCellValue('D'.$row, $ticketIntervalIsCreated);
|
||||||
|
$sheet->setCellValue('E'.$row, 'Lejár az időszakban');
|
||||||
|
$sheet->setCellValue('F'.$row, $ticketIntervalIsExpire);
|
||||||
|
$sheet->setCellValue('G'.$row, 'Fizetve az időszakban');
|
||||||
|
$sheet->setCellValue('H'.$row, $ticketIntervalIsPaid);
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
$sheet->setCellValue('A'.$row, 'B. Azonosító')
|
||||||
|
->setCellValue('B'.$row, 'Vendég')
|
||||||
|
->setCellValue('C'.$row, 'Kártya')
|
||||||
|
->setCellValue('D'.$row, 'Érvényes -tól')
|
||||||
|
->setCellValue('E'.$row, 'Érvényes -ig')
|
||||||
|
->setCellValue('F'.$row, 'Létrehozva')
|
||||||
|
->setCellValue('G'.$row, 'Bérlet típus')
|
||||||
|
->setCellValue('H'.$row, 'Felhasználó')
|
||||||
|
->setCellValue('I'.$row, 'Kassza')
|
||||||
|
->setCellValue('J'.$row, 'Státusz')
|
||||||
|
->setCellValue('K'.$row, 'Belépések száma')
|
||||||
|
->setCellValue('L'.$row, 'Maximum belépések száma')
|
||||||
|
->setCellValue('M'.$row, 'Nála fizették')
|
||||||
|
->setCellValue('N'.$row, 'Fizetési mód')
|
||||||
|
->setCellValue('O'.$row, 'Összeg')
|
||||||
|
->setCellValue('P'.$row, 'Fizetés státusza')
|
||||||
|
->setCellValue('Q'.$row, 'Vendég azonosító')
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
foreach ( $dataProvider->getModels() as $model ) {
|
||||||
|
$row ++;
|
||||||
|
$sheet
|
||||||
|
->setCellValue('A'.$row, $model['ticket_id_ticket'])
|
||||||
|
->setCellValue('B'.$row, $model['customer_name'])
|
||||||
|
->setCellValue('C'.$row, $model['card_number'])
|
||||||
|
->setCellValue('D'.$row, $formatter->asDate($model['ticket_start']))
|
||||||
|
->setCellValue('E'.$row, $formatter->asDate($model['ticket_end']))
|
||||||
|
->setCellValue('F'.$row, $formatter->asDateTime($model['ticket_created_at']))
|
||||||
|
->setCellValue('G'.$row, $model['ticket_type_name'])
|
||||||
|
->setCellValue('H'.$row, $model['user_username'])
|
||||||
|
->setCellValue('I'.$row, $model['account_name'])
|
||||||
|
->setCellValue('J'.$row, Ticket::toStatusName( $model['ticket_status']))
|
||||||
|
->setCellValue('K'.$row, $model['ticket_usage_count'])
|
||||||
|
->setCellValue('L'.$row, $model['ticket_max_usage_count'])
|
||||||
|
->setCellValue('M'.$row, $model['paid_by_username'])
|
||||||
|
->setCellValue('N'.$row, Transfer::toPaymentMethodName( $model['transfer_payment_method']))
|
||||||
|
->setCellValue('O'.$row, $model['ticket_price_brutto'])
|
||||||
|
->setCellValue('P'.$row, Transfer::toStatusName( $model['transfer_status']))
|
||||||
|
->setCellValue('Q'.$row, $model['customer_id_customer'])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function downloadIndexPdf($searchModel,$dataProvider){
|
||||||
|
|
||||||
|
$formatter = \Yii::$app->formatter;
|
||||||
|
$admin = User::findOne(\Yii::$app->user->id);
|
||||||
|
$exported_at = $formatter->asDatetime(new \DateTime());
|
||||||
|
|
||||||
|
$user = User::findOne($searchModel->id_user);
|
||||||
|
$ticketType = TicketType::findOne($searchModel->id_ticket_type);
|
||||||
|
$account = Account::findOne($searchModel->id_account);
|
||||||
|
$ticketStatus = !empty($searchModel->status) ? Ticket::toStatusName($searchModel->status) : "Mind";
|
||||||
|
$customerIdCustomer = !empty($searchModel->id_customer) ? $searchModel->id_customer : "Mind";
|
||||||
|
$customerName = !empty($searchModel->customer_name) ? $searchModel->customer_name : "Mind";
|
||||||
|
$start = isset($searchModel->start) ? $formatter->asDateTime($searchModel->timestampStart) : '';
|
||||||
|
$end = isset($searchModel->end) ? $formatter->asDateTime($searchModel->timestampEnd) : '';
|
||||||
|
$ticketIdTicket = !empty($searchModel->id_ticket ) ? $searchModel->id_ticket : 'Mind';
|
||||||
|
|
||||||
|
$allDateConditionOn = $searchModel->isAllDateConditionOn();
|
||||||
|
$ticketIntervalIsValid = ( $allDateConditionOn || "1" == $searchModel->valid_in_interval )? "Igen" : "";
|
||||||
|
$ticketIntervalIsCreated =( $allDateConditionOn || "1" == $searchModel->created_in_interval) ? "Igen" : "";
|
||||||
|
$ticketIntervalIsExpire = ( $allDateConditionOn || "1" == $searchModel->expire_in_interval) ? "Igen" : "";
|
||||||
|
$ticketIntervalIsPaid = ( $allDateConditionOn || "1" == $searchModel->paid_in_interval) ? "Igen" : "";
|
||||||
|
|
||||||
|
$username = isset($user) ? $user->username : 'Mind';
|
||||||
|
$ticketTypeName = isset($ticketType) ? $ticketType->name : 'Mind';
|
||||||
|
$accountName = isset($account) ? $account->name : 'Mind';
|
||||||
|
$cardNumber = !empty($searchModel->card_number) ? $searchModel->card_number : "Mind";
|
||||||
|
|
||||||
|
$filters = [
|
||||||
|
'admin' => $admin->username,
|
||||||
|
'exported_at' => $exported_at,
|
||||||
|
'ticketStatus' =>$ticketStatus,
|
||||||
|
'customerIdCustomer' => $customerIdCustomer,
|
||||||
|
'customerName' => $customerName,
|
||||||
|
'start' => $start,
|
||||||
|
'end' => $end,
|
||||||
|
'ticketIdTicket' => $ticketIdTicket,
|
||||||
|
'ticketIntervalIsValid' => $ticketIntervalIsValid,
|
||||||
|
'ticketIntervalIsCreated' => $ticketIntervalIsCreated,
|
||||||
|
'ticketIntervalIsExpire' => $ticketIntervalIsExpire,
|
||||||
|
'ticketIntervalIsPaid' => $ticketIntervalIsPaid,
|
||||||
|
'username' => $username,
|
||||||
|
'ticketTypeName' => $ticketTypeName,
|
||||||
|
'accountName' => $accountName,
|
||||||
|
'cardNumber' => $cardNumber
|
||||||
|
];
|
||||||
|
|
||||||
|
$fileName = "berletek";
|
||||||
|
$fileName .= "_" . date ( "Ymd_His" );
|
||||||
|
$fileName .= ".pdf";
|
||||||
|
$mpdf = new \mPDF ( 'utf-8', 'A4' );
|
||||||
|
|
||||||
|
$mpdf->useSubstitutions = false;
|
||||||
|
$mpdf->simpleTables = true;
|
||||||
|
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Bérletek - Létrehozva: " .$admin->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||||
|
$mpdf->setFooter ( '{PAGENO} / {nb}' );
|
||||||
|
|
||||||
|
$stylesheet = file_get_contents( \Yii::getAlias('@backend/web/css/ticket-index-pdf.css')); // external css
|
||||||
|
$mpdf->WriteHTML($stylesheet,1);
|
||||||
|
|
||||||
|
$mpdf->WriteHTML ( $this->renderPartial ( '_index_pdf.php', [
|
||||||
|
'model' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'filters' => $filters
|
||||||
|
] ) );
|
||||||
|
$mpdf->Output ( $fileName, 'D' );
|
||||||
|
exit ();
|
||||||
|
/*
|
||||||
|
return $this->render ( '_index_pdf', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider
|
||||||
|
] );
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Ticket models.
|
* Lists all Ticket models.
|
||||||
*
|
*
|
||||||
@ -129,7 +368,9 @@ class TicketController extends \backend\controllers\BackendController {
|
|||||||
/**
|
/**
|
||||||
* Lists all Ticket models.
|
* Lists all Ticket models.
|
||||||
*
|
*
|
||||||
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public function actionIndexCustomer($id) {
|
public function actionIndexCustomer($id) {
|
||||||
$customer = Customer::findOne ( $id );
|
$customer = Customer::findOne ( $id );
|
||||||
|
|||||||
@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
namespace backend\models;
|
namespace backend\models;
|
||||||
|
|
||||||
|
use common\models\Transfer;
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\Model;
|
use yii\base\Model;
|
||||||
use yii\data\ActiveDataProvider;
|
use yii\data\ActiveDataProvider;
|
||||||
use common\models\Ticket;
|
use common\models\Ticket;
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
use yii\db\ActiveRecord;
|
use yii\db\ActiveRecord;
|
||||||
|
use yii\db\Expression;
|
||||||
|
use yii\db\Query;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,11 +29,17 @@ class TicketSearch extends Ticket
|
|||||||
public $valid_in_interval;
|
public $valid_in_interval;
|
||||||
public $created_in_interval;
|
public $created_in_interval;
|
||||||
public $expire_in_interval;
|
public $expire_in_interval;
|
||||||
|
public $paid_in_interval;
|
||||||
|
|
||||||
public $statistics;
|
public $statistics;
|
||||||
public $statisticsTotal;
|
public $statisticsTotal;
|
||||||
|
|
||||||
public $customer;
|
public $customer;
|
||||||
|
public $output;
|
||||||
|
|
||||||
|
public $id_customer;
|
||||||
|
public $customer_name;
|
||||||
|
public $card_number;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,10 +48,13 @@ class TicketSearch extends Ticket
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'],
|
[['id_ticket', 'id_user', 'id_ticket_type', 'id_account', 'status', 'id_customer'], 'integer'],
|
||||||
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
// [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||||
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
// [[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||||
[[ 'valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] ,
|
[['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'],
|
||||||
|
[['valid_in_interval', 'created_in_interval', 'expire_in_interval', 'paid_in_interval'], 'boolean'],
|
||||||
|
[['output', 'customer_name','card_number'], 'safe']
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -56,17 +68,20 @@ class TicketSearch extends Ticket
|
|||||||
return Model::scenarios();
|
return Model::scenarios();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function attributeLabels(){
|
public function attributeLabels()
|
||||||
|
{
|
||||||
return ArrayHelper::merge(parent::attributeLabels(), [
|
return ArrayHelper::merge(parent::attributeLabels(), [
|
||||||
'start' => Yii::t('backend/ticket', 'Start of interval'),
|
'start' => Yii::t('backend/ticket', 'Start of interval'),
|
||||||
'end' => Yii::t('backend/ticket', 'End of interval'),
|
'end' => Yii::t('backend/ticket', 'End of interval'),
|
||||||
'valid_in_interval' => Yii::t('backend/ticket', 'Valid in interval'),
|
'valid_in_interval' => Yii::t('backend/ticket', 'Valid in interval'),
|
||||||
'created_in_interval' => Yii::t('backend/ticket', 'Created in interval'),
|
'created_in_interval' => Yii::t('backend/ticket', 'Created in interval'),
|
||||||
'expire_in_interval' => Yii::t('backend/ticket', 'Expire in interval'),
|
'expire_in_interval' => Yii::t('backend/ticket', 'Expire in interval'),
|
||||||
|
'paid_in_interval' => "Fizetve az időszakban",
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterValidate(){
|
public function afterValidate()
|
||||||
|
{
|
||||||
|
|
||||||
if (!isset($this->timestampStart)) {
|
if (!isset($this->timestampStart)) {
|
||||||
$this->timestampStart = '1900-01-01';
|
$this->timestampStart = '1900-01-01';
|
||||||
@ -87,24 +102,41 @@ class TicketSearch extends Ticket
|
|||||||
*/
|
*/
|
||||||
public function search($params)
|
public function search($params)
|
||||||
{
|
{
|
||||||
$query = Ticket::find();
|
|
||||||
|
$query = new Query();
|
||||||
|
$query->select([
|
||||||
|
'ticket.id_ticket as ticket_id_ticket',
|
||||||
|
'customer.id_customer as customer_id_customer',
|
||||||
|
'customer.name as customer_name',
|
||||||
|
'card.number as card_number',
|
||||||
|
'ticket.start as ticket_start',
|
||||||
|
'ticket.end as ticket_end',
|
||||||
|
'ticket.created_at as ticket_created_at',
|
||||||
|
'user.username as user_username',
|
||||||
|
'ticket_type.name as ticket_type_name',
|
||||||
|
'account.name as account_name',
|
||||||
|
'ticket.status as ticket_status',
|
||||||
|
'ticket.max_usage_count as ticket_max_usage_count',
|
||||||
|
'ticket.usage_count as ticket_usage_count',
|
||||||
|
'paid_by.username as paid_by_username',
|
||||||
|
'transfer.payment_method as transfer_payment_method',
|
||||||
|
'transfer.status as transfer_status',
|
||||||
|
'transfer.money as transfer_money',
|
||||||
|
'ticket.price_brutto as ticket_price_brutto'
|
||||||
|
]);
|
||||||
|
$query->from('ticket');
|
||||||
|
$query->innerJoin("transfer", "ticket.id_ticket = transfer.id_object and transfer.type =" . Transfer::TYPE_TICKET);
|
||||||
|
$query->innerJoin("card", "ticket.id_card = card.id_card");
|
||||||
|
$query->innerJoin("customer", "card.id_card = customer.id_customer_card");
|
||||||
|
$query->innerJoin("user", "user.id = transfer.id_user");
|
||||||
|
$query->leftJoin("user as paid_by", "paid_by.id = transfer.paid_by");
|
||||||
|
$query->innerJoin("account", "account.id_account = transfer.id_account");
|
||||||
|
$query->innerJoin("ticket_type", "ticket_type.id_ticket_type = ticket.id_ticket_type");
|
||||||
|
|
||||||
|
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
|
||||||
|
|
||||||
Helper::queryAccountConstraint($query, 'ticket.id_account');
|
Helper::queryAccountConstraint($query, 'ticket.id_account');
|
||||||
|
|
||||||
$query->with('ticketType' );
|
|
||||||
$query->with('user');
|
|
||||||
$query->with('customer');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$dataProvider = new ActiveDataProvider([
|
|
||||||
'query' => $query,
|
|
||||||
'sort' =>[
|
|
||||||
'defaultOrder' => ['end' => SORT_DESC],
|
|
||||||
'attributes' => ['end']
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->load($params);
|
$this->load($params);
|
||||||
|
|
||||||
|
|
||||||
@ -114,20 +146,57 @@ class TicketSearch extends Ticket
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$dataProviderSetup = [
|
||||||
|
'query' => $query,
|
||||||
|
];
|
||||||
|
|
||||||
|
$dataProviderSetup['sort'] = [
|
||||||
|
'defaultOrder' => ['ticket_created_at' => SORT_DESC],
|
||||||
|
'attributes' => Helper::mkYiiSortItems([
|
||||||
|
['ticket_id_ticket'],
|
||||||
|
['customer_name'],
|
||||||
|
['customer_id_customer'],
|
||||||
|
['card_number'],
|
||||||
|
['ticket_start'],
|
||||||
|
['ticket_end'],
|
||||||
|
['ticket_created_at'],
|
||||||
|
['user_username'],
|
||||||
|
['ticket_type_name'],
|
||||||
|
['account_name'],
|
||||||
|
['ticket_status'],
|
||||||
|
['ticket_max_usage_count'],
|
||||||
|
['ticket_usage_count'],
|
||||||
|
['paid_by_username'],
|
||||||
|
['paid_at'],
|
||||||
|
['transfer_payment_method'],
|
||||||
|
['transfer_status'],
|
||||||
|
['transfer_money'],
|
||||||
|
['ticket_price_brutto'],
|
||||||
|
])
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($this->output == 'pdf' || $this->output == 'xls') {
|
||||||
|
$dataProviderSetup['pagination'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider($dataProviderSetup);
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id_user' => $this->id_user,
|
'user.id' => $this->id_user,
|
||||||
'id_ticket_type' => $this->id_ticket_type,
|
'ticket_type.id_ticket_type' => $this->id_ticket_type,
|
||||||
'id_account' => $this->id_account,
|
'account.id_account' => $this->id_account,
|
||||||
'id_card' => $this->id_card,
|
'card.id_card' => $this->id_card,
|
||||||
'id_ticket' => $this->id_ticket,
|
'ticket.id_ticket' => $this->id_ticket,
|
||||||
'status' => $this->status
|
'ticket.status' => $this->status,
|
||||||
|
'customer.id_customer' => $this->id_customer,
|
||||||
|
'card.number' => $this->card_number
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', new Expression('LOWER(customer.name)'), strtolower($this->customer_name)]);
|
||||||
|
|
||||||
|
$all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) && !($this->paid_in_interval))
|
||||||
$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);
|
($this->valid_in_interval == true && $this->expire_in_interval == true && $this->created_in_interval && $this->paid_in_interval);
|
||||||
|
|
||||||
$dateConditions = [];
|
$dateConditions = [];
|
||||||
$start = $this->timestampStart;
|
$start = $this->timestampStart;
|
||||||
@ -145,6 +214,10 @@ class TicketSearch extends Ticket
|
|||||||
$dateConditions[] = Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end);
|
$dateConditions[] = Helper::queryExpireRule('ticket.start', 'ticket.end', $start, $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($all || $this->paid_in_interval) {
|
||||||
|
$dateConditions[] = ['and', ['>=', 'transfer.paid_at', $start], ['<', 'transfer.paid_at', $end]];
|
||||||
|
}
|
||||||
|
|
||||||
if (count($dateConditions) == 1) {
|
if (count($dateConditions) == 1) {
|
||||||
$query->andWhere($dateConditions[0]);
|
$query->andWhere($dateConditions[0]);
|
||||||
} else if (count($dateConditions) > 1) {
|
} else if (count($dateConditions) > 1) {
|
||||||
@ -159,8 +232,17 @@ class TicketSearch extends Ticket
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function isAllDateConditionOn(){
|
||||||
|
$all = (!($this->valid_in_interval) && !($this->expire_in_interval) && !($this->created_in_interval) && !($this->paid_in_interval))
|
||||||
|
||
|
||||||
|
($this->valid_in_interval == true && $this->expire_in_interval == true && $this->created_in_interval && $this->paid_in_interval);
|
||||||
|
|
||||||
public function searchTotals(){
|
return $all;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function searchTotals()
|
||||||
|
{
|
||||||
$query = Ticket::mkStatisticQuery($this->timestampStart, $this->timestampEnd, $this->id_card);
|
$query = Ticket::mkStatisticQuery($this->timestampStart, $this->timestampEnd, $this->id_card);
|
||||||
$this->statistics = $query->all();
|
$this->statistics = $query->all();
|
||||||
|
|
||||||
@ -178,7 +260,8 @@ class TicketSearch extends Ticket
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function mkSearchCondition( $timestampStart, $timestampEnd, $id_user,$id_ticket_tpye,$id_account,$valid_in_interval ,$expire_in_interval,$created_in_interval ){
|
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();
|
$query = Ticket::find();
|
||||||
|
|
||||||
Helper::queryAccountConstraint($query, 'ticket.id_account');
|
Helper::queryAccountConstraint($query, 'ticket.id_account');
|
||||||
|
|||||||
1
backend/tests/fixtures/initdb.php
vendored
Normal file
1
backend/tests/fixtures/initdb.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO user (username,auth_key,password_hash,password_reset_token,email,status,created_at,updated_at) VALUES ('admin','TzZY5KoLbg4VTxwaxs5OoxhFwNt_VeIv','$2y$13$oWyHf7oSB7XktVe0pEhfROahmxr9NWbYo0o3z69aH6rnBf0oyhTSe',null,'admin@rocho-net.hu',10,1446658188,1461356211);
|
||||||
128
backend/views/ticket/_index_pdf.php
Normal file
128
backend/views/ticket/_index_pdf.php
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
use yii\data\ArrayDataProvider;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\TicketSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
?>
|
||||||
|
<div class="ticket-index">
|
||||||
|
<h1>Bérletek</h1>
|
||||||
|
|
||||||
|
<table class="filter-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Exportálta</th>
|
||||||
|
<td><?php echo $filters['admin'] ?></td>
|
||||||
|
<th>Exportálás ideje</th>
|
||||||
|
<td><?php echo $filters['exported_at'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<td><?php echo $filters['username'] ?></td>
|
||||||
|
<th>Bérlet típus</th>
|
||||||
|
<td><?php echo $filters['ticketTypeName'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<td><?php echo $filters['accountName'] ?></td>
|
||||||
|
<th>Státusz</th>
|
||||||
|
<td><?php echo $filters['ticketStatus'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Vendég azon</th>
|
||||||
|
<td><?php echo $filters['customerIdCustomer'] ?></td>
|
||||||
|
<th>Vendég neve</th>
|
||||||
|
<td><?php echo $filters['customerName'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Időszak -tól</th>
|
||||||
|
<td><?php echo $filters['start'] ?></td>
|
||||||
|
<th>Időszak -ig</th>
|
||||||
|
<td><?php echo $filters['end'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Bérlet azon</th>
|
||||||
|
<td><?php echo $filters['ticketIdTicket'] ?></td>
|
||||||
|
<th>Kártya</th>
|
||||||
|
<td><?php echo $filters['cardNumber'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Érvényes az időszakban</th>
|
||||||
|
<td><?php echo $filters['ticketIntervalIsValid'] ?></td>
|
||||||
|
<th>Kiadva az időszakban</th>
|
||||||
|
<td><?php echo $filters['ticketIntervalIsCreated'] ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Lejár az időszakban</th>
|
||||||
|
<td><?php echo $filters['ticketIntervalIsExpire'] ?></td>
|
||||||
|
<th>Fizetve az időszakban</th>
|
||||||
|
<td><?php echo $filters['ticketIntervalIsPaid'] ?></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'tableOptions' => ['class' => 'table table-bordered tbl-pdf'],
|
||||||
|
'columns' => [
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_id_ticket',
|
||||||
|
'label' => 'B. Azon.',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'customer_name',
|
||||||
|
'label' => 'Vendég',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'card_number',
|
||||||
|
'label' => 'Kártya',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_start',
|
||||||
|
'label' => 'Érvényes -tól',
|
||||||
|
'format' => 'date',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_end',
|
||||||
|
'label' => 'Érvényes -ig',
|
||||||
|
'format' => 'date',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_created_at',
|
||||||
|
'label' => 'Létrehozva',
|
||||||
|
'format' => 'datetime',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_type_name',
|
||||||
|
'label' => 'Bérlet típus',
|
||||||
|
'enableSorting' => false
|
||||||
|
],[
|
||||||
|
'attribute' => 'user_username',
|
||||||
|
'label' => 'Felhasználó',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'account_name',
|
||||||
|
'label' => 'Kassza',
|
||||||
|
'enableSorting' => false
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_status',
|
||||||
|
'label' => 'Státusz',
|
||||||
|
'enableSorting' => false,
|
||||||
|
'value' => function ($model, $key, $index, $column){
|
||||||
|
return \common\models\Ticket::toStatusName($model['ticket_status']);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
use kartik\widgets\DatePicker;
|
|
||||||
use common\models\Ticket;
|
use common\models\Ticket;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
@ -42,6 +42,19 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
|
|||||||
<?= $form->field($model, 'status')->dropDownList( ["" =>"Mind"]+ Ticket::statuses()) ?>
|
<?= $form->field($model, 'status')->dropDownList( ["" =>"Mind"]+ Ticket::statuses()) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
|
<?= $form->field($model, 'id_customer')->textInput()->label("Vendég azonosító") ?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?= $form->field($model, 'customer_name')->textInput()->label("Vendég neve") ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?= $form->field($model, 'id_ticket')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?= $form->field($model, 'card_number')->textInput()->label("Kártyaszám") ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
</div>
|
</div>
|
||||||
@ -49,35 +62,38 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
<?= $form->field($model, 'start')->widget(DateTimePicker::className(), [
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
'autoclose'=>true,
|
'autoclose'=>true,
|
||||||
'format' => 'yyyy.mm.dd'
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
]
|
]
|
||||||
]) ?>
|
]) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::className() , [
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
'autoclose'=>true,
|
'autoclose'=>true,
|
||||||
'format' => 'yyyy.mm.dd'
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
]
|
]
|
||||||
]) ?>
|
]) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?= $form->field($model, 'id_ticket')->textInput() ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-3'>
|
||||||
<?php echo $form->field($model, 'valid_in_interval')->checkbox( ) ?>
|
<?php echo $form->field($model, 'valid_in_interval')->checkbox( ) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-3'>
|
||||||
<?php echo $form->field($model, 'created_in_interval')->checkbox( ) ?>
|
<?php echo $form->field($model, 'created_in_interval')->checkbox( ) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-3'>
|
||||||
<?php echo $form->field($model, 'expire_in_interval')->checkbox( ) ?>
|
<?php echo $form->field($model, 'expire_in_interval')->checkbox( ) ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?php echo $form->field($model, 'paid_in_interval')->checkbox( ) ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@ -12,23 +12,36 @@ use yii\data\ArrayDataProvider;
|
|||||||
$this->title = Yii::t('common/ticket', 'Tickets');
|
$this->title = Yii::t('common/ticket', 'Tickets');
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="ticket-index">
|
<div class="ticket-index">
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="clearfix" style="margin-bottom: 6px;">
|
||||||
|
<span class="pull-left">
|
||||||
|
Exportálás:
|
||||||
|
</span>
|
||||||
|
<?php
|
||||||
|
echo Html::a(
|
||||||
|
"PDF",\yii\helpers\Url::current( [ Html::getInputName($searchModel,'output') => 'pdf' ]),
|
||||||
|
['class' => 'btn btn-primary pull-left','style'=> 'margin-left: 12px;']
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
echo Html::a(
|
||||||
|
"XLS",\yii\helpers\Url::current( [ Html::getInputName($searchModel,'output') => 'xls' ]),
|
||||||
|
['class' => 'btn btn-primary pull-left','style'=> 'margin-left: 12px;']
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">Bérlet statisztika</div>
|
<div class="panel-heading">Bérlet statisztika</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>Bérlet statisztika a kiválasztott időszakra</p>
|
<p>Bérlet statisztika a kiválasztott időszakra</p>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo GridView::widget([
|
echo GridView::widget([
|
||||||
'dataProvider' => new ArrayDataProvider([
|
'dataProvider' => new ArrayDataProvider([
|
||||||
'allModels' => $searchModel->statistics,
|
'allModels' => $searchModel->statistics,
|
||||||
@ -71,51 +84,71 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
echo GridView::widget([
|
||||||
|
|
||||||
<?= GridView::widget([
|
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
'columns' => [
|
'columns' => [
|
||||||
[
|
[
|
||||||
'attribute' => 'id_ticket',
|
'attribute' => 'ticket_id_ticket',
|
||||||
'value' => 'id_ticket',
|
|
||||||
'label' => 'B. Azonosító'
|
'label' => 'B. Azonosító'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'id_customer',
|
'attribute' => 'customer_name',
|
||||||
'value' => 'customerName'
|
'label' => 'Vendég'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'id_card',
|
'attribute' => 'card_number',
|
||||||
'value' => 'cardNumber'
|
'label' => 'Kártya'
|
||||||
],
|
|
||||||
'start:date',
|
|
||||||
'end:date',
|
|
||||||
'created_at:date',
|
|
||||||
[
|
|
||||||
'attribute' => 'id_user',
|
|
||||||
'value' => 'userName'
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'id_ticket_type',
|
'attribute' => 'ticket_start',
|
||||||
'value' => 'ticketTypeName'
|
'label' => 'Érvényes -tól',
|
||||||
|
'format' => 'date'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'id_account',
|
'attribute' => 'ticket_end',
|
||||||
'value' => 'accountName'
|
'label' => 'Érvényes -ig',
|
||||||
|
'format' => 'date'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'status',
|
'attribute' => 'ticket_type_name',
|
||||||
'value' => 'statusName'
|
'label' => 'Bérlet típus',
|
||||||
],
|
],
|
||||||
// 'max_usage_count',
|
[
|
||||||
// 'usage_count',
|
'attribute' => 'ticket_created_at',
|
||||||
|
'label' => 'Létrehozva',
|
||||||
|
'format' => 'datetime'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'user_username',
|
||||||
|
'label' => 'Felhasználó',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'account_name',
|
||||||
|
'label' => 'Kassza',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'ticket_status',
|
||||||
|
'label' => 'Státusz',
|
||||||
|
'value' => function ($model, $key, $index, $column){
|
||||||
|
return \common\models\Ticket::toStatusName($model['ticket_status']);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view}',
|
||||||
|
'urlCreator' => function($action, $model, $key, $index){
|
||||||
|
$result = "";
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn',
|
if ( $action == 'view'){
|
||||||
'template' => '{view}'
|
$result = \yii\helpers\Url::toRoute(['ticket/view','id' => $model['ticket_id_ticket']]);
|
||||||
],
|
}
|
||||||
],
|
|
||||||
]); ?>
|
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
]
|
||||||
|
|
||||||
|
]);
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -11,10 +11,7 @@ $this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'),
|
|||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
<div class="ticket-view">
|
<div class="ticket-view">
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?= DetailView::widget([
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
@ -39,8 +36,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'value' => $model->discountName,
|
'value' => $model->discountName,
|
||||||
|
|
||||||
],
|
],
|
||||||
'start:datetime',
|
'start:date',
|
||||||
'end:datetime',
|
'end:date',
|
||||||
'max_usage_count',
|
'max_usage_count',
|
||||||
'usage_count',
|
'usage_count',
|
||||||
[
|
[
|
||||||
@ -49,9 +46,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
],
|
],
|
||||||
'price_brutto',
|
'price_brutto',
|
||||||
'comment:raw',
|
'comment:raw',
|
||||||
'created_at',
|
'created_at:datetime',
|
||||||
'updated_at',
|
'updated_at:datetime',
|
||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
17
backend/web/css/ticket-index-pdf.css
Normal file
17
backend/web/css/ticket-index-pdf.css
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
*{
|
||||||
|
font-family: "Times New Roman";
|
||||||
|
}
|
||||||
|
|
||||||
|
table{
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
padding: 3px;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.filter-table th{
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
@ -1,3 +1,6 @@
|
|||||||
|
-0.0.76
|
||||||
|
- add backend ticket changes
|
||||||
|
- add backend ticket export xls/pdf
|
||||||
-0.0.75
|
-0.0.75
|
||||||
- add unpaid tickets display
|
- add unpaid tickets display
|
||||||
-0.0.74
|
-0.0.74
|
||||||
|
|||||||
@ -5,7 +5,7 @@ return [
|
|||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'infoEmail' => 'info@rocho-net.hu',
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.0.75',
|
'version' => 'v0.0.76',
|
||||||
'company' => 'movar',//gyor
|
'company' => 'movar',//gyor
|
||||||
'company_name' => "Freimann Kft.",
|
'company_name' => "Freimann Kft.",
|
||||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||||
|
|||||||
@ -478,6 +478,17 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function toStatusName($id) {
|
||||||
|
$result = "";
|
||||||
|
$arr = static::statuses();
|
||||||
|
|
||||||
|
if (array_key_exists ( $id, $arr )) {
|
||||||
|
$result = $arr [$id];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
public static function readUserSoldTransfers($user) {
|
public static function readUserSoldTransfers($user) {
|
||||||
$transfers = [ ];
|
$transfers = [ ];
|
||||||
|
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
class_name: AcceptanceTester
|
class_name: AcceptanceTester
|
||||||
modules:
|
modules:
|
||||||
enabled:
|
enabled:
|
||||||
- PhpBrowser
|
# - PhpBrowser
|
||||||
- tests\codeception\common\_support\FixtureHelper
|
- tests\codeception\common\_support\FixtureHelper
|
||||||
# you can use WebDriver instead of PhpBrowser to test javascript and ajax.
|
# you can use WebDriver instead of PhpBrowser to test javascript and ajax.
|
||||||
# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium
|
# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium
|
||||||
# "restart" option is used by the WebDriver to start each time per test-file new session and cookies,
|
# "restart" option is used by the WebDriver to start each time per test-file new session and cookies,
|
||||||
# it is useful if you want to login in your app in each test.
|
# it is useful if you want to login in your app in each test.
|
||||||
# - WebDriver
|
- WebDriver
|
||||||
config:
|
config:
|
||||||
PhpBrowser:
|
# PhpBrowser:
|
||||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
|
# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
|
||||||
url: http://localhost:8080
|
# url: http://localhost/fitness-web
|
||||||
# WebDriver:
|
WebDriver:
|
||||||
# url: http://localhost:8080
|
url: http://localhost
|
||||||
# browser: firefox
|
browser: firefox
|
||||||
# restart: true
|
restart: true
|
||||||
|
|||||||
@ -10,11 +10,22 @@ $I->wantTo('ensure login page works');
|
|||||||
|
|
||||||
$loginPage = LoginPage::openBy($I);
|
$loginPage = LoginPage::openBy($I);
|
||||||
|
|
||||||
|
if (method_exists($I, 'wait')) {
|
||||||
|
$I->wait(10); // only for selenium
|
||||||
|
}
|
||||||
|
|
||||||
|
$I->expectTo('see that login button');
|
||||||
|
$I->see('Fitness');
|
||||||
|
|
||||||
|
/*
|
||||||
$I->amGoingTo('submit login form with no data');
|
$I->amGoingTo('submit login form with no data');
|
||||||
$loginPage->login('', '');
|
$loginPage->login('', '');
|
||||||
if (method_exists($I, 'wait')) {
|
if (method_exists($I, 'wait')) {
|
||||||
$I->wait(3); // only for selenium
|
$I->wait(3); // only for selenium
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
$I->expectTo('see validations errors');
|
$I->expectTo('see validations errors');
|
||||||
$I->see('Username cannot be blank.', '.help-block');
|
$I->see('Username cannot be blank.', '.help-block');
|
||||||
$I->see('Password cannot be blank.', '.help-block');
|
$I->see('Password cannot be blank.', '.help-block');
|
||||||
@ -27,16 +38,16 @@ if (method_exists($I, 'wait')) {
|
|||||||
}
|
}
|
||||||
$I->expectTo('see validations errors');
|
$I->expectTo('see validations errors');
|
||||||
$I->see('Incorrect username or password.', '.help-block');
|
$I->see('Incorrect username or password.', '.help-block');
|
||||||
|
*/
|
||||||
|
|
||||||
$I->amGoingTo('try to login with correct credentials');
|
$I->amGoingTo('try to login with correct credentials');
|
||||||
$loginPage->login('erau', 'password_0');
|
$loginPage->login('admin', 'test');
|
||||||
if (method_exists($I, 'wait')) {
|
if (method_exists($I, 'wait')) {
|
||||||
$I->wait(3); // only for selenium
|
$I->wait(10); // only for selenium
|
||||||
}
|
}
|
||||||
$I->expectTo('see that user is logged');
|
$I->expectTo('see that user is logged');
|
||||||
$I->seeLink('Logout (erau)');
|
$I->see('Üdvözöljük adminisztrációs felületünkön');
|
||||||
$I->dontSeeLink('Login');
|
//$I->dontSeeLink('Signup');
|
||||||
$I->dontSeeLink('Signup');
|
|
||||||
/** Uncomment if using WebDriver
|
/** Uncomment if using WebDriver
|
||||||
* $I->click('Logout (erau)');
|
* $I->click('Logout (erau)');
|
||||||
* $I->dontSeeLink('Logout (erau)');
|
* $I->dontSeeLink('Logout (erau)');
|
||||||
|
|||||||
30
tests/codeception/backend/acceptance/ObjectCept.php
Normal file
30
tests/codeception/backend/acceptance/ObjectCept.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
use tests\codeception\backend\AcceptanceTester;
|
||||||
|
|
||||||
|
class ObjectCept
|
||||||
|
{
|
||||||
|
private $cookie = null;
|
||||||
|
|
||||||
|
public function _before(AcceptanceTester $I)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _after(AcceptanceTester $I)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// tests
|
||||||
|
public function login(AcceptanceTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('entrar al sistema');
|
||||||
|
$I->amOnPage('/');
|
||||||
|
$I->seeInCurrentUrl('/admin/login');
|
||||||
|
$I->fillField('user','perry');
|
||||||
|
$I->fillField('pass','pass-perry');
|
||||||
|
$I->click('Login');
|
||||||
|
$I->see('You\'re logged!');
|
||||||
|
$this->cookie = $I->grabCookie('your-session-cookie-name');
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -14,4 +14,4 @@ settings:
|
|||||||
config:
|
config:
|
||||||
# the entry script URL (with host info) for functional and acceptance tests
|
# the entry script URL (with host info) for functional and acceptance tests
|
||||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
|
||||||
test_entry_url: http://localhost:8080/backend/web/index-test.php
|
test_entry_url: http://localhost/fitness-web/backend/web/index-test.php
|
||||||
|
|||||||
@ -5,6 +5,7 @@ use tests\codeception\common\_pages\LoginPage;
|
|||||||
|
|
||||||
/* @var $scenario Codeception\Scenario */
|
/* @var $scenario Codeception\Scenario */
|
||||||
|
|
||||||
|
/*
|
||||||
$I = new FunctionalTester($scenario);
|
$I = new FunctionalTester($scenario);
|
||||||
$I->wantTo('ensure login page works');
|
$I->wantTo('ensure login page works');
|
||||||
|
|
||||||
@ -28,3 +29,4 @@ $I->expectTo('see that user is logged');
|
|||||||
$I->seeLink('Logout (erau)');
|
$I->seeLink('Logout (erau)');
|
||||||
$I->dontSeeLink('Login');
|
$I->dontSeeLink('Login');
|
||||||
$I->dontSeeLink('Signup');
|
$I->dontSeeLink('Signup');
|
||||||
|
*/
|
||||||
@ -11,4 +11,14 @@ return [
|
|||||||
'updated_at' => '1392559490',
|
'updated_at' => '1392559490',
|
||||||
'email' => 'sfriesen@jenkins.info',
|
'email' => 'sfriesen@jenkins.info',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'username' => 'admin',
|
||||||
|
'auth_key' => 'TzZY5KoLbg4VTxwaxs5OoxhFwNt_VeIv',
|
||||||
|
'password_hash' => '$2y$13$oWyHf7oSB7XktVe0pEhfROahmxr9NWbYo0o3z69aH6rnBf0oyhTSe',
|
||||||
|
'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490',
|
||||||
|
'email' => 'admin@rocho-net.hu',
|
||||||
|
'status' => 10,
|
||||||
|
'created_at' => '1446658188',
|
||||||
|
'updated_at' => '1461356211',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
1
tests/codeception/config/backend/fixtures/initdb.php
Normal file
1
tests/codeception/config/backend/fixtures/initdb.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO user (id,username,auth_key,password_hash,password_reset_token,email,status,created_at,updated_at) VALUES (1,'admin','TzZY5KoLbg4VTxwaxs5OoxhFwNt_VeIv','$2y$13$oWyHf7oSB7XktVe0pEhfROahmxr9NWbYo0o3z69aH6rnBf0oyhTSe',null,'admin@rocho-net.hu',10,1446658188,1461356211);
|
||||||
@ -14,7 +14,10 @@ return [
|
|||||||
],
|
],
|
||||||
'components' => [
|
'components' => [
|
||||||
'db' => [
|
'db' => [
|
||||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_tests',
|
'dsn' => 'mysql:host=localhost;dbname=fitness_codecept',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => '',
|
||||||
|
'charset' => 'utf8',
|
||||||
],
|
],
|
||||||
'mailer' => [
|
'mailer' => [
|
||||||
'useFileTransport' => true,
|
'useFileTransport' => true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user