Finish version/v.0.0.25

This commit is contained in:
Roland Schneider 2016-01-22 19:28:46 +01:00
commit 58895a64f3
150 changed files with 5717 additions and 67 deletions

7
.gitignore vendored
View File

@ -33,4 +33,9 @@ phpunit.phar
/frontend/web/profile/**
!/frontend/web/profile/.gitkeep
/frontend/web/uploads/**
/frontend/web/uploads/**
/backend/web/giro/megbizas/**
!/backend/web/giro/megbizas/.gitkeep
/backend/web/giro/valasz/**
!/backend/web/giro/valasz/.gitkeep

5
backend/0209ch7z.det Normal file
View File

@ -0,0 +1,5 @@
01DETSTA8A24237545 201501270001201502094542162957
020000010000014097201501270020150204201502031104 03916201502031001307001595 0015520150127321538700000000000000000000000340
020000020000015240201501275020150204 1117 73377201502033417908001595 0015520150127321538800000000000000000000000347
020000030000015240201501270020150204201502031120 94002201502030005151001595 0015520150127321538900000000000000000000000176
03000002000000000002933700000100000000000152400000000000000000000000

View File

@ -0,0 +1,28 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace backend\assets;
use yii\web\AssetBundle;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class PendingRequestAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
];
public $js = [
'js/index.pending.js',
];
public $depends = [
'backend\assets\AppAsset',
];
}

View File

@ -5,6 +5,7 @@ use Yii;
use common\models\Order;
use yii\helpers\Html;
use common\components\RoleDefinition;
use common\components\Helper;
class AdminMenuStructure{
@ -103,6 +104,24 @@ class AdminMenuStructure{
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
'items' => $items
];
/////////////////////////////
// Tartós megbízások
/////////////////////////////
$items = [];
$items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index' , 'TicketInstallmentRequestSearch[start]' =>$today,'TicketInstallmentRequestSearch[end]' => $tomorrow ] ];
$items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending' , 'TicketInstallmentRequestSearchPending[end]' => $tomorrow ] ];
$items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro' ] ];
$items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index' ] ];
$items[] = ['label' => 'Detsta feltöltés', 'url' => ['/ugiro/upload' ] ];
// $items[] = ['label' => 'Részletek aktiválása', 'url' => ['/ugiro/parts' ] ];
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
// $items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
// $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
if ( RoleDefinition::isAdmin() || RoleDefinition::isEmployee() ){
$this->menuItems[] = ['label' => 'Tartós megbízások', 'url' => $this->emptyUrl,
'items' => $items
];
}
}

View File

@ -0,0 +1,212 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\TicketInstallmentRequest;
use backend\models\TicketInstallmentRequestSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use backend\models\TicketInstallmentRequestSearchPending;
use backend\models\TicketInstallmentMarkForSendForm;
use backend\models\TicketInstallmentRequestSearchDownloadGiro;
use backend\models\GiroKotegForm;
/**
* TicketInstallmentRequestController implements the CRUD actions for TicketInstallmentRequest model.
*/
class TicketInstallmentRequestController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
'accept' => ['post'],
],
],
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
'actions' => [],
'allow' => true,
'roles' => [
'admin',
'employee',
'reception'
]
]
]
// everything else is denied
]
];
}
/**
* Lists all TicketInstallmentRequest models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TicketInstallmentRequestSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Lists pending TicketInstallmentRequest models.
* @return mixed
*/
public function actionPending()
{
$model = new TicketInstallmentMarkForSendForm();
if ($model->load(Yii::$app->request->post()) ) {
$model->markForSend();
}
$searchModel = new TicketInstallmentRequestSearchPending();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index_pending', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
public function actionAccept( $id )
{
$model = $this->findModel($id);
if ( !$model->isStatusAccepted() ){
$model->applyStatus(TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL,true);
\Yii::$app->session->setFlash('success',"Megbízás teljesítve");
}
// else{
// }
// echo "asdff";
return $this->redirect(['ticket-installment-request/view',
'id' => $model->id_ticket_installment_request,
]);
}
/**
* Lists pending TicketInstallmentRequest models.
* @return mixed
*/
public function actionDownloadGiro()
{
$model = new GiroKotegForm();
if ($model->load(Yii::$app->request->post()) ) {
$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,
'dataProvider' => $dataProvider,
'model' => $model,
]);
}
/**
* Displays a single TicketInstallmentRequest model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new TicketInstallmentRequest model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new TicketInstallmentRequest();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket_installment_request]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing TicketInstallmentRequest model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket_installment_request]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing TicketInstallmentRequest model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
public function actionTest( )
{
return $this->render('test');
}
/**
* Finds the TicketInstallmentRequest model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return TicketInstallmentRequest the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = TicketInstallmentRequest::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,202 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Ugiro;
use backend\models\UgiroSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\components\DetStatProcessor;
use backend\models\DestaUploadForm;
use yii\web\UploadedFile;
/**
* UgiroController implements the CRUD actions for Ugiro model.
*/
class UgiroController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
'actions' => [],
'allow' => true,
'roles' => [
'admin',
'employee',
'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', [
'searchModel' => $searchModel,
'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', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
public function actionActivate(){
}
/**
* Displays a single Ugiro model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
$model = $this->findModel($id);
if (Yii::$app->request->isPost) {
if ($model->status == Ugiro::$STATUS_RECIEVED){
set_time_limit(1200);//20 perc
$processor = new DetStatProcessor(
['koteg' => $model]
);
$processor->run();
}else{
\Yii::$app->session->setFlash('danger','Nem lehet futtatni a fájlt');
\Yii::error("a koteg státusza nem STATUS_RECIEVED. A koteg azonosíótja:" . $model->id_ugiro );
}
}
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* 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(['view', 'id' => $model->id_ugiro]);
} else {
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
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ugiro]);
} else {
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
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
public function actionDetsta(){
$ugiro = Ugiro::findOne(31);
$model = new DetStatProcessor(
['koteg' => $ugiro]
);
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(['view', 'id' => $model->koteg->id_ugiro]);
}
}
return $this->render('upload', ['model' => $model]);
}
/**
* 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
* @return Ugiro the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Ugiro::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

5
backend/detsta.txt Normal file
View File

@ -0,0 +1,5 @@
01DETSTA8A24237545 201501270001201502094542162957
020000010000014097201501270020150204201502031104 03916201502031001307001595 0015520150127321538700000000000000000000000340
020000020000015240201501275020150204 1117 73377201502033417908001595 0015520150127321538800000000000000000000000347
020000030000015240201501270020150204201502031120 94002201502030005151001595 0015520150127321538900000000000000000000000176
03000002000000000002933700000100000000000152400000000000000000000000

2
backend/giro2710txt Normal file
View File

@ -0,0 +1,2 @@
01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar
030000000000000000000000

2
backend/giro5459txt Normal file
View File

@ -0,0 +1,2 @@
01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar
030000000000000000000000

2
backend/giro9077txt Normal file
View File

@ -0,0 +1,2 @@
01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar
030000000000000000000000

2
backend/giro9550txt Normal file
View File

@ -0,0 +1,2 @@
01BESZED1A25366936T2442016012000015860025215371128 00000000BEEmovar
030000000000000000000000

View File

@ -89,6 +89,9 @@ class CustomerCreate extends \common\models\Customer
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
[['bank_account'], 'string', 'max' => 24],
[['bank_name'], 'string', 'max' => 100],
[['phone'], 'required', 'when' => function($model) {
return !isset( $model->email ) || empty( $model->email ) ;
} ,

View File

@ -88,6 +88,8 @@ class CustomerUpdate extends \common\models\Customer
[[ 'description', 'address'], 'string', 'max' => 255],
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
[['bank_account'], 'string', 'max' => 24],
[['bank_name'], 'string', 'max' => 100],
[['phone'], 'required', 'when' => function($model) {
return !isset( $model->email ) || empty( $model->email ) ;

View File

@ -0,0 +1,68 @@
<?php
namespace backend\models;
use yii\base\Model;
use yii\web\UploadedFile;
use common\components\giro\GiroDETSTA;
use common\models\Ugiro;
class DestaUploadForm extends Model
{
/**
* @var UploadedFile
*/
public $destaFile;
public $koteg;
public function rules()
{
return [
[['destaFile'], 'file', 'skipOnEmpty' => false, ],
[['destaFile'], 'validateKoteg', ],
];
}
public function attributeLabels(){
return [
"destaFile" => "Desta fájl"
];
}
public function validateKoteg($attribute,$params){
if ( !$this->hasErrors()){
$content = file_get_contents($this->destaFile->tempName);
$destaUzenet = GiroDETSTA::parse($content);
$number = $destaUzenet->fej->csoportosUzenetSorszam->sorszam;
$datum = $destaUzenet->fej->csoportosUzenetSorszam->osszeallitasDatuma;
$koteg = Ugiro::find()->andWhere(['number' =>$number,'datum' => $datum ])->one();
$this->koteg = $koteg;
$idKoteg = $this->koteg->id_ugiro;
if (!isset($koteg)){
$this->addError($attribute,"Nincs ilyen köteg! ( Datum: $datum, Sorszam: $number )");
}else{
if ( $koteg->status != Ugiro::$STATUS_SENT ){
$this->addError($attribute,"A köteg detsta fájl-ja már fel van töltve !( Köteg azonosító: $idKoteg )");
}
}
}
}
public function upload()
{
if ($this->validate()) {
$path = 'giro/valasz/' . $this->destaFile->baseName . '.' . $this->destaFile->extension;
$this->destaFile->saveAs( $path );
$this->koteg->desta_path = $path;
$this->koteg->status = Ugiro::$STATUS_RECIEVED;
$this->koteg->save(false);
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,155 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use common\models\Card;
use common\models\Customer;
use common\models\Ticket;
use common\models\Account;
use yii\web\UploadedFile;
use common\models\TicketInstallmentRequest;
use common\models\Ugiro;
use common\components\giro\GiroBeszed;
use yii\helpers\FileHelper;
use yii\helpers\Inflector;
use yii\helpers\BaseInflector;
use common\models\UgiroRequestAssignment;
use yii\db\Query;
/**
* ContactForm is the model behind the contact form.
* @property \Yii\web\UploadedFile $file
*/
class GiroKotegForm extends Model{
public $action;
public $requests;
public $content;
public $koteg;
public $success;
public function rules(){
return [
[['action'], 'safe']
];
}
public function createKoteg(){
$this->readRequests();
$this->success = true;
if ( count( $this->requests ) > 0 ){
$connection = \Yii::$app->db;
$transaction = $connection->beginTransaction();
try {
$this->createUGiroKoteg();
$this->assignRequestsToUgiro();
$this->changeRequestsStatusToSent();
$this->generateFileContent();
$this->saveFile();
if ($this->success) {
$transaction->commit();
\Yii::$app->session->setFlash('success',"Fájl létrehozva");
return true;
} else {
$transaction->rollback();
throw new NotFoundHttpException( "Hiba történt!");
}
} catch (\Exception $e) {
$transaction->rollback();
throw $e;
}
}else{
\Yii::$app->session->setFlash('danger', "Megbízások száma 0!");
return false;
}
}
public function changeRequestsStatusToSent(){
foreach ($this->requests as $request){
$request->status = TicketInstallmentRequest::$STATUS_SENT;
$this->success &= $request->save(false);
}
}
public function assignRequestsToUgiro(){
foreach ($this->requests as $request){
$assignment = new UgiroRequestAssignment();
$assignment->id_request = $request->id_ticket_installment_request;
$assignment->id_ugiro = $this->koteg->id_ugiro;
$this->success &= $assignment->save(false);
}
}
public function createUGiroKoteg(){
$this->koteg = new Ugiro();
$this->koteg->status = Ugiro::$STATUS_SENT;
$this->koteg->id_user = \Yii::$app->user->id;
$this->koteg->datum = date('Ymd');
$lastNumber = $this->loadLastNumber($this->koteg->datum);
$nextNumber = $lastNumber+1;
$this->koteg->number = $nextNumber;
$this->success &= $this->koteg->save(false);
}
public function loadLastNumber($datum){
$query = new Query();
$query->select(['coalesce(max(number),0)']);
$query->from('ugiro');
$query->andWhere(["datum" => $datum]);
return $query->scalar();
}
public function readRequests(){
$this->requests = TicketInstallmentRequest::find()->andWhere(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND])->all();
}
public function generateFileContent(){
$this->content = GiroBeszed::createFileContent($this->koteg->number, $this->koteg->datum, $this->requests);
}
public function saveFile( ) {
// $data = static::transliterate($this->content);
$data = $this->content;
$data = iconv("utf-8","ASCII",$data);
$path = Ugiro::$PATH_MEGBIZAS . DIRECTORY_SEPARATOR ."giro" . $this->koteg->id_ugiro."_". date('Ymd' ) .".txt";
$filename = Yii::getAlias('@backend/web').DIRECTORY_SEPARATOR .$path;
$dir = Yii::getAlias('@backend/web').DIRECTORY_SEPARATOR .Ugiro::$PATH_MEGBIZAS;
$this->koteg->path = $path;
$this->koteg->save(false);
if(!FileHelper::createDirectory($dir)){
throw new HttpException(500, 'Cannot create "'.$dir.'". Please check write permissions.');
}
$myfile = fopen($filename,'a');
fwrite($myfile, $data);
fclose($myfile);
}
public static function transliterate($string)
{
// if (static::hasIntl()) {
// return transliterator_transliterate(BaseInflector::$transliterator, $string);
// } else {
return str_replace(array_keys(BaseInflector::$transliteration), BaseInflector::$transliteration, $string);
// }
}
/**
* @return boolean if intl extension is loaded
*/
protected static function hasIntl()
{
return extension_loaded('intl');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use common\models\Card;
use common\models\Customer;
use common\models\Ticket;
use common\models\Account;
use yii\web\UploadedFile;
use common\models\TicketInstallmentRequest;
/**
* ContactForm is the model behind the contact form.
* @property \Yii\web\UploadedFile $file
*/
class TicketInstallmentMarkForSendForm extends Model{
public $items;
public function rules(){
return [
['items', 'each', 'rule' => ['integer']],
];
}
public function markForSend(){
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! " );
}
}
}

View File

@ -0,0 +1,138 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\TicketInstallmentRequest;
use yii\db\Query;
use yii\data\ArrayDataProvider;
/**
* TicketInstallmentRequestSearch represents the model behind the search form about `common\models\TicketInstallmentRequest`.
*/
class TicketInstallmentRequestSearch extends TicketInstallmentRequest
{
public $start;
public $end;
public $timestampStart;
public $timestampEnd;
public $processedStart;
public $processedEnd;
public $timestampProcessedStart;
public $timestampProcessedEnd;
public $sentStart;
public $sentEnd;
public $timestampSentStart;
public $timestampSentEnd;
public $customer_name;
public $id_ticket_type;
public $id_ugiro;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ticket_installment_request', 'id_ticket', 'id_customer', 'status' ,'id_ticket_type','id_ugiro'], 'integer'],
[['customer_name' ], 'safe'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'processedStart', ], 'date' , 'timestampAttribute' => 'timestampProcessedStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'processedEnd' , ], 'date' , 'timestampAttribute' => 'timestampProcessedEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'sentStart', ], 'date' , 'timestampAttribute' => 'timestampSentStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'sentEnd' , ], 'date' , 'timestampAttribute' => 'timestampSentEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = new Query();
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
}
$query->select([
'ticket_installment_request.id_ticket_installment_request as request_id_ticket_installment_request', //id
'ticket_installment_request.request_target_time_at as request_request_target_time_at',//target time
'ticket_installment_request.money as request_money',//money
'ticket_installment_request.status as request_status',//status
'ticket_installment_request.request_sent_at as request_sent_at',//sent_at
'ticket_installment_request.priority as request_priority',//sent_at
'ticket_installment_request.request_processed_at as request_processed_at',//request_processed_at
'customer.id_customer as customer_id_customer',//id_customer
'customer.name as customer_name',//customer_name
'ticket_type.name as ticket_type_name',//ticket_type_name
'ticket.status as ticket_status',//ticket_status
'ticket.start as ticket_start',//ticket_start
'ticket.end as ticket_end',//ticket_send
'ticket.id_ticket as ticket_id_ticket',//id_ticket
'ugiro_request_assignment.id_ugiro as ugiro_id_ugiro' ,//köteg azonosító
]);
$query->from("ticket_installment_request");
$query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer");
$query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket");
$query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type");
$query->leftJoin("ugiro_request_assignment","ticket_installment_request.id_ticket_installment_request = ugiro_request_assignment.id_request");
$query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]);
$query->andFilterWhere([
'ticket_installment_request.id_ticket_installment_request' => $this->id_ticket_installment_request,
'ticket.id_ticket' => $this->id_ticket,
'customer.id_customer' => $this->id_customer,
'ticket_installment_request.status' => $this->status,
'ticket_type.id_ticket_type' => $this->id_ticket_type,
]);
$query->andFilterWhere(['like', 'customer.name', $this->customer_name]);
//target time
$query->andFilterWhere(['>=', 'ticket_installment_request.request_target_time_at', $this->timestampStart]);
$query->andFilterWhere(['<', 'ticket_installment_request.request_target_time_at', $this->timestampEnd]);
//sent time
$query->andFilterWhere(['>=', 'ticket_installment_request.request_sent_at', $this->timestampSentStart]);
$query->andFilterWhere(['<', 'ticket_installment_request.request_sent_at', $this->timestampSentEnd]);
//processed time
$query->andFilterWhere(['>=', 'ticket_installment_request.request_processed_at', $this->timestampProcessedStart]);
$query->andFilterWhere(['<', 'ticket_installment_request.request_processed_at', $this->timestampProcessedEnd]);
if ( isset($this->id_ugiro ) && !empty($this->id_ugiro)){
$query->andWhere(["ugiro_request_assignment.id_ugiro" => $this->id_ugiro]);
}
$dataProvider = new ArrayDataProvider([
'allModels' => $query->all(),
// 'sort' => [
// 'attributes' => ['id', 'username', 'email'],
// ],
// 'pagination' => [
// 'pageSize' => 10,
// ],
]);
return $dataProvider;
}
}

View File

@ -0,0 +1,114 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\TicketInstallmentRequest;
use yii\db\Query;
use yii\data\ArrayDataProvider;
/**
* TicketInstallmentRequestSearch represents the model behind the search form about `common\models\TicketInstallmentRequest`.
*/
class TicketInstallmentRequestSearchDownloadGiro extends TicketInstallmentRequest
{
public $start;
public $end;
public $timestampStart;
public $timestampEnd;
public $customer_name;
public $id_ticket_type;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ticket_installment_request', 'id_ticket', 'id_customer', 'status' ,'id_ticket_type'], 'integer'],
[['customer_name' ], 'safe'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = new Query();
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
}
$query->select([
'ticket_installment_request.id_ticket_installment_request as request_id_ticket_installment_request', //id
'ticket_installment_request.request_target_time_at as request_request_target_time_at',//target time
'ticket_installment_request.money as request_money',//money
'ticket_installment_request.status as request_status',//status
'ticket_installment_request.request_sent_at as request_sent_at',//sent_at
'ticket_installment_request.priority as request_priority',//sent_at
'ticket_installment_request.request_processed_at as request_processed_at',//request_processed_at
'customer.id_customer as customer_id_customer',//id_customer
'customer.name as customer_name',//customer_name
'ticket_type.name as ticket_type_name',//ticket_type_name
'ticket.status as ticket_status',//ticket_status
'ticket.start as ticket_start',//ticket_start
'ticket.end as ticket_end',//ticket_send
'ticket.id_ticket as ticket_id_ticket',//id_ticket
]);
$query->from("ticket_installment_request");
$query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer");
$query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket");
$query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type");
$query->andWhere(['ticket_installment_request.status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND]);
$query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]);
// $query->andFilterWhere([
// 'ticket_installment_request.id_ticket_installment_request' => $this->id_ticket_installment_request,
// 'ticket.id_ticket' => $this->id_ticket,
// 'customer.id_customer' => $this->id_customer,
// 'ticket_installment_request.status' => $this->status,
// 'ticket_type.id_ticket_type' => $this->id_ticket_type,
// ]);
// $query->andFilterWhere(['like', 'customer.name', $this->customer_name]);
//target time
// $query->andFilterWhere(['>=', 'ticket_installment_request.request_target_time_at', $this->timestampStart]);
// $query->andFilterWhere(['<', 'ticket_installment_request.request_target_time_at', $this->timestampEnd]);
$dataProvider = new ArrayDataProvider([
'allModels' => $query->all(),
// 'sort' => [
// 'attributes' => ['id', 'username', 'email'],
// ],
// 'pagination' => [
// 'pageSize' => 10,
// ],
]);
return $dataProvider;
}
}

View File

@ -0,0 +1,114 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\TicketInstallmentRequest;
use yii\db\Query;
use yii\data\ArrayDataProvider;
/**
* TicketInstallmentRequestSearch represents the model behind the search form about `common\models\TicketInstallmentRequest`.
*/
class TicketInstallmentRequestSearchPending extends TicketInstallmentRequest
{
public $start;
public $end;
public $timestampStart;
public $timestampEnd;
public $customer_name;
public $id_ticket_type;
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ticket_installment_request', 'id_ticket', 'id_customer', 'status' ,'id_ticket_type'], 'integer'],
[['customer_name' ], 'safe'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = new Query();
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
}
$query->select([
'ticket_installment_request.id_ticket_installment_request as request_id_ticket_installment_request', //id
'ticket_installment_request.request_target_time_at as request_request_target_time_at',//target time
'ticket_installment_request.money as request_money',//money
'ticket_installment_request.status as request_status',//status
'ticket_installment_request.request_sent_at as request_sent_at',//sent_at
'ticket_installment_request.priority as request_priority',//sent_at
'ticket_installment_request.request_processed_at as request_processed_at',//request_processed_at
'customer.id_customer as customer_id_customer',//id_customer
'customer.name as customer_name',//customer_name
'ticket_type.name as ticket_type_name',//ticket_type_name
'ticket.status as ticket_status',//ticket_status
'ticket.start as ticket_start',//ticket_start
'ticket.end as ticket_end',//ticket_send
'ticket.id_ticket as ticket_id_ticket',//id_ticket
]);
$query->from("ticket_installment_request");
$query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer");
$query->innerJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket");
$query->innerJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type");
$query->andWhere(['ticket_installment_request.status' => TicketInstallmentRequest::$STATUS_PENDING]);
$query->orderBy(["ticket_installment_request.request_target_time_at" => SORT_ASC]);
$query->andFilterWhere([
'ticket_installment_request.id_ticket_installment_request' => $this->id_ticket_installment_request,
'ticket.id_ticket' => $this->id_ticket,
'customer.id_customer' => $this->id_customer,
'ticket_installment_request.status' => $this->status,
'ticket_type.id_ticket_type' => $this->id_ticket_type,
]);
$query->andFilterWhere(['like', 'customer.name', $this->customer_name]);
//target time
$query->andFilterWhere(['>=', 'ticket_installment_request.request_target_time_at', $this->timestampStart]);
$query->andFilterWhere(['<', 'ticket_installment_request.request_target_time_at', $this->timestampEnd]);
$dataProvider = new ArrayDataProvider([
'allModels' => $query->all(),
// 'sort' => [
// 'attributes' => ['id', 'username', 'email'],
// ],
// 'pagination' => [
// 'pageSize' => 10,
// ],
]);
return $dataProvider;
}
}

View File

@ -37,7 +37,7 @@ class TicketSearch extends Ticket
public function rules()
{
return [
[[ 'id_user', 'id_ticket_type', 'id_account'], 'integer'],
[[ 'id_ticket', 'id_user', 'id_ticket_type', 'id_account','status'], 'integer'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[['valid_in_interval','created_in_interval','expire_in_interval'],'boolean'] ,
@ -117,6 +117,8 @@ class TicketSearch extends Ticket
'id_ticket_type' => $this->id_ticket_type,
'id_account' => $this->id_account,
'id_card' => $this->id_card,
'id_ticket' => $this->id_ticket,
'status' => $this->status
]);

View File

@ -40,7 +40,7 @@ class TransferSearch extends Transfer
public function rules()
{
return [
[[ 'id_account','id_user', 'type'], 'integer'],
[[ 'id_account','id_user', 'type','status'], 'integer'],
// [[ 'searchObjectName' ], 'string'],
[[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
[[ 'end' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
@ -101,6 +101,7 @@ class TransferSearch extends Transfer
'transfer.id_account' => $this->id_account,
'transfer.type' => $this->type,
'transfer.id_user' => $this->id_user,
'transfer.status' => $this->status
]);
$query->andFilterWhere(['in' ,'transfer.type', $this->types]);

View File

@ -0,0 +1,67 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Ugiro;
/**
* UgiroSearch represents the model behind the search form about `common\models\Ugiro`.
*/
class UgiroSearch extends Ugiro
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ugiro', 'id_user'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Ugiro::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'id_ugiro' => $this->id_ugiro,
'id_user' => $this->id_user,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
return $dataProvider;
}
}

View File

@ -75,6 +75,16 @@ use kartik\widgets\DatePicker;
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>

View File

@ -79,6 +79,16 @@ use kartik\widgets\DatePicker;
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>

View File

@ -44,6 +44,8 @@ $this->params['breadcrumbs'][] = $this->title;
'image',
'description',
'tax_number',
'bank_name',
'bank_account',
'country',
'zip',
'city',

View File

@ -0,0 +1,124 @@
<?php
use common\models\TicketInstallmentRequest;
use common\models\Ticket;
?>
<table class="table table-striped">
<tr>
<th>
Megbízás azonosító
</th>
<td>
<?php echo "".$model['request_id_ticket_installment_request'];?>
</td>
<th>
Megbízás státusza
</th>
<td>
<?php echo TicketInstallmentRequest::toStatusName( $model['request_status'] );?>
</td>
<th>
Megbízás összege
</th>
<td>
<?php echo $model['request_money'] ." Ft";?>
</td>
<tr>
<tr>
<th>
Megbízás inditására irányzott dátum
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_request_target_time_at'] );?>
</td>
<th>
Megbízás elindításának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_sent_at'] );?>
</td>
<th>
Megbízás feldoglozásának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_processed_at'] );?>
</td>
<tr>
<tr>
<th>
Megbízás prioritása
</th>
<td>
<?php echo $model['request_priority'] ;?>
</td>
<th>
</th>
<td>
</td>
<th>
</th>
<td>
</td>
<tr>
<tr>
<th>
Vendég azonosító
</th>
<td>
<?php echo "". $model['customer_id_customer'];?>
</td>
<th>
Vendég neve
</th>
<td>
<?php echo $model['customer_name'];?>
</td>
<th>
</th>
<td>
</td>
<tr>
<tr>
<th>
Bérlet azonosító
</th>
<td>
<?php echo "". $model['ticket_id_ticket'];?>
</td>
<th>
Bérlet típus
</th>
<td>
<?php echo $model['ticket_type_name'];?>
</td>
<th>
Bérlet státusza
</th>
<td>
<?php echo Ticket::toStatusName( $model['ticket_status'] );?>
</td>
<tr>
<tr>
<th>
Bérlet érvényességének kezdete
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model['ticket_start'] ) ;?>
</td>
<th>
Bérlet érvényességének vége
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model['ticket_end'] ) ;?>
</td>
<th>
</th>
<td>
</td>
<tr>
</table>

View File

@ -0,0 +1,51 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\TicketInstallmentRequest */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ticket-installment-request-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_ticket')->textInput() ?>
<?= $form->field($model, 'id_customer')->textInput() ?>
<?= $form->field($model, 'id_transfer')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'money')->textInput() ?>
<?= $form->field($model, 'customer_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'bank_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'bank_address')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'bank_account')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'priority')->textInput() ?>
<?= $form->field($model, 'request_sent_at')->textInput() ?>
<?= $form->field($model, 'request_processed_at')->textInput() ?>
<?= $form->field($model, 'request_target_time_at')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket_installment_request', 'Create') : Yii::t('common/ticket_installment_request', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,162 @@
<?php
use common\models\TicketInstallmentRequest;
use common\models\Ticket;
use yii\helpers\Html;
?>
<?php
$statusStyle = "";
if ( $model['request_status'] == TicketInstallmentRequest::$STATUS_ACCEPTED || $model['request_status'] == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL ){
$statusStyle = "accepted";
}else if ($model['request_status'] == TicketInstallmentRequest::$STATUS_REJECTED ){
$statusStyle = "rejected";
}
?>
<style>
.accepted table td.status {
background-color: green;
}
.rejected table td.status {
background-color: #dd4b39;
}
</style>
<div class="panel panel-default">
<div class="panel-body">
<div class="request-view <?= $statusStyle ?>">
<table class="table table-striped">
<tr>
<th>
Megbízás azonosító
</th>
<td>
<?php echo "".$model['request_id_ticket_installment_request'];?>
</td>
<th>
Megbízás státusza
</th>
<td class="status">
<?php echo TicketInstallmentRequest::toStatusName( $model['request_status'] );?>
</td>
<th>
Megbízás összege
</th>
<td>
<?php echo $model['request_money'] ." Ft";?>
</td>
</tr>
<tr>
<th>
Megbízás inditására irányzott dátum
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_request_target_time_at'] );?>
</td>
<th>
Megbízás elindításának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_sent_at'] );?>
</td>
<th>
Megbízás feldoglozásának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_processed_at'] );?>
</td>
</tr>
<tr>
<th>
Megbízás prioritása
</th>
<td>
<?php echo $model['request_priority'] ;?>
</td>
<th>
Köteg azonosító
</th>
<td>
<?php echo $model['ugiro_id_ugiro'] ;?>
</td>
<th>
</th>
<td>
</td>
</tr>
<tr>
<th>
Vendég azonosító
</th>
<td>
<?php echo "". $model['customer_id_customer'];?>
</td>
<th>
Vendég neve
</th>
<td>
<?php echo $model['customer_name'];?>
</td>
<th>
</th>
<td>
</td>
</tr>
<tr>
<th>
Bérlet azonosító
</th>
<td>
<?php echo "". $model['ticket_id_ticket'];?>
</td>
<th>
Bérlet típus
</th>
<td>
<?php echo $model['ticket_type_name'];?>
</td>
<th>
Bérlet státusza
</th>
<td>
<?php echo Ticket::toStatusName( $model['ticket_status'] );?>
</td>
</tr>
<tr>
<th>
Bérlet érvényességének kezdete
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model['ticket_start'] ) ;?>
</td>
<th>
Bérlet érvényességének vége
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model['ticket_end'] ) ;?>
</td>
<th>
</th>
<td>
</td>
</tr>
</table>
<div >
<?php
if ( !empty( $model['ugiro_id_ugiro'] )){
echo Html::a("Köteg",['ugiro/view', 'id' => $model['ugiro_id_ugiro']] ,[ 'class' => 'btn btn-primary']);
}
echo Html::a("Megbízás részletek",['ticket-installment-request/view', 'id' => $model['request_id_ticket_installment_request']] ,[ 'class' => 'btn btn-primary']);
if ( !empty( $model['ticket_id_ticket'] )){
echo Html::a("Bérlet részletei",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ticket]' => $model['ticket_id_ticket']] ,[ 'class' => 'btn btn-primary']);
}
?>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,142 @@
<?php
use common\models\TicketInstallmentRequest;
use common\models\Ticket;
use yii\helpers\Html;
?>
<table class="table table-striped">
<tr>
<th>
Beküldésre jelöl
</th>
<td>
<?php echo Html::checkbox("TicketInstallmentMarkForSendForm[items][]",false, ['class' => 'pending-request', 'value' => $model['request_id_ticket_installment_request']])?>
</td>
<th>
</th>
<td>
</td>
<th>
</th>
<td>
</td>
<tr>
<tr>
<th>
Megbízás azonosító
</th>
<td>
<?php echo "".$model['request_id_ticket_installment_request'];?>
</td>
<th>
Megbízás státusza
</th>
<td>
<?php echo TicketInstallmentRequest::toStatusName( $model['request_status'] );?>
</td>
<th>
Megbízás összege
</th>
<td>
<?php echo $model['request_money'] ." Ft";?>
</td>
<tr>
<tr>
<th>
Megbízás inditására irányzott dátum
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_request_target_time_at'] );?>
</td>
<th>
Megbízás elindításának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_sent_at'] );?>
</td>
<th>
Megbízás feldoglozásának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model['request_processed_at'] );?>
</td>
<tr>
<tr>
<th>
Megbízás prioritása
</th>
<td>
<?php echo $model['request_priority'] ;?>
</td>
<th>
</th>
<td>
</td>
<th>
</th>
<td>
</td>
<tr>
<tr>
<th>
Vendég azonosító
</th>
<td>
<?php echo "". $model['customer_id_customer'];?>
</td>
<th>
Vendég neve
</th>
<td>
<?php echo $model['customer_name'];?>
</td>
<th>
</th>
<td>
</td>
<tr>
<tr>
<th>
Bérlet azonosító
</th>
<td>
<?php echo "". $model['ticket_id_ticket'];?>
</td>
<th>
Bérlet típus
</th>
<td>
<?php echo $model['ticket_type_name'];?>
</td>
<th>
Bérlet státusza
</th>
<td>
<?php echo Ticket::toStatusName( $model['ticket_status'] );?>
</td>
<tr>
<tr>
<th>
Bérlet érvényességének kezdete
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model['ticket_start'] ) ;?>
</td>
<th>
Bérlet érvényességének vége
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model['ticket_end'] ) ;?>
</td>
<th>
</th>
<td>
</td>
<tr>
</table>

View File

@ -0,0 +1,140 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\TicketInstallmentRequest;
use common\models\TicketType;
use yii\helpers\ArrayHelper;
use kartik\widgets\DatePicker;
/* @var $this yii\web\View */
/* @var $model backend\models\TicketInstallmentRequestSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map(TicketType::read(), 'id_ticket_type', 'name');
?>
<div class="ticket-installment-request-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'id_ticket_installment_request')->label("Megbízás azonosító") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_ugiro')->label("Köteg azonosító") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_ticket')->label("Bérlet azonosító") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_customer')->label("Vendég azonosító") ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'customer_name')->label("Vendég neve") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'status')->label("Megbízás státusza")->dropDownList( ['' => 'Mind' ] + TicketInstallmentRequest::statuses()) ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_ticket_type')->label("Bérlet típus")->dropDownList( $ticketTypeOptions) ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás inditására irányzott kezdete ( inklúzív )') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás inditására irányzott dátum vége ( exklúzív )') ?>
</div>
</div>
<?php /*?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'sentStart')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás elindításának időszak kezdete ( inklúzív )') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'sentEnd') ->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás elindításának időszak vége ( exklúzív )') ?>
</div>
</div>
<?php */ ?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'processedStart')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás feldolgozása időszak kezdete ( inklúzív )') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'processedEnd') ->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás feldolgozása időszak vége ( exklúzív )') ?>
</div>
</div>
<?php // echo $form->field($model, 'money') ?>
<?php // echo $form->field($model, 'customer_name') ?>
<?php // echo $form->field($model, 'bank_name') ?>
<?php // echo $form->field($model, 'bank_address') ?>
<?php // echo $form->field($model, 'bank_account') ?>
<?php // echo $form->field($model, 'priority') ?>
<?php // echo $form->field($model, 'request_sent_at') ?>
<?php // echo $form->field($model, 'request_processed_at') ?>
<?php // echo $form->field($model, 'request_target_time_at') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton("Keresés", ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,76 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\TicketInstallmentRequest;
use common\models\TicketType;
use yii\helpers\ArrayHelper;
use kartik\widgets\DatePicker;
/* @var $this yii\web\View */
/* @var $model backend\models\TicketInstallmentRequestSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map(TicketType::read(), 'id_ticket_type', 'name');
?>
<div class="ticket-installment-request-search">
<?php $form = ActiveForm::begin([
'action' => ['pending'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'id_ticket_installment_request')->label("Megbízás azonosító") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_ticket')->label("Bérlet azonosító") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_customer')->label("Vendég azonosító") ?>
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'customer_name')->label("Vendég neve") ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'id_ticket_type')->label("Bérlet típus")->dropDownList( $ticketTypeOptions) ?>
</div>
<div class="col-md-3">
</div>
</div>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás inditására irányzott kezdete ( inklúzív )') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
])->label('Megbízás inditására irányzott dátum vége ( exklúzív )') ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/ticket_installment_request', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/ticket_installment_request', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\TicketInstallmentRequest */
$this->title = Yii::t('common/ticket_installment_request', 'Create Ticket Installment Request');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_installment_request', 'Ticket Installment Requests'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-installment-request-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketInstallmentRequestSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/ticket_installment_request', 'Bérlet fizetési megbízások');
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
a.btn{
margin-right: 6px;
}
</style>
<div class="ticket-installment-request-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?php
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_index_view'
]);
?>
</div>

View File

@ -0,0 +1,44 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
use kartik\widgets\ActiveForm;
use backend\assets\PendingRequestAsset;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketInstallmentRequestSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/ticket_installment_request', 'Giro köteg létrehozása');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
PendingRequestAsset::register($this);
?>
<div class="ticket-installment-request-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_download_giro_view'
]);
?>
<?php $form = ActiveForm::begin([
'action' => Url::current(),
'method' => 'post',
]); ?>
<?php echo $form->field($model, 'action')->hiddenInput()->label(false) ?>
<div class="form-group">
<?= Html::submitButton("Köteg létrehozása", ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,50 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
use kartik\widgets\ActiveForm;
use backend\assets\PendingRequestAsset;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketInstallmentRequestSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/ticket_installment_request', 'Indításra váró bérlet fizetési megbízások');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
PendingRequestAsset::register($this);
?>
<div class="ticket-installment-request-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search_pending', ['model' => $searchModel]); ?>
<div>
<label>
Mindent ki/be
<?php echo Html::checkbox("select-all",false, ['id' => 'select-all-pending' ]);?>
</label>
</div>
<?php $form = ActiveForm::begin([
'action' => Url::current(),
'method' => 'post',
]); ?>
<?php
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '_pending_view'
]);
?>
<div class="form-group">
<?= Html::submitButton("Beküldendőnek jelöl", ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,85 @@
<?php
use common\components\giro\GiroBeszedLab;
use common\components\giro\GiroBeszedFej;
use yii\helpers\Html;
use common\components\giro\GiroBeszedTetel;
use common\components\giro\GiroBeszed;
use common\components\giro\GiroDETSTAFej;
$data = iconv("utf-8","CP852","árvíztűrő tükörfúrógép");
echo $data;
echo mb_detect_encoding($data, "auto");
$fej = new GiroBeszedFej();
$fej->duplumKod = 1;
$fej->kezdemenyezoAzonosito = "A25366936T244" ;//"66658092128";
$fej->uzenetSorszam ->osszeallitasDatuma = "20160120";
$fej->uzenetSorszam->sorszam = 1;
$fej->kezdemenyezoBankszamla->szamlaszam = "5860025215371128";//"5860025215371128";
// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; //"TAKBHUHB";
$fej->ertesitesiHatarido = "";
$fej->kezdemenyezoCegNeve = "Cutler Four kft";
echo "fej<br>";
echo "'".str_replace(' ', '&nbsp;',Html::encode($fej->toString()) )."'";
echo "<br>";
$tetel = new GiroBeszedTetel();
$tetel->tetelSorszam = 1;
$tetel->terhelesiDatum = "20160122";
$tetel->osszeg = "1000";
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
$tetel->kotelezettBankszamla->szamlaszam = "5860025215371128";
$tetel->ugyfelazonositoAKezdemenyezonel = 1;
$tetel->ugyfelNeve = "Schneider Roland";
$tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
$tetel->szamlaTulajdonosNeve = "Schneider Roland";
$tetel->kozlemeny = "Berlet";
echo "tetel<br>";
echo "'".str_replace(' ', '&nbsp;',($tetel->toString())) ."'";
echo "<br>";
$lab = new GiroBeszedLab();
$lab->tetelekOsszerteke = 1000;
$lab->tetelekSzama=1;
echo "<br>lab<br>";
echo str_replace(' ', '&nbsp;', $lab->toString() );
$content = GiroBeszed::createFileContent(1, []);
echo "'".str_replace(' ', '&nbsp;', Html::encode(GiroBeszed::createFileContent(1, [])) ."'");
$data = iconv("windows-1252","ASCII",$content);
// $filename = \Yii::$app->basePath . "/" ."giro" . rand(0,10000)."txt";
// $myfile = fopen($filename,'a');
// fwrite($myfile, $data);
// fclose($myfile);
$dfej = new GiroDETSTAFej();
$dfej->kezdemenyezoAzonosito = "A25366936T244";
$dfej->csoportosUzenetSorszam ->osszeallitasDatuma = "20160120";
$dfej->csoportosUzenetSorszam->sorszam = 1;
$dfej->detstaUzenetSorszam ->osszeallitasDatuma = "20160120";
$dfej->detstaUzenetSorszam->sorszam = 1;
$dfej->ido = "100000";
echo "dfej<br>";
echo $dfej->toString();
echo "<br>";
$s = "01DETSTA0A25366936T244201601200001201601200001100000";
$def2 = GiroDETSTAFej::parse($s);
print_r($def2);
?>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\TicketInstallmentRequest */
$this->title = Yii::t('common/ticket_installment_request', 'Update {modelClass}: ', [
'modelClass' => 'Ticket Installment Request',
]) . ' ' . $model->id_ticket_installment_request;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket_installment_request', 'Ticket Installment Requests'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_ticket_installment_request, 'url' => ['view', 'id' => $model->id_ticket_installment_request]];
$this->params['breadcrumbs'][] = Yii::t('common/ticket_installment_request', 'Update');
?>
<div class="ticket-installment-request-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,226 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use common\models\TicketInstallmentRequest;
use common\models\Ticket;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\TicketInstallmentRequest */
$this->title = "Megbízás: " . $model->id_ticket_installment_request;
$this->params['breadcrumbs'][] = ['label' => "Megbízások", 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<?php
$statusStyle = "";
if ( $model->isStatusAccepted() ){
$statusStyle = "accepted";
}else if ( $model->isStatusRejected() ){
$statusStyle = "rejected";
}
?>
<style>
.accepted table td.status {
background-color: green;
}
.rejected table td.status {
background-color: #dd4b39;
}
a.btn{
margin-right: 6px;
}
</style>
<div class="ticket-installment-request-view">
<h1><?= Html::encode($this->title) ?></h1>
<div class="panel panel-default">
<div class="panel-body">
<?php
if ( $model->isStatusRejected()){
echo Html::a("Teljesítettnek jelölés",['accept', 'id' => $model->id_ticket_installment_request] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
}
?>
<div class="request-view <?= $statusStyle ?>">
<table class="table table-striped">
<tr>
<th>
Megbízás azonosító
</th>
<td>
<?php echo "".$model->id_ticket_installment_request;?>
</td>
<th>
Megbízás státusza
</th>
<td class="status">
<?php echo TicketInstallmentRequest::toStatusName( $model->status );?>
</td>
<th>
Megbízás összege
</th>
<td>
<?php echo $model->money." Ft";?>
</td>
</tr>
<tr>
<th>
Megbízás inditására irányzott dátum
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model->request_target_time_at );?>
</td>
<th>
Megbízás elindításának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model->request_sent_at);?>
</td>
<th>
Megbízás feldoglozásának ideje
</th>
<td>
<?php echo \Yii::$app->formatter->asDatetime( $model->request_processed_at );?>
</td>
</tr>
<tr>
<th>
Megbízás prioritása (Sorszám)
</th>
<td>
<?php echo $model->priority ;?>
</td>
<th>
Köteg azonosító
</th>
<td>
<?php echo $model->idGiro ;?>
</td>
<th>
</th>
<td>
</td>
</tr>
<tr>
<th>
Vendég azonosító
</th>
<td>
<?php echo "". $model->customer->id_customer;?>
</td>
<th>
Vendég neve
</th>
<td>
<?php echo "". $model->customer->name;?>
</td>
<th>
</th>
<td>
</td>
</tr>
<tr>
<th>
Bérlet azonosító
</th>
<td>
<?php echo "". $model->ticket->id_ticket;?>
</td>
<th>
Bérlet típus
</th>
<td>
<?php echo $model->ticket->ticketTypeName;?>
</td>
<th>
Bérlet státusza
</th>
<td>
<?php echo Ticket::toStatusName( $model->ticket->status );?>
</td>
</tr>
<tr>
<th>
Bérlet érvényességének kezdete
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model->ticket->start) ;?>
</td>
<th>
Bérlet érvényességének vége
</th>
<td>
<?php echo \Yii::$app->formatter->asDate( $model->ticket->end ) ;?>
</td>
<th>
</th>
<td>
</td>
</tr>
<tr>
<th>
Bérlet részletek száma
</th>
<td>
<?php echo $model->ticket->part_count ;?>
</td>
<th>
Bérlet esedékes részlet
</th>
<td>
<?php echo $model->ticket->part ;?>
</td>
<th>
Bérlet utoljára fizetett részlet
</th>
<td>
<?php echo $model->ticket->part_paid ;?>
</td>
</tr>
<tr>
<th>
DetSta válasz kód
</th>
<td>
<?php echo $model->detsta_answer ;?>
</td>
<th>
DetSta válasz szöveg
</th>
<td>
<?php echo $model->comment ;?>
</td>
<th>
</th>
<td>
</td>
</tr>
</table>
<?php
if ( !empty( $model->idGiro )){
echo Html::a("Köteg",['ugiro/view', 'id' => $model->idGiro] ,[ 'class' => 'btn btn-primary']);
echo Html::a("Részletek a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->idGiro] ,[ 'class' => 'btn btn-primary']);
}
echo Html::a("Bérlet fizetési részletei",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ticket]' => $model->id_ticket] ,[ 'class' => 'btn btn-primary']);
?>
</div>
</div>
</div>
</div>

View File

@ -56,8 +56,12 @@ use yii\helpers\ArrayHelper;
<?= $form->field($model, 'status')->checkbox( ['value' => 10, 'label' => Yii::t('common/ticket_type', "Active") ]) ?>
<?= $form->field($model, 'flag_student')->checkbox( ['value' => 1, 'label' => Yii::t('common/ticket_type', "Student") ]) ?>
<?= mkTitle("Csoportos beszedés")?>
<?= $form->field($model, 'installment_enabled')->checkbox( ['value' => 1, 'label' => Yii::t('common/ticket_type', "Csoportos beszedéses a bruttó áron felül") ]) ?>
<p>A részletek havonta kerülnek beszedésre</p>
<?= $form->field($model, 'installment_money')->textInput() ?>
<?= $form->field($model, 'installment_count')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket_type', 'Create') : Yii::t('common/ticket_type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

View File

@ -52,6 +52,12 @@ $this->params['breadcrumbs'][] = $this->title;
],
'created_at:datetime',
'updated_at:datetime',
[
'attribute' => 'installment_enabled',
'value' => ( $model->isInstallment() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
],
'installment_money',
'installment_count',
],
]) ?>

View File

@ -4,6 +4,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\widgets\DatePicker;
use common\models\Ticket;
/* @var $this yii\web\View */
/* @var $model backend\models\TicketSearch */
@ -36,6 +37,15 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
</div>
</div>
<div class='row'>
<div class='col-md-4'>
<?= $form->field($model, 'status')->dropDownList( ["" =>"Mind"]+ Ticket::statuses()) ?>
</div>
<div class='col-md-4'>
</div>
<div class='col-md-4'>
</div>
</div>
<div class="row">
<div class="col-md-4">
@ -54,6 +64,9 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
]
]) ?>
</div>
<div class='col-md-4'>
<?= $form->field($model, 'id_ticket')->textInput() ?>
</div>
</div>
<div class='row'>
<div class='col-md-4'>

View File

@ -77,6 +77,11 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_ticket',
'value' => 'id_ticket',
'label' => 'B. Azonosító'
],
[
'attribute' => 'id_customer',
'value' => 'customerName'
@ -87,6 +92,7 @@ $this->params['breadcrumbs'][] = $this->title;
],
'start:date',
'end:date',
'created_at:date',
[
'attribute' => 'id_user',
'value' => 'userName'
@ -99,6 +105,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'id_account',
'value' => 'accountName'
],
[
'attribute' => 'status',
'value' => 'statusName'
],
// 'max_usage_count',
// 'usage_count',

View File

@ -19,17 +19,36 @@ $this->params['breadcrumbs'][] = $this->title;
'model' => $model,
'attributes' => [
'id_ticket',
'id_user',
'id_ticket_type',
'id_account',
'id_discount',
'start',
'end',
[
'attribute' => 'id_user',
'value' => $model->user->username,
],
[
'attribute' => 'id_ticket_type',
'value' => $model->ticketTypeName,
],
[
'attribute' => 'id_account',
'value' => $model->accountName,
],
[
'attribute' => 'id_discount',
'value' => $model->discountName,
],
'start:datetime',
'end:datetime',
'max_usage_count',
'usage_count',
'status',
[
'attribute' => 'status',
'value' => $model->statusName
],
'price_brutto',
'comment',
'comment:raw',
'created_at',
'updated_at',
],

View File

@ -22,15 +22,18 @@ use kartik\widgets\DatePicker;
]); ?>
<div class='row'>
<div class='col-md-4'>
<div class='col-md-3'>
<?= $form->field($model, 'id_account')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +HtmlHelper::mkAccountOptions($accounts) ) ?>
</div>
<div class='col-md-4'>
<div class='col-md-3'>
<?php echo $form->field($model, 'types')->checkboxList( Transfer::types()) ?>
</div>
<div class='col-md-4'>
<div class='col-md-3'>
<?= $form->field($model, 'id_user')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +ArrayHelper::map($users,'id' , 'username') ) ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'status')->dropDownList( ['' => "Mind"] + Transfer::statuses() ) ?>
</div>
</div>
<div class="row">

View File

@ -75,6 +75,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'money',
'value' => 'signedMoney'
],
[
'attribute' => 'status',
'value' => 'statusName'
],
'created_at:datetime',
'paid_at:datetime',

View File

@ -0,0 +1,27 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Ugiro */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ugiro-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ugiro', 'Create') : Yii::t('common/ugiro', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,33 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\UgiroSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ugiro-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_ugiro') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/ugiro', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/ugiro', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ugiro */
$this->title = Yii::t('common/ugiro', 'Create Ugiro');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ugiro', 'Ugiros'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ugiro-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,26 @@
<?php
/* @var $this yii\web\View */
/* @var $model common\components\DetStatProcessor */
?>
detsta
<?php
echo $model->koteg->id_ugiro;
$model->run();
$megbizasok = $model->megbizasok;
echo "<br>Megbízások száma:". count($megbizasok);
foreach ($megbizasok as $m){
echo "<br>". $m->id_ticket_installment_request . " - " . ($m->detstaTetel->toString());
}
echo "<br>" . nl2br( $model->detstatUzenet->toString());
print_r($model->errors);
?>

View File

@ -0,0 +1,46 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\UgiroSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/ugiro', 'Kötegek');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ugiro-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_ugiro',
'label' => 'Köteg azonosító'
],
[
'attribute' => 'user.username',
'label' => 'Felhasnáló'
],
[
'attribute' => 'statusName',
'label' => 'Státusz'
],
[
'attribute' => 'created_at',
'label' => 'Létrehozva',
'format' =>'datetime'
],
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ugiro */
$this->title = Yii::t('common/ugiro', 'Update {modelClass}: ', [
'modelClass' => 'Ugiro',
]) . ' ' . $model->id_ugiro;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ugiro', 'Ugiros'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_ugiro, 'url' => ['view', 'id' => $model->id_ugiro]];
$this->params['breadcrumbs'][] = Yii::t('common/ugiro', 'Update');
?>
<div class="ugiro-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,27 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Ugiro */
/* @var $form yii\widgets\ActiveForm */
?>
<h1>DetSta Fájl Feltöltés</h1>
<p>
Ezen a felületen csak a fájl feltöltés törénik meg, a fájl feldolgozása a köteg nézet-ben lehetséges
</p>
<div class="ugiro-form">
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>
<?= $form->field($model, 'destaFile')->fileInput() ?>
<div class="form-group">
<?= Html::submitButton( "Feltöltés" , ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,93 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\helpers\Url;
use common\models\Ugiro;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Ugiro */
$this->title = "Köteg részletei";
$this->params['breadcrumbs'][] = ['label' => "Kötegek", 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<style >
.btns a{
margin-right: 6px;
}
a.btn{
margin-right: 6px;
}
</style>
<div class="ugiro-view">
<h1><?= Html::encode($this->title) ?></h1>
<?php
$attributes = [
[
'attribute' => 'id_ugiro',
'label' => 'Köteg azonosító'
],
[
'attribute' => 'number',
'label' => 'Üzenet sorszám'
],
[
'attribute' => 'datum',
'label' => 'Üzenet összeállítási dátum'
],
[
'attribute' => 'user.username',
'label' => 'Felhasználó'
],
[
'attribute' => 'statusName',
'label' => 'Státusz'
],
[
'attribute' => 'created_at',
'label' => 'Létrehozva',
'format' =>'datetime'
],
[
'attribute' => 'path',
'label' => 'Beszed Fájl',
'value' => Html::a( "Letöltés" , Url::base() ."/". $model->path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ),
'format' => 'raw'
],
];
if ( $model->status == Ugiro::$STATUS_RECIEVED || $model->status == Ugiro::$STATUS_FINISHED ){
$attributes[] = [
'attribute' => 'desta_path',
'label' => 'Detsta Fájl',
'value' => Html::a( "Letöltés" , Url::base() ."/". $model->desta_path , ['target' =>'_blank' ,'download' =>'CS-BESZED.' .$model->id_ugiro ] ),
'format' => 'raw'
];
}
?>
<?= DetailView::widget([
'model' => $model,
'attributes' => $attributes,
]) ?>
</div>
<div class="btns">
<?php
if ( $model->status == Ugiro::$STATUS_RECIEVED ){
echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
}
echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
?>
</div>

View File

View File

@ -0,0 +1,3 @@
01BESZED1A25366936T2442016012000105860025215371128 00000000BEEmovar
02000001201601250000007800 1 roland Berlet :614
030000010000000000007800

View File

@ -0,0 +1,3 @@
01BESZED1A25366936T2442016012000115860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland Berlet :614
030000010000000000007800

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000125860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland Berlet :614
020000022016012500000078005860025215371128 1 roland Berlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000145860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland  rv¡ztûr t<>k”rfûr¢gBerlet :614
020000022016012500000078005860025215371128 1 roland  rv¡ztûr t<>k”rfûr¢gBerlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000155860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland  rv¡ztûr t<>k”rfûr¢ Berlet :614
020000022016012500000078005860025215371128 1 roland  rv¡ztûr t<>k”rfûr¢ Berlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000165860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000175860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000185860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000195860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukor Berlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000205860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland Berlet :614
020000022016012500000078005860025215371128 1 roland a Berlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000215860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000225860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000235860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogBerlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000265860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
030000020000000000015600

View File

@ -0,0 +1,4 @@
01BESZED1A25366936T2442016012000275860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
030000020000000000015600

View File

@ -0,0 +1,3 @@
01BESZED1A25366936T2442016012000285860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
030000010000000000007800

View File

@ -0,0 +1,3 @@
01BESZED1A25366936T2442016012000295860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
030000010000000000007800

View File

@ -0,0 +1,13 @@
01BESZED1A25366936T2442016012000305860025215371128 00000000BEEmovar
020000012016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000022016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000032016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000042016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000052016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000062016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000072016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000082016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000092016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000102016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
020000112016012500000078005860025215371128 1 roland arvizturo tukorfurogep Berlet :614
030000110000000000085800

View File

@ -0,0 +1,3 @@
01BESZED1A25366936T2442016012000095860025215371128 00000000BEEmovar
02000001201601250000007800 1 roland Berlet :614
030000010000000000007800

View File

View File

@ -0,0 +1,8 @@
$(document).ready(function() {
$("#select-all-pending").click(function() {
var checkBoxes = $(".pending-request");
checkBoxes.prop("checked", $("#select-all-pending").prop("checked"));
});
});

120
bkr.html Normal file
View File

@ -0,0 +1,120 @@
<html>
<head>
<meta charset="utf8">
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<style>
table{
border: 1px solid black;
border-collapse: collapse;
}
td{
border: 1px solid black;
border-collapse: collapse;
padding: 3px;
}
</style>
<script type="text/javascript">
function build(){
var s = "";
s += $("#f210").val();
s += $("#F211").val();
s += $("#F212").val();
$("#result").val(s);
}
</script>
</head>
<body>
<form>
<table>
<tr>
<td>pozíció</td>
<td>mező-név</td>
<td>tartalom</td>
<td>típus</td>
<td>hossz</td>
<td>érték</td>
<td>K / V</td>
<td>megjegyzés</td>
<td></td>
</tr>
<tr>
<td>1 2</td>
<td>F210</td>
<td>rekordtípus</td>
<td>N</td>
<td>2</td>
<td>01</td>
<td>K</td>
<td></td>
<td><input id="f210" type="text" value="01"></td>
</tr>
<tr>
<td>3 8</td>
<td>F211</td>
<td>üzenettípus</td>
<td>A</td>
<td>6</td>
<td>BESZED</td>
<td>K</td>
<td></td>
<td><input id="F211" type="text" value="BESZED"></td>
</tr>
<tr>
<td>9</td>
<td>F212**</td>
<td>duplum-kód</td>
<td>N</td>
<td>1</td>
<td>0 - 9</td>
<td>K</td>
<td>a feldolgozás menetére nincs hatással</td>
<td><input id="F212" type="text" value="0"></td>
</tr>
<tr>
<td>10-22</td>
<td>F213</td>
<td>kezdeményező azonosítója</td>
<td>AN</td>
<td>13</td>
<td></td>
<td>K</td>
<td>a CSBESZ-t összeállító
szolgáltató / beszedő
- adószáma
(Aaaaaaaaa[Tttt]),
- EAN kódja,
- egyéb azonosítója
(Ebbbsssss)</td>
<td><input id="F212" type="text" value="0"></td>
</tr>
<tr>
<td>9</td>
<td>F212**</td>
<td>duplum-kód</td>
<td>N</td>
<td>1</td>
<td>0 - 9</td>
<td>K</td>
<td>a feldolgozás menetére nincs hatással</td>
<td><input id="F212" type="text" value="0"></td>
</tr>
</table>
</form>
<textarea id="result" rows="3" cols="80"></textarea>
<a class="btn btn-primary" onclick='javascript: build(); ' >Generál</a>
<table>
</table>
</body>
</html>

View File

@ -1,3 +1,8 @@
-0.0.25
- add reception key changes,
- add money movent storno,
- status displays
- ticket installmetn request, ugiro, beszed, detsta
-0.0.24
- add transfer payment_method
-0.0.23

View File

@ -252,6 +252,10 @@ class DailyListing
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
if ( $this->isModeReception() || $this->isModeAccountState() ){
$query->andWhere(['transfer.payment_method' => Transfer::PAYMENT_METHOD_CASH]);
}
}

View File

@ -0,0 +1,137 @@
<?php
namespace common\components;
use yii\base\Object;
use common\models\TicketInstallmentRequest;
use common\components\giro\GiroDETSTATetel;
use backend\models\TicketInstallmentMarkForSendForm;
use common\models\Ugiro;
use yii\db\Query;
use common\components\giro\GiroDETSTA;
use common\components\giro\GiroDETSTAFej;
use common\components\giro\GiroDETSTALab;
/**
* This is the model class for table "ticket".
*
* @property common\components\giro\GiroDETSTA $detstatUzenet
* @property common\models\UGiro $koteg
*
* */
class DetStatProcessor extends Object{
/**aktuális koteg, config paraméterként kapju*/
public $koteg;
public $idKoteg;
public $detstatUzenet;
public $megbizasok;
public $errors = [];
public function run(){
// $this->readKoteg();
$this->readKotegMegbizasok();
$this->readDetstaUzenet();
$this->createMegbizasTetelHozzarendelesek();
$this->processMegbizasok();
$this->markKotegFinished();
}
public function markKotegFinished(){
$this->koteg->status = Ugiro::$STATUS_FINISHED;
$this->koteg->save();
}
public function processMegbizasok(){
foreach ($this->megbizasok as $megbizas){
$processor = new DetStatTetelProcessor(
[
'tetel' => $megbizas->detstaTetel,
'megbizas' => $megbizas
]
);
$processor->run();
$this->errors = $this->errors + $processor->errors;
}
}
public function readDetstaUzenet(){
$filename = \Yii::getAlias("@webroot") ."/" .$this->koteg->desta_path;
$content = file_get_contents($filename);
$this->detstatUzenet = GiroDETSTA::parse($content);
$this->detstatUzenet = new GiroDETSTA();
$this->idKoteg = 33;
$fej = new GiroDETSTAFej();
$this->detstatUzenet->fej = $fej;
$tetel = new GiroDETSTATetel();
$tetel->ugyfelAzonosito = 12;
$tetel->visszajelzesInformacio = "00";
$tetel->visszajelzesInformacio = "02";
$this->detstatUzenet->tetelek[] = $tetel;
$lab = new GiroDETSTALab();
$this->detstatUzenet->lab = $lab;
}
public function createMegbizasTetelHozzarendelesek(){
$mapTetel = [];
foreach ($this->detstatUzenet->tetelek as $tetel ){
$mapTetel[$tetel->ugyfelAzonosito] = $tetel;
}
foreach ($this->megbizasok as $megbizas){
if ( array_key_exists($megbizas->id_ticket_installment_request, $mapTetel)){
$megbizas->detstaTetel = $mapTetel[$megbizas->id_ticket_installment_request];
}
}
}
public function readKoteg(){
$this->koteg = Ugiro::findOne($this->idKoteg );
if ( !isset($this->koteg) ){
$this->errors [] = "Kötege nem található! (".$this->detstatUzenet->fej." )";
}
}
public function readKotegMegbizasok(){
$this->megbizasok = $this->koteg->requests;
}
public function applyNewMegbizasState(){
$kod = $this->tetel->valaszHivatkozasiKod;
if ( $kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT){
$this->megbizas->status = TicketInstallmentRequest::$STATUS_ACCEPTED;
}else{
$this->megbizas->status = TicketInstallmentRequest::$STATUS_REJECTED;
}
$this->megbizas->save(false);
}
public function applyNewTicketState(){
$this->ticket->applyTicketInstallmentRequest($this->megbizas);
$this->ticket->save(false);
}
public function hasError(){
return count($this->errors) > 0;
}
}

View File

@ -0,0 +1,129 @@
<?php
namespace common\components;
use yii\base\Object;
use common\models\TicketInstallmentRequest;
use common\components\giro\GiroDETSTATetel;
use backend\models\TicketInstallmentMarkForSendForm;
use common\models\Transfer;
use common\models\Account;
use common\models\Discount;
/**
* This is the model class for table "ticket".
*
* @property common\components\giro\GiroDETSTATetel $tetel
* @property common\models\TicketInstallmentRequest $megbizas
* @property common\models\Ticket $ticket
*
*
*/
class DetStatTetelProcessor extends Object {
public $tetel; // config
public $megbizas; // config
public $ticket;
public $errors = [ ];
public $dryRun = false; // for testing, to not to persist the changes
public function run() {
// $this->readMegbizas();
if ($this->megbizas->isStatusAccepted()) {
// return;
}
$status = TicketInstallmentRequest::$STATUS_REJECTED;
$kod = 'xx';
$comment = "";
if (isset ( $this->tetel )) {
$kod = $this->tetel->visszajelzesInformacio;
}
if ($kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT) {
$status = TicketInstallmentRequest::$STATUS_ACCEPTED;
} else {
$status = TicketInstallmentRequest::$STATUS_REJECTED;
if ( $kod == "xx"){
$comment = "Nem található a detsta fájlban a tétel válasza";
}else{
if ( array_key_exists($kod, GiroDETSTATetel::$INFORMACIOK)){
$comment = "Hiba kód: ".$kod ." - " .GiroDETSTATetel::$INFORMACIOK[$kod];
}else{
$comment = "Ismeretlen hiba kód: " .$kod;
}
}
}
$this->megbizas->applyStatus($status,true,$kod,$comment);
// $this->readTicket();
// if ( !$this->hasError() ){
// $this->applyNewMegbizasState();
// $this->applyNewTicketState();
// $this->addTransfer();
// }
}
// public function readMegbizas(){
// $this->megbizas = TicketInstallmentRequest::findOne($this->tetel->ugyfelAzonosito);
// if ( !isset($this->megbizas) ){
// $this->errors [] = "Válaszban jelölt megbízás nem található! (".$this->tetel->ugyfelAzonosito." )";
// }
// }
// public function readTicket(){
// $this->ticket = $this->megbizas->ticket;
// if ( !isset($this->ticket) ){
// $this->errors [] = "Válaszban jelölt bérlet nem található! (".$this->megbizas->id_ticket." )";
// }
// }
// public function applyNewMegbizasState(){
// $kod = 'xx';
// if ( isset($this->tetel ) ) {
// $kod = $this->tetel->visszajelzesInformacio;
// }
// if ( $kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT){
// $this->megbizas->status = TicketInstallmentRequest::$STATUS_ACCEPTED;
// }else{
// $this->megbizas->status = TicketInstallmentRequest::$STATUS_REJECTED;
// }
// if ( !$this->isDryRun() ){
// $this->megbizas->save(false);
// }
// }
// public function applyNewTicketState(){
// $this->ticket->applyTicketInstallmentRequest($this->megbizas);
// if ( !$this->isDryRun() ){
// $this->ticket->save(false);
// }
// }
// protected function addTransfer(){
// $account = Account::findOne($this->ticket->id_account);
// $discount = null;
// if ( isset($this->ticket->id_account)){
// $discount = Discount::findOne( $this->ticket->id_discount );
// }
// $transfer = Transfer::createTicketTransfer($account, $discount, null, 1, $this->ticket);
// $transfer->status = Transfer::STATUS_PAID;
// $transfer->paid_at = date('Y-m-d H:i:s' ) ;
// $transfer->paid_by = \Yii::$app->user->id;
// $transfer->payment_method = Transfer::PAYMENT_METHOD_TRANSFER;
// $transfer->money = $this->megbizas->money;
// $transfer->comment = "Csoportos beszedes";
// $transfer->id_user = \Yii::$app->user->id;
// $transfer->id_customer = $this->ticket->id_customer;
// $transfer->save(false);
// }
public function hasError() {
return count ( $this->errors ) > 0;
}
public function isDryRun() {
return $this->dryRun;
}
}

View File

@ -5,6 +5,11 @@ namespace common\components;
use \Yii;
class Helper {
public static function getDateTimeString(){
return date("Y-m-d H:i:s");
}
public static function hufRound($m) {
$result = round ( $m / 5, 0 ) * 5;
return $result;

View File

@ -0,0 +1,16 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
class GiroBankszamla extends GiroBase{
// public $bankszerv;
public $szamlaszam;
public function toString(){
return $this->szovegKitolt( $this->szamlaszam, 24 );
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace common\components\giro;
use backend\models\GiroKotegForm;
class GiroBase {
public function mezoKitolt($input, $hossz, $pad_string = "") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
}
public function szamKitolt($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
}
public function szamKitoltJobb($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_RIGHT);
}
public function szovegKitolt($input, $hossz, $pad_string = " ") {
$data = $input;
$data = GiroKotegForm::transliterate($data);
if ( strlen($data) > $hossz){
$data = substr($data, 0, $hossz );
}
$data = str_pad($data, $hossz, $pad_string, STR_PAD_RIGHT);
echo $data;
// echo strlen($data);
return $data;
}
public static function szovegOlvas($row,$start,$length, $padchar = " "){
return rtrim(substr($row, $start,$length),$padchar);
}
public static function szamOlvas($row,$start,$length, $padchar = "0"){
return ltrim(substr($row, $start,$length),$padchar);
}
public function rekordVege(){
return "\r\n";
}
}

View File

@ -0,0 +1,87 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
*
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroBeszed extends GiroBase {
public function __construct() {
}
public static function createFileContent($number,$datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) {
if ( !isset($terhelesiDatum)){
$terhelesiDatum = date('Ymd' ,strtotime("+5 day"));
}
$s = self::createFej($number, $datum);
$s .= self::createTetelek($requests,$terhelesiDatum);
$s .= self::createLab($requests);
return $s;
}
public static function createFej($number, $daturm) {
$fej = new GiroBeszedFej ();
$fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod'];
$fej->kezdemenyezoAzonosito = \Yii::$app->params['ugiro_kezdemenyezo_azonosito'];//"A25366936T244"; // "66658092128";
$fej->uzenetSorszam->osszeallitasDatuma = $daturm;
$fej->uzenetSorszam->sorszam = $number;
$fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128";
// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB";
$fej->ertesitesiHatarido = "";
$fej->kezdemenyezoCegNeve = \Yii::$app->params['company'];
return $fej->toString ();
}
public static function createTetelek($requests,$terhelesiDatum){
$s = "";
$i = 0;
foreach ($requests as $request){
$i++;
$s .= self::createTetel($request,$i,$terhelesiDatum);
}
return $s;
}
/**
* @param common\models\TicketInstallmentRequest $request
* */
public static function createTetel($request,$sorszam,$terhelesiDatum) {
$tetel = new GiroBeszedTetel ();
$customer = $request->customer;
$tetel->tetelSorszam = $sorszam;
$tetel->terhelesiDatum = $terhelesiDatum;
$tetel->osszeg = $request->money;
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
$tetel->ugyfelazonositoAKezdemenyezonel = $request->id_ticket_installment_request;
// $tetel->ugyfelNeve = "Schneider Roland";
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
$tetel->szamlaTulajdonosNeve = $customer->name;
$tetel->kozlemeny = "Berlet:" . $request->id_ticket .";MegbizasAzo:" . $request->id_ticket_installment_request;
return $tetel->toString();
}
public static function createLab($requests) {
$lab = new GiroBeszedLab ();
$osszeg = 0;
foreach ($requests as $request ){
$osszeg += $request->money;
}
$lab->tetelekOsszerteke = $osszeg;
$lab->tetelekSzama = count($requests);
return $lab->toString ();
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace common\components\giro;
/**
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */
class GiroBeszedFej extends GiroBase{
public $recordTipus = "01";
public $uzenetTipus = "BESZED";
public $duplumKod = "";
public $kezdemenyezoAzonosito = "";
public $uzenetSorszam;
public $kezdemenyezoBankszamla;
public $ertesitesiHatarido;
public $jogcim = "BEE";
public $kezdemenyezoCegNeve;
public $kozlemeny;
public function __construct(){
$this->uzenetSorszam = new GiroUzenetsorszam();
$this->kezdemenyezoBankszamla = new GiroBankszamla();
}
public function toString( ) {
return $this->recordTipus
.$this->uzenetTipus
. $this->duplumKod
. $this->szamKitolt( $this->kezdemenyezoAzonosito , 13)
. $this->uzenetSorszam->toString()
. $this->kezdemenyezoBankszamla->toString()
. $this->szamKitolt($this->ertesitesiHatarido,8)
. $this->jogcim
. $this->szovegKitolt($this->kezdemenyezoCegNeve, 35)
. $this->szovegKitolt($this->kozlemeny, 70)
. $this->rekordVege()
;
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */
class GiroBeszedLab extends GiroBase{
public $rekordTipus = "03";
public $tetelekSzama = 0;
public $tetelekOsszerteke = 0;
public function GiroBeszedLab(){
}
public function toString(){
return $this->rekordTipus
. $this->szamKitolt($this->tetelekSzama,6)
. $this->szamKitolt($this->tetelekOsszerteke,16)
. $this->rekordVege()
;
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kotelezettBankszamla
* */
class GiroBeszedTetel extends GiroBase{
public $rekordTipus = "02";
public $tetelSorszam = 0;
public $terhelesiDatum = "";
public $osszeg;
public $kotelezettBankszamla;
public $ugyfelazonositoAKezdemenyezonel;
public $ugyfelNeve;
public $ugyfelCime;
public $szamlaTulajdonosNeve;
public $kozlemeny;
public function __construct(){
$this->kotelezettBankszamla = new GiroBankszamla();
}
public function toString(){
return $this->rekordTipus
. $this->szamKitolt($this->tetelSorszam,6)
. $this->terhelesiDatum
. $this->szamKitolt($this->osszeg, 10)
. $this->kotelezettBankszamla->toString()
. $this->szovegKitolt($this->ugyfelazonositoAKezdemenyezonel ,24)
. $this->szovegKitolt( $this->ugyfelNeve ,35 )
. $this->szovegKitolt($this->ugyfelCime , 35 )
. $this->szovegKitolt($this->szamlaTulajdonosNeve , 35 )
. $this->szovegKitolt($this->kozlemeny , 70 )
. $this->rekordVege()
;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
*
* @property common\components\giro\GiroDETSTAFej $fej
* @property common\components\giro\GiroDETSTALab $lab
* @property common\components\giro\GiroDETSTATetel $tetelek
*
*/
class GiroDETSTA extends GiroBase {
public $fej;
public $lab;
public $tetelek = [];
public function __construct() {
}
public function toString(){
$s = "";
$s .= $this->fej->toString();
foreach ($this->tetelek as $tetel ){
$s .= $tetel->toString();
}
$s .= $this->lab->toString();
return $s;
}
public static function parse($content){
$detsta = new GiroDETSTA();
$array = preg_split("/\r\n|\n|\r/", $content);
$detsta->fej = GiroDETSTAFej::parse($array[0]);
$detsta->lab = GiroDETSTALab::parse($array[count($array) -2]);
for ( $i = 1 ; $i < count($array) -2; $i++ ){
$row = $array[$i];
$tetel = GiroDETSTATetel::parse($row);
$detsta->tetelek[] = $tetel;
}
return $detsta;
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace common\components\giro;
/**
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */
class GiroDETSTAFej extends GiroBase{
public $recordTipus = "01";
public $uzenetTipus = "DETSTA";
public $jelentesJelzo = "9";
public $kezdemenyezoAzonosito = "";
public $csoportosUzenetSorszam;
public $detstaUzenetSorszam;
public $ido;
public function __construct(){
$this->csoportosUzenetSorszam = new GiroUzenetsorszam();
$this->detstaUzenetSorszam = new GiroUzenetsorszam();
}
public function toString( ) {
return $this->recordTipus
.$this->uzenetTipus
. $this->jelentesJelzo
. $this->szamKitolt( $this->kezdemenyezoAzonosito , 13)
. $this->csoportosUzenetSorszam->toString()
. $this->detstaUzenetSorszam->toString()
. $this->ido
. $this->rekordVege()
;
}
public static function parse($row){
$fej = new GiroDETSTAFej();
$fej->recordTipus = substr($row,0,2 );
$fej->uzenetTipus = substr($row, 2,6 );
$fej->jelentesJelzo = substr($row, 8,1);
$fej->kezdemenyezoAzonosito = substr($row, 9,13);
$fej->csoportosUzenetSorszam ->osszeallitasDatuma = substr($row, 22, 8);
$fej->csoportosUzenetSorszam->sorszam = static::szamOlvas($row, 30, 4);
$fej->detstaUzenetSorszam ->osszeallitasDatuma = substr($row, 34,8);
$fej->detstaUzenetSorszam->sorszam = substr($row, 42,4);
$fej->ido = substr($row, 46,6);
return $fej;
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace common\components\giro;
/**
*
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroDETSTALab extends GiroBase {
public $recordTipus = "03";
public $teljesitettTetelekSzama = "0";
public $teljesitettTetelekOsszerteke = "0";
public $visszautasitottTetelekSzama = "0";
public $visszautasitottTetelekOsszerteke = "0";
public $megNemValaszoltTetelekSzama = "0";
public $megNemValaszoltTetelekOsszerteke = "0";
public function __construct() {
}
public function toString() {
return $this->recordTipus
. $this->szamKitolt ( $this->teljesitettTetelekSzama, 6 )
. $this->szamKitolt ( $this->teljesitettTetelekOsszerteke, 16 )
. $this->szamKitolt ( $this->visszautasitottTetelekSzama, 6 )
. $this->szamKitolt ( $this->visszautasitottTetelekOsszerteke, 16 )
. $this->szamKitolt ( $this->megNemValaszoltTetelekSzama, 6 )
. $this->szamKitolt ( $this->megNemValaszoltTetelekOsszerteke, 16 )
. $this->rekordVege();
;
}
public static function parse($row) {
$lab = new GiroDETSTALab ();
$lab->recordTipus = substr($row,0,2 );
$lab->teljesitettTetelekSzama = substr($row,2,6 );
$lab->teljesitettTetelekOsszerteke = substr($row,8,16 );
$lab->visszautasitottTetelekSzama = substr($row,24,6 );
$lab->visszautasitottTetelekOsszerteke = substr($row,30,16 );
$lab->megNemValaszoltTetelekSzama = substr($row,46,6 );
$lab->megNemValaszoltTetelekOsszerteke = substr($row,52, 16 );
return $lab;
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace common\components\giro;
/**
*
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroDETSTATetel extends GiroBase {
public static $INFORMACIO_TELJESITETT = "00";
public static $INFORMACIO_VISSZAUTASIOTT_VALASZ_NELKUL = "NO";
public static $INFORMACIOK = [
'02' => "nem létező 'címzett' számlaszám",
'03' => "megszűnt 'címzett' számlaszám",
'06' => "a 'címzett' számlaszáma nem értelmezhető (az ügyfél számlaszáma helyett a bank ügyfélforgalmi számlaszáma szerepel)",
'10' => "a számlatulajdonos neve és a megadott számlaszám nem tartozik össze szemantikai, 'teljesíthetetlen' ok miatti visszaküldés (RETURN)",
'50' => "fedezethiány miatti visszaküldés",
'51' => "felhatalmazás hiánya miatti visszaküldés",
'54' => "általános visszaküldés (az ügyfél megbízása alapján)",
'65' => "összeghatár feletti beszedési megbízás",
'99' => "egyéb hiba"
];
public $recordTipus = "01";
public $tetelSorszam = "0";
public $osszeg = "0";
public $eredetiTetelElszamolasiDatuma = "";
public $visszajelzesInformacio;
public $feldolgozasDatum;
public $terhelesiDatum;
public $valaszHivatkozasiKod;
public $eredetiHivatkozasiKod;
public $ugyfelAzonosito;
public function __construct() {
$this->csoportosUzenetSorszam = new GiroUzenetsorszam ();
$this->detstaUzenetSorszam = new GiroUzenetsorszam ();
}
public function toString() {
return $this->recordTipus
. $this->szamKitolt ( $this->tetelSorszam, 6 )
. $this->szamKitolt ( $this->osszeg, 10 )
. $this->eredetiTetelElszamolasiDatuma
. $this->visszajelzesInformacio
. $this->feldolgozasDatum
. $this->terhelesiDatum
. $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 )
. $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 )
. $this->szovegKitolt ( $this->ugyfelAzonosito, 24 )
. $this->rekordVege();
}
public static function parse($row) {
$tetel = new GiroDETSTATetel ();
$tetel->recordTipus = substr ( $row, 0, 2 );
$tetel->tetelSorszam = substr ( $row, 2, 6 );
$tetel->osszeg = substr ( $row, 8, 10 );
$tetel->eredetiTetelElszamolasiDatuma = substr ( $row, 18, 8 );
$tetel->visszajelzesInformacio = substr ( $row, 26, 2 );
$tetel->feldolgozasDatum = substr ( $row, 28, 8 );
$tetel->terhelesiDatum = substr ( $row, 36, 8 );
$tetel->valaszHivatkozasiKod = substr ( $row, 44, 29 );
$tetel->eredetiHivatkozasiKod = substr ( $row, 73, 29 );
$tetel->ugyfelAzonosito = substr ( $row, 102, 24 );
return $tetel;
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
class GiroUzenetsorszam extends GiroBase{
public $osszeallitasDatuma;
public $sorszam;
public function toString( ) {
return $this->osszeallitasDatuma . $this->szamKitolt( $this->sorszam,4);
}
}
?>

View File

@ -4,7 +4,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.24',
'version' => 'v0.0.25',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global
@ -13,5 +13,8 @@ return [
'login_reception_email' => true, //if reception login should send email
'login_admin_email' => true, //if admin login should send email
'account_state_close_preload_money' => 'true',//preload money wnen show account state close page
'ugiro_duplom_kod' => 1,
'ugiro_kezdemenyezo_szamlaszam' => '5860025215371128',
'ugiro_kezdemenyezo_azonosito' => 'A25366936T244',
];

View File

@ -233,7 +233,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
$this->prev_state = $lastOpen->id_account_state;
$this->prev_money = $lastOpen->money;
}
$end = date("Y-m-d H:i:s");
$end = date('Y-m-d H:i:s' );
// $end = Yii::$app->formatter->asDatetime(strtotime("now"), "php:Y-m-d H:i:s");
$this->collection_money = Transfer::readPaid($start, $end, Yii::$app->user->id);

View File

@ -0,0 +1,62 @@
<?php
namespace common\models;
use Yii;
use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "card_key_assignment".
*
* @property integer $id_card
* @property integer $id_key
* @property integer $id_user
* @property string $created_at
* @property string $updated_at
*/
class CardKeyAssignment extends \yii\db\ActiveRecord
{
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
],
], parent::behaviors());
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'card_key_assignment';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_card', 'id_key', 'id_user'], 'integer'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_card' => Yii::t('common/image', 'Id Card'),
'id_key' => Yii::t('common/image', 'Id Key'),
'id_user' => Yii::t('common/image', 'Id User'),
'created_at' => Yii::t('common/image', 'Created At'),
'updated_at' => Yii::t('common/image', 'Updated At'),
];
}
}

View File

@ -57,9 +57,11 @@ class CardSearch extends Card
{
$query = new Query();
$query->select(['card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']);
$query->select(['card.id_card as card_id_card', 'card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']);
$query->from('card');
$query->innerJoin('customer','card.id_card = customer.id_customer_card');
$query->leftJoin("card_key_assignment", 'card.id_card = card_key_assignment.id_card');
$query->leftJoin("key", 'key.id_key = card_key_assignment.id_key');
$query->orderBy(['customer.name' => SORT_ASC]);
@ -77,9 +79,18 @@ class CardSearch extends Card
return $dataProvider;
}
$query->andFilterWhere([
// 'lower(customer.name)' => $this->customerName
]);
// $query->andFilterWhere([
// 'lower(card.number)' => $this->customerName
// ]);
if ( !empty($this->number)){
$query->andWhere(['or',
['and',[ 'in','card.number' , [$this->number]],"trim(coalesce(card.number, '')) <>'' " ],
['and', ['in','card.rfid_key' ,[ $this->number] ],"trim(coalesce(card.rfid_key, '')) <>'' "],
['and',[ 'in','key.number' , [$this->number]],"trim(coalesce(key.number, '')) <>'' " ],
['and', ['in','key.rfid_key' ,[ $this->number] ],"trim(coalesce(key.rfid_key, '')) <>'' "]
]);
}
$query->andFilterWhere(['like', 'customer.name', $this->customerName]);

View File

@ -29,6 +29,9 @@ class MoneyMovement extends \yii\db\ActiveRecord
const TYPE_OUT = 10;
const TYPE_IN = 20;
const STATUS_PAID = 20;
const STATUS_STORNO = 30;
public $_account;
/**
@ -140,4 +143,23 @@ class MoneyMovement extends \yii\db\ActiveRecord
return self::typeName($this->type);
}
public static function statuses( ) {
return [
MoneyMovement::STATUS_PAID => 'Fizetve',
MoneyMovement::STATUS_STORNO => 'Törölve',
];
}
public static function toStatusName($id_status){
$result = "Ismeretlen";
$statuses = MoneyMovement::statuses();
if ( array_key_exists($id_status, $statuses)){
$result = $statuses[$id_status];
}
return $result;
}
public function getStatusName(){
return static::toStatusName($this->status);
}
}

View File

@ -37,6 +37,7 @@ class Sale extends \yii\db\ActiveRecord
const STATUS_NOT_PAID = 10;
const STATUS_PAID = 20;
const STATUS_DELETED= 30;
/**
* @inheritdoc
@ -140,4 +141,26 @@ class Sale extends \yii\db\ActiveRecord
return $sale;
}
public static function statuses( ) {
return [
Sale::STATUS_PAID => 'Aktív',
Sale::STATUS_DELETED => 'Törölve',
Sale::STATUS_NOT_PAID => 'Nincs fizetve',
];
}
public static function toStatusName($id_status){
$result = "Ismeretlen";
$statuses = Sale::statuses();
if ( array_key_exists($id_status, $statuses)){
$result = $statuses[$id_status];
}
return $result;
}
public function getStatusName(){
return static::toStatusName($this->status);
}
}

View File

@ -23,6 +23,9 @@ use common\components\Helper;
* @property integer $usage_count
* @property integer $status
* @property integer $price_brutto
* @property integer $part eddig a részletig kell kifizetve lenni
* @property integer $part_count ennyi részlet van összesen
* @property integer $part_paid ennyi részlet van kifizetve
* @property string $comment
* @property string $created_at
* @property string $updated_at
@ -31,6 +34,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const STATUS_INACTIVE = 20;
/**
* @inheritdoc
@ -46,7 +50,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
public function rules()
{
return [
[['id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'],
[[ 'id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'],
[['start', 'end', 'created_at', 'updated_at'], 'safe'],
[['comment'], 'required'],
[['comment'], 'string', 'max' => 255]
@ -59,7 +63,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
public function attributeLabels()
{
return [
'id_ticket' => Yii::t('common/ticket', 'Id Ticket'),
'id_ticket' => Yii::t('common/ticket', 'Bérlet azonosító'),
'id_user' => Yii::t('common/ticket', 'Id User'),
'id_ticket_type' => Yii::t('common/ticket', 'Id Ticket Type'),
'id_account' => Yii::t('common/ticket', 'Id Account'),
@ -200,10 +204,10 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
new Expression( 'ticket_type.name as name'),
new Expression( 'coalesce( count(ticket.id_ticket),0) as total'),
new Expression( "coalesce( sum( case when ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid
new Expression( "coalesce( sum( case when ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created
new Expression( "coalesce( sum( case when ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money
new Expression( "coalesce( sum( case when " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ),
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlValidRule('ticket.start', 'ticket.end', ':start', ':end') . " then 1 else 0 end) , 0) as valid" ), //valid
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then 1 else 0 end) , 0) as created" ),//created
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND ". Helper::sqlInIntervalRule('ticket.created_at', ':start', ':end') . " then transfer.money else 0 end) , 0) as created_money" ),//created_money
new Expression( "coalesce( sum( case when ticket.status <> " .Ticket::STATUS_DELETED ." AND " . Helper::sqlExpireRule('ticket.start', 'ticket.end', ':start', ":end") . " then 1 else 0 end) , 0) as expired" ),
]);
@ -233,4 +237,79 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
return $query;
}
public static function statuses( ) {
return [
Ticket::STATUS_ACTIVE => 'Aktív',
Ticket::STATUS_DELETED => 'Törölve',
Ticket::STATUS_INACTIVE => 'Inaktív',
];
}
public static function toStatusName($id_status){
$result = "Ismeretlen";
$statuses = Ticket::statuses();
if ( array_key_exists($id_status, $statuses)){
$result = $statuses[$id_status];
}
return $result;
}
public function getStatusName(){
return static::toStatusName($this->status);
}
public function isDeleted(){
return $this->status == Ticket::STATUS_DELETED;
}
/**csoportos beszedéses a bérlet*/
public function isInstallmentTicket(){
return ( isset($this->part_count) && $this->part_count > 0 );
}
/**
* Apply request
*
* @var common\models\TicketInstallmentRequest $request megbízás
* */
public function applyTicketInstallmentRequest( $request ) {
//ha csoportos beszedéses
if ( $this->isInstallmentTicket() ){
if ( $request->isStatusAccepted() ){
if ( $this->part_paid < $request->priority ){
$this->part_paid = $request->priority;
}
$this->recalclulate();
}else if ( $request->isStatusRejected() ){
$this->status = static::STATUS_INACTIVE;
}
}
}
/*
* *
* @param common\models\TicketInstallmentRequest $request megbízás
*/
public function setPartRequired($request){
// ha keveseb a részlet sorszám mint a bérlet max sorszáma
if ( $request->priority <= $this->part_count ){
//ha az aktuális elvárt részlet kisebb , mint a megbízása
if ( $this->part < $request-> priority ){
$this->part = $request->priority;
}
}
}
/**
* Csoportos beszedéses bérlet érvényességének újraszámolása
* */
public function recalclulate( ) {
if ( $this->isInstallmentTicket() ){
$enabled = $this->part_paid >= $this->part;
if ( $enabled == true ){
$this->status = static::STATUS_ACTIVE;
}else{
$this->status = static::STATUS_INACTIVE;
}
}
}
}

View File

@ -0,0 +1,260 @@
<?php
namespace common\models;
use Yii;
use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
use common\components\Helper;
/**
* This is the model class for table "ticket_installment_request".
*
* @property integer $id_ticket_installment_request
* @property integer $id_ticket
* @property integer $id_customer
* @property integer $id_transfer
* @property integer $status
* @property integer $money
* @property string $customer_name
* @property string $bank_name
* @property string $bank_address
* @property string $bank_account
* @property integer $priority
* @property string $request_sent_at
* @property string $request_processed_at
* @property string $request_target_time_at
* @property string $created_at
* @property string $updated_at
* @property string $detsta_answer
* @property string $comment
* @property string $updated_at
* @property common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból
*/
class TicketInstallmentRequest extends \yii\db\ActiveRecord
{
///status //pending | marked_to_send | sent | canceled | rejected | accepted |
public static $STATUS_PENDING = 0;
public static $STATUS_MARKED_TO_SEND = 10;
public static $STATUS_SENT = 20;
public static $STATUS_CANCELED = 30;
public static $STATUS_REJECTED = 40;
public static $STATUS_ACCEPTED = 50;
public static $STATUS_ACCEPTED_MANUAL = 60;
/**
* GiroDetstaTetel record a DetSta fájlból
* */
public $detstaTetel;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'ticket_installment_request';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ticket', 'id_customer', 'id_transfer', 'status', 'money', 'priority'], 'integer'],
[['request_sent_at', 'request_processed_at', 'request_target_time_at', 'created_at', 'updated_at'], 'required'],
[['request_sent_at', 'request_processed_at', 'request_target_time_at', 'created_at', 'updated_at'], 'safe'],
[['customer_name', 'bank_name', 'bank_address', 'bank_account'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_ticket_installment_request' => Yii::t('common/ticket_installment_request', 'Id Ticket Installment Request'),
'id_ticket' => Yii::t('common/ticket_installment_request', 'Id Ticket'),
'id_customer' => Yii::t('common/ticket_installment_request', 'Id Customer'),
'id_transfer' => Yii::t('common/ticket_installment_request', 'Id Transfer'),
'status' => Yii::t('common/ticket_installment_request', 'Status'),
'money' => Yii::t('common/ticket_installment_request', 'Money'),
'customer_name' => Yii::t('common/ticket_installment_request', 'Customer Name'),
'bank_name' => Yii::t('common/ticket_installment_request', 'Bank Name'),
'bank_address' => Yii::t('common/ticket_installment_request', 'Bank Address'),
'bank_account' => Yii::t('common/ticket_installment_request', 'Bank Account'),
'priority' => Yii::t('common/ticket_installment_request', 'Priority'),
'request_sent_at' => Yii::t('common/ticket_installment_request', 'Request Sent At'),
'request_processed_at' => Yii::t('common/ticket_installment_request', 'Request Processed At'),
'request_target_time_at' => Yii::t('common/ticket_installment_request', 'Request Target Time At'),
'created_at' => Yii::t('common/ticket_installment_request', 'Created At'),
'updated_at' => Yii::t('common/ticket_installment_request', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
],
], parent::behaviors());
}
public function getCustomer(){
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
}
public function getTicket(){
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket", ] ) ;
}
public function getUgiro()
{
return $this->hasOne(Ugiro::className(), [ 'id_ugiro' => 'id_ugiro' ])
->viaTable('ugiro_request_assignment', [ 'id_request' => 'id_ticket_installment_request' ]);
}
public function isStatusAccepted(){
return $this->status == static::$STATUS_ACCEPTED || $this->status == static::$STATUS_ACCEPTED_MANUAL;
}
public function isStatusRejected(){
return $this->status == static::$STATUS_REJECTED ;
}
public function getIdGiro(){
$result = null;
$giro = $this->ugiro;
if ( isset($giro) ){
$result = $giro->id_ugiro;
}
return $result;
}
/**
* Megbízás státuszának beállítása
*
* Létrehozza a szükséges ticket/transfer objectumokat
*
* @param boolean $partRequired ha igaz, a bérleten a part mezőt változtatjuk
* */
public function applyStatus($status, $partRequired = false, $visszajelzes = "", $comment = ""){
if ( $status == static::$STATUS_ACCEPTED || $status == static::$STATUS_ACCEPTED_MANUAL){
if ( !$this->isStatusAccepted() ){
$this->status = $status;
$tranfer = $this->addTransfer();
$this->id_transfer = $tranfer->id_transfer;
$this->request_processed_at = Helper::getDateTimeString();
$this->save(false);
$this->applyNewTicketState($partRequired);
return true;
}else{
return false;
}
}else{
$this->status = $status;
$this->detsta_answer = $visszajelzes;
$this->comment = $comment;
$this->request_processed_at = Helper::getDateTimeString();
$this->save(false);
$this->applyNewTicketState($partRequired);
return true;
}
}
protected function applyNewTicketState($partRequired = false){
if ( $partRequired ){
$this->ticket->setPartRequired($this);
}
$this->ticket->applyTicketInstallmentRequest($this);
$this->ticket->save(false);
}
protected function addTransfer(){
$account = Account::findOne($this->ticket->id_account);
$discount = null;
if ( isset($this->ticket->id_account)){
$discount = Discount::findOne( $this->ticket->id_discount );
}
$transfer = Transfer::createTicketTransfer($account, $discount, null, 1, $this->ticket);
$transfer->status = Transfer::STATUS_PAID;
$transfer->paid_at = date('Y-m-d H:i:s' ) ;
$transfer->paid_by = \Yii::$app->user->id;
$transfer->payment_method = Transfer::PAYMENT_METHOD_TRANSFER;
$transfer->money = $this->money;
$transfer->comment = "Csoportos beszedes";
$transfer->id_user = \Yii::$app->user->id;
$transfer->id_customer = $this->ticket->card->customer->id_customer;
$transfer->save(false);
return $transfer;
}
/**
* @param common\models\Ticket $ticket
* @param common\models\TicketType $type
* @return common\models\TicketInstallmentRequest[]
* */
public static function createInstallments($ticket,$type,$customer){
$result = [];
if ( $type->isInstallment() ){
$count = $type->installment_count;
$discount = $ticket->discount;
$money = $type->price_brutto;
if ( isset($discount ) ){
$money = Discount::applyDiscount($money, $discount);
}
$ticketCreatedAt = time();
for ( $i = 1; $i <= $count; $i++){
$request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $money, $ticketCreatedAt, $i);
$result[] = $request;
}
}
return $result;
}
public static function createInstallment($ticket,$type,$customer,$money,$ticketCreated,$index){
$request = new TicketInstallmentRequest();
$request->id_ticket = $ticket->id_ticket;
$request->id_customer = $customer->id_customer;
$request->status = TicketInstallmentRequest::$STATUS_PENDING;
$request->priority = $index;
$request->request_target_time_at = date('Y-m-d H:i:s', strtotime("+".$index." month" ));
$request->request_processed_at = null;
$request->request_sent_at = null;
$request->money = $money;
return $request;
}
public static function statuses(){
return [
TicketInstallmentRequest::$STATUS_PENDING => 'Indításra vár',
TicketInstallmentRequest::$STATUS_MARKED_TO_SEND=> 'Beküldésre jelölve',
TicketInstallmentRequest::$STATUS_SENT=> 'Beküldve',
TicketInstallmentRequest::$STATUS_CANCELED=> 'Törölve',
TicketInstallmentRequest::$STATUS_REJECTED=> 'Visszautasítva',
TicketInstallmentRequest::$STATUS_ACCEPTED=> 'Sikeresen végrehajtva',
TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL=> 'Manuálisan elfogadva',
];
}
public static function toStatusName($id_status){
$result = "Ismeretlen";
$statuses = TicketInstallmentRequest::statuses();
if ( array_key_exists($id_status, $statuses)){
$result = $statuses[$id_status];
}
return $result;
}
}

Some files were not shown because too many files have changed in this diff Show More