update mpdf lib version from 6 to 8
This commit is contained in:
parent
ac21048f95
commit
f848b34245
@ -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.
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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]);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
41
common/components/MpdfUtil.php
Normal file
41
common/components/MpdfUtil.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace common\components;
|
||||
|
||||
use Mpdf\Mpdf;
|
||||
use yii\base\BaseObject;
|
||||
|
||||
class MpdfUtil extends BaseObject
|
||||
{
|
||||
|
||||
// mpdf version 6 constructor
|
||||
//function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P') {
|
||||
|
||||
public static function createMpdfWith6XConstructor($mode = '', $format = 'A4', $default_font_size = 0, $default_font = '', $mgl = 15, $mgr = 15, $mgt = 16, $mgb = 16, $mgh = 9, $mgf = 9, $orientation = 'P')
|
||||
{
|
||||
return self::createMpdf([
|
||||
'mode' => $mode,
|
||||
'format' => $format,
|
||||
'default_font_size' => $default_font_size,
|
||||
'default_font' => $default_font,
|
||||
'margin_left' => $mgl,
|
||||
'margin_right' => $mgr,
|
||||
'margin_top' => $mgt,
|
||||
'margin_bottom' => $mgb,
|
||||
'margin_header' => $mgh,
|
||||
'margin_footer' => $mgf,
|
||||
'orientation' => $orientation
|
||||
]);
|
||||
}
|
||||
|
||||
public static function createMpdf($options = [])
|
||||
{
|
||||
$mpdf = new Mpdf(
|
||||
array_merge([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4'
|
||||
], $options)
|
||||
);
|
||||
return $mpdf;
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,7 @@ use common\models\User;
|
||||
use common\models\Account;
|
||||
use common\models\AccountState;
|
||||
use common\components\DailyListing;
|
||||
use common\components\MpdfUtil;
|
||||
use yii\base\BaseObject;
|
||||
|
||||
/**
|
||||
@ -76,7 +77,7 @@ class AccountStateMail extends BaseObject {
|
||||
|
||||
|
||||
protected function attachPdf(){
|
||||
$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()) );
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"dmstr/yii2-adminlte-asset": "2.*",
|
||||
"bassjobsen/bootstrap-3-typeahead": "^4.0",
|
||||
"bower-asset/webcamjs": "^1.0",
|
||||
"mpdf/mpdf": "^6.0",
|
||||
"mpdf/mpdf": "^8.1",
|
||||
"os/php-excel": "^2.1",
|
||||
"phpoffice/phpexcel": "^1.8",
|
||||
"2amigos/yii2-tinymce-widget": "~1.1",
|
||||
|
||||
356
composer.lock
generated
356
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d1d630cf85ac72b3cb7d161afee070fe",
|
||||
"content-hash": "138d862466e8a155a65957524deabe0f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "2amigos/yii2-tinymce-widget",
|
||||
@ -2200,46 +2200,69 @@
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v6.0.0",
|
||||
"version": "v8.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/mpdf.git",
|
||||
"reference": "a15743d030ce3b5b7be36c6e83f76589b27c3f2c"
|
||||
"reference": "add590e93b7502efafd9839a68cff99f3497b318"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/a15743d030ce3b5b7be36c6e83f76589b27c3f2c",
|
||||
"reference": "a15743d030ce3b5b7be36c6e83f76589b27c3f2c",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/add590e93b7502efafd9839a68cff99f3497b318",
|
||||
"reference": "add590e93b7502efafd9839a68cff99f3497b318",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=4.3.10"
|
||||
"myclabs/deep-copy": "^1.7",
|
||||
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
|
||||
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
|
||||
"php-http/message-factory": "^1.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/log": "^1.0 || ^2.0",
|
||||
"setasign/fpdi": "^2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3.0",
|
||||
"mpdf/qrcode": "^1.1.0",
|
||||
"squizlabs/php_codesniffer": "^3.5.0",
|
||||
"tracy/tracy": "~2.5",
|
||||
"yoast/phpunit-polyfills": "^1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "Needed for generation of some types of barcodes",
|
||||
"ext-xml": "Needed mainly for SVG manipulation",
|
||||
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"mpdf.php",
|
||||
"classes"
|
||||
]
|
||||
"psr-4": {
|
||||
"Mpdf\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-1.0+"
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ian Back"
|
||||
"name": "Matěj Humpál",
|
||||
"role": "Developer, maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Ian Back",
|
||||
"role": "Developer (retired)"
|
||||
}
|
||||
],
|
||||
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
|
||||
"homepage": "http://www.mpdf1.com/mpdf/index.php",
|
||||
"description": "PHP library generating PDF files from UTF-8 encoded HTML",
|
||||
"homepage": "https://mpdf.github.io",
|
||||
"keywords": [
|
||||
"pdf",
|
||||
"php",
|
||||
"utf-8"
|
||||
],
|
||||
"time": "2015-03-01T10:27:49+00:00"
|
||||
"time": "2022-12-15T11:24:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mrclay/minify",
|
||||
@ -2286,6 +2309,55 @@
|
||||
"homepage": "http://code.google.com/p/minify/",
|
||||
"time": "2016-03-08T11:49:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614",
|
||||
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.6.8",
|
||||
"doctrine/common": "^2.13.3 || ^3.2.2",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2022-03-03T13:19:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/php-enum",
|
||||
"version": "1.6.6",
|
||||
@ -2415,6 +2487,101 @@
|
||||
],
|
||||
"time": "2012-05-02T20:42:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v9.99.100",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
|
||||
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">= 7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*|5.*",
|
||||
"vimeo/psalm": "^1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paragon Initiative Enterprises",
|
||||
"email": "security@paragonie.com",
|
||||
"homepage": "https://paragonie.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||
"keywords": [
|
||||
"csprng",
|
||||
"polyfill",
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2020-10-15T08:29:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/message-factory",
|
||||
"version": "v1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/message-factory.git",
|
||||
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
|
||||
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Factory interfaces for PSR-7 HTTP Message",
|
||||
"homepage": "http://php-http.org",
|
||||
"keywords": [
|
||||
"factory",
|
||||
"http",
|
||||
"message",
|
||||
"stream",
|
||||
"uri"
|
||||
],
|
||||
"time": "2015-12-19T14:08:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
"version": "1.8.1",
|
||||
@ -2473,6 +2640,103 @@
|
||||
"abandoned": "phpoffice/phpspreadsheet",
|
||||
"time": "2015-05-01T07:00:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
"psr",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2021-05-03T11:20:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rmrevin/yii2-fontawesome",
|
||||
"version": "2.12.2",
|
||||
@ -2525,6 +2789,68 @@
|
||||
],
|
||||
"time": "2015-11-20T09:17:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
"version": "v2.3.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Setasign/FPDI.git",
|
||||
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
|
||||
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-zlib": "*",
|
||||
"php": "^5.6 || ^7.0 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"setasign/tfpdf": "<1.31"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~5.7",
|
||||
"setasign/fpdf": "~1.8",
|
||||
"setasign/tfpdf": "1.31",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"tecnickcom/tcpdf": "~6.2"
|
||||
},
|
||||
"suggest": {
|
||||
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"setasign\\Fpdi\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jan Slabon",
|
||||
"email": "jan.slabon@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
},
|
||||
{
|
||||
"name": "Maximilian Kresse",
|
||||
"email": "maximilian.kresse@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
}
|
||||
],
|
||||
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
|
||||
"homepage": "https://www.setasign.com/fpdi",
|
||||
"keywords": [
|
||||
"fpdf",
|
||||
"fpdi",
|
||||
"pdf"
|
||||
],
|
||||
"time": "2021-02-11T11:37:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sizeg/yii2-jwt",
|
||||
"version": "v2.0.0",
|
||||
|
||||
33
doc/composer.md
Normal file
33
doc/composer.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Composer Knowledge base
|
||||
|
||||
## upgrade packages
|
||||
|
||||
[upgrade.txt](./upgrade.txt)
|
||||
|
||||
## use newer github tokens
|
||||
|
||||
Edit the composer authentication configuration file ~/.composer/auth.json.
|
||||
```bash
|
||||
nano ~/.composer/auth.json
|
||||
```
|
||||
Then replace the following.
|
||||
```json
|
||||
{
|
||||
"github-oauth": {
|
||||
"github.com": "ghp_[YOUR-PERSONAL-TOKEN]"
|
||||
}
|
||||
}
|
||||
```
|
||||
With this (basic auth):
|
||||
|
||||
```json
|
||||
{
|
||||
"http-basic": {
|
||||
"github.com": {
|
||||
"username": "[YOUR-GITHUB-USERNAME]",
|
||||
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -31,7 +31,7 @@ RUN pecl update-channels
|
||||
RUN pecl install mcrypt
|
||||
|
||||
RUN apt-get -y install \
|
||||
# Required by composer
|
||||
# Required by composr
|
||||
git \
|
||||
zlib1g-dev \
|
||||
--no-install-recommends
|
||||
|
||||
@ -16,16 +16,17 @@ use common\models\User;
|
||||
use common\components\accountstate\AccountStateMail;
|
||||
use common\models\Transfer;
|
||||
use common\components\Helper;
|
||||
use common\components\MpdfUtil;
|
||||
|
||||
/**
|
||||
* AccountStateController implements the CRUD actions for AccountState model.
|
||||
*/
|
||||
class AccountStateController extends Controller {
|
||||
public function behaviors() {
|
||||
return [
|
||||
'access' => [
|
||||
return [
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className (),
|
||||
'only' => [
|
||||
'only' => [
|
||||
'index',
|
||||
'open',
|
||||
'close',
|
||||
@ -34,17 +35,17 @@ class AccountStateController extends Controller {
|
||||
],
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
[
|
||||
'allow' => true,
|
||||
'roles' => [
|
||||
'@'
|
||||
]
|
||||
]
|
||||
]
|
||||
'roles' => [
|
||||
'@'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
// everything else is denied
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@ -60,15 +61,15 @@ class AccountStateController extends Controller {
|
||||
}
|
||||
|
||||
$searchModel = new AccountstateSearch ();
|
||||
|
||||
|
||||
$searchModel->accounts = Account::read ();
|
||||
$searchModel->users = User::read ();
|
||||
|
||||
|
||||
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||
|
||||
return $this->render ( 'index', [
|
||||
|
||||
return $this->render ( 'index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider
|
||||
'dataProvider' => $dataProvider
|
||||
] );
|
||||
}
|
||||
|
||||
@ -98,38 +99,38 @@ class AccountStateController extends Controller {
|
||||
public function actionOpen() {
|
||||
$lastStates = AccountState::readLastForUser ( AccountState::TYPE_CLOSE );
|
||||
$lastStates = AccountState::modelsToArray ( $lastStates );
|
||||
|
||||
|
||||
|
||||
|
||||
$model = new AccountState ();
|
||||
$model->type = AccountState::TYPE_OPEN;
|
||||
$model->id_user = Yii::$app->user->id;
|
||||
$model->id_account = Account::readDefault ();
|
||||
|
||||
|
||||
$account = Account::readDefaultObject();
|
||||
|
||||
|
||||
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||
// return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||
|
||||
|
||||
|
||||
|
||||
if ( Helper::isAccountStateOpenSendMail() ){
|
||||
$mail = new AccountStateMail(['model' => $model,'controller' => $this]);
|
||||
$mail->sednMail();
|
||||
}
|
||||
|
||||
|
||||
$redirectTo = 'index';
|
||||
|
||||
if ( Helper::isReceptionAccountStateIndexToday() ){
|
||||
$redirectTo = 'today';
|
||||
}
|
||||
|
||||
return $this->redirect ( [
|
||||
return $this->redirect ( [
|
||||
$redirectTo
|
||||
] );
|
||||
} else {
|
||||
|
||||
|
||||
$accounts = Account::read ();
|
||||
|
||||
return $this->render ( 'open', [
|
||||
|
||||
return $this->render ( 'open', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'lastStates' => $lastStates,
|
||||
@ -151,19 +152,19 @@ class AccountStateController extends Controller {
|
||||
$model->id_user = Yii::$app->user->id;
|
||||
$model->id_account = Account::readDefault ();
|
||||
$account = Account::readDefaultObject();
|
||||
|
||||
$lastCassaState = AccountState::readLast(null,null, Account::readDefault());
|
||||
|
||||
|
||||
|
||||
|
||||
$lastCassaState = AccountState::readLast(null,null, Account::readDefault());
|
||||
|
||||
|
||||
|
||||
|
||||
if ( Helper::isAccountStateClosePreloadMoney()){
|
||||
$model->money = $this->readCassaClose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||
|
||||
|
||||
if ( Helper::isAccountStateCloseSendMail()){
|
||||
$mail = new AccountStateMail(['model' => $model,'controller' => $this]);
|
||||
$mail->sednMail();
|
||||
@ -181,10 +182,10 @@ class AccountStateController extends Controller {
|
||||
] );
|
||||
// return $this->redirect(['view', 'id' => $model->id_account_state]);
|
||||
} else {
|
||||
|
||||
|
||||
$accounts = Account::read ();
|
||||
|
||||
return $this->render ( 'close', [
|
||||
|
||||
return $this->render ( 'close', [
|
||||
'model' => $model,
|
||||
'accounts' => $accounts,
|
||||
'account' => $account,
|
||||
@ -193,7 +194,7 @@ class AccountStateController extends Controller {
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function readCassaClose(){
|
||||
$total = 0;
|
||||
$openDate = null;
|
||||
@ -205,12 +206,12 @@ class AccountStateController extends Controller {
|
||||
$total += Transfer::readPaidCash($openDate, date('Y-m-d H:i:s'), \Yii::$app->user->id);
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the AccountState 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 AccountState the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
@ -228,12 +229,12 @@ class AccountStateController extends Controller {
|
||||
throw new NotFoundHttpException ( 'The requested page does not exist.' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes an existing AccountState 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) {
|
||||
@ -264,7 +265,7 @@ class AccountStateController extends Controller {
|
||||
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
|
||||
$details = null;
|
||||
if ($accountState->isTypeClose ()) {
|
||||
|
||||
|
||||
$prev = null;
|
||||
if ($accountState->type == AccountState::TYPE_CLOSE) {
|
||||
if (isset ( $accountState->prev_state )) {
|
||||
@ -276,53 +277,53 @@ class AccountStateController extends Controller {
|
||||
}
|
||||
$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()) );
|
||||
/** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
|
||||
$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
|
||||
]));
|
||||
/** @noinspection SpellCheckingInspection */
|
||||
$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');
|
||||
exit(0);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
return $this->render ( 'view', [
|
||||
|
||||
return $this->render ( 'view', [
|
||||
'model' => $accountState,
|
||||
'details' => $details
|
||||
'details' => $details
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function actionMixed($id){
|
||||
$accountState = $this->findModel ( $id );
|
||||
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
|
||||
$details = null;
|
||||
|
||||
|
||||
if ($accountState->isTypeClose ()) {
|
||||
|
||||
|
||||
$prev = null;
|
||||
if ($accountState->type == AccountState::TYPE_CLOSE) {
|
||||
if (isset ( $accountState->prev_state )) {
|
||||
@ -334,30 +335,30 @@ class AccountStateController extends Controller {
|
||||
}
|
||||
$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');
|
||||
$mpdf=new Mpdf('utf-8', 'A4');
|
||||
$mpdf->useSubstitutions=false;
|
||||
$mpdf->simpleTables = true;
|
||||
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||
/** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
|
||||
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||
|
||||
|
||||
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||
$mpdf->WriteHTML($stylesheet,1);
|
||||
|
||||
|
||||
$stylesheet = file_get_contents( \Yii::getAlias('@frontend'.'/web/css/account_close.css')); // external css
|
||||
$mpdf->WriteHTML($stylesheet,1);
|
||||
|
||||
|
||||
|
||||
|
||||
$mpdf->WriteHTML($this->renderPartial("@frontend/views/account-state/mixed_pdf", [
|
||||
'model' => $accountState,
|
||||
'details' => $details
|
||||
@ -367,8 +368,8 @@ class AccountStateController extends Controller {
|
||||
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
|
||||
$fn= $type .$dt.".pdf";
|
||||
$mpdf->Output($fn, 'D');
|
||||
exit();
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
return $this->render ( 'mixed', [
|
||||
'model' => $accountState,
|
||||
|
||||
@ -19,27 +19,28 @@ use common\models\Product;
|
||||
use common\models\ShoppingCart;
|
||||
use common\models\Customer;
|
||||
use frontend\models\ContractForm;
|
||||
use common\components\MpdfUtil;
|
||||
|
||||
/**
|
||||
* ContractController implements the CRUD actions for Contract model.
|
||||
*/
|
||||
class ContractController extends Controller {
|
||||
public function behaviors() {
|
||||
return [
|
||||
'verbs' => [
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className (),
|
||||
'actions' => [
|
||||
'delete' => [
|
||||
'post'
|
||||
'actions' => [
|
||||
'delete' => [
|
||||
'post'
|
||||
],
|
||||
'payout' => [
|
||||
'post'
|
||||
'payout' => [
|
||||
'post'
|
||||
],
|
||||
'cancel' => [
|
||||
'post'
|
||||
]
|
||||
]
|
||||
]
|
||||
'cancel' => [
|
||||
'post'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@ -51,18 +52,18 @@ class ContractController extends Controller {
|
||||
*/
|
||||
public function actionIndex($id_card) {
|
||||
$card = Card::findOne ( $id_card );
|
||||
|
||||
|
||||
if (! isset ( $card ))
|
||||
throw new NotFoundHttpException ( 'A bérlet nem található' );
|
||||
|
||||
|
||||
$searchModel = new ContractSearch ();
|
||||
$searchModel->card = $card;
|
||||
$searchModel->customer = $card->customer;
|
||||
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||
|
||||
return $this->render ( 'index', [
|
||||
|
||||
return $this->render ( 'index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider
|
||||
'dataProvider' => $dataProvider
|
||||
] );
|
||||
}
|
||||
|
||||
@ -77,20 +78,20 @@ class ContractController extends Controller {
|
||||
$model = $this->findModel ( $id );
|
||||
$customer = $model->customer;
|
||||
$card = $customer->card;
|
||||
|
||||
$installments = TicketInstallmentRequest::find ()->andWhere ( [
|
||||
'id_contract' => $model->id_contract
|
||||
] )->orderBy ( [
|
||||
'ticket_installment_request.priority' => SORT_ASC
|
||||
|
||||
$installments = TicketInstallmentRequest::find ()->andWhere ( [
|
||||
'id_contract' => $model->id_contract
|
||||
] )->orderBy ( [
|
||||
'ticket_installment_request.priority' => SORT_ASC
|
||||
] )->all ();
|
||||
|
||||
return $this->render ( 'view', [
|
||||
|
||||
return $this->render ( 'view', [
|
||||
'model' => $model,
|
||||
'intstallments' => $installments,
|
||||
'card' => $card
|
||||
'card' => $card
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new Contract model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
@ -99,15 +100,15 @@ class ContractController extends Controller {
|
||||
*/
|
||||
public function actionCreate() {
|
||||
$model = new Contract ();
|
||||
|
||||
|
||||
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||
return $this->redirect ( [
|
||||
return $this->redirect ( [
|
||||
'view',
|
||||
'id' => $model->id_contract
|
||||
'id' => $model->id_contract
|
||||
] );
|
||||
} else {
|
||||
return $this->render ( 'create', [
|
||||
'model' => $model
|
||||
return $this->render ( 'create', [
|
||||
'model' => $model
|
||||
] );
|
||||
}
|
||||
}
|
||||
@ -122,15 +123,15 @@ class ContractController extends Controller {
|
||||
*/
|
||||
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_contract
|
||||
'id' => $model->id_contract
|
||||
] );
|
||||
} else {
|
||||
return $this->render ( 'update', [
|
||||
'model' => $model
|
||||
return $this->render ( 'update', [
|
||||
'model' => $model
|
||||
] );
|
||||
}
|
||||
}
|
||||
@ -146,12 +147,12 @@ class ContractController extends Controller {
|
||||
*/
|
||||
public function actionDelete($id) {
|
||||
$this->findModel ( $id )->delete ();
|
||||
|
||||
return $this->redirect ( [
|
||||
'index'
|
||||
|
||||
return $this->redirect ( [
|
||||
'index'
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* EGY RÉSZLET KIFIZETÉSE
|
||||
*/
|
||||
@ -160,33 +161,33 @@ class ContractController extends Controller {
|
||||
$contract = $part->contract;
|
||||
$customer = $contract->customer;
|
||||
$card = $customer->card;
|
||||
|
||||
|
||||
$connection = \Yii::$app->db;
|
||||
$transaction = $connection->beginTransaction ();
|
||||
try {
|
||||
|
||||
|
||||
$result = Transfer::sellContractTicket ( $contract, $part, Account::readDefaultObject (), Transfer::STATUS_NOT_PAID, Transfer::PAYMENT_METHOD_CASH, true );
|
||||
$transfer = $result [0];
|
||||
$ticket = $result [1];
|
||||
if ($part->status != TicketInstallmentRequest::$STATUS_REJECTED) {
|
||||
$contract->part_required = $contract->part_required + 1;
|
||||
}
|
||||
|
||||
|
||||
$contract->part_paid = $contract->part_paid + 1;
|
||||
|
||||
|
||||
if ($contract->part_paid >= $contract->part_required) {
|
||||
$contract->status = Contract::$STATUS_PAID;
|
||||
} else {
|
||||
$contract->status = Contract::$STATUS_NOT_PAID;
|
||||
}
|
||||
|
||||
|
||||
$contract->save ( false );
|
||||
|
||||
|
||||
$part->status = TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL;
|
||||
$part->id_transfer = $transfer->id_transfer;
|
||||
$part->request_processed_at = Helper::getDateTimeString ();
|
||||
$part->id_ticket = $ticket->id_ticket;
|
||||
|
||||
|
||||
$part->save ( false );
|
||||
$transaction->commit ();
|
||||
\Yii::$app->session->setFlash ( 'success', "Részlet a bevásárló kosárba helyezve!" );
|
||||
@ -194,10 +195,10 @@ class ContractController extends Controller {
|
||||
$transaction->rollback ();
|
||||
Yii::error ( "Nem sikerült a kifizetés." );
|
||||
}
|
||||
|
||||
return $this->redirect ( [
|
||||
|
||||
return $this->redirect ( [
|
||||
'view',
|
||||
'id' => $contract->id_contract
|
||||
'id' => $contract->id_contract
|
||||
] );
|
||||
}
|
||||
|
||||
@ -211,26 +212,26 @@ class ContractController extends Controller {
|
||||
*/
|
||||
public function actionCancel($id,$flag) {
|
||||
$contract = $this->findModel ( $id );
|
||||
|
||||
|
||||
if ( $flag != Contract::$FLAG_CANCELED && $flag != Contract::$FLAG_CANCELED_2){
|
||||
\Yii::error("A felmondási státusz nem található! ($flag)");
|
||||
throw new NotFoundHttpException("Az oldal nem található!");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$customer = $contract->customer;
|
||||
$card = $customer->card;
|
||||
|
||||
|
||||
if ($contract->canCancel ()) {
|
||||
$connection = \Yii::$app->db;
|
||||
$transaction = $connection->beginTransaction ();
|
||||
try {
|
||||
|
||||
|
||||
$contract->flag = $flag;
|
||||
$contract->save ();
|
||||
$requests = $contract->requests;
|
||||
$buntetes = 0;
|
||||
|
||||
|
||||
foreach ( $requests as $request ) {
|
||||
/** @var \common\models\TicketInstallmentRequest $request*/
|
||||
if ($request->isStatusAccepted ()) {
|
||||
@ -240,15 +241,15 @@ class ContractController extends Controller {
|
||||
$request->save ( false );
|
||||
}
|
||||
}
|
||||
|
||||
$productBuntetes = Product::find ()->andWhere ( [
|
||||
'product_number' => Product::$BUNTETES
|
||||
|
||||
$productBuntetes = Product::find ()->andWhere ( [
|
||||
'product_number' => Product::$BUNTETES
|
||||
] )->one ();
|
||||
|
||||
// if there is a fee , generate fee and put it to the shopping cart
|
||||
if (isset ( $productBuntetes )) {
|
||||
if ($buntetes > 0) {
|
||||
|
||||
|
||||
$sale = new Sale ();
|
||||
$sale->id_account = Account::readDefault ();
|
||||
$sale->id_product = $productBuntetes->id_product;
|
||||
@ -258,29 +259,29 @@ class ContractController extends Controller {
|
||||
$sale->count = $buntetes;
|
||||
$sale->money = $buntetes * $sale->item_price;
|
||||
$sale->id_user = \Yii::$app->user->id;
|
||||
|
||||
|
||||
$sale->save ( false );
|
||||
|
||||
|
||||
$transfer = Transfer::createProductTransfer ( $sale, Account::readDefaultObject (), null, null, $sale->count, $productBuntetes, Transfer::STATUS_NOT_PAID, $customer );
|
||||
$transfer->payment_method = Transfer::PAYMENT_METHOD_CASH;
|
||||
|
||||
|
||||
$transfer->id_user = Yii::$app->user->id;
|
||||
|
||||
|
||||
$transfer->save ( false );
|
||||
|
||||
|
||||
$cart = new ShoppingCart ();
|
||||
$cart->id_customer = $customer->id_customer;
|
||||
$cart->id_transfer = $transfer->id_transfer;
|
||||
$cart->save ( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$transaction->commit ();
|
||||
\Yii::$app->session->setFlash ( 'success', "Szerződés felbontva!" );
|
||||
|
||||
return $this->redirect ( [
|
||||
|
||||
return $this->redirect ( [
|
||||
'product/sale',
|
||||
'number' => $card->number
|
||||
'number' => $card->number
|
||||
] );
|
||||
} catch ( Exception $e ) {
|
||||
$transaction->rollback ();
|
||||
@ -289,10 +290,10 @@ class ContractController extends Controller {
|
||||
} else {
|
||||
\Yii::$app->session->setFlash ( 'danger', "Szerződést nem lehet felbontani!" );
|
||||
}
|
||||
|
||||
return $this->redirect ( [
|
||||
|
||||
return $this->redirect ( [
|
||||
'view',
|
||||
'id' => $contract->id_contract
|
||||
'id' => $contract->id_contract
|
||||
] );
|
||||
}
|
||||
|
||||
@ -303,31 +304,31 @@ class ContractController extends Controller {
|
||||
*/
|
||||
public function actionMake($id) {
|
||||
$customer = Customer::findOne ( $id );
|
||||
|
||||
|
||||
if (! isset ( $customer )) {
|
||||
throw new Exception ( "Az oldal nem található" );
|
||||
}
|
||||
|
||||
|
||||
$model = new ContractForm ( [
|
||||
|
||||
|
||||
$model = new ContractForm ( [
|
||||
'customer' => $customer ,
|
||||
'idUser' => \Yii::$app->user->id,
|
||||
'idAccount' => Account::readDefault ()
|
||||
] );
|
||||
|
||||
|
||||
$model->started_at = date(date('Y.m.d'));
|
||||
|
||||
|
||||
$model->fillOut ();
|
||||
|
||||
|
||||
if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) {
|
||||
|
||||
|
||||
$connection = \Yii::$app->db;
|
||||
$transaction = $connection->beginTransaction ();
|
||||
try {
|
||||
|
||||
|
||||
$model->make ();
|
||||
$transaction->commit();
|
||||
return $this->redirect ( [
|
||||
return $this->redirect ( [
|
||||
'contract/view',
|
||||
'id' => $model->contract->id_contract
|
||||
] );
|
||||
@ -336,9 +337,9 @@ class ContractController extends Controller {
|
||||
\Yii::$app->session->setFlash('danger', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render ( '_make_contract', [
|
||||
'model' => $model
|
||||
|
||||
return $this->render ( '_make_contract', [
|
||||
'model' => $model
|
||||
] );
|
||||
}
|
||||
|
||||
@ -349,16 +350,18 @@ class ContractController extends Controller {
|
||||
*/
|
||||
public function actionContract($id){
|
||||
$model = $this->findModel($id);
|
||||
|
||||
|
||||
// print_r($model);
|
||||
|
||||
//$mpdf=new \mPDF('utf-8', 'A4');
|
||||
$mpdf=new \mPDF('utf-8','A4','','','15','15','26','18','3');
|
||||
|
||||
$mpdf= MpdfUtil::createMpdfWith6XConstructor('utf-8','A4','','','15','15','26','18','3');
|
||||
|
||||
$mpdf->SetHTMLHeader("<div style='height: 80px; text-align: right; ' ><img height='80px' src='" . \Yii::getAlias("@webroot") . DIRECTORY_SEPARATOR. "images" . DIRECTORY_SEPARATOR . "cutler_contract_pdf_header.jpg'></div>");
|
||||
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||
$mpdf->WriteHTML($this->renderPartial('_contract', [
|
||||
'model' => $model,
|
||||
]));
|
||||
|
||||
|
||||
$fileName = "szerzodes";
|
||||
$fileName .= "." . $model->customer->name;
|
||||
$fileName .= "." .\Yii::$app->formatter->asDate( $model->created_at, "Y");
|
||||
@ -367,12 +370,12 @@ class ContractController extends Controller {
|
||||
// $mpdf->Output('szerzodes.pdf', 'I');//open in new tab
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the Contract 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 Contract the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
|
||||
@ -25,6 +25,7 @@ use common\models\Customer;
|
||||
use frontend\models\CustomerCartForm;
|
||||
use common\models\Card;
|
||||
use common\components\Helper;
|
||||
use common\components\MpdfUtil;
|
||||
use yii\base\Exception;
|
||||
use common\components\TransferPayout;
|
||||
|
||||
@ -83,20 +84,20 @@ class TransferController extends Controller
|
||||
if ( !Helper::isReceptionTransferIndexEnabled()){
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
|
||||
$searchModel = new TransferSearch();
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->load(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
$searchModel->totalsTransfers(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +120,7 @@ class TransferController extends Controller
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Transfer models.
|
||||
* @return mixed
|
||||
@ -129,14 +130,14 @@ class TransferController extends Controller
|
||||
$searchModel = new TransferListSearch();
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->load(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
$searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->render('list', [
|
||||
'searchModel' => $searchModel,
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,7 +152,7 @@ class TransferController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new Transfer model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
@ -160,10 +161,10 @@ class TransferController extends Controller
|
||||
public function actionMoneyMovementCreate()
|
||||
{
|
||||
$model = new Transfer();
|
||||
|
||||
|
||||
$model->type = Transfer::TYPE_MONEY_MOVEMENT_OUT;
|
||||
$model->direction = Transfer::DIRECTION_OUT;
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_transfer]);
|
||||
} else {
|
||||
@ -189,8 +190,8 @@ class TransferController extends Controller
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Updates an existing Transfer model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
@ -221,16 +222,16 @@ class TransferController extends Controller
|
||||
$transfer = $this->findModel($id);
|
||||
$connection = \Yii::$app->db;
|
||||
$transaction = $connection->beginTransaction();
|
||||
|
||||
|
||||
try {
|
||||
$tp = new TransferPayout( [
|
||||
'idUser' => \Yii::$app->user->id,
|
||||
'idTransfers' => [$transfer->id_transfer ],
|
||||
'idTransfers' => [$transfer->id_transfer ],
|
||||
'idAccount' => Account::readDefault (),
|
||||
] );
|
||||
|
||||
|
||||
$tp->payout ();
|
||||
|
||||
|
||||
// UserSoldItem::payout ( $user, $model->transfers );
|
||||
$transaction->commit ();
|
||||
\Yii::$app->session->setFlash ( 'success', 'Tranzakció fizetve: ' . $transfer->count ." db " . $transfer->getObjectName() . " - " . $transfer->money);
|
||||
@ -241,10 +242,10 @@ class TransferController extends Controller
|
||||
$transaction->rollback ();
|
||||
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||
}
|
||||
|
||||
|
||||
return $this->redirect(Yii::$app->request->referrer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes an existing Transfer model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
@ -266,17 +267,17 @@ class TransferController extends Controller
|
||||
// }else{
|
||||
// throw new \Exception("Failed to save");
|
||||
// }
|
||||
|
||||
|
||||
} catch(Exception $e) {
|
||||
$transaction->rollback();
|
||||
\Yii::$app->session->setFlash( 'danger','Tranzakció törlése nem sikerült' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this->redirect(Yii::$app->request->referrer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected function delete($id){
|
||||
$transfer = $this->findModel($id);
|
||||
$connection = \Yii::$app->db;
|
||||
@ -288,14 +289,14 @@ class TransferController extends Controller
|
||||
}else{
|
||||
throw new \Exception("Failed to save");
|
||||
}
|
||||
|
||||
|
||||
} catch(Exception $e) {
|
||||
$transaction->rollback();
|
||||
\Yii::$app->session->setFlash( 'danger','Tranzakció törlése nem sikerült' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Transfer models.
|
||||
* @return mixed
|
||||
@ -307,35 +308,35 @@ class TransferController extends Controller
|
||||
$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->accounts = Account::read();
|
||||
$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');
|
||||
$mpdf->WriteHTML($this->renderPartial('_result_sale', [
|
||||
'searchModel' => $searchModel,
|
||||
]));
|
||||
$mpdf->Output('eladasaim.pdf', 'D');
|
||||
exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Transfer models.
|
||||
@ -347,43 +348,43 @@ class TransferController extends Controller
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->users = User::read();
|
||||
$searchModel->ticketTypes = TicketType::read(null, Account::readDefault());
|
||||
|
||||
|
||||
$searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
|
||||
|
||||
return $this->render('tickets', [
|
||||
'searchModel' => $searchModel,
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function actionTicketsPdf(){
|
||||
$searchModel = new TransferTicketSearch();
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->users = User::read();
|
||||
$searchModel->ticketTypes = TicketType::read(null, Account::readDefault());
|
||||
|
||||
|
||||
$searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
|
||||
$mpdf=new \mPDF('utf-8', 'A4-L');
|
||||
|
||||
|
||||
$mpdf=new Mpdf('utf-8', 'A4-L');
|
||||
$mpdf->WriteHTML($this->renderPartial('_result_ticket', [
|
||||
'searchModel' => $searchModel,
|
||||
]));
|
||||
$mpdf->Output('eladdot_berletek_'. \Yii::$app->formatter->asDatetime(time()).'.pdf', 'D');
|
||||
exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function actionUserCart(){
|
||||
|
||||
|
||||
$defaultAccount = Account::readDefault();
|
||||
|
||||
|
||||
if ( !isset($defaultAccount)){
|
||||
return $this->redirect(['account/select']);
|
||||
}
|
||||
|
||||
|
||||
$model = new UserCartForm();
|
||||
if ($model->load(Yii::$app->request->post()) && $model->payout()) {
|
||||
return $this->redirect(['user-cart']);
|
||||
@ -391,31 +392,31 @@ class TransferController extends Controller
|
||||
$model->run();
|
||||
return $this->render("usercart",[ 'model' => $model]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function actionCustomerCart($id_card){
|
||||
|
||||
|
||||
$defaultAccount = Account::readDefault();
|
||||
|
||||
|
||||
if ( !isset($defaultAccount)){
|
||||
return $this->redirect(['account/select']);
|
||||
}
|
||||
|
||||
|
||||
$hiddenAccounts = Account::find()
|
||||
->andWhere(['type' => Account::TYPE_VALUE_HIDDEN])
|
||||
->andWhere(['status' => Account::STATUS_ACTIVE])->all();
|
||||
|
||||
|
||||
|
||||
$customer = null;
|
||||
$card = Card::findOne($id_card);
|
||||
if ($card != null )
|
||||
$customer = $card->customer;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( !isset($customer) ){
|
||||
throw new NotFoundHttpException ( 'Az oldal nem található' );
|
||||
}
|
||||
|
||||
|
||||
$model = new CustomerCartForm();
|
||||
$model->customer = $customer;
|
||||
$model->hiddenAccounts = $hiddenAccounts;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user