Finish version/v.0.0.20
This commit is contained in:
commit
dadb32d3f1
@ -35,10 +35,10 @@ class AdminMenuStructure{
|
|||||||
|
|
||||||
//$today = \Yii::$app->formatter->asDate( time() );
|
//$today = \Yii::$app->formatter->asDate( time() );
|
||||||
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
||||||
$tomorrow = \Yii::$app->formatter->asDate( ( 60 *60 *24 + time()));
|
$tomorrow = \Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
|
||||||
|
|
||||||
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today') );
|
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
|
||||||
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
|
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|||||||
@ -10,6 +10,7 @@ use yii\web\NotFoundHttpException;
|
|||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use common\models\User;
|
use common\models\User;
|
||||||
|
use common\components\DailyListing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountStateController implements the CRUD actions for AccountState model.
|
* AccountStateController implements the CRUD actions for AccountState model.
|
||||||
@ -17,6 +18,24 @@ use common\models\User;
|
|||||||
class AccountStateController extends \backend\controllers\BackendController
|
class AccountStateController extends \backend\controllers\BackendController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'actions' => ['create','index','view','update','delete'],
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['admin','employee','reception'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all AccountState models.
|
* Lists all AccountState models.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@ -30,7 +49,6 @@ class AccountStateController extends \backend\controllers\BackendController
|
|||||||
$users = User::read();
|
$users = User::read();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
@ -44,12 +62,65 @@ class AccountStateController extends \backend\controllers\BackendController
|
|||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function actionView($id)
|
/*
|
||||||
{
|
* Displays a single AccountState model.
|
||||||
return $this->render('view', [
|
* @param integer $id
|
||||||
'model' => $this->findModel($id),
|
* $var common\models\AccountState $accountState
|
||||||
]);
|
* @return mixed
|
||||||
}
|
*/
|
||||||
|
public function actionView($id) {
|
||||||
|
echo "view";
|
||||||
|
$accountState = $this->findModel ( $id );
|
||||||
|
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
|
||||||
|
$details = null;
|
||||||
|
if ($accountState->isTypeClose ()) {
|
||||||
|
|
||||||
|
$prev;
|
||||||
|
if ($accountState->type == AccountState::TYPE_CLOSE) {
|
||||||
|
if (isset ( $accountState->prev_state )) {
|
||||||
|
$prev = AccountState::findOne ( $accountState->prev_state );
|
||||||
|
}
|
||||||
|
if (isset ( $prev )) {
|
||||||
|
$accountState->start_date = $prev->created_at;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$details = new DailyListing();
|
||||||
|
$details->loadAccountState ( $accountState );
|
||||||
|
|
||||||
|
$details->readTotalEasy ();
|
||||||
|
$details->readTotalDetailed ();
|
||||||
|
$details->readTotalMedium ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output == 'pdf') {
|
||||||
|
$user = User::findOne(\Yii::$app->user->id);
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->useSubstitutions=false;
|
||||||
|
$mpdf->simpleTables = true;
|
||||||
|
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||||
|
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||||
|
|
||||||
|
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||||
|
$mpdf->WriteHTML($stylesheet,1);
|
||||||
|
|
||||||
|
|
||||||
|
$mpdf->WriteHTML($this->renderPartial("@common/views/account-state/account_state_pdf", [
|
||||||
|
'model' => $accountState,
|
||||||
|
'details' => $details
|
||||||
|
]));
|
||||||
|
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
|
||||||
|
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
|
||||||
|
$fn= $type .$dt.".pdf";
|
||||||
|
$mpdf->Output($fn, 'D');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $this->render ( 'view', [
|
||||||
|
'model' => $accountState,
|
||||||
|
'details' => $details
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new AccountState model.
|
* Creates a new AccountState model.
|
||||||
@ -88,6 +159,37 @@ class AccountStateController extends \backend\controllers\BackendController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing AccountState model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
*
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionDelete($id) {
|
||||||
|
$model = $this->findModel ( $id );
|
||||||
|
|
||||||
|
$delete = true;
|
||||||
|
if ( $model->isTypeOpen() ){
|
||||||
|
$closeStates = AccountState::find()->andWhere( ['prev_state' => $model->id_account_state] )->all();
|
||||||
|
|
||||||
|
if ( count($closeStates) > 0){
|
||||||
|
$delete = false;
|
||||||
|
\Yii::$app->session->setFlash('error', ['Nem lehet törölni a nyitást, mert van kapcsolódó zárás!']);
|
||||||
|
throw new \Exception('Nem lehet törölni a nyitást, mert van kapcsolódó zárás!');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $delete == true ){
|
||||||
|
$model->delete();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', 'Kassza művelet törölve' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect ( ["index"] );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing AccountState model.
|
* Deletes an existing AccountState model.
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
|||||||
@ -5,168 +5,247 @@ namespace backend\controllers;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use common\models\Card;
|
use common\models\Card;
|
||||||
use backend\models\CardSearch;
|
use backend\models\CardSearch;
|
||||||
use yii\web\Controller;
|
|
||||||
use yii\web\NotFoundHttpException;
|
use yii\web\NotFoundHttpException;
|
||||||
use yii\filters\VerbFilter;
|
|
||||||
use yii\base\Object;
|
|
||||||
use yii\db\Query;
|
use yii\db\Query;
|
||||||
use common\models\Customer;
|
use common\models\Customer;
|
||||||
use yii\helpers\Json;
|
use yii\helpers\Json;
|
||||||
|
use backend\models\CardImportRfidForm;
|
||||||
|
use yii\web\UploadedFile;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CardController implements the CRUD actions for Card model.
|
* CardController implements the CRUD actions for Card model.
|
||||||
*/
|
*/
|
||||||
class CardController extends \backend\controllers\BackendController
|
class CardController extends \backend\controllers\BackendController {
|
||||||
{
|
public function behaviors() {
|
||||||
|
return [
|
||||||
public function behaviors()
|
'access' => [
|
||||||
{
|
'class' => \yii\filters\AccessControl::className (),
|
||||||
return [
|
'rules' => [
|
||||||
'access' => [
|
// allow authenticated users
|
||||||
'class' => \yii\filters\AccessControl::className(),
|
[
|
||||||
'rules' => [
|
'actions' => [
|
||||||
// allow authenticated users
|
'create',
|
||||||
[
|
'index',
|
||||||
'actions' => ['create','index','view','update','list'],
|
'view',
|
||||||
'allow' => true,
|
'update',
|
||||||
'roles' => ['@'],
|
'list' ,
|
||||||
],
|
'import-rfid'
|
||||||
// everything else is denied
|
],
|
||||||
],
|
'allow' => true,
|
||||||
],
|
'roles' => [
|
||||||
|
'@'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
// everything else is denied
|
||||||
|
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Card models.
|
* Lists all Card models.
|
||||||
* @return mixed
|
*
|
||||||
*/
|
* @return mixed
|
||||||
public function actionIndex()
|
*/
|
||||||
{
|
public function actionIndex() {
|
||||||
$searchModel = new CardSearch();
|
$searchModel = new CardSearch ();
|
||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render ( 'index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider
|
||||||
]);
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a single Card model.
|
* Displays a single Card model.
|
||||||
* @param integer $id
|
*
|
||||||
* @return mixed
|
* @param integer $id
|
||||||
*/
|
* @return mixed
|
||||||
public function actionView($id)
|
*/
|
||||||
{
|
public function actionView($id) {
|
||||||
return $this->render('view', [
|
return $this->render ( 'view', [
|
||||||
'model' => $this->findModel($id),
|
'model' => $this->findModel ( $id )
|
||||||
]);
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Card model.
|
* Creates a new Card model.
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
* @return mixed
|
*
|
||||||
*/
|
* @return mixed
|
||||||
public function actionCreate()
|
*/
|
||||||
{
|
public function actionCreate() {
|
||||||
$model = new Card();
|
$model = new Card ();
|
||||||
$model->status = Card::STATUS_ACTIVE;
|
$model->status = Card::STATUS_ACTIVE;
|
||||||
$model->type = Card::TYPE_RFID;
|
$model->type = Card::TYPE_RFID;
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||||
\Yii::$app->session->setFlash( 'success','Card created!' );
|
\Yii::$app->session->setFlash ( 'success', 'Card created!' );
|
||||||
if ( isset($_POST['create_next'])){
|
if (isset ( $_POST ['create_next'] )) {
|
||||||
return $this->redirect(['create' ]);
|
return $this->redirect ( [
|
||||||
}else{
|
'create'
|
||||||
return $this->redirect(['view', 'id' => $model->id_card]);
|
] );
|
||||||
}
|
} else {
|
||||||
} else {
|
return $this->redirect ( [
|
||||||
return $this->render('create', [
|
'view',
|
||||||
'model' => $model,
|
'id' => $model->id_card
|
||||||
]);
|
] );
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
return $this->render ( 'create', [
|
||||||
|
'model' => $model
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Card 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 ( [
|
||||||
|
'index'
|
||||||
|
] );
|
||||||
|
// return $this->redirect(Yii::$app->request->referrer);
|
||||||
|
} else {
|
||||||
|
return $this->render ( 'update', [
|
||||||
|
'model' => $model
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Card 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 Card model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
*
|
||||||
|
* @param integer $id
|
||||||
|
* @return Card the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id) {
|
||||||
|
if (($model = Card::findOne ( $id )) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException ( 'The requested page does not exist.' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Your controller action to fetch the list
|
||||||
|
*/
|
||||||
|
public function actionList($search = null) {
|
||||||
|
$query = new Query ();
|
||||||
|
|
||||||
|
$query->select ( [
|
||||||
|
'card.number as number',
|
||||||
|
'customer.name as name',
|
||||||
|
"concat( card.number , case when customer.name is null then '' else customer.name end ) as txt "
|
||||||
|
] )->from ( Card::tableName () )->join ( "left join", Customer::tableName (), 'card.id_card = customer.id_customer_card' )->where ( ' lower(number) LIKE "%' . strtolower ( $search ) . '%"' )->orderBy ( 'number' );
|
||||||
|
|
||||||
|
if (isset ( $_GET ['onlyFree'] ) && $_GET ['onlyFree'] == '1') {
|
||||||
|
$query->andWhere ( 'customer.id_customer is null' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$command = $query->createCommand ();
|
||||||
|
$data = $command->queryAll ();
|
||||||
|
$out = [ ];
|
||||||
|
foreach ( $data as $d ) {
|
||||||
|
$out [] = [
|
||||||
|
'number' => $d ['number'],
|
||||||
|
'name' => $d ['name'],
|
||||||
|
'txt' => $d ['txt']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
echo Json::encode ( $out );
|
||||||
|
}
|
||||||
|
public function actionImportRfid() {
|
||||||
|
$model = new CardImportRfidForm ();
|
||||||
|
$arr = [];
|
||||||
|
|
||||||
|
if (Yii::$app->request->isPost) {
|
||||||
|
$model->file = UploadedFile::getInstance($model, 'file');
|
||||||
|
|
||||||
/**
|
// print_r($model->file);
|
||||||
* Updates an existing Card model.
|
// $model->message = "ok";
|
||||||
* If update is successful, the browser will be redirected to the 'view' page.
|
$file = $model->file->tempName;
|
||||||
* @param integer $id
|
|
||||||
* @return mixed
|
$file = fopen ( $file , "r" );
|
||||||
*/
|
|
||||||
public function actionUpdate($id)
|
$trans = null;
|
||||||
{
|
$i = 0;
|
||||||
$model = $this->findModel($id);
|
$j = 0;
|
||||||
|
while ( ($data = fgetcsv ( $file, 0, "," )) != null ) {
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
// if ($i == 0) {
|
||||||
return $this->redirect(['index']);
|
// $i ++;
|
||||||
// return $this->redirect(Yii::$app->request->referrer);
|
// continue;
|
||||||
} else {
|
// }
|
||||||
return $this->render('update', [
|
$j++;
|
||||||
'model' => $model,
|
$number = $key = false;
|
||||||
]);
|
if ( isset($data[0]) ){
|
||||||
}
|
$number = $data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if ( isset($data[1]) ){
|
||||||
* Deletes an existing Card model.
|
$key = $data[1];
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
}
|
||||||
* @param integer $id
|
|
||||||
* @return mixed
|
if ( isset($number) && isset($key)){
|
||||||
*/
|
$item = [];
|
||||||
public function actionDelete($id)
|
$item['number'] = $number;
|
||||||
{
|
$item['key'] = Helper::fixAsciiChars( $key);
|
||||||
$this->findModel($id)->delete();
|
$arr[] = $item;
|
||||||
|
}
|
||||||
return $this->redirect(['index']);
|
|
||||||
}
|
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Finds the Card model based on its primary key value.
|
$failed = [];
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
$sqls = [];
|
||||||
* @param integer $id
|
foreach ($arr as $item ){
|
||||||
* @return Card the loaded model
|
$card = Card::find()->andWhere(['number' => $item['number']])->one();
|
||||||
* @throws NotFoundHttpException if the model cannot be found
|
if ( $card != null ){
|
||||||
*/
|
$card->rfid_key = $item['key'];
|
||||||
protected function findModel($id)
|
$sql = "update card set rfid_key = '" .$item['key'] ."' where id_card = " .$card->id_card .";";
|
||||||
{
|
$sqls[] = $sql;
|
||||||
if (($model = Card::findOne($id)) !== null) {
|
$i++;
|
||||||
return $model;
|
}else{
|
||||||
} else {
|
$failed [] = $item;
|
||||||
throw new NotFoundHttpException('The requested page does not exist.');
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$model->message = "rows read: " .$j ." / ". "updated cards: " .$i;
|
||||||
|
$model->message .= "<br> array size: " . count($arr);
|
||||||
/**
|
$model->message .= "<br> failed: " . print_r($failed,true);
|
||||||
* Your controller action to fetch the list
|
$model->message .= "<br>sql:";
|
||||||
*/
|
$model->message .= "<br>". implode("<br>", $sqls);
|
||||||
public function actionList($search = null) {
|
|
||||||
$query = new Query();
|
}
|
||||||
|
|
||||||
$query->select ( [
|
return $this->render ( 'importRfid.php', [
|
||||||
'card.number as number',
|
'model' => $model
|
||||||
'customer.name as name',
|
] );
|
||||||
"concat( card.number , case when customer.name is null then '' else customer.name end ) as txt ",
|
}
|
||||||
] )->from (Card::tableName() )->join("left join", Customer::tableName(), 'card.id_card = customer.id_customer_card')->where ( ' lower(number) LIKE "%' . strtolower ( $search ) . '%"' )->orderBy ( 'number' ) ;
|
|
||||||
|
|
||||||
if ( isset($_GET['onlyFree']) && $_GET['onlyFree'] == '1'){
|
|
||||||
$query->andWhere( 'customer.id_customer is null' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$command = $query->createCommand ();
|
|
||||||
$data = $command->queryAll ();
|
|
||||||
$out = [ ];
|
|
||||||
foreach ( $data as $d ) {
|
|
||||||
$out [] = [
|
|
||||||
'number' => $d ['number'],
|
|
||||||
'name' => $d ['name'],
|
|
||||||
'txt' => $d ['txt'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
echo Json::encode ( $out );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,8 @@ use yii\web\Controller;
|
|||||||
use common\models\LoginForm;
|
use common\models\LoginForm;
|
||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
use backend\models\UploadForm;
|
use backend\models\UploadForm;
|
||||||
|
use common\components\Helper;
|
||||||
|
use common\models\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site controller
|
* Site controller
|
||||||
@ -71,6 +73,9 @@ class SiteController extends Controller
|
|||||||
'employee'
|
'employee'
|
||||||
];
|
];
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||||
|
|
||||||
|
$this->sendLoginMail();
|
||||||
|
|
||||||
return $this->goBack();
|
return $this->goBack();
|
||||||
} else {
|
} else {
|
||||||
return $this->render('login', [
|
return $this->render('login', [
|
||||||
@ -79,6 +84,23 @@ class SiteController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function sendLoginMail(){
|
||||||
|
if ( \Yii::$app->params['login_admin_email'] == true){
|
||||||
|
$geoip = Helper::getGeoIp();
|
||||||
|
|
||||||
|
$user = User::findOne(\Yii::$app->user->id);
|
||||||
|
$message = \Yii::$app->mailer->compose('login_admin', [
|
||||||
|
'model' => $user,
|
||||||
|
'geoip' => $geoip
|
||||||
|
]);
|
||||||
|
|
||||||
|
$message->setFrom( \Yii::$app->params['infoEmail'] )
|
||||||
|
->setTo( \Yii::$app->params['notify_mail'] )
|
||||||
|
->setSubject('Admin bejelentkezés - ' . $user->username )
|
||||||
|
->send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function actionLogout()
|
public function actionLogout()
|
||||||
{
|
{
|
||||||
Yii::$app->user->logout();
|
Yii::$app->user->logout();
|
||||||
|
|||||||
@ -117,6 +117,10 @@ class TransferController extends \backend\controllers\BackendController
|
|||||||
$mpdf->simpleTables = true;
|
$mpdf->simpleTables = true;
|
||||||
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||||
$mpdf->setFooter('{PAGENO} / {nb}');
|
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||||
|
|
||||||
|
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||||
|
$mpdf->WriteHTML($stylesheet,1);
|
||||||
|
|
||||||
$mpdf->WriteHTML($this->renderPartial($ov, [
|
$mpdf->WriteHTML($this->renderPartial($ov, [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
]));
|
]));
|
||||||
@ -184,6 +188,8 @@ class TransferController extends \backend\controllers\BackendController
|
|||||||
|
|
||||||
|
|
||||||
$mpdf=new \mPDF('utf-8', 'A4-L');
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||||
|
$mpdf->WriteHTML($stylesheet,1);
|
||||||
$mpdf->WriteHTML($this->renderPartial('_result_sale', [
|
$mpdf->WriteHTML($this->renderPartial('_result_sale', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
]));
|
]));
|
||||||
|
|||||||
30
backend/models/CardImportRfidForm.php
Normal file
30
backend/models/CardImportRfidForm.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use common\models\Card;
|
||||||
|
use common\models\Customer;
|
||||||
|
use common\models\Ticket;
|
||||||
|
use common\models\Account;
|
||||||
|
use yii\web\UploadedFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContactForm is the model behind the contact form.
|
||||||
|
* @property \Yii\web\UploadedFile $file
|
||||||
|
*/
|
||||||
|
class CardImportRfidForm extends Model{
|
||||||
|
|
||||||
|
public $file;
|
||||||
|
public $message;
|
||||||
|
|
||||||
|
public function rules(){
|
||||||
|
return [
|
||||||
|
[['file'], 'file']
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -17,6 +17,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<?php echo $this->render('_search', ['model' => $searchModel,'accounts' => $accounts,'users' => $users,]); ?>
|
<?php echo $this->render('_search', ['model' => $searchModel,'accounts' => $accounts,'users' => $users,]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php /*echo GridView::widget([
|
<?php /*echo GridView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
'columns' => [
|
'columns' => [
|
||||||
|
|||||||
@ -2,55 +2,117 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\DetailView;
|
use yii\widgets\DetailView;
|
||||||
|
use common\components\total\TotalEasyWidget;
|
||||||
|
use common\components\total\TotalDetailedProductsWidget;
|
||||||
|
use common\components\total\TotalDetailedTicketsWidget;
|
||||||
|
use common\components\total\TotalDetailedMoneyMovementWidget;
|
||||||
|
use common\components\accountstate\BankNotesWidget;
|
||||||
|
use common\components\total\TotalMediumTicketsWidget;
|
||||||
|
use common\components\total\TotalMediumProductsWidget;
|
||||||
|
use common\components\total\TotalMediumMoneyMovementsWidget;
|
||||||
|
use common\components\total\TotalDifferenceWidget;
|
||||||
|
use yii\base\Widget;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
use common\components\accountstate\AccountStateWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\AccountState */
|
/* @var $model common\models\AccountState */
|
||||||
|
if ( $model ->type == AccountState::TYPE_OPEN ){
|
||||||
$this->title = $model->id_account_state;
|
$this->title = "Kassza nyitás";
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/account-state', 'Account States'), 'url' => ['index']];
|
}else{
|
||||||
|
$this->title = "Kassza zárás";
|
||||||
|
}
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/account-state', 'Account States'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.btn-pdf{
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.money{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<div class="account-state-view">
|
<div class="account-state-view">
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
if ( $model->hasMinus()){
|
||||||
|
?>
|
||||||
|
<div class="alert alert-danger" role="alert">Negatív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}else{
|
||||||
|
?>
|
||||||
|
<div class="alert alert-success" role="alert">Pozitív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php echo AccountStateWidget::widget(['model' =>$model]) ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt'])." Pdf", Url::current(['output' =>'pdf']) ,['class' => 'btn btn-primary btn-pdf']);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
?>
|
||||||
|
<h2>Különbözet</h2>
|
||||||
|
<?php
|
||||||
|
echo TotalDifferenceWidget::widget(['model' => $model] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php if ( $model ->type == AccountState::TYPE_CLOSE ){?>
|
||||||
|
<div>
|
||||||
|
|
||||||
<p>
|
<!-- Nav tabs -->
|
||||||
<?= Html::a(Yii::t('backend/account-state', 'Update'), ['update', 'id' => $model->id_account_state], ['class' => 'btn btn-primary']) ?>
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<?= Html::a(Yii::t('backend/account-state', 'Delete'), ['delete', 'id' => $model->id_account_state], [
|
<li role="presentation" class="active"><a href="#easy"
|
||||||
'class' => 'btn btn-danger',
|
aria-controls="easy" role="tab" data-toggle="tab">Egyszerű összesítő</a></li>
|
||||||
'data' => [
|
<li role="presentation"><a href="#medium" aria-controls="medium"
|
||||||
'confirm' => Yii::t('backend/account-state', 'Are you sure you want to delete this item?'),
|
role="tab" data-toggle="tab">Közepes összesítő</a></li>
|
||||||
'method' => 'post',
|
<li role="presentation"><a href="#detailed" aria-controls="detailed"
|
||||||
],
|
role="tab" data-toggle="tab">Részletes összesítő</a></li>
|
||||||
]) ?>
|
<li role="presentation" class=""><a href="#banknotes"
|
||||||
</p>
|
aria-controls="banknotes" role="tab" data-toggle="tab">Címletek</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<!-- Tab panes -->
|
||||||
'model' => $model,
|
<div class="tab-content">
|
||||||
'attributes' => [
|
<div role="tabpanel" class="tab-pane active" id="easy">
|
||||||
'id_account_state',
|
<?php echo TotalEasyWidget::widget(['dailyListing' => $details]);?>
|
||||||
'id_account',
|
</div>
|
||||||
'type',
|
<div role="tabpanel" class="tab-pane " id="medium">
|
||||||
'money',
|
<h2>Közepes összesítés</h2>
|
||||||
'banknote_5_ft',
|
<h3>Bérletek típus szerint</h3>
|
||||||
'banknote_10_ft',
|
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_20_ft',
|
<h3>Termékek név szerint</h3>
|
||||||
'banknote_50_ft',
|
<?php echo TotalMediumProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_100_ft',
|
<h3>Pénzmozgások típus szerint</h3>
|
||||||
'banknote_200_ft',
|
<?php echo TotalMediumMoneyMovementsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_500_ft',
|
</div>
|
||||||
'banknote_1000_ft',
|
<div role="tabpanel" class="tab-pane " id="detailed">
|
||||||
'banknote_2000_ft',
|
<h2>Részletek</h2>
|
||||||
'banknote_5000_ft',
|
<?php echo TotalDetailedTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_10000_ft',
|
<?php echo TotalDetailedProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_20000_ft',
|
<?php echo TotalDetailedMoneyMovementWidget::widget(['dailyListing' => $details]);?>
|
||||||
'id_user',
|
</div>
|
||||||
'created_at',
|
<div role="tabpanel" class="tab-pane " id="banknotes">
|
||||||
'updated_at',
|
<h2>Címletek</h2>
|
||||||
'comment',
|
<?php echo BankNotesWidget::widget(['model' => $model]);?>
|
||||||
'prev_state',
|
</div>
|
||||||
'prev_money',
|
</div>
|
||||||
],
|
|
||||||
]) ?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php }else{?>
|
||||||
|
<h2>Címletek</h2>
|
||||||
|
<?php echo BankNotesWidget::widget(['model' => $model]);?>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
</div>
|
||||||
16
backend/views/card/importRfid.php
Normal file
16
backend/views/card/importRfid.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'file')->fileInput() ?>
|
||||||
|
|
||||||
|
<button>Submit</button>
|
||||||
|
<?php
|
||||||
|
echo ($model->message);
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php ActiveForm::end() ?>
|
||||||
@ -53,14 +53,7 @@ $items = $adminMenu->run();
|
|||||||
<?= Breadcrumbs::widget([
|
<?= Breadcrumbs::widget([
|
||||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||||
]) ?>
|
]) ?>
|
||||||
<?php //echo Alert::widget() ?>
|
<?php echo Alert::widget() ?>
|
||||||
<?php
|
|
||||||
echo AlertBlock::widget([
|
|
||||||
'useSessionFlash' => true,
|
|
||||||
'type' => AlertBlock::TYPE_GROWL,
|
|
||||||
'delay' => '1'
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
<?= $content ?>
|
<?= $content ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
use yii\widgets\Breadcrumbs;
|
use yii\widgets\Breadcrumbs;
|
||||||
use dmstr\widgets\Alert;
|
use dmstr\widgets\Alert;
|
||||||
|
use kartik\widgets\AlertBlock;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
@ -15,7 +16,13 @@ use dmstr\widgets\Alert;
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<?= Alert::widget() ?>
|
<?php
|
||||||
|
echo AlertBlock::widget([
|
||||||
|
'useSessionFlash' => true,
|
||||||
|
'type' => AlertBlock::TYPE_GROWL,
|
||||||
|
'delay' => '1'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
<?= $content ?>
|
<?= $content ?>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
-0.0.20
|
||||||
|
- account state email with pdf
|
||||||
|
- login email
|
||||||
|
-0.0.19
|
||||||
|
- reception account state view + pdf export
|
||||||
|
- acount state collection_money fix
|
||||||
|
-0.0.18
|
||||||
|
- reception customer search
|
||||||
|
- timezone changes
|
||||||
|
- reception card read redirect changes
|
||||||
|
- fix reception ticket visiblitity
|
||||||
-0.0.17
|
-0.0.17
|
||||||
- fix helper::fixascii function
|
- fix helper::fixascii function
|
||||||
- admin pdf download
|
- admin pdf download
|
||||||
|
|||||||
@ -15,7 +15,8 @@ use common\components\RoleDefinition;
|
|||||||
class DailyListing
|
class DailyListing
|
||||||
{
|
{
|
||||||
|
|
||||||
public $mode = "reception";//reception or admin
|
public $mode = "reception";//reception or admin or accountstate
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* string start date , inclusive
|
* string start date , inclusive
|
||||||
* */
|
* */
|
||||||
@ -108,6 +109,25 @@ class DailyListing
|
|||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
|
|
||||||
|
public function readTotalEasy(){
|
||||||
|
$this->readTicketMoney();
|
||||||
|
$this->readProductsMoney();
|
||||||
|
$this->readMoneyMovementMoney();
|
||||||
|
$this->calcTotal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function readTotalDetailed(){
|
||||||
|
$this->readTickets();
|
||||||
|
$this->readProducts();
|
||||||
|
$this->readMoneyMovements();
|
||||||
|
}
|
||||||
|
public function readTotalMedium(){
|
||||||
|
$this->readProductsByCategory();
|
||||||
|
$this->readProductsByCategoryDetailed();
|
||||||
|
$this->readTicketStas();
|
||||||
|
$this->readMoneyMovementsStats();
|
||||||
|
}
|
||||||
|
|
||||||
public function loadFilters($transfer){
|
public function loadFilters($transfer){
|
||||||
$this->start = $transfer->start;
|
$this->start = $transfer->start;
|
||||||
$this->end = $transfer->end;
|
$this->end = $transfer->end;
|
||||||
@ -119,9 +139,22 @@ class DailyListing
|
|||||||
$this->timestampEnd = $transfer->timestampEnd;
|
$this->timestampEnd = $transfer->timestampEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function loadAccountState($accountState){
|
||||||
|
$this->mode = 'accountstate';
|
||||||
|
$this->start = $accountState->start_date;
|
||||||
|
$this->end = $accountState->created_at;
|
||||||
|
$this->timestampStart = $accountState->start_date;
|
||||||
|
$this->timestampEnd =$accountState->created_at;
|
||||||
|
$this->id_account = $accountState->id_account;
|
||||||
|
$this->id_user = $accountState->id_user;
|
||||||
|
}
|
||||||
|
|
||||||
public function isModeAdmin(){
|
public function isModeAdmin(){
|
||||||
return $this->mode == 'admin';
|
return $this->mode == 'admin';
|
||||||
}
|
}
|
||||||
|
public function isModeAccountState(){
|
||||||
|
return $this->mode == 'accountstate';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function calcTotal(){
|
public function calcTotal(){
|
||||||
@ -139,11 +172,15 @@ class DailyListing
|
|||||||
|
|
||||||
|
|
||||||
public function addAccountConstraint($query){
|
public function addAccountConstraint($query){
|
||||||
if (!$this->isModeAdmin() || !RoleDefinition::isAdmin() ){
|
|
||||||
|
if ( $this->isModeAccountState() ){
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||||
|
|
||||||
|
}else if (!$this->isModeAdmin() || !RoleDefinition::isAdmin() ){
|
||||||
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
|
$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(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||||
|
|
||||||
if ( RoleDefinition::isReception() || !$this->isModeAdmin()){
|
if ( RoleDefinition::isReception() || !$this->isModeAdmin()){
|
||||||
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,101 +1,184 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace common\components;
|
namespace common\components;
|
||||||
|
|
||||||
use \Yii;
|
use \Yii;
|
||||||
|
|
||||||
class Helper
|
class Helper {
|
||||||
{
|
public static function hufRound($m) {
|
||||||
|
$result = round ( $m / 5, 0 ) * 5;
|
||||||
public static function hufRound($m){
|
|
||||||
$result = round($m/5, 0) * 5;
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
public static function notInInterval($query, $field, $start, $end) {
|
||||||
|
$query->andFilterWhere ( [
|
||||||
|
'or',
|
||||||
public static function notInInterval($query ,$field , $start,$end ){
|
[
|
||||||
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ] );
|
'<',
|
||||||
|
$field,
|
||||||
|
isset ( $start ) ? $start : '1900-01-01'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'>=',
|
||||||
|
$field,
|
||||||
|
isset ( $end ) ? $end : '3000-01-01'
|
||||||
|
]
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
|
public static function notPaid($query, $field, $start, $end) {
|
||||||
public static function notPaid($query ,$field , $start,$end ){
|
$query->andFilterWhere ( [
|
||||||
$query->andFilterWhere( ['or', [ '<', $field , isset( $start ) ? $start : '1900-01-01' ] ,[ '>=' , $field , isset($end) ? $end : '3000-01-01' ] ,[ "transfer.status" => Transfer::STATUS_NOT_PAID ] ] );
|
'or',
|
||||||
|
[
|
||||||
|
'<',
|
||||||
|
$field,
|
||||||
|
isset ( $start ) ? $start : '1900-01-01'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'>=',
|
||||||
|
$field,
|
||||||
|
isset ( $end ) ? $end : '3000-01-01'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"transfer.status" => Transfer::STATUS_NOT_PAID
|
||||||
|
]
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
public static function inInterval($query ,$field , $start,$end ){
|
public static function inInterval($query, $field, $start, $end) {
|
||||||
$query->andFilterWhere([ '>=', $field , $start ] );
|
$query->andFilterWhere ( [
|
||||||
$query->andFilterWhere([ '<' , $field , $end ] );
|
'>=',
|
||||||
|
$field,
|
||||||
|
$start
|
||||||
|
] );
|
||||||
|
$query->andFilterWhere ( [
|
||||||
|
'<',
|
||||||
|
$field,
|
||||||
|
$end
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
|
public static function queryInIntervalRule($field, $start, $end) {
|
||||||
public static function queryInIntervalRule( $field , $start,$end ){
|
return [
|
||||||
return ['and',[ '>=', $field , $start ] , [ '<' , $field , $end ] ];
|
'and',
|
||||||
|
[
|
||||||
|
'>=',
|
||||||
|
$field,
|
||||||
|
$start
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'<',
|
||||||
|
$field,
|
||||||
|
$end
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
public static function queryExpireRule($field_start, $field_end, $start, $end) {
|
||||||
public static function queryExpireRule( $field_start,$field_end , $start,$end ){
|
return [
|
||||||
|
'and',
|
||||||
return ['and' ,['<',$field_start, $end], ['>=' , $field_end , $start ], ['<=' , $field_end , $end ] ];
|
[
|
||||||
|
'<',
|
||||||
|
$field_start,
|
||||||
|
$end
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'>=',
|
||||||
|
$field_end,
|
||||||
|
$start
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'<=',
|
||||||
|
$field_end,
|
||||||
|
$end
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
public static function queryValidRule($field_start, $field_end, $start, $end) {
|
||||||
public static function queryValidRule( $field_start ,$field_end , $start,$end ){
|
return [
|
||||||
return ['and' ,['<',$field_start, $end], ['>=' , $field_end , $start ] ];
|
'and',
|
||||||
|
[
|
||||||
|
'<',
|
||||||
|
$field_start,
|
||||||
|
$end
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'>=',
|
||||||
|
$field_end,
|
||||||
|
$start
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
public static function sqlInIntervalRule($field, $paramStart, $paramEnd) {
|
||||||
public static function sqlInIntervalRule( $field , $paramStart,$paramEnd ){
|
return ' ' . $field . ' >= ' . $paramStart . ' and ' . $field . ' < ' . $paramEnd;
|
||||||
return ' ' .$field . ' >= ' . $paramStart . ' and ' . $field . ' < ' . $paramEnd ;
|
|
||||||
}
|
}
|
||||||
|
public static function sqlExpireRule($field_start, $field_end, $paramStart, $paramEnd) {
|
||||||
public static function sqlExpireRule( $field_start,$field_end , $paramStart,$paramEnd ){
|
return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' < ' . $paramEnd;
|
||||||
return ' ' .$field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' < ' . $paramEnd ;
|
|
||||||
}
|
}
|
||||||
|
public static function sqlValidRule($field_start, $field_end, $paramStart, $paramEnd) {
|
||||||
public static function sqlValidRule( $field_start ,$field_end , $paramStart,$paramEnd ){
|
return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' >=' . $paramStart;
|
||||||
return ' ' .$field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' >=' . $paramStart ;
|
|
||||||
}
|
}
|
||||||
|
public static function queryAccountConstraint($query, $field) {
|
||||||
public static function queryAccountConstraint($query,$field){
|
if (! RoleDefinition::isAdmin ()) {
|
||||||
if ( !RoleDefinition::isAdmin() ){
|
$query->innerJoin ( "user_account_assignment", $field . ' = user_account_assignment.id_account' );
|
||||||
$query->innerJoin("user_account_assignment", $field . ' = user_account_assignment.id_account' );
|
$query->andWhere ( [
|
||||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
'user_account_assignment.id_user' => Yii::$app->user->id
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static function roleLabels() {
|
||||||
|
return [
|
||||||
public static function roleLabels(){
|
'reception' => Yii::t ( 'common/role', 'Reception' ),
|
||||||
return [
|
'admin' => Yii::t ( 'common/role', 'Administrator' ),
|
||||||
'reception' => Yii::t('common/role' ,'Reception'),
|
'employee' => Yii::t ( 'common/role', 'Alkalmazott' )
|
||||||
'admin' => Yii::t('common/role' ,'Administrator'),
|
|
||||||
'employee' => Yii::t('common/role' ,'Alkalmazott'),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
public static function roleDefinitions() {
|
||||||
public static function roleDefinitions(){
|
return [
|
||||||
return [
|
'employee' => [
|
||||||
'employee' => [
|
'canAllow' => [
|
||||||
'canAllow' => [ 'employee'],
|
'employee'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'canAllow' => ['admin','reception','employee'],
|
'canAllow' => [
|
||||||
],
|
'admin',
|
||||||
'reception' => [
|
'reception',
|
||||||
'canAllow' => [ ],
|
'employee'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
'reception' => [
|
||||||
|
'canAllow' => [ ]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
public static function flash($mode, $message) {
|
||||||
public static function flash($mode,$message){
|
\Yii::$app->session->setFlash ( $mode, $message );
|
||||||
\Yii::$app->session->setFlash($mode, $message );
|
|
||||||
}
|
}
|
||||||
|
public static function fixAsciiChars($in) {
|
||||||
|
$out = str_replace ( "ö", "0", $in );
|
||||||
public static function fixAsciiChars($in){
|
$out = str_replace ( "Ö", "0", $out );
|
||||||
$out = str_replace("ö", "0", $in);
|
|
||||||
$out = str_replace("Ö", "0", $out);
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
public static function isCompanyMovar() {
|
||||||
public static function isCompanyMovar(){
|
return \Yii::$app->params ['company'] == 'movar';
|
||||||
return \Yii::$app->params['company'] == 'movar';
|
|
||||||
}
|
}
|
||||||
public static function isProductVisibilityAccount(){
|
public static function isProductVisibilityAccount() {
|
||||||
return \Yii::$app->params['product_visiblity'] == 'account';
|
return \Yii::$app->params ['product_visiblity'] == 'account';
|
||||||
|
}
|
||||||
|
public static function getRealUserIp() {
|
||||||
|
$client = @$_SERVER ['HTTP_CLIENT_IP'];
|
||||||
|
$forward = @$_SERVER ['HTTP_X_FORWARDED_FOR'];
|
||||||
|
$remote = $_SERVER ['REMOTE_ADDR'];
|
||||||
|
|
||||||
|
if (filter_var ( $client, FILTER_VALIDATE_IP )) {
|
||||||
|
$ip = $client;
|
||||||
|
} elseif (filter_var ( $forward, FILTER_VALIDATE_IP )) {
|
||||||
|
$ip = $forward;
|
||||||
|
} else {
|
||||||
|
$ip = $remote;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ip;
|
||||||
|
}
|
||||||
|
public static function getGeoIp() {
|
||||||
|
$ip = Helper::getRealUserIp ();
|
||||||
|
$details = json_decode ( file_get_contents ( "http://ipinfo.io/{$ip}/json" ) );
|
||||||
|
return $details;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
98
common/components/accountstate/AccountStateMail.php
Normal file
98
common/components/accountstate/AccountStateMail.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\accountstate;
|
||||||
|
|
||||||
|
|
||||||
|
use yii\base\Object;
|
||||||
|
use common\models\User;
|
||||||
|
use common\models\Account;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use common\components\DailyListing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property common\models\AccountState $model
|
||||||
|
* */
|
||||||
|
class AccountStateMail extends Object {
|
||||||
|
|
||||||
|
|
||||||
|
public $controller;
|
||||||
|
public $model;
|
||||||
|
public $user;
|
||||||
|
public $account;
|
||||||
|
public $message;
|
||||||
|
public $details;
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
|
||||||
|
$this->user = User::findOne($this->model->id_user);
|
||||||
|
$this->account = Account::findOne($this->model->id_account);
|
||||||
|
|
||||||
|
$this->details = null;
|
||||||
|
|
||||||
|
if ($this->model ->isTypeClose ()) {
|
||||||
|
|
||||||
|
$prev;
|
||||||
|
if ($this->model->type == AccountState::TYPE_CLOSE) {
|
||||||
|
if (isset ( $this->model->prev_state )) {
|
||||||
|
$prev = AccountState::findOne ( $this->model->prev_state );
|
||||||
|
}
|
||||||
|
if (isset ( $prev )) {
|
||||||
|
$this->model ->start_date = $prev->created_at;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->details = new DailyListing();
|
||||||
|
$this->details->loadAccountState ( $this->model );
|
||||||
|
|
||||||
|
$this->details->readTotalEasy ();
|
||||||
|
$this->details->readTotalDetailed ();
|
||||||
|
$this->details->readTotalMedium ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function sednMail(){
|
||||||
|
|
||||||
|
$subject = $this->model->isTypeOpen() ? "Kassza nyitás " : "Kassza zárás";
|
||||||
|
$subject .= " - " . $this->user->username ." - ". $this->account->name;
|
||||||
|
|
||||||
|
$this->message = \Yii::$app->mailer->compose('account_state', [
|
||||||
|
'model' => $this->model,
|
||||||
|
'details' => $this->details
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->attachPdf();
|
||||||
|
|
||||||
|
$this->message->setFrom('noreplay@fitnessadmin.hu')
|
||||||
|
->setTo( \Yii::$app->params['notify_mail'] )
|
||||||
|
->setSubject($subject )
|
||||||
|
->send();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function attachPdf(){
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->useSubstitutions=false;
|
||||||
|
$mpdf->simpleTables = true;
|
||||||
|
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||||
|
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||||
|
|
||||||
|
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||||
|
$mpdf->WriteHTML($stylesheet,1);
|
||||||
|
|
||||||
|
|
||||||
|
$mpdf->WriteHTML($this->controller->renderPartial("@common/views/account-state/account_state_pdf", [
|
||||||
|
'model' => $this->model,
|
||||||
|
'details' => $this->details
|
||||||
|
]));
|
||||||
|
$type = $this->model->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
|
||||||
|
$dt= "_letrehozva_".date("Ymd_His"). "_" . $this->user->username;
|
||||||
|
$fn= $type .$dt.".pdf";
|
||||||
|
$content = $mpdf->Output($fn, 'S');
|
||||||
|
|
||||||
|
$this->message->attachContent($content, ['fileName' => $fn, 'contentType' => 'application/pdf']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
84
common/components/accountstate/AccountStateWidget.php
Normal file
84
common/components/accountstate/AccountStateWidget.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\accountstate;
|
||||||
|
use yii\base\Widget;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use yii\data\ArrayDataProvider;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for widget display bank notes.
|
||||||
|
*
|
||||||
|
* @property common\models\AccountState $model
|
||||||
|
* */
|
||||||
|
class AccountStateWidget extends Widget{
|
||||||
|
|
||||||
|
public $model;
|
||||||
|
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
parent::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
|
||||||
|
if ($this->model->isTypeOpen() ){
|
||||||
|
$attributes = [
|
||||||
|
[
|
||||||
|
'attribute' =>'account.name',
|
||||||
|
'label' => 'Kassza'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' =>'typeName',
|
||||||
|
'label' => 'Típus'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' =>'money',
|
||||||
|
'value' => \Yii::$app->formatter->asInteger($this->model->money) ." Ft",
|
||||||
|
],
|
||||||
|
'user.username',
|
||||||
|
[
|
||||||
|
'attribute' => 'created_at',
|
||||||
|
'label' => 'Nyitás ideje'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$attributes = [
|
||||||
|
[
|
||||||
|
'attribute' =>'account.name',
|
||||||
|
'label' => 'Kassza'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' =>'typeName',
|
||||||
|
'label' => 'Típus'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' =>'money',
|
||||||
|
'value' => \Yii::$app->formatter->asInteger($this->model->money) ." Ft",
|
||||||
|
],
|
||||||
|
'user.username',
|
||||||
|
[
|
||||||
|
'attribute' => 'start_date',
|
||||||
|
'label' => 'Előző nyitás ideje'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'created_at',
|
||||||
|
'label' => 'Zárás ideje'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo DetailView::widget([
|
||||||
|
'model' => $this->model,
|
||||||
|
'attributes' =>$attributes,
|
||||||
|
]) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
96
common/components/accountstate/BankNotesWidget.php
Normal file
96
common/components/accountstate/BankNotesWidget.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\accountstate;
|
||||||
|
use yii\base\Widget;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use yii\data\ArrayDataProvider;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for widget display bank notes.
|
||||||
|
*
|
||||||
|
* @property common\models\AccountState $model
|
||||||
|
* */
|
||||||
|
class BankNotesWidget extends Widget{
|
||||||
|
|
||||||
|
public $model;
|
||||||
|
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
parent::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
echo $this->generateNotes();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateNotes(){
|
||||||
|
$s = "";
|
||||||
|
$s .= Html::beginTag("div", ['class' => 'row', 'style' => 'margin-top: 6px;']);
|
||||||
|
$s .= Html::beginTag("div", ['class' => 'col-md-4']);
|
||||||
|
$s .= $this->generateBanknoteGrid( [ 'banknote_5_ft','banknote_10_ft','banknote_20_ft','banknote_50_ft' ]);
|
||||||
|
$s .= Html::endTag("div");
|
||||||
|
$s .= Html::beginTag("div", ['class' => 'col-md-4']);
|
||||||
|
$s .= $this->generateBanknoteGrid( [ 'banknote_100_ft','banknote_200_ft','banknote_500_ft','banknote_1000_ft' ]);
|
||||||
|
$s .= Html::endTag("div");
|
||||||
|
$s .= Html::beginTag("div", ['class' => 'col-md-4']);
|
||||||
|
$s .= $this->generateBanknoteGrid( [ 'banknote_2000_ft','banknote_5000_ft','banknote_10000_ft','banknote_20000_ft' ]);
|
||||||
|
$s .= Html::endTag("div");
|
||||||
|
$s .= Html::endTag("div");
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateBanknoteGrid($attributes){
|
||||||
|
|
||||||
|
return $this->generateBanknoteColumn( $this->mkColumnData($attributes));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function mkColumnData( $attributes){
|
||||||
|
|
||||||
|
$values = AccountState::banknoteValues();
|
||||||
|
$items = [];
|
||||||
|
foreach ($attributes as $note){
|
||||||
|
$value = $values[$note];
|
||||||
|
$count = $this->model->$note;
|
||||||
|
if ( !isset($count) || empty($count)){
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
$value = \Yii::$app->formatter->asInteger($value);
|
||||||
|
$item = [
|
||||||
|
'note' => $value . " Ft",
|
||||||
|
'count' => $count
|
||||||
|
];
|
||||||
|
$items[] = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateBanknoteColumn($data){
|
||||||
|
$dp = new ArrayDataProvider(
|
||||||
|
[
|
||||||
|
'allModels' => $data,
|
||||||
|
'sort' => false,
|
||||||
|
'pagination' => false
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$s = GridView::widget([
|
||||||
|
'dataProvider' => $dp,
|
||||||
|
'layout' => '{items}',
|
||||||
|
'options' => ['class' => 'grid-view notes-view'],
|
||||||
|
'columns' =>[
|
||||||
|
[
|
||||||
|
'contentOptions' => ['class' => 'note-name'],
|
||||||
|
'value' => 'note',
|
||||||
|
'label' => 'Címlet'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'value' => 'count',
|
||||||
|
'label' => 'Db'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
21
common/components/total/TotalBaseWidget.php
Normal file
21
common/components/total/TotalBaseWidget.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
class TotalBaseWidget extends Widget{
|
||||||
|
|
||||||
|
public $dailyListing;
|
||||||
|
|
||||||
|
public $viewPath = '@common/views/total';
|
||||||
|
public $viewFile = 'totaleasy.php';
|
||||||
|
public $view;
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
$this->view = $this->viewPath . "/" . $this->viewFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
echo $this->render($this->view,[ 'model' => $this->dailyListing ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
class TotalDetailedMoneyMovementWidget extends TotalBaseWidget{
|
||||||
|
|
||||||
|
public $viewFile = 'total_detailed_money_movement.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
common/components/total/TotalDetailedProductsWidget.php
Normal file
9
common/components/total/TotalDetailedProductsWidget.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
class TotalDetailedProductsWidget extends TotalBaseWidget{
|
||||||
|
|
||||||
|
public $viewFile = 'total_detailed_product.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
common/components/total/TotalDetailedTicketsWidget.php
Normal file
9
common/components/total/TotalDetailedTicketsWidget.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
class TotalDetailedTicketsWidget extends TotalBaseWidget{
|
||||||
|
|
||||||
|
public $viewFile = 'total_detailed_ticket.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
68
common/components/total/TotalDifferenceWidget.php
Normal file
68
common/components/total/TotalDifferenceWidget.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
use yii\base\Widget;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display account state difference information widget
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @property common\models\AccountState $model
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
class TotalDifferenceWidget extends Widget{
|
||||||
|
|
||||||
|
|
||||||
|
public $model;
|
||||||
|
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
return $this->generateDifference();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateDifference(){
|
||||||
|
$s = "";
|
||||||
|
if ( $this->model->hasDifferenceToPrevState()){
|
||||||
|
|
||||||
|
$ft = " Ft";
|
||||||
|
$s .= DetailView::widget([
|
||||||
|
'model' => $this->model,
|
||||||
|
'template' =>"<tr><th>{label}</th><td style='text-align: right;'>{value} </td></tr>",
|
||||||
|
'attributes' => [
|
||||||
|
[
|
||||||
|
'label' => "Előző nyitás ideje",
|
||||||
|
'value' => $this->model->prevObject ? \Yii::$app->formatter->asDatetime( $this->model->prevObject->created_at) : "-",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Előzőleg nyitott",
|
||||||
|
'value' => $this->model->prevObject ? $this->model->user->username : "-",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Előző nyitás összege",
|
||||||
|
'value' => $this->model->prev_money.$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Bevételek összesen előző nyitás óta",
|
||||||
|
'value' => $this->model->collection_money .$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Zárás összege",
|
||||||
|
'value' => $this->model->money.$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Várt összeg",
|
||||||
|
'value' => $this->model->expected.$ft
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => "Különbözet",
|
||||||
|
'value' => $this->model->signedDiff.$ft
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
22
common/components/total/TotalEasyWidget.php
Normal file
22
common/components/total/TotalEasyWidget.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
class TotalEasyWidget extends Widget{
|
||||||
|
|
||||||
|
public $dailyListing;
|
||||||
|
|
||||||
|
public $viewPath = '@common/views/total';
|
||||||
|
public $viewFile = 'totaleasy.php';
|
||||||
|
public $view;
|
||||||
|
|
||||||
|
public function init(){
|
||||||
|
$this->view = $this->viewPath . "/" . $this->viewFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(){
|
||||||
|
echo $this->render($this->view,[ 'model' => $this->dailyListing ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
class TotalMediumMoneyMovementsWidget extends TotalBaseWidget{
|
||||||
|
|
||||||
|
public $viewFile = 'total_medium_money_movement.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
common/components/total/TotalMediumProductsWidget.php
Normal file
9
common/components/total/TotalMediumProductsWidget.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
class TotalMediumProductsWidget extends TotalBaseWidget{
|
||||||
|
|
||||||
|
public $viewFile = 'total_medium_product.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
common/components/total/TotalMediumTicketsWidget.php
Normal file
9
common/components/total/TotalMediumTicketsWidget.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components\total;
|
||||||
|
|
||||||
|
class TotalMediumTicketsWidget extends TotalBaseWidget{
|
||||||
|
|
||||||
|
public $viewFile = 'total_medium_ticket.php';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -24,8 +24,9 @@ return [
|
|||||||
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
|
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
|
||||||
'timeFormat' => 'HH:mm',
|
'timeFormat' => 'HH:mm',
|
||||||
'locale' => 'hu-Hu',
|
'locale' => 'hu-Hu',
|
||||||
'timeZone' => 'Europe/Budapest',
|
// 'timeZone' => 'Europe/Budapest',
|
||||||
'defaultTimeZone' => 'UTC',
|
'timeZone' => 'UTC',
|
||||||
|
// 'defaultTimeZone' => 'UTC',
|
||||||
'nullDisplay' => "-",
|
'nullDisplay' => "-",
|
||||||
],
|
],
|
||||||
'authManager' => [
|
'authManager' => [
|
||||||
|
|||||||
@ -2,9 +2,15 @@
|
|||||||
return [
|
return [
|
||||||
'adminEmail' => 'rocho02@gmail.com',
|
'adminEmail' => 'rocho02@gmail.com',
|
||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.0.17',
|
'version' => 'v0.0.20',
|
||||||
'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
|
||||||
|
'notify_mail' => ['rocho02@gmail.com' ],
|
||||||
|
'mail_account_state_open' => true,
|
||||||
|
'login_reception_email' => true, //if reception login should send email
|
||||||
|
'login_admin_email' => true, //if admin login should send email
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
84
common/mail/account_state.php
Normal file
84
common/mail/account_state.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use common\components\total\TotalEasyWidget;
|
||||||
|
use common\components\total\TotalDetailedProductsWidget;
|
||||||
|
use common\components\total\TotalDetailedTicketsWidget;
|
||||||
|
use common\components\total\TotalDetailedMoneyMovementWidget;
|
||||||
|
use common\components\accountstate\BankNotesWidget;
|
||||||
|
use common\components\total\TotalMediumTicketsWidget;
|
||||||
|
use common\components\total\TotalMediumProductsWidget;
|
||||||
|
use common\components\total\TotalMediumMoneyMovementsWidget;
|
||||||
|
use common\components\total\TotalDifferenceWidget;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
use common\components\accountstate\AccountStateWidget;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\AccountState */
|
||||||
|
if ( $model ->type == AccountState::TYPE_OPEN ){
|
||||||
|
$this->title = "Kassza nyitás";
|
||||||
|
}else{
|
||||||
|
$this->title = "Kassza zárás";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
table{
|
||||||
|
|
||||||
|
}
|
||||||
|
th,td{
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
td.money{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="account-state-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
if ( $model->hasMinus()){
|
||||||
|
?>
|
||||||
|
<div class="alert alert-danger" role="alert">Negatív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}else{
|
||||||
|
?>
|
||||||
|
<div class="alert alert-success" role="alert">Pozitív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php echo AccountStateWidget::widget(['model' =>$model]) ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
?>
|
||||||
|
<h2>Különbözet</h2>
|
||||||
|
<?php
|
||||||
|
echo TotalDifferenceWidget::widget(['model' => $model] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php if ( $model ->type == AccountState::TYPE_CLOSE ){?>
|
||||||
|
|
||||||
|
<?php echo TotalEasyWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<h2>Közepes összesítés</h2>
|
||||||
|
<h3>Bérletek típus szerint</h3>
|
||||||
|
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<h3>Termékek név szerint</h3>
|
||||||
|
<?php echo TotalMediumProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<h3>Pénzmozgások típus szerint</h3>
|
||||||
|
<?php echo TotalMediumMoneyMovementsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
12
common/mail/login_admin.php
Normal file
12
common/mail/login_admin.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>Admin bejelentkezés:</h1>
|
||||||
|
<b>Felhasználó:</b> <?php echo $model->username ;?><br>
|
||||||
|
<b>Idő:</b> <?php echo \Yii::$app->formatter->asDatetime(time());?><br>
|
||||||
|
<?php
|
||||||
|
if ( isset($geoip->city)){
|
||||||
|
?>
|
||||||
|
<b>Ip cím:</b> <?php echo $geoip->ip?><br>
|
||||||
|
<b>Város:</b> <?php echo $geoip->city?><br>
|
||||||
|
<?php }?>
|
||||||
12
common/mail/login_frontend.php
Normal file
12
common/mail/login_frontend.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>Recepció bejelentkezés:</h1>
|
||||||
|
<b>Felhasználó:</b> <?php echo $model->username ;?><br>
|
||||||
|
<b>Idő:</b> <?php echo \Yii::$app->formatter->asDatetime(time());?><br>
|
||||||
|
<?php
|
||||||
|
if ( isset($geoip->city)){
|
||||||
|
?>
|
||||||
|
<b>Ip cím:</b> <?php echo $geoip->ip?><br>
|
||||||
|
<b>Város:</b> <?php echo $geoip->city?><br>
|
||||||
|
<?php }?>
|
||||||
@ -36,6 +36,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
const TYPE_OPEN = 10;
|
const TYPE_OPEN = 10;
|
||||||
const TYPE_CLOSE = 20;
|
const TYPE_CLOSE = 20;
|
||||||
|
|
||||||
|
public $start_date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -94,6 +96,13 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isTypeOpen(){
|
||||||
|
return $this->type == AccountState::TYPE_OPEN;
|
||||||
|
}
|
||||||
|
public function isTypeClose(){
|
||||||
|
return $this->type == AccountState::TYPE_CLOSE;
|
||||||
|
}
|
||||||
|
|
||||||
public static function banknoteValues()
|
public static function banknoteValues()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
88
common/models/CardSearch.php
Normal file
88
common/models/CardSearch.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Card;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CardSearch represents the model behind the search form about `common\models\Card`.
|
||||||
|
*/
|
||||||
|
class CardSearch extends Card
|
||||||
|
{
|
||||||
|
|
||||||
|
public $customerName;
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['customerName','string','max' =>200],
|
||||||
|
['number','string','max' =>200]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attributeLabels(){
|
||||||
|
return ArrayHelper::merge(parent::attributeLabels(),
|
||||||
|
[
|
||||||
|
'card_number' => 'Kártya szám',
|
||||||
|
'customerName' => 'Vendég'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
|
||||||
|
$query = new Query();
|
||||||
|
$query->select(['card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']);
|
||||||
|
$query->from('card');
|
||||||
|
$query->innerJoin('customer','card.id_card = customer.id_customer_card');
|
||||||
|
$query->orderBy(['customer.name' => SORT_ASC]);
|
||||||
|
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
// 'lower(customer.name)' => $this->customerName
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'customer.name', $this->customerName]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -59,7 +59,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
return ArrayHelper::merge( [
|
return ArrayHelper::merge( [
|
||||||
[
|
[
|
||||||
'class' => TimestampBehavior::className(),
|
'class' => TimestampBehavior::className(),
|
||||||
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
'value' => function(){ return date('Y-m-d H:i:s' ,\Yii::$app->formatter->asTimestamp(date('Y-d-m h:i:s')) ); }
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'class' => DiscountAwareBehavior::className(),
|
'class' => DiscountAwareBehavior::className(),
|
||||||
@ -712,6 +712,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
$query = (new \yii\db\Query());
|
$query = (new \yii\db\Query());
|
||||||
$query->select(['coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN. ' then transfer.money else -1 * transfer.money end ),0) AS transfer_money']);
|
$query->select(['coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN. ' then transfer.money else -1 * transfer.money end ),0) AS transfer_money']);
|
||||||
$query->from('transfer');
|
$query->from('transfer');
|
||||||
|
$query->innerJoin("account","account.id_account = transfer.id_account");
|
||||||
$query->andWhere(['transfer.id_user' => $idUser ]);
|
$query->andWhere(['transfer.id_user' => $idUser ]);
|
||||||
|
|
||||||
$created_condition = ['and',[ '>=', 'transfer.created_at', $start ] ,[ '<', 'transfer.created_at', $end ] ];
|
$created_condition = ['and',[ '>=', 'transfer.created_at', $start ] ,[ '<', 'transfer.created_at', $end ] ];
|
||||||
@ -719,6 +720,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
|
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
|
||||||
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
|
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
|
||||||
|
$query->andWhere(['account.type' => Account::TYPE_ALL]);
|
||||||
|
|
||||||
return $query->scalar();
|
return $query->scalar();
|
||||||
}
|
}
|
||||||
|
|||||||
102
common/views/account-state/account_state_pdf.php
Normal file
102
common/views/account-state/account_state_pdf.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
use common\components\total\TotalEasyWidget;
|
||||||
|
use common\components\total\TotalDetailedProductsWidget;
|
||||||
|
use common\components\total\TotalDetailedTicketsWidget;
|
||||||
|
use common\components\total\TotalDetailedMoneyMovementWidget;
|
||||||
|
use common\components\accountstate\BankNotesWidget;
|
||||||
|
use common\components\total\TotalMediumTicketsWidget;
|
||||||
|
use common\components\total\TotalMediumProductsWidget;
|
||||||
|
use common\components\total\TotalMediumMoneyMovementsWidget;
|
||||||
|
use common\components\total\TotalDifferenceWidget;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use common\components\accountstate\AccountStateWidget;
|
||||||
|
use yii\base\Widget;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\AccountState */
|
||||||
|
if ( $model ->type == AccountState::TYPE_OPEN ){
|
||||||
|
$this->title = "Kassza nyitás";
|
||||||
|
}else{
|
||||||
|
$this->title = "Kassza zárás";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<link rel='stylesheet' href='<?php echo \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')?>'>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
td,th{
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
td.note-name{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.money{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="account-state-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
if ( $model->hasMinus()){
|
||||||
|
?>
|
||||||
|
<div class="alert alert-danger" role="alert">Negatív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}else{
|
||||||
|
?>
|
||||||
|
<div class="alert alert-success" role="alert">Pozitív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo AccountStateWidget::widget(['model' => $model]);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
?>
|
||||||
|
<h2>Különbözet</h2>
|
||||||
|
<?php
|
||||||
|
echo TotalDifferenceWidget::widget(['model' => $model] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php if ( $model ->type == AccountState::TYPE_CLOSE ){?>
|
||||||
|
<pagebreak />
|
||||||
|
<?php echo TotalEasyWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<pagebreak />
|
||||||
|
<h2>Közepes összesítés</h2>
|
||||||
|
<h3>Bérletek típus szerint</h3>
|
||||||
|
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<h3>Termékek név szerint</h3>
|
||||||
|
<?php echo TotalMediumProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<h3>Pénzmozgások típus szerint</h3>
|
||||||
|
<?php echo TotalMediumMoneyMovementsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<pagebreak />
|
||||||
|
<h2>Részletek</h2>
|
||||||
|
<?php echo TotalDetailedTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<?php echo TotalDetailedProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<?php echo TotalDetailedMoneyMovementWidget::widget(['dailyListing' => $details]);?>
|
||||||
|
<pagebreak />
|
||||||
|
<h2>Címletek</h2>
|
||||||
|
<?php echo BankNotesWidget::widget(['model' => $model]);?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<?php }else{?>
|
||||||
|
<pagebreak />
|
||||||
|
<h2>Címletek</h2>
|
||||||
|
<?php echo BankNotesWidget::widget(['model' => $model]);?>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
</div>
|
||||||
41
common/views/total/total_detailed_money_movement.php
Normal file
41
common/views/total/total_detailed_money_movement.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<h3>Pénzmozgások</h3>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Dátum</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Név</th>
|
||||||
|
<th>Típus</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($model->moneyMovements as $p ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $p['money_movement_created_at']?> </td>
|
||||||
|
<td><?php echo $p['account_name']?> </td>
|
||||||
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
<td><?php echo $p['money_movement_name'] ?></td>
|
||||||
|
<td><?php echo $p['money_movement_type_name'] ?></td>
|
||||||
|
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['signed_money'])?> Ft</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php if ( count($model->moneyMovements ) == 0 ) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}else{?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo \Yii::$app->formatter->asInteger( $model->moneyMovementMoneis); ?> Ft
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
51
common/views/total/total_detailed_product.php
Normal file
51
common/views/total/total_detailed_product.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
//////////////////////////
|
||||||
|
// Termék eladás
|
||||||
|
////////////////////////
|
||||||
|
?>
|
||||||
|
<h3>Termék eladások</h3>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Kategória</th>
|
||||||
|
<th>Termék</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($model->products as $p ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $p['product_created_at']?> </td>
|
||||||
|
<td><?php echo $p['product_paid_at']?> </td>
|
||||||
|
<td><?php echo $p['account_name']?> </td>
|
||||||
|
<td><?php echo $p['user_name']?> </td>
|
||||||
|
<td><?php echo $p['product_category_name'] ?></td>
|
||||||
|
<td><?php echo $p['product_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $p['product_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['product_money'])?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php if ( count($model->products ) == 0 ) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}else{?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo \Yii::$app->formatter->asInteger( $model->productMoney); ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
46
common/views/total/total_detailed_ticket.php
Normal file
46
common/views/total/total_detailed_ticket.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<h3>Bérletek</h3>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Kiadva</th>
|
||||||
|
<th>Fizetve</th>
|
||||||
|
<th>Kassza</th>
|
||||||
|
<th>Felhasználó</th>
|
||||||
|
<th>Bérlet típus</th>
|
||||||
|
<th>Egység ár</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($model->tickets as $t ){?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $t['ticket_created_at']?> </td>
|
||||||
|
<td><?php echo $t['ticket_paid_at']?> </td>
|
||||||
|
<td><?php echo $t['account_name']?> </td>
|
||||||
|
<td><?php echo $t['user_name']?> </td>
|
||||||
|
<td><?php echo $t['ticket_type_name'] ?></td>
|
||||||
|
<td class='money'><?php echo $t['ticket_item_price']?> Ft</td>
|
||||||
|
<td class='count'><?php echo $t['ticket_count']?> Db</td>
|
||||||
|
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $t['ticket_money'])?> FT</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php if ( count($model->tickets ) == 0 ) {
|
||||||
|
?>
|
||||||
|
Nincs találat
|
||||||
|
<?php
|
||||||
|
}else{?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo \Yii::$app->formatter->asInteger( $model->ticketMoney); ?> Ft
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
1
common/views/total/total_difference.php
Normal file
1
common/views/total/total_difference.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php
|
||||||
26
common/views/total/total_medium_money_movement.php
Normal file
26
common/views/total/total_medium_money_movement.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Pénzmozgás típus</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ( $model->moneyMovementsByType as $mmStat ) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="name"><?php echo $mmStat['name'] ?></td>
|
||||||
|
<td class="count"><?php echo $mmStat['money_movement_count']?> Db</td>
|
||||||
|
<td class="money"><?php echo \Yii::$app->formatter->asInteger( $mmStat['money_movement_money'])?> FT</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo \Yii::$app->formatter->asInteger( $model->moneyMovementMoneis); ?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
45
common/views/total/total_medium_product.php
Normal file
45
common/views/total/total_medium_product.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
foreach ( $model->productsByCategory ['categories'] as $categoryHolder ) {
|
||||||
|
|
||||||
|
$products = $categoryHolder ['products'];
|
||||||
|
?>
|
||||||
|
<h4><?php echo $categoryHolder['category']['name']?></h4>
|
||||||
|
|
||||||
|
<table
|
||||||
|
class="table table-bordered table-striped table-summary table-category-product">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Termék</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ( $products as $p){?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class='name'><?php echo $p['product_name'] ?></td>
|
||||||
|
<td class='count'><?php echo $p['product_count'] ?> Db</td>
|
||||||
|
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['product_money'])?> FT</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php }?>
|
||||||
|
<tr class="warning">
|
||||||
|
<td><?php echo "Összesen" ?></td>
|
||||||
|
<td><?php ?></td>
|
||||||
|
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $categoryHolder['total'])?> FT</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen:
|
||||||
|
<?php
|
||||||
|
echo \Yii::$app->formatter->asInteger( $model->productsByCategory ['total']);
|
||||||
|
?> Ft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
27
common/views/total/total_medium_ticket.php
Normal file
27
common/views/total/total_medium_ticket.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Bérlet típus</th>
|
||||||
|
<th>Mennyiség</th>
|
||||||
|
<th>Összeg</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ( $model->ticketStats as $ticketStat ) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="name"><?php echo $ticketStat['ticket_type_name'] ?></td>
|
||||||
|
<td class="count"><?php echo $ticketStat['ticket_count']?> Db</td>
|
||||||
|
<td class="money"><?php echo \Yii::$app->formatter->asInteger( $ticketStat['ticket_money'])?> FT</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right" style="text-decoration: underline;">
|
||||||
|
Összesen: <?php echo \Yii::$app->formatter->asInteger( $model->ticketMoney); ?> Ft
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
46
common/views/total/totaleasy.php
Normal file
46
common/views/total/totaleasy.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
use common\components\RoleDefinition;
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
//echo $this->render('_list_pdf_head',[ 'searchModel' =>$model, 'label' => 'Napi bevételek - Egyszerű','type' =>'easy']);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h2>Egyszerű összesítés</h2>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// if ( !isset($model->output) ){
|
||||||
|
|
||||||
|
// $pdfUrl = Url::current([ Html::getInputName($model, 'output') => 'pdf']);
|
||||||
|
// echo Html::a("Teljes PDF letöltése", $pdfUrl,['class' => 'btn btn-primary btn-all' ]);
|
||||||
|
|
||||||
|
// $pdfUrl = Url::current([ Html::getInputName($model, 'output') => 'pdf', Html::getInputName($model, 'outputView') => 'easy']);
|
||||||
|
// echo Html::a("Egyszerű összesítő Pdf", $pdfUrl,['class' => 'btn btn-primary' ]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h3>Bruttó</h3>
|
||||||
|
<table class="table table-bordered table-striped table-summary">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Bérletek</th>
|
||||||
|
<td class="money"><?php echo \Yii::$app->formatter->asInteger( $model->ticketMoney)?> FT</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Termékek</th>
|
||||||
|
<td class="money"><?php echo \Yii::$app->formatter->asInteger( $model->productMoney)?> FT</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Pénzmozgások</th>
|
||||||
|
<td class="money"><?php echo \Yii::$app->formatter->asInteger( $model->moneyMovementMoneis)?> FT</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Végösszeg bruttó</th>
|
||||||
|
<td class="money"><span style='border-bottom: 1px solid black'><?php echo \Yii::$app->formatter->asInteger( $model->total)?> FT</span></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
@ -11,8 +11,14 @@ return [
|
|||||||
'mailer' => [
|
'mailer' => [
|
||||||
'class' => 'yii\swiftmailer\Mailer',
|
'class' => 'yii\swiftmailer\Mailer',
|
||||||
'viewPath' => '@common/mail',
|
'viewPath' => '@common/mail',
|
||||||
'fileTransport' => true,
|
'useFileTransport' =>false,
|
||||||
'transport' =>[]
|
'transport' => [
|
||||||
],
|
'class' => 'Swift_SmtpTransport',
|
||||||
],
|
'host' => 'smtp.websiter.hu',
|
||||||
|
'username' => 'info@rocho-net.hu',
|
||||||
|
'password' => 'botond2015',
|
||||||
|
'port' => '25',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@ -9,7 +9,14 @@ use yii\grid\GridView;
|
|||||||
use yii\base\Object;
|
use yii\base\Object;
|
||||||
use yii\data\ArrayDataProvider;
|
use yii\data\ArrayDataProvider;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
|
use common\components\total\TotalDifferenceWidget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display account state widget
|
||||||
|
*
|
||||||
|
* @property common\models\AccountState $model the account state object
|
||||||
|
* @property int $index the current index in the list
|
||||||
|
* */
|
||||||
class AccountStateBanknoteCountWidget extends Widget{
|
class AccountStateBanknoteCountWidget extends Widget{
|
||||||
|
|
||||||
public $model;
|
public $model;
|
||||||
@ -37,53 +44,27 @@ class AccountStateBanknoteCountWidget extends Widget{
|
|||||||
|
|
||||||
|
|
||||||
$s .= $this->generateInfoRow();
|
$s .= $this->generateInfoRow();
|
||||||
$s .= $this->generateNotes();
|
// $s .= $this->generateNotes();
|
||||||
|
|
||||||
if ( $this->model->hasDifferenceToPrevState()){
|
if ( $this->model->hasDifferenceToPrevState()){
|
||||||
|
$s .= "<h3>Különbözet</h3>";
|
||||||
$ft = " Ft";
|
$s .= TotalDifferenceWidget::widget(['model' => $this->model]);
|
||||||
$s .= DetailView::widget([
|
|
||||||
'model' => $this->model,
|
|
||||||
'template' =>"<tr><th>{label}</th><td style='text-align: right;'>{value} </td></tr>",
|
|
||||||
'attributes' => [
|
|
||||||
[
|
|
||||||
'label' => "Előző nyitás ideje",
|
|
||||||
'value' => $this->model->prevObject ? \Yii::$app->formatter->asDatetime( $this->model->prevObject->created_at) : "-",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => "Előzőleg nyitott",
|
|
||||||
'value' => $this->model->prevObject ? $this->model->user->username : "-",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => "Előző nyitás összege",
|
|
||||||
'value' => $this->model->prev_money.$ft
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => "Bevételek összesen utolsó nyitás óta",
|
|
||||||
'value' => $this->model->collection_money .$ft
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => "Zárás összege",
|
|
||||||
'value' => $this->model->money.$ft
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => "Várt összeg",
|
|
||||||
'value' => $this->model->expected.$ft
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => "Különbözet",
|
|
||||||
'value' => $this->model->signedDiff.$ft
|
|
||||||
],
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$s .= $this->generateComment();
|
$s .= $this->generateComment();
|
||||||
|
|
||||||
$s .= Html::beginTag("div", ['class' => 'row', 'style' => 'margin-top: 6px;']);
|
$s .= Html::beginTag("div", ['class' => 'row', 'style' => 'margin-top: 6px;']);
|
||||||
$s .= Html::beginTag("div", ['class' => 'col-md-12 text-right']);
|
$s .= Html::beginTag("div", ['class' => 'col-md-12 text-right']);
|
||||||
|
|
||||||
$s .= Html::a('<span class="glyphicon glyphicon-trash"></span>Törlés', Url::toRoute(['delete','id' =>$this->model->id_account_state]), [
|
$s .= Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt']) ." Pdf", Url::to([ 'view', 'id' =>$this->model->id_account_state, 'output' =>'pdf']) ,['class' => 'btn btn-primary btn-pdf','style' =>'margin-bottom: 12px; margin-right: 6px;']);
|
||||||
|
|
||||||
|
$s .= Html::a('<span class="glyphicon glyphicon-eye-open"></span> Részletek', Url::toRoute(['view','id' =>$this->model->id_account_state]), [
|
||||||
|
'title' => 'Részletek',
|
||||||
|
'class' => 'btn btn-success',
|
||||||
|
'style' =>'margin-bottom: 12px; margin-right: 6px;'
|
||||||
|
]);
|
||||||
|
$s .= Html::a('<span class="glyphicon glyphicon-trash"></span> Törlés', Url::toRoute(['delete','id' =>$this->model->id_account_state]), [
|
||||||
'title' => \Yii::t('yii', 'Delete'),
|
'title' => \Yii::t('yii', 'Delete'),
|
||||||
'data-confirm' =>\Yii::t('yii', 'Are you sure to delete this item?'),
|
'data-confirm' =>\Yii::t('yii', 'Are you sure to delete this item?'),
|
||||||
'data-method' => 'post',
|
'data-method' => 'post',
|
||||||
|
|||||||
@ -19,12 +19,14 @@ class FrontendMenuStructure{
|
|||||||
|
|
||||||
public $startDate;//start date
|
public $startDate;//start date
|
||||||
public $tomorrowDate;//tomorrow date
|
public $tomorrowDate;//tomorrow date
|
||||||
|
public $yesterDay;//yesterday date
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->menuItems = [];
|
$this->menuItems = [];
|
||||||
|
|
||||||
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today') );
|
$this->yesterDay = \Yii::$app->formatter->asDatetime( strtotime('yesterday UTC') );
|
||||||
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
|
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
|
||||||
|
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
||||||
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
|
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
|
||||||
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
|
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
|
||||||
|
|
||||||
@ -66,7 +68,7 @@ class FrontendMenuStructure{
|
|||||||
|
|
||||||
$items = [
|
$items = [
|
||||||
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
||||||
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index'] ],
|
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index' ,'AccountstateSearch[id_account]' => Account::readDefault(), 'AccountstateSearch[start]' => $this->yesterDay] ],
|
||||||
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
|
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
|
||||||
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
||||||
|
|
||||||
@ -84,6 +86,8 @@ class FrontendMenuStructure{
|
|||||||
$items[] = ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[id_user]' =>\Yii::$app->user->id, 'TransferSearch[id_account]' => Account::readDefault(), 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ];
|
$items[] = ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[id_user]' =>\Yii::$app->user->id, 'TransferSearch[id_account]' => Account::readDefault(), 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ];
|
||||||
$items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ];
|
$items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$items[] = ['label' => Yii::t('frontend/card','Vendégek'), 'url' => [ '/card/index' ] ];
|
||||||
|
|
||||||
|
|
||||||
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),
|
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),
|
||||||
|
|||||||
@ -9,179 +9,260 @@ use yii\web\Controller;
|
|||||||
use yii\web\NotFoundHttpException;
|
use yii\web\NotFoundHttpException;
|
||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
use common\components\DailyListing;
|
||||||
|
use common\models\User;
|
||||||
|
use common\components\accountstate\AccountStateMail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountStateController implements the CRUD actions for AccountState model.
|
* AccountStateController implements the CRUD actions for AccountState model.
|
||||||
*/
|
*/
|
||||||
class AccountStateController extends Controller
|
class AccountStateController extends Controller {
|
||||||
{
|
public function behaviors() {
|
||||||
public function behaviors()
|
return [
|
||||||
{
|
'access' => [
|
||||||
return [
|
'class' => \yii\filters\AccessControl::className (),
|
||||||
'access' => [
|
'only' => [
|
||||||
'class' => \yii\filters\AccessControl::className(),
|
'index',
|
||||||
'only' => [ 'index','open','close'],
|
'open',
|
||||||
'rules' => [
|
'close',
|
||||||
// allow authenticated users
|
'view'
|
||||||
[
|
],
|
||||||
'allow' => true,
|
'rules' => [
|
||||||
'roles' => ['@'],
|
// allow authenticated users
|
||||||
],
|
[
|
||||||
// everything else is denied
|
'allow' => true,
|
||||||
],
|
'roles' => [
|
||||||
],
|
'@'
|
||||||
];
|
]
|
||||||
}
|
]
|
||||||
|
]
|
||||||
/**
|
]
|
||||||
* Lists all AccountState models.
|
// everything else is denied
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function actionIndex()
|
];
|
||||||
{
|
}
|
||||||
$searchModel = new AccountstateSearch();
|
|
||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
/**
|
||||||
|
* Lists all AccountState models.
|
||||||
return $this->render('index', [
|
*
|
||||||
'searchModel' => $searchModel,
|
* @return mixed
|
||||||
'dataProvider' => $dataProvider,
|
*/
|
||||||
]);
|
public function actionIndex() {
|
||||||
}
|
$searchModel = new AccountstateSearch ();
|
||||||
|
|
||||||
|
$searchModel->accounts = Account::read ();
|
||||||
/**
|
$searchModel->users = User::read ();
|
||||||
* Creates a new AccountState model.
|
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||||
* @return mixed
|
|
||||||
*/
|
return $this->render ( 'index', [
|
||||||
public function actionOpen()
|
'searchModel' => $searchModel,
|
||||||
{
|
'dataProvider' => $dataProvider
|
||||||
|
] );
|
||||||
$lastStates = AccountState::readLastForUser(AccountState::TYPE_CLOSE );
|
}
|
||||||
$lastStates = AccountState::modelsToArray($lastStates);
|
|
||||||
|
/**
|
||||||
$model = new AccountState();
|
* Creates a new AccountState model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionOpen() {
|
||||||
|
$lastStates = AccountState::readLastForUser ( AccountState::TYPE_CLOSE );
|
||||||
|
$lastStates = AccountState::modelsToArray ( $lastStates );
|
||||||
|
|
||||||
|
$model = new AccountState ();
|
||||||
$model->type = AccountState::TYPE_OPEN;
|
$model->type = AccountState::TYPE_OPEN;
|
||||||
$model->id_user = Yii::$app->user->id;
|
$model->id_user = Yii::$app->user->id;
|
||||||
$model->id_account = Account::readDefault();
|
$model->id_account = Account::readDefault ();
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||||
// return $this->redirect(['view', 'id' => $model->id_account_state]);
|
// return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||||
return $this->redirect(['index' ]);
|
|
||||||
} else {
|
|
||||||
|
$mail = new AccountStateMail(['model' => $model,'controller' => $this]);
|
||||||
$accounts = Account::read();
|
$mail->sednMail();
|
||||||
|
|
||||||
return $this->render('open', [
|
|
||||||
'model' => $model,
|
return $this->redirect ( [
|
||||||
'accounts' => $accounts,
|
'index'
|
||||||
'lastStates' => $lastStates,
|
] );
|
||||||
]);
|
} else {
|
||||||
}
|
|
||||||
}
|
$accounts = Account::read ();
|
||||||
/**
|
|
||||||
* Creates a new AccountState model.
|
return $this->render ( 'open', [
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
'model' => $model,
|
||||||
* @return mixed
|
'accounts' => $accounts,
|
||||||
*/
|
'lastStates' => $lastStates
|
||||||
public function actionClose()
|
] );
|
||||||
{
|
}
|
||||||
$lastStates = AccountState::readLastForUser(AccountState::TYPE_OPEN );
|
}
|
||||||
$lastStates = AccountState::modelsToArray($lastStates);
|
/**
|
||||||
$model = new AccountState();
|
* Creates a new AccountState model.
|
||||||
$model->type = AccountState::TYPE_CLOSE;
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
$model->id_user = Yii::$app->user->id;
|
*
|
||||||
$model->id_account = Account::readDefault();
|
* @return mixed
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
*/
|
||||||
return $this->redirect(['index' ]);
|
public function actionClose() {
|
||||||
// return $this->redirect(['view', 'id' => $model->id_account_state]);
|
$lastStates = AccountState::readLastForUser ( AccountState::TYPE_OPEN );
|
||||||
} else {
|
$lastStates = AccountState::modelsToArray ( $lastStates );
|
||||||
|
$model = new AccountState ();
|
||||||
$accounts = Account::read();
|
$model->type = AccountState::TYPE_CLOSE;
|
||||||
|
$model->id_user = Yii::$app->user->id;
|
||||||
return $this->render('close', [
|
$model->id_account = Account::readDefault ();
|
||||||
'model' => $model,
|
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||||
'accounts' => $accounts,
|
|
||||||
'lastStates' => $lastStates,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$mail = new AccountStateMail(['model' => $model,'controller' => $this]);
|
||||||
|
$mail->sednMail();
|
||||||
/**
|
|
||||||
* Finds the AccountState model based on its primary key value.
|
return $this->redirect ( [
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
'index'
|
||||||
* @param integer $id
|
] );
|
||||||
* @return AccountState the loaded model
|
// return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||||
* @throws NotFoundHttpException if the model cannot be found
|
} else {
|
||||||
*/
|
|
||||||
protected function findModel($id)
|
$accounts = Account::read ();
|
||||||
{
|
|
||||||
if (($model = AccountState::findOne($id)) !== null) {
|
return $this->render ( 'close', [
|
||||||
return $model;
|
'model' => $model,
|
||||||
} else {
|
'accounts' => $accounts,
|
||||||
throw new NotFoundHttpException('The requested page does not exist.');
|
'lastStates' => $lastStates
|
||||||
}
|
] );
|
||||||
}
|
}
|
||||||
/**
|
}
|
||||||
* Creates a new AccountState model.
|
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
/**
|
||||||
* @return mixed
|
* Finds the AccountState model based on its primary key value.
|
||||||
public function actionCreate()
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
{
|
*
|
||||||
$model = new AccountState();
|
* @param integer $id
|
||||||
|
* @return AccountState the loaded model
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
return $this->redirect(['view', 'id' => $model->id_account_state]);
|
*/
|
||||||
} else {
|
protected function findModel($id) {
|
||||||
return $this->render('create', [
|
if (($model = AccountState::findOne ( $id )) !== null) {
|
||||||
'model' => $model,
|
return $model;
|
||||||
]);
|
} else {
|
||||||
}
|
throw new NotFoundHttpException ( 'The requested page does not exist.' );
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
/**
|
/**
|
||||||
* Updates an existing AccountState model.
|
* Creates a new AccountState model.
|
||||||
* If update is successful, the browser will be redirected to the 'view' page.
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
* @param integer $id
|
*
|
||||||
* @return mixed
|
* @return mixed public function actionCreate()
|
||||||
public function actionUpdate($id)
|
* {
|
||||||
{
|
* $model = new AccountState();
|
||||||
$model = $this->findModel($id);
|
*
|
||||||
|
* if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
* return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||||
return $this->redirect(['view', 'id' => $model->id_account_state]);
|
* } else {
|
||||||
} else {
|
* return $this->render('create', [
|
||||||
return $this->render('update', [
|
* 'model' => $model,
|
||||||
'model' => $model,
|
* ]);
|
||||||
]);
|
* }
|
||||||
}
|
* }
|
||||||
}
|
*/
|
||||||
*/
|
/**
|
||||||
/**
|
* Updates an existing AccountState model.
|
||||||
* Deletes an existing AccountState model.
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
*
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed public function actionUpdate($id)
|
||||||
*/
|
* {
|
||||||
public function actionDelete($id)
|
* $model = $this->findModel($id);
|
||||||
{
|
*
|
||||||
$this->findModel($id)->delete();
|
* if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
\Yii::$app->session->setFlash( 'success','Kassza művelet törölve' );
|
* return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||||
return $this->redirect(Yii::$app->request->referrer);
|
* } else {
|
||||||
}
|
* return $this->render('update', [
|
||||||
/**
|
* 'model' => $model,
|
||||||
* Displays a single AccountState model.
|
* ]);
|
||||||
* @param integer $id
|
* }
|
||||||
* @return mixed
|
* }
|
||||||
|
*/
|
||||||
public function actionView($id)
|
/**
|
||||||
{
|
* Deletes an existing AccountState model.
|
||||||
return $this->render('view', [
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
'model' => $this->findModel($id),
|
*
|
||||||
]);
|
* @param integer $id
|
||||||
}
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
public function actionDelete($id) {
|
||||||
|
$model = $this->findModel ( $id );
|
||||||
|
$delete = true;
|
||||||
|
if ( $model->isTypeOpen() ){
|
||||||
|
$closeStates = AccountState::find()->andWhere(['prev_state' => $model->id_account_state])->all();
|
||||||
|
if ( count($closeStates) > 0){
|
||||||
|
// throw new \Exception("Nem lehet törölni a nyitást, mert van kapcsolódó zárás!");
|
||||||
|
\Yii::$app->session->setFlash ( 'error', "Nem lehet törölni a nyitást, mert van kapcsolódó zárás!" );
|
||||||
|
$delete = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $delete == true){
|
||||||
|
$model->delete();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', 'Kassza művelet törölve' );
|
||||||
|
}
|
||||||
|
return $this->redirect ( Yii::$app->request->referrer );
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Displays a single AccountState model.
|
||||||
|
* @param integer $id
|
||||||
|
* $var common\models\AccountState $accountState
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id) {
|
||||||
|
$accountState = $this->findModel ( $id );
|
||||||
|
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
|
||||||
|
$details = null;
|
||||||
|
if ($accountState->isTypeClose ()) {
|
||||||
|
|
||||||
|
$prev;
|
||||||
|
if ($accountState->type == AccountState::TYPE_CLOSE) {
|
||||||
|
if (isset ( $accountState->prev_state )) {
|
||||||
|
$prev = AccountState::findOne ( $accountState->prev_state );
|
||||||
|
}
|
||||||
|
if (isset ( $prev )) {
|
||||||
|
$accountState->start_date = $prev->created_at;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$details = new DailyListing ();
|
||||||
|
$details->loadAccountState ( $accountState );
|
||||||
|
|
||||||
|
$details->readTotalEasy ();
|
||||||
|
$details->readTotalDetailed ();
|
||||||
|
$details->readTotalMedium ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output == 'pdf') {
|
||||||
|
$user = User::findOne(\Yii::$app->user->id);
|
||||||
|
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||||
|
$mpdf->useSubstitutions=false;
|
||||||
|
$mpdf->simpleTables = true;
|
||||||
|
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||||
|
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||||
|
|
||||||
|
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||||
|
$mpdf->WriteHTML($stylesheet,1);
|
||||||
|
|
||||||
|
|
||||||
|
$mpdf->WriteHTML($this->renderPartial("@common/views/account-state/account_state_pdf", [
|
||||||
|
'model' => $accountState,
|
||||||
|
'details' => $details
|
||||||
|
]));
|
||||||
|
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
|
||||||
|
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
|
||||||
|
$fn= $type .$dt.".pdf";
|
||||||
|
$mpdf->Output($fn, 'D');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $this->render ( 'view', [
|
||||||
|
'model' => $accountState,
|
||||||
|
'details' => $details
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,6 +81,16 @@ class CardController extends Controller
|
|||||||
echo Json::encode ( $out );
|
echo Json::encode ( $out );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function actionIndex(){
|
||||||
|
$searchModel = new \common\models\CardSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,8 @@ class CustomerController extends Controller
|
|||||||
if ( $model->isFreeCard() ){
|
if ( $model->isFreeCard() ){
|
||||||
return $this->redirect([ 'create', 'number' => $model->card->number ]);
|
return $this->redirect([ 'create', 'number' => $model->card->number ]);
|
||||||
}else if ( $model->isCustomerWithTicket()){
|
}else if ( $model->isCustomerWithTicket()){
|
||||||
return $this->redirect([ 'product/sale', 'number' => $model->card->number ]);
|
// return $this->redirect([ 'product/sale', 'number' => $model->card->number ]);
|
||||||
|
// return $this->redirect([ 'customer/reception', 'number' => $model->card->number ]);
|
||||||
}else if ( $model->isCardWithCustomer() ){
|
}else if ( $model->isCardWithCustomer() ){
|
||||||
return $this->redirect([ 'ticket/create', 'number' => $model->card->number ]);
|
return $this->redirect([ 'ticket/create', 'number' => $model->card->number ]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,8 @@ use yii\web\BadRequestHttpException;
|
|||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
use yii\filters\VerbFilter;
|
use yii\filters\VerbFilter;
|
||||||
use yii\filters\AccessControl;
|
use yii\filters\AccessControl;
|
||||||
|
use common\models\User;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site controller
|
* Site controller
|
||||||
@ -88,12 +90,31 @@ class SiteController extends Controller
|
|||||||
|
|
||||||
$model = new LoginForm();
|
$model = new LoginForm();
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||||
|
|
||||||
|
|
||||||
// return $this->goBack();
|
// return $this->goBack();
|
||||||
return $this->redirect(['account/select']);
|
return $this->redirect(['account/select']);
|
||||||
} else {
|
} else {
|
||||||
return $this->render('login', ['model' => $model,]);
|
return $this->render('login', ['model' => $model,]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function sendLoginIp(){
|
||||||
|
if ( \Yii::$app->params['login_reception_email'] == true){
|
||||||
|
$geoip = Helper::getGeoIp();
|
||||||
|
|
||||||
|
$user = User::findOne(\Yii::$app->user->id);
|
||||||
|
$message = \Yii::$app->mailer->compose('login_frontend', [
|
||||||
|
'model' => $user,
|
||||||
|
'geoip' => $geoip
|
||||||
|
]);
|
||||||
|
|
||||||
|
$message->setFrom( \Yii::$app->params['infoEmail'] )
|
||||||
|
->setTo( \Yii::$app->params['notify_mail'] )
|
||||||
|
->setSubject('Recepció bejelentkezés - ' . $user->username )
|
||||||
|
->send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs out the current user.
|
* Logs out the current user.
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class TicketController extends FrontendController
|
|||||||
|
|
||||||
$discounts = Discount::read();
|
$discounts = Discount::read();
|
||||||
|
|
||||||
$ticketTypes = TicketType::read(null, Account::readDefault());
|
$ticketTypes = TicketType::read(null, null);
|
||||||
|
|
||||||
$accounts = Account::readAccounts();
|
$accounts = Account::readAccounts();
|
||||||
|
|
||||||
|
|||||||
@ -12,12 +12,25 @@ use common\models\AccountState;
|
|||||||
*/
|
*/
|
||||||
class AccountstateSearch extends AccountState
|
class AccountstateSearch extends AccountState
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $start;
|
||||||
|
public $end;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
|
|
||||||
|
public $accounts;
|
||||||
|
public $users;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
[[ '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' ],
|
||||||
|
[ [ 'id_account','id_user' ,'type' ] , 'integer'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,9 +67,19 @@ class AccountstateSearch extends AccountState
|
|||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$query->innerJoinWith('account');
|
$query->innerJoinWith('account');
|
||||||
$query->innerJoinWith('account.userAccountAssignments');
|
$query->innerJoinWith('account.userAccountAssignments');
|
||||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
|
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id]);
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'account_state.id_user' => $this->id_user,
|
||||||
|
'account_state.type' => $this->type,
|
||||||
|
'account_state.id_account' => $this->id_account,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere([ '>=', 'account_state.created_at', $this->timestampStart ] );
|
||||||
|
$query->andFilterWhere([ '<', 'account_state.created_at', $this->timestampEnd ] );
|
||||||
|
|
||||||
$query->orderBy( 'created_at desc' );
|
$query->orderBy( 'created_at desc' );
|
||||||
|
|
||||||
$query->limit = 20;
|
$query->limit = 20;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use common\models\Card;
|
|||||||
use common\models\Customer;
|
use common\models\Customer;
|
||||||
use common\models\Ticket;
|
use common\models\Ticket;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
use common\models\CardSearch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContactForm is the model behind the contact form.
|
* ContactForm is the model behind the contact form.
|
||||||
@ -19,6 +20,7 @@ class ReceptionForm extends Model
|
|||||||
public $customer;
|
public $customer;
|
||||||
public $tickets;
|
public $tickets;
|
||||||
public $defaultAccount;
|
public $defaultAccount;
|
||||||
|
public $cardSearchModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@ -56,6 +58,8 @@ class ReceptionForm extends Model
|
|||||||
$this->defaultAccount = Account::findOne($defaultAccount);
|
$this->defaultAccount = Account::findOne($defaultAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->cardSearchModel = new CardSearch();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDefaultAccountName(){
|
public function getDefaultAccountName(){
|
||||||
|
|||||||
@ -2,12 +2,19 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use common\models\AccountState;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model frontend\models\AccountstateSearch */
|
/* @var $model frontend\models\AccountstateSearch */
|
||||||
/* @var $form yii\widgets\ActiveForm */
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
?>
|
?>
|
||||||
|
<?php
|
||||||
|
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
|
||||||
|
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
|
||||||
|
$typeOptions = ['' => 'Mind'] + AccountState::types();
|
||||||
|
?>
|
||||||
<div class="account-state-search">
|
<div class="account-state-search">
|
||||||
|
|
||||||
<?php $form = ActiveForm::begin([
|
<?php $form = ActiveForm::begin([
|
||||||
@ -15,47 +22,41 @@ use yii\widgets\ActiveForm;
|
|||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_account_state') ?>
|
|
||||||
|
|
||||||
<?= $form->field($model, 'id_account') ?>
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'type')->dropDownList($typeOptions) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
])->label('Időszak kezdete') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
]
|
||||||
|
])->label("Időszak vége") ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?= $form->field($model, 'type') ?>
|
|
||||||
|
|
||||||
<?= $form->field($model, 'money') ?>
|
|
||||||
|
|
||||||
<?= $form->field($model, 'banknote_5_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_10_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_20_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_50_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_100_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_200_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_500_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_1000_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_2000_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_5000_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_10000_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'banknote_20000_ft') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'id_user') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'created_at') ?>
|
|
||||||
|
|
||||||
<?php // echo $form->field($model, 'updated_at') ?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton(Yii::t('frontend/account-state', 'Search'), ['class' => 'btn btn-primary']) ?>
|
<?= Html::submitButton(Yii::t('frontend/account-state', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
<?= Html::resetButton(Yii::t('frontend/account-state', 'Reset'), ['class' => 'btn btn-default']) ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|||||||
@ -23,7 +23,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<div class="account-state-index">
|
<div class="account-state-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]); ?>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?= Html::a(Yii::t('frontend/account-state', 'Open Account State'), ['open'], ['class' => 'btn btn-success']) ?>
|
<?= Html::a(Yii::t('frontend/account-state', 'Open Account State'), ['open'], ['class' => 'btn btn-success']) ?>
|
||||||
|
|||||||
@ -2,52 +2,117 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\DetailView;
|
use yii\widgets\DetailView;
|
||||||
|
use common\components\total\TotalEasyWidget;
|
||||||
|
use common\components\total\TotalDetailedProductsWidget;
|
||||||
|
use common\components\total\TotalDetailedTicketsWidget;
|
||||||
|
use common\components\total\TotalDetailedMoneyMovementWidget;
|
||||||
|
use common\components\accountstate\BankNotesWidget;
|
||||||
|
use common\components\total\TotalMediumTicketsWidget;
|
||||||
|
use common\components\total\TotalMediumProductsWidget;
|
||||||
|
use common\components\total\TotalMediumMoneyMovementsWidget;
|
||||||
|
use common\components\total\TotalDifferenceWidget;
|
||||||
|
use yii\base\Widget;
|
||||||
|
use common\models\AccountState;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
use common\components\accountstate\AccountStateWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\AccountState */
|
/* @var $model common\models\AccountState */
|
||||||
|
if ( $model ->type == AccountState::TYPE_OPEN ){
|
||||||
$this->title = $model->id_account_state;
|
$this->title = "Kassza nyitás";
|
||||||
|
}else{
|
||||||
|
$this->title = "Kassza zárás";
|
||||||
|
}
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/account-state', 'Account States'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/account-state', 'Account States'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.btn-pdf{
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.money{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<div class="account-state-view">
|
<div class="account-state-view">
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
if ( $model->hasMinus()){
|
||||||
|
?>
|
||||||
|
<div class="alert alert-danger" role="alert">Negatív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}else{
|
||||||
|
?>
|
||||||
|
<div class="alert alert-success" role="alert">Pozitív különbözet</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php echo AccountStateWidget::widget(['model' =>$model]) ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt'])." Pdf", Url::current(['output' =>'pdf']) ,['class' => 'btn btn-primary btn-pdf']);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( $model->hasDifferenceToPrevState() ){
|
||||||
|
?>
|
||||||
|
<h2>Különbözet</h2>
|
||||||
|
<?php
|
||||||
|
echo TotalDifferenceWidget::widget(['model' => $model] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<?php if ( $model ->type == AccountState::TYPE_CLOSE ){?>
|
||||||
|
<div>
|
||||||
|
|
||||||
<p>
|
<!-- Nav tabs -->
|
||||||
<?= Html::a(Yii::t('frontend/account-state', 'Update'), ['update', 'id' => $model->id_account_state], ['class' => 'btn btn-primary']) ?>
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<?= Html::a(Yii::t('frontend/account-state', 'Delete'), ['delete', 'id' => $model->id_account_state], [
|
<li role="presentation" class="active"><a href="#easy"
|
||||||
'class' => 'btn btn-danger',
|
aria-controls="easy" role="tab" data-toggle="tab">Egyszerű összesítő</a></li>
|
||||||
'data' => [
|
<li role="presentation"><a href="#medium" aria-controls="medium"
|
||||||
'confirm' => Yii::t('frontend/account-state', 'Are you sure you want to delete this item?'),
|
role="tab" data-toggle="tab">Közepes összesítő</a></li>
|
||||||
'method' => 'post',
|
<li role="presentation"><a href="#detailed" aria-controls="detailed"
|
||||||
],
|
role="tab" data-toggle="tab">Részletes összesítő</a></li>
|
||||||
]) ?>
|
<li role="presentation" class=""><a href="#banknotes"
|
||||||
</p>
|
aria-controls="banknotes" role="tab" data-toggle="tab">Címletek</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<!-- Tab panes -->
|
||||||
'model' => $model,
|
<div class="tab-content">
|
||||||
'attributes' => [
|
<div role="tabpanel" class="tab-pane active" id="easy">
|
||||||
'id_account_state',
|
<?php echo TotalEasyWidget::widget(['dailyListing' => $details]);?>
|
||||||
'id_account',
|
</div>
|
||||||
'type',
|
<div role="tabpanel" class="tab-pane " id="medium">
|
||||||
'money',
|
<h2>Közepes összesítés</h2>
|
||||||
'banknote_5_ft',
|
<h3>Bérletek típus szerint</h3>
|
||||||
'banknote_10_ft',
|
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_20_ft',
|
<h3>Termékek név szerint</h3>
|
||||||
'banknote_50_ft',
|
<?php echo TotalMediumProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_100_ft',
|
<h3>Pénzmozgások típus szerint</h3>
|
||||||
'banknote_200_ft',
|
<?php echo TotalMediumMoneyMovementsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_500_ft',
|
</div>
|
||||||
'banknote_1000_ft',
|
<div role="tabpanel" class="tab-pane " id="detailed">
|
||||||
'banknote_2000_ft',
|
<h2>Részletek</h2>
|
||||||
'banknote_5000_ft',
|
<?php echo TotalDetailedTicketsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_10000_ft',
|
<?php echo TotalDetailedProductsWidget::widget(['dailyListing' => $details]);?>
|
||||||
'banknote_20000_ft',
|
<?php echo TotalDetailedMoneyMovementWidget::widget(['dailyListing' => $details]);?>
|
||||||
'id_user',
|
</div>
|
||||||
'created_at',
|
<div role="tabpanel" class="tab-pane " id="banknotes">
|
||||||
'updated_at',
|
<h2>Címletek</h2>
|
||||||
],
|
<?php echo BankNotesWidget::widget(['model' => $model]);?>
|
||||||
]) ?>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php }else{?>
|
||||||
|
<h2>Címletek</h2>
|
||||||
|
<?php echo BankNotesWidget::widget(['model' => $model]);?>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
</div>
|
||||||
38
frontend/views/card/_search.php
Normal file
38
frontend/views/card/_search.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model frontend\models\CollectionSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="collection-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?php echo $form->field($model, 'customerName') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<?php echo $form->field($model, 'number') ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
70
frontend/views/card/index.php
Normal file
70
frontend/views/card/index.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use common\components\AccountTotalWidget;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel frontend\models\CollectionSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('frontend/collection', 'Vendégek');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="collection-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
[
|
||||||
|
'attribute' => 'card_number',
|
||||||
|
'label' => 'Kártyaszám',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'customer_name',
|
||||||
|
'label' => 'Név',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'customer_phone',
|
||||||
|
'label' => 'Tel',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'customer_email',
|
||||||
|
'label' => 'E-mail',
|
||||||
|
],
|
||||||
|
// [
|
||||||
|
// 'attribute' => 'customer.name',
|
||||||
|
// 'value' => 'customer.name',
|
||||||
|
// ],
|
||||||
|
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{ticket} {ticket_history}',
|
||||||
|
'buttons' => [
|
||||||
|
'ticket' => function ($url, $model, $key) {
|
||||||
|
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||||
|
},
|
||||||
|
'ticket_history' => function ($url, $model, $key) {
|
||||||
|
return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'urlCreator' => function ($action, $model, $key, $index){
|
||||||
|
$url = "";
|
||||||
|
if ( 'ticket' == $action ){
|
||||||
|
$url = Url::to(['ticket/create','number' => $model['card_number']]);
|
||||||
|
}else if ( 'ticket_history' == $action ){
|
||||||
|
$url = Url::to(['ticket/index','number' => $model['card_number']]);
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -6,6 +6,8 @@ use frontend\components\ReceptionCardNumberTicketsWidget;
|
|||||||
use yii\base\Widget;
|
use yii\base\Widget;
|
||||||
use frontend\components\ReceptionTicketWidget;
|
use frontend\components\ReceptionTicketWidget;
|
||||||
use frontend\components\ReceptionCustomerWidget;
|
use frontend\components\ReceptionCustomerWidget;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use yii\helpers\Html;
|
||||||
?>
|
?>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
@ -13,6 +15,19 @@ use frontend\components\ReceptionCustomerWidget;
|
|||||||
Aktuális kassza: <?php echo $model->getDefaultAccountName();?>
|
Aktuális kassza: <?php echo $model->getDefaultAccountName();?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['card/index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?php echo Html::textInput('CardSearch[customerName]','',['class'=>"form-control", 'placeholder' =>'Vendég neve']) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
|
|||||||
@ -26,8 +26,7 @@ if ( isset($model->card)){
|
|||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
<div class="form-card-number">
|
||||||
<div class="form-card-number">
|
|
||||||
<?php $form = ActiveForm::begin([
|
<?php $form = ActiveForm::begin([
|
||||||
'enableAjaxValidation' => false,
|
'enableAjaxValidation' => false,
|
||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
@ -35,7 +34,7 @@ if ( isset($model->card)){
|
|||||||
]); ?>
|
]); ?>
|
||||||
<div class="row" >
|
<div class="row" >
|
||||||
<div class='col-md-12'>
|
<div class='col-md-12'>
|
||||||
<?php echo Html::textInput("number", $number ,['class' => 'form-control'])?>
|
<?php echo Html::textInput("number", $number ,['class' => 'form-control', 'placeholder' => 'Kártyaszám'])?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" >
|
<div class="row" >
|
||||||
@ -44,7 +43,7 @@ if ( isset($model->card)){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,3 +6,9 @@ use frontend\components\ReceptionWidget;
|
|||||||
?>
|
?>
|
||||||
<h1>Recepció</h1>
|
<h1>Recepció</h1>
|
||||||
<?php echo ReceptionWidget::widget( ['form' => $model, 'route' => ['customer/reception'] ] )?>
|
<?php echo ReceptionWidget::widget( ['form' => $model, 'route' => ['customer/reception'] ] )?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// echo "Timezone:" . date_default_timezone_get();
|
||||||
|
//echo date("Y-m-d H:i");
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@ -68,7 +68,7 @@ use common\models\Account;
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php echo Html::a(Yii::t("frontend/ticket","Sell"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
<?php echo Html::a(Yii::t("frontend/ticket","Fizetve"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>
|
<?php echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user