merge app api

This commit is contained in:
Schneider Roland
2023-01-19 17:43:10 +01:00
570 changed files with 81491 additions and 1263 deletions

View File

@@ -2,6 +2,7 @@
namespace backend\controllers;
use Mpdf\Mpdf;
use Yii;
use common\models\AccountState;
use backend\models\AccountStateSearch;
@@ -11,6 +12,7 @@ use yii\filters\VerbFilter;
use common\models\Account;
use common\models\User;
use common\components\DailyListing;
use common\components\MpdfUtil;
/**
* AccountStateController implements the CRUD actions for AccountState model.
@@ -35,7 +37,7 @@ class AccountStateController extends \backend\controllers\BackendController
],
];
}
/**
* Lists all AccountState models.
* @return mixed
@@ -47,8 +49,8 @@ class AccountStateController extends \backend\controllers\BackendController
$accounts = Account::read();
$users = User::read();
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@@ -73,7 +75,7 @@ class AccountStateController extends \backend\controllers\BackendController
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
$details = null;
if ($accountState->isTypeClose ()) {
$prev;
if ($accountState->type == AccountState::TYPE_CLOSE) {
if (isset ( $accountState->prev_state )) {
@@ -85,38 +87,38 @@ class AccountStateController extends \backend\controllers\BackendController
}
$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= MpdfUtil::createMpdfWith6XConstructor('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
'details' => $details
]));
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf";
$mpdf->Output($fn, 'D');
} else {
return $this->render ( 'view', [
return $this->render ( 'view', [
'model' => $accountState,
'details' => $details
'details' => $details
] );
}
}
@@ -158,7 +160,7 @@ class AccountStateController extends \backend\controllers\BackendController
}
}
/**
* Deletes an existing AccountState model.
* If deletion is successful, the browser will be redirected to the 'index' page.
@@ -168,27 +170,27 @@ class AccountStateController extends \backend\controllers\BackendController
*/
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.
* If deletion is successful, the browser will be redirected to the 'index' page.

View File

@@ -8,7 +8,6 @@ use backend\models\CitySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\db\Query;
use yii\helpers\Json;
@@ -36,5 +35,5 @@ class BackendController extends Controller
];
}
}

View File

@@ -8,7 +8,6 @@ use backend\models\CitySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\db\Query;
use yii\helpers\Json;
@@ -34,7 +33,7 @@ class CityController extends \backend\controllers\BackendController
],
];
}
/**
* Lists all City models.
@@ -128,14 +127,14 @@ class CityController extends \backend\controllers\BackendController
throw new NotFoundHttpException('The requested page does not exist.');
}
}
/**
* Your controller action to fetch the list
*/
public function actionNameList($search = null) {
$query = new Query();
$query->select ( [
'name',
'min(zip) as zip',
@@ -158,7 +157,7 @@ class CityController extends \backend\controllers\BackendController
*/
public function actionZipList($search = null) {
$query = new Query();
$query->select ( [
'name',
'min(zip) as zip',

View File

@@ -12,7 +12,6 @@ use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use backend\models\CustomerUpdate;
use backend\models\CustomerNewsLetterModel;
use yii\db\Query;
@@ -24,7 +23,7 @@ use yii\data\ActiveDataProvider;
class CustomerController extends \backend\controllers\BackendController
{
public function behaviors()
{
@@ -130,10 +129,10 @@ class CustomerController extends \backend\controllers\BackendController
public function actionCreate()
{
$model = new CustomerCreate();
$model->country = "Magyarország";
$model->id_user = Yii::$app->user->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_customer]);
@@ -157,9 +156,9 @@ class CustomerController extends \backend\controllers\BackendController
if (($model = CustomerUpdate::findOne($id)) == null) {
throw new NotFoundHttpException('The requested page does not exist.');
}
$model->birthdate= isset($model->birthdate ) ? Yii::$app->formatter->asDate($model->birthdate) :'';
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_customer]);
@@ -198,24 +197,24 @@ class CustomerController extends \backend\controllers\BackendController
throw new NotFoundHttpException('The requested page does not exist.');
}
}
public function actionMail(){
$model = new CustomerNewsLetterModel();
$query = new Query();
$query->distinct();
$query->select([ 'email']);
$query->from("customer");
$query->andWhere(['newsletter' => 1]);
$query->andWhere(['status' => Customer::STATUS_ACTIVE]);
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$message = \Yii::$app->mailer->compose ( );
$message
->setFrom ( "noreply@fitnessadmin.hu" )
->setBcc(['rocho02@gmail.com',"rocho02@freemail.hu"])
@@ -225,9 +224,9 @@ class CustomerController extends \backend\controllers\BackendController
->send ();
return $this->redirect(['customer/mail']);
}
return $this->render('mail', [ 'model' => $model ]);
}
}

View File

@@ -4,6 +4,7 @@ namespace backend\controllers;
use common\models\Log;
use common\models\Transfer;
use Mpdf\Mpdf;
use Yii;
use common\models\Ticket;
use backend\models\TicketSearch;
@@ -27,19 +28,20 @@ use yii\helpers\VarDumper;
use backend\models\TicketUpdate;
use yii\helpers\Url;
use common\components\Helper;
use common\components\MpdfUtil;
/**
* TicketController implements the CRUD actions for Ticket model.
*/
class TicketController extends \backend\controllers\BackendController {
public function behaviors() {
return [
'access' => [
return [
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
'actions' => [
[
'actions' => [
'create',
'index',
'view',
@@ -49,22 +51,22 @@ class TicketController extends \backend\controllers\BackendController {
'test'
],
'allow' => true,
'roles' => [
'roles' => [
'admin',
'employee',
'reception'
]
]
'reception'
]
]
]
// everything else is denied
]
]
];
}
/**
* Lists all Ticket models.
*
*
* @return mixed
*/
public function actionIndex() {
@@ -82,10 +84,10 @@ class TicketController extends \backend\controllers\BackendController {
}else if ( $searchModel->output == 'xls'){
return $this->downloadIndexXls($searchModel,$dataProvider);
}
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
@@ -292,7 +294,7 @@ class TicketController extends \backend\controllers\BackendController {
$fileName = "berletek";
$fileName .= "_" . date ( "Ymd_His" );
$fileName .= ".pdf";
$mpdf = new \mPDF ( 'utf-8', 'A4' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor( 'utf-8', 'A4' );
$mpdf->useSubstitutions = false;
$mpdf->simpleTables = true;
@@ -316,24 +318,24 @@ class TicketController extends \backend\controllers\BackendController {
] );
*/
}
/**
* Lists all Ticket models.
*
*
* @return mixed
*/
public function actionStatistics() {
$searchModel = new TicketSearchStatisitcs();
$searchModel->search ( Yii::$app->request->queryParams );
$searchModel->searchTotals ();
$searchModel->users = User::read ();
$searchModel->accounts = Account::read ();
$searchModel->ticketTypes = TicketType::read ();
if ($searchModel->output == 'pdf') {
$user = User::findOne ( \Yii::$app->user->id );
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "";
$ov = '_total_content_pdf';
$dt = "_letrehozva_" . date ( "Ymd_His" ) . "_" . $user->username;
@@ -341,24 +343,24 @@ class TicketController extends \backend\controllers\BackendController {
$account = "";
$currentUser = "";
$fn = $fn . $interval . $dt . $account . $currentUser . ".pdf";
$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 ( 'statistics_pdf', [
'searchModel' => $searchModel
$mpdf->WriteHTML ( $this->renderPartial ( 'statistics_pdf', [
'searchModel' => $searchModel
] ) );
$mpdf->Output ( $fn, 'D' );
exit ();
} else {
return $this->render ( 'statistics', [
'searchModel' => $searchModel
return $this->render ( 'statistics', [
'searchModel' => $searchModel
] );
}
}
@@ -373,91 +375,91 @@ class TicketController extends \backend\controllers\BackendController {
public function actionIndexCustomer($id) {
$customer = Customer::findOne ( $id );
$card = Card::findOne ( $id );
if ($customer == null) {
throw new NotFoundHttpException ( 'The requested page does not exist.' );
}
$searchModel = new TicketSearchCustomer(['customer' => $customer]);
$searchModel->id_card = $customer->id_customer_card;
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
//$searchModel->searchTotals ();
$searchModel->users = User::read ();
$searchModel->accounts = Account::read ();
$searchModel->ticketTypes = TicketType::read ();
Url::remember(Url::current(),"ticket_index_customer");
return $this->render ( 'index_customer', [
return $this->render ( 'index_customer', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'customer' => $customer,
'card' => $card
'card' => $card
] );
}
/**
* Displays a single Ticket model.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionView($id) {
return $this->render ( 'view', [
'model' => $this->findModel ( $id )
return $this->render ( 'view', [
'model' => $this->findModel ( $id )
] );
}
/**
* Creates a new Ticket model.
* If creation is successful, the browser will be redirected to the 'view' page.
*
*
* @return mixed
*/
public function actionCreate() {
$model = new Ticket ();
$discounts = Discount::read ();
$ticketTypes = TicketType::read ();
$accounts = Account::readAccounts ();
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ticket
'id' => $model->id_ticket
] );
} else {
return $this->render ( 'create', [
return $this->render ( 'create', [
'model' => $model,
'discounts' => $discounts,
'ticketTypes' => $ticketTypes,
'accounts' => $accounts
'accounts' => $accounts
] );
}
}
/**
* Updates an existing Ticket model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionUpdate($id) {
$model = TicketUpdate::findOne( $id );
$model->startDate = substr( $model->start ,0 ,10 );
$model->endDate = substr( $model->end ,0 ,10 );
$model->startDate = \Yii::$app->formatter->asDate($model->startDate);
$model->endDate = \Yii::$app->formatter->asDate($model->endDate);
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
@@ -468,66 +470,66 @@ class TicketController extends \backend\controllers\BackendController {
]);
Helper::flash("success", "Bérlet sikeresen módosítva");
$url = Url::previous("ticket_index_customer");
if ( isset($url) ){
return $this->redirect($url);
}
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ticket
'id' => $model->id_ticket
] );
} else {
return $this->render ( 'update', [
'model' => $model
return $this->render ( 'update', [
'model' => $model
] );
}
}
/**
* Deletes an existing Ticket model.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel ( $id )->delete ();
return $this->redirect ( [
'index'
return $this->redirect ( [
'index'
] );
}
public function actionTest(){
// $this->doTestTicketSale();
$this->doTestDetstaProcess();
return $this->render('test');
}
protected function doTestDetstaProcess(){
$contract = Contract::findOne(19);
$megbizas = $contract->requests[0];
$tetel = new GiroDETSTATetel();
$tetel->visszajelzesInformacio = "02";
$tp = new DetStatTetelProcessor([
'megbizas' => $megbizas,
'tetel' => $tetel
]);
$tp->run();
}
protected function doTestTicketSale(){
$ticketType = TicketType::findOne(1);
$customer = Customer::findOne(1);
@@ -536,9 +538,9 @@ class TicketController extends \backend\controllers\BackendController {
$discount = null;
$contract = Contract::findOne(19);
$megbizas = $contract->requests[0];
$ticketSale = new TicketSale(
[
'ticketType'=> $ticketType,
@@ -550,15 +552,15 @@ class TicketController extends \backend\controllers\BackendController {
'ticketInstallmentRequest' => $megbizas
]
);
$ticketSale->doSale();
}
/**
* Finds the Ticket model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param integer $id
*
* @param integer $id
* @return Ticket the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/

View File

@@ -17,7 +17,7 @@ use backend\models\GiroKotegForm;
/**
* TicketInstallmentRequestController implements the CRUD actions for TicketInstallmentRequest model.
*
*
* TODO: FIX ACCESS
*/
class TicketInstallmentRequestController extends Controller
@@ -47,7 +47,6 @@ class TicketInstallmentRequestController extends Controller
]
]
// everything else is denied
]
];
}
@@ -66,18 +65,19 @@ class TicketInstallmentRequestController extends Controller
'dataProvider' => $dataProvider,
]);
}
/**
* Lists pending TicketInstallmentRequest models.
* @return mixed
*/
public function actionPending()
{
\Yii::info("Showing pending");
$model = new TicketInstallmentMarkForSendForm();
if ($model->load(Yii::$app->request->post()) ) {
$model->markForSend();
}
$searchModel = new TicketInstallmentRequestSearchPending();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
@@ -102,7 +102,7 @@ class TicketInstallmentRequestController extends Controller
\Yii::$app->session->setFlash('success',"Megbízás teljesítve");
}
return $this->redirect(['ticket-installment-request/view',
return $this->redirect(['ticket-installment-request/view',
'id' => $model->id_ticket_installment_request,
]);
}
@@ -115,15 +115,15 @@ class TicketInstallmentRequestController extends Controller
public function actionDownloadGiro()
{
$model = new GiroKotegForm();
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
$model->createKoteg();
return $this->redirect(['ugiro/view', 'id' => $model->koteg->id_ugiro]);
}
$searchModel = new TicketInstallmentRequestSearchDownloadGiro();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$model->action = "create";
return $this->render('index_download_giro', [
'searchModel' => $searchModel,
@@ -197,7 +197,7 @@ class TicketInstallmentRequestController extends Controller
return $this->redirect(['index']);
}
public function actionTest( )
{
return $this->render('test');

View File

@@ -21,6 +21,7 @@ use backend\models\TransferListUserGroupedSearch;
use backend\models\TransferLaterSearch;
use yii\helpers\Url;
use common\components\Helper;
use common\components\MpdfUtil;
/**
* TransferController implements the CRUD actions for Transfer model.
@@ -66,23 +67,23 @@ class TransferController extends \backend\controllers\BackendController
],
];
}
public function actionPaymentLater(){
$searchModel = new TransferLaterSearch();
if ( \Yii::$app->request->isPost){
$searchModel->load(Yii::$app->request->post());
if ( $searchModel->doPayout()) {
return $this->redirect(['transfer/payment-later' ]);
}
}
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
if ( $searchModel->output =='pdf'){
$this->downloadPaymentLaterPDF($dataProvider);
}else if ( $searchModel->output =='xls'){
@@ -91,9 +92,9 @@ class TransferController extends \backend\controllers\BackendController
$accounts = Account::read();
$users = User::read();
Url::remember("payment_later",Url::current());
return $this->render('payment_later', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@@ -245,31 +246,31 @@ class TransferController extends \backend\controllers\BackendController
exit ();
}
protected function downloadPaymentLaterPDF($dataProvider) {
// $mpdf = new \mPDF ( 'utf-8', 'A4' );
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "utolagos_fizetesek.pdf";
$mpdf->useSubstitutions = false;
$mpdf->simpleTables = true;
$mpdf->SetHeader ( "" );
$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 ( '_pdf_payment_later.php', [
'dataProvider' => $dataProvider
] ) );
$mpdf->Output ( $fn, 'D' );
exit ();
}
/**
* Lists all Transfer models.
* @return mixed
@@ -278,7 +279,7 @@ class TransferController extends \backend\controllers\BackendController
{
$searchModel = new TransferSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$accounts = Account::read();
$searchModel->totalsTransfers();
$users = User::read();
@@ -293,7 +294,7 @@ class TransferController extends \backend\controllers\BackendController
'accounts' => $accounts,
'users' => $users,
]);
}
/**
@@ -446,23 +447,23 @@ class TransferController extends \backend\controllers\BackendController
$searchModel = new TransferListSearch();
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->search(Yii::$app->request->queryParams);
if ( $searchModel->output === 'pdf'){
$user = User::findOne(\Yii::$app->user->id);
$mpdf=new \mPDF('utf-8', 'A4-L');
$mpdf= MpdfUtil::createMpdfWith6XConstructor('utf-8', 'A4-L');
$fn = "";
$ov = '_total_content_pdf';
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$interval="";
$account = "";
$currentUser= "";
if ( isset($searchModel->currentAccount) ){
$account =( "_kassza_".$searchModel->currentAccount->name);
}
if ( isset($searchModel->currentUser) ){
$currentUser = ( "_felhasznalo_".$searchModel->currentUser->username);
}
@@ -486,15 +487,15 @@ class TransferController extends \backend\controllers\BackendController
$fn="napi_bevetelek.teljes";
}
$fn = $fn. $interval . $dt .$account .$currentUser. ".pdf";
$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($ov, [
'searchModel' => $searchModel,
]));
@@ -505,10 +506,10 @@ class TransferController extends \backend\controllers\BackendController
'searchModel' => $searchModel,
]);
}
}
/**
* Lists all Transfer models.
* @return mixed
@@ -518,16 +519,16 @@ class TransferController extends \backend\controllers\BackendController
$searchModel = new TransferListUserGroupedSearch();
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->search(Yii::$app->request->queryParams);
return $this->render('list_user_grouped', [
'searchModel' => $searchModel,
]);
}
/**
* Lists all Transfer models.
* @return mixed
@@ -540,16 +541,16 @@ class TransferController extends \backend\controllers\BackendController
$searchModel->users = User::read();
$searchModel->productCategories = ProductCategory::read();
$searchModel->productOptions = Product::read();
$searchModel->search(Yii::$app->request->queryParams);
return $this->render('sale', [
'searchModel' => $searchModel,
]);
}
public function actionSalePdf(){
$searchModel = new TransferSaleSearch();
$searchModel->mode = 'admin';
@@ -557,11 +558,11 @@ class TransferController extends \backend\controllers\BackendController
$searchModel->users = User::read();
$searchModel->productCategories = ProductCategory::read();
$searchModel->productOptions = Product::read();
$searchModel->search(Yii::$app->request->queryParams);
$mpdf=new \mPDF('utf-8', 'A4-L');
$mpdf= MpdfUtil::createMpdfWith6XConstructor('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', [
@@ -569,9 +570,9 @@ class TransferController extends \backend\controllers\BackendController
]));
$mpdf->Output('MyPDF.pdf', 'D');
exit;
}
/**
* Lists all Transfer models.
* @return mixed
@@ -580,11 +581,11 @@ class TransferController extends \backend\controllers\BackendController
{
$searchModel = new TransferSummarySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$accounts = Account::read();
$users = User::read();
return $this->render('summary', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@@ -592,7 +593,7 @@ class TransferController extends \backend\controllers\BackendController
'users' => $users,
]);
}
/**
* Displays a single Transfer model.
* @param integer $id
@@ -604,16 +605,16 @@ class TransferController extends \backend\controllers\BackendController
'model' => $this->findModel($id),
]);
}
public function actionUnstorno($id)
{
$model = $this->findModel($id);
$model->unstorono();
Helper::flash("success", "Bérlet visszaállítva");
return $this->redirect( ['view' ,'id' => $model->id_transfer]);
}

View File

@@ -10,6 +10,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\components\DetStatProcessor;
use common\components\MpdfUtil;
use backend\models\DestaUploadForm;
use yii\web\UploadedFile;
use yii\data\ArrayDataProvider;
@@ -23,71 +24,71 @@ use common\models\MessageDetsta;
*/
class UgiroController extends Controller {
public function behaviors() {
return [
'verbs' => [
return [
'verbs' => [
'class' => VerbFilter::className (),
'actions' => [
'delete' => [
'post'
]
]
'actions' => [
'delete' => [
'post'
]
]
],
'access' => [
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
[
'actions' => [ ],
'allow' => true,
'roles' => [
'roles' => [
'admin',
'employee',
'reception'
]
]
]
'reception'
]
]
]
]
// everything else is denied
];
}
/**
* Lists all Ugiro models.
*
*
* @return mixed
*/
public function actionIndex() {
$searchModel = new UgiroSearch ();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
/**
* Lists all Ugiro models.
*
*
* @return mixed
*/
public function actionItems($id) {
$searchModel = new UgiroSearch ();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
public function actionActivate() {
}
/**
* Displays a single Ugiro model.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionView($id) {
@@ -95,8 +96,8 @@ class UgiroController extends Controller {
if (Yii::$app->request->isPost) {
if ($model->status == Ugiro::$STATUS_RECIEVED) {
set_time_limit ( 1200 ); // 20 perc
$processor = new DetStatProcessor ( [
'koteg' => $model
$processor = new DetStatProcessor ( [
'koteg' => $model
] );
$processor->run ();
$this->redirect(['view', 'id' => $model->id_ugiro]);
@@ -107,7 +108,7 @@ class UgiroController extends Controller {
} else {
if (isset ( $_GET ['output'] )) {
$output = $_GET ['output'];
if ($output == 'pdf') {
$this->downloadUgiroPdf ( $model );
}else if ($output == 'xls') {
@@ -115,18 +116,18 @@ class UgiroController extends Controller {
}
}
}
$query = MessageDetsta::find();
$query->andWhere(['id_ugiro' => $model->id_ugiro]);
$query->orderBy([ 'created_at' => SORT_ASC ]);
$detstaDp = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
return $this->render ( 'view', [
return $this->render ( 'view', [
'model' => $this->findModel ( $id ) ,
'detstaDp' => $detstaDp
] );
@@ -136,7 +137,7 @@ class UgiroController extends Controller {
* @param \common\models\Ugiro $model
*/
protected function downloadUgiroXls($model) {
$fn = "köteg.". $model->id_ugiro . ".xls";
$query = new Query();
@@ -159,7 +160,7 @@ class UgiroController extends Controller {
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
'query' => $query,
'sort' => false,
'pagination' => false
]
@@ -278,11 +279,11 @@ class UgiroController extends Controller {
exit ();
}
protected function downloadUgiroPdf($model) {
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "köteg.". $model->id_ugiro . ".pdf";
$mpdf->useSubstitutions = false;
@@ -325,99 +326,99 @@ class UgiroController extends Controller {
/**
* Creates a new Ugiro model.
* If creation is successful, the browser will be redirected to the 'view' page.
*
*
* @return mixed
*/
public function actionCreate() {
$model = new Ugiro ();
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ugiro
'id' => $model->id_ugiro
] );
} else {
return $this->render ( 'create', [
'model' => $model
return $this->render ( 'create', [
'model' => $model
] );
}
}
/**
* Updates an existing Ugiro model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
*
* @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 ( [
return $this->redirect ( [
'view',
'id' => $model->id_ugiro
'id' => $model->id_ugiro
] );
} else {
return $this->render ( 'update', [
'model' => $model
return $this->render ( 'update', [
'model' => $model
] );
}
}
/**
* Deletes an existing Ugiro model.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel ( $id )->delete ();
return $this->redirect ( [
'index'
return $this->redirect ( [
'index'
] );
}
public function actionDetsta() {
$ugiro = Ugiro::findOne ( 31 );
$model = new DetStatProcessor ( [
'koteg' => $ugiro
$model = new DetStatProcessor ( [
'koteg' => $ugiro
] );
return $this->render ( 'detsta', [
'model' => $model
return $this->render ( 'detsta', [
'model' => $model
] );
}
public function actionUpload() {
$model = new DestaUploadForm ();
if (Yii::$app->request->isPost) {
$model->destaFile = UploadedFile::getInstance ( $model, 'destaFile' );
if ($model->upload ()) {
// file is uploaded successfully
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->koteg->id_ugiro
'id' => $model->koteg->id_ugiro
] );
}
}
return $this->render ( 'upload', [
'model' => $model
return $this->render ( 'upload', [
'model' => $model
] );
}
public function actionGenerateDetsta() {
}
/**
* Finds the Ugiro model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param integer $id
*
* @param integer $id
* @return Ugiro the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/

View File

@@ -12,7 +12,6 @@ use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use backend\models\UserUpdate;
use common\models\Account;
use common\models\UserAccountAssignment;
@@ -109,6 +108,8 @@ class UserController extends \backend\controllers\BackendController
public function updateAccountAssignments($model){
echo "saving accounts";
UserAccountAssignment::deleteAll(['id_user' => $model->id]);
foreach ( $model->selected_accounts as $id_account ){
$uaa = new UserAccountAssignment();

View File

@@ -8,7 +8,7 @@ use backend\models\WarehouseSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\base\BaseObject;
/**
* WarehouseController implements the CRUD actions for Warehouse model.

View File

@@ -2,6 +2,7 @@
namespace backend\models;
use common\models\HuBankAccountValidator;
use Yii;
use yii\base\Model;
use common\models\Card;
@@ -16,25 +17,48 @@ use common\models\TicketInstallmentRequest;
* @property \Yii\web\UploadedFile $file
*/
class TicketInstallmentMarkForSendForm extends Model{
public $items;
public function rules(){
return [
['items', 'each', 'rule' => ['integer']],
['items', 'validateBankAccount'],
];
}
public function validateBankAccount($attribute, $params){
$items = TicketInstallmentRequest::find()->andWhere([
'in', 'id_ticket_installment_request' , $this->items
])->all();
\Yii::info("validateBankAccount:". count($items));
$validator = new HuBankAccountValidator();
foreach($items as $item){
\Yii::info("validateBankAccount2:". $item->id_ticket_installment_request);
/** @var Customer $customer */
$customer = $item->customer;
\Yii::info("validateBankAccount3:". $customer->username);
$isBankAccountValid = $validator->validate($customer->bank_account);
if (!$isBankAccountValid){
$errorMessage = "";
$errorMessage .= "Vendég=".$customer->name;
$errorMessage .= "; Kártya=".$customer->card->number;
$errorMessage .= "; Megbízás=".$item->id_ticket_installment_request;
$this->addError('items', "Hibás bankszámlaszám:" .$errorMessage );
}
}
}
public function markForSend(){
\Yii::info("mark for send");
if ( $this->validate() && isset($this->items ) && is_array($this->items ) ){
$updated = 0;
$updated = TicketInstallmentRequest::updateAll(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND ],['in', 'id_ticket_installment_request' , $this->items]);
\Yii::$app->session->setFlash('success', $updated . " megbízás küldésre jelölve " );
}else{
\Yii::$app->session->setFlash('success', " Nem történt küldésre jelölés! " );
\Yii::$app->session->setFlash('error', " Nem történt küldésre jelölés! " . $this->getFirstError('items') );
}
}
}

View File

@@ -7,7 +7,7 @@ use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\db\Expression;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\helpers\ArrayHelper;
use common\components\Helper;

View File

@@ -6,7 +6,7 @@ use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\db\Expression;
use common\models\Account;

View File

@@ -7,7 +7,7 @@ use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\db\Expression;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\helpers\ArrayHelper;
use common\models\Account;

View File

@@ -49,31 +49,31 @@ class UserUpdate extends User {
];
}
public function validateEmail($attribute, $params){
/** @var User $user */
$user = User::find()
->andWhere(['email' => $this->email])->one();
if (isset($user)){
if ( $user->id != $this->id ){
$this->addError($attribute,'Az email cím már használatban van!');
}
}
}
public function validateUsername($attribute, $params){
/** @var User $user */
$user = User::find()
->andWhere(['username' => $this->username])->one();
if (isset($user)){
if ( $user->id != $this->id ){
$this->addError($attribute,'A felhasználónév már használatban van!');
}
}
}
// public function validateEmail($attribute, $params){
// /** @var User $user */
// $user = User::find()
// ->andWhere(['email' => $this->email])->one();
//
// if (isset($user)){
// if ( $user->id != $this->id ){
// $this->addError($attribute,'Az email cím már használatban van!');
// }
// }
//
// }
//
// public function validateUsername($attribute, $params){
// /** @var User $user */
// $user = User::find()
// ->andWhere(['username' => $this->username])->one();
//
// if (isset($user)){
// if ( $user->id != $this->id ){
// $this->addError($attribute,'A felhasználónév már használatban van!');
// }
// }
//
// }
/**
* @formatter:on
@@ -87,6 +87,28 @@ class UserUpdate extends User {
}
}
}
public function validateEmail($attribute, $params) {
if (! $this->hasErrors ()) {
if ( !empty($this->email) ){
$user = User::findOne(['email' => $this->email]);
if ( isset($user) && $user->id != $this->id){
$this->addError ( $attribute, "Az email már használatban van (".$user->username.")");
}
}
}
}
public function validateUsername($attribute, $params) {
if (! $this->hasErrors ()) {
if ( !empty($this->email) ){
$user = User::findOne(['username' => $this->username]);
if ( isset($user) && $user->id != $this->id){
$this->addError ( $attribute, "A felhasználónév már használatban van (".$user->username.")");
}
}
}
}
public function attributeLabels() {
return [

View File

@@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\DetailView;
use yii\base\Widget;
use yii\base\Object;
use yii\base\BaseObject;
use yii\data\ArrayDataProvider;
use common\components\AccountStatisticWidget;
use common\components\DataProviderTotal;

View File

@@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\DetailView;
use yii\base\Widget;
use yii\base\Object;
use yii\base\BaseObject;
use yii\data\ArrayDataProvider;
use common\components\AccountStatisticWidget;
use common\components\DataProviderTotal;